Observable.combineLatest(
Api.getService(Api.getEndpointUrl()).getUserProfile(SoundcloudConstants.USERNAME),
Api.getService(Api.getEndpointUrl()).getFavoriteTracks(SoundcloudConstants.USERNAME),
new Func2<UserProfile, List<Track>, Account>() {
@Override
public Account call(UserProfile userProfile, List<Track> tracks) {
return new Account(userProfile, tracks);
}
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 CustomViewGroup extends FrameLayout { | |
| @Override | |
| public boolean dispatchKeyEventPreIme(KeyEvent event) { | |
| Timber.d(""); | |
| if(event != null){ | |
| int keyCode = event.getKeyCode(); | |
| if(keyCode == KeyEvent.KEYCODE_BACK){ | |
| // hide search suggestions UI |
while true; do
./adb shell input swipe 100 400 4000 400 400;
doneFunctional Programmingis a model of programming that transform and compose stream of immutable sequences by applying map, filter and reduce. Events are immutable because you can't change history.Reactive Programmingis a model of programming focuses on data flow and change propagation.ReactiveXis an API that focuses on asynchronous composition and manipulation of observable streams of data or events by using a combination of the Observer pattern, Iterator pattern, and features of Functional Programming.RxJavais the open-source implementation ofReactiveXin Java.RxJavais a Java VM implementation ofReactiveX(Reactive Extensions): a library for composing asynchronous and event-based programs by using observable sequences.RxAndroidis a lightweight extension to RxJava that providers a Scheduler for Android’s Main Thread, as well as the ability to create a Scheduler that runs on any given Android Handler class.- The two main classes are
ObservableandSubscriber. - `O
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 RxImageView extends ImageView { | |
| // region Member Variables | |
| private PublishSubject<Boolean> publishSubject = PublishSubject.create(); | |
| // endregion | |
| // region Constructors | |
| public RxImageView(Context context) { | |
| super(context); | |
| } |
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
| @Override | |
| public void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
| super.onScrolled(recyclerView, dx, dy); | |
| int visibleItemCount = recyclerView.getChildCount(); | |
| int totalItemCount = recyclerView.getAdapter().getItemCount(); | |
| int[] positions = layoutManager.findFirstVisibleItemPositions(null); | |
| int firstVisibleItem = positions[1]; | |
| if (!isLoading && !isLastPage) { |
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 NetworkLogUtility { | |
| public static void logFailure(Call call, Throwable throwable){ | |
| if(call != null){ | |
| if (call.isCanceled()) | |
| Timber.e("Request was cancelled"); | |
| Request request = call.request(); | |
| if(request != null){ | |
| HttpUrl httpUrl = request.url(); |
CacheControl.FORCE_CACHEadds anonly-if-cacheflag and also sets the max-stale to a very high value which overrides the max-stale value.- The
max-agerequest directive indicates that the client is unwilling to accept a response whose age is greater than the specified number of seconds. Unless themax-stalerequest directive is also present, the client is not willing to accept a stale response. - The
max-stalerequest directive indicates that the client is willing to accept a response that has exceeded its freshness lifetime. If max-stale is assigned a value, then the client is willing to accept a response that has exceeded its freshness lifetime by no more than the specified number of seconds. - The
max-agerequest directive is the oldest that a response can be, as long as theCache-Controlfrom the origin server indicates that it is still fresh. Themax-stalerequest directive indicates that, even if the response is known to be stale, you will also accept it as long as it's only stale by
OlderNewer