Skip to content

Instantly share code, notes, and snippets.

View ZaeemSattar's full-sized avatar
🏠
Working from home

Zaeem Sattar ZaeemSattar

🏠
Working from home
  • Synavos
  • Lahore, Pakistan
View GitHub Profile
// dependency
compile 'com.android.support:design:23.0.1'
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
/**
* This Activity displays the screen's UI, creates a TaskFragment
* to manage the task, and receives progress updates and results
* from the TaskFragment when they occur.
*/
public class MainActivity extends Activity implements TaskFragment.TaskCallbacks {
private static final String TAG_TASK_FRAGMENT = "task_fragment";
private TaskFragment mTaskFragment;
// how to use
val timer = Timer()
timer.schedule(RemindTask(imageList.size, pager), 0, 5000)
// handler
inner class RemindTask() : TimerTask() {
private var numberOfPages = 0
private lateinit var mViewPager: ViewPager
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sooq.activities.LoginActivity">
<android.support.design.widget.AppBarLayout
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-6dp"
android:right="-6dp"
android:top="-3dp">
<shape>
<solid android:color="@android:color/transparent" />
<stroke
// pick single image from gallery
private fun openGalleryImages() {
val intent = Intent(Intent.ACTION_PICK)
intent.type = "image/*"
startActivityForResult(Intent.createChooser(intent, "Select Picture"), TYPE_IMAGE)
}
// get path
https://www.lottiefiles.com/
https://github.com/airbnb/lottie-android
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_path" />
</provider>
class PhoneContactModel {
var id: Int = 0
var name: String = ""
var number: String = ""
var isSelected: Boolean = false
var viewType: Int = 1
var headerName = ""
}