Skip to content

Instantly share code, notes, and snippets.

View yolapop's full-sized avatar
💅
I didn't go missing, David. The FBI knew where I was the entire time!

Yolanda Dewi yolapop

💅
I didn't go missing, David. The FBI knew where I was the entire time!
  • N26
  • Indonesia
View GitHub Profile
@yolapop
yolapop / BaseFragment.java
Last active July 20, 2017 03:25
Make ViewModel survive Activity tear down
public class BaseFragment extends Fragment {
protected long dbId = -1;
protected ViewModelFactory viewModelFactory;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
dbId = savedInstanceState.getLong("dbId", -1);
@yolapop
yolapop / ViewBinder.java
Last active August 16, 2017 16:15
Generic FastAdapter's AbstractItem to be used for all types of ViewHolders
/**
* Functional interface for binding data to a view
*/
public interface ViewBinder<V extends View> {
void bindView(V view, ViewItem<V> item);
}
@yolapop
yolapop / BaseFragment.java
Last active July 19, 2017 13:02
Code snippet for app launch optimization
public class BaseFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
MyApplication.get().setAppIsReady(true);
}
}