Skip to content

Instantly share code, notes, and snippets.

Cain Wong wongcain

  • Bay Area
View GitHub Profile
@wongcain
wongcain / MyViewModel.java
Last active Feb 13, 2018
RecyclerView Binding
View MyViewModel.java
package com.example.cain.mvvmexample;
import android.arch.lifecycle.ViewModel;
import me.tatarka.bindingcollectionadapter2.ItemBinding;
import me.tatarka.bindingcollectionadapter2.collections.DiffObservableList;
// See https://github.com/evant/binding-collection-adapter
public class MyViewModel extends ViewModel {
View NavigationDataBindings.java
package com.example.cain.mvvmexample;
import android.content.Intent;
import android.databinding.BindingAdapter;
import android.databinding.InverseBindingAdapter;
import android.databinding.InverseBindingListener;
import android.support.annotation.Nullable;
import android.view.View;
@wongcain
wongcain / AlertDialogBindings.java
Last active Feb 13, 2018
AlertDialog Data Binding
View AlertDialogBindings.java
package com.example.cain.mvvmexample;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.databinding.BindingAdapter;
import android.databinding.InverseBindingAdapter;
import android.databinding.InverseBindingListener;
import android.support.annotation.Nullable;
View GridLayoutQuirksFixedManager.java
package android.support.v7.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
/**
* Bug fixed version of GridLayoutManager
* Created by SangsooNam on 20/09/15.
* Modified by Cain Wong on 13/11/15: Updated for Recyclerview-v7:22.2.1
You can’t perform that action at this time.