This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RetrofitService.doTheThing(params) // Your typical API call | |
.subscribeOn(Schedulers.io()) // Execute API call on IO thread | |
.observeOn(AndroidSchedulers.mainThread()) // Execute observers on Android's main thread | |
.subscribe(results -> handle(results)); // Handling the results of the API call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LazyListManagerUtils { | |
public static <T> List<T> add(List<T> list, T item) { | |
if (list == null) { | |
list = new ArrayList<T>(); | |
list.add(item); | |
} | |
else if (!list.contains(item)) { | |
list.add(item); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("unchecked") | |
public static <T extends View> T findView(Activity activity, int id) { | |
return (T) activity.findViewById(id); | |
} | |
@SuppressWarnings("unchecked") | |
public static <T extends View> T findView(View view, int id) { | |
return (T) view.findViewById(id); | |
} |
NewerOlder