Skip to content

Instantly share code, notes, and snippets.

View aungtuntun's full-sized avatar

Aung Tun Tun aungtuntun

View GitHub Profile
@aungtuntun
aungtuntun / AutoCompleteAdapters.kt
Created August 26, 2019 04:22 — forked from frett/AutoCompleteAdapters.kt
Android Material Components - Dropdown Menu + Data Binding
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import androidx.annotation.LayoutRes
import androidx.databinding.BindingAdapter
@BindingAdapter("dropDownItems", "dropDownItemLayout", "dropDownItemsIncludeEmpty", requireAll = false)
fun AutoCompleteTextView.setItems(items: Array<String>?, @LayoutRes layout: Int?, includeEmpty: Boolean?) =
setAdapter(
ArrayAdapter(
context,
@aungtuntun
aungtuntun / AccountAuthenticator.java
Created February 22, 2019 10:59 — forked from burgalon/AccountAuthenticator.java
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
@aungtuntun
aungtuntun / FabIconAnimator.java
Created January 16, 2019 10:45 — forked from tunjid/FabIconAnimator.java
A simple utility class that creates an expandable Floating Action Button
package com.mainstreetcode.teammate.util;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.ConstraintSet;
@aungtuntun
aungtuntun / NetModule.java
Created January 7, 2019 11:06 — forked from staakk/NetModule.java
Dagger2 module for Retrofit with authorization, and Java 8 DateTime mappers
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.threeten.bp.LocalDateTime;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
@aungtuntun
aungtuntun / gist:a0eeb66fc7cb7c6bf9422762f6f8c3b0
Created December 12, 2018 05:28 — forked from orhanobut/gist:8665372
Up down animation for dialog fragment
// Slide up animation
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0" />
@aungtuntun
aungtuntun / RoundedBottomSheetDialogFragment.kt
Created October 19, 2018 09:34 — forked from ArthurNagy/RoundedBottomSheetDialogFragment.kt
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom