This file contains 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
How do I transform observable's error to another observable? | |
I am trying to implement algorithm showed on scheme below: | |
![Block scheme][1] | |
[1]: http://i.stack.imgur.com/777p5.png | |
I am using a tutorial named Grokking RxJava to start my learning and found that flatMap operator can convert one Observable returning by Retrofit into another which allows me to do a chain of invocations of server methods. But in the tutorial chaining methods always return success result. **How I can do the same chaining if one of the remote methods returns error?** |
This file contains 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
package com.tagakov.testapplication; | |
import android.animation.ValueAnimator; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.PorterDuff; |
This file contains 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
package com.tagakov.testapplication; | |
import android.animation.ValueAnimator; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; |
This file contains 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
import timber.log.Timber; | |
public class DebugTreeWithCodeLink extends Timber.DebugTree { | |
private final ThreadLocal<String> codeLink = new ThreadLocal<>(); | |
private static final int CALL_STACK_INDEX = 5; | |
@Override | |
protected String createStackElementTag(StackTraceElement element) { | |
codeLink.set(createCodeLink(element)); |
This file contains 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 PagerLayoutManager extends LinearLayoutManager { | |
private static final int SETTLE_DURATION = 600; | |
private static final float DEFAULT_FLING_THRESHOLD_DP = 10f; | |
private final int flingThreshold; | |
private int scrollState; | |
public PagerLayoutManager(Context context) { |
This file contains 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
#!/usr/bin/env bash | |
REMOTE_MACHINE=${1} | |
APPLICATION_MODULE=${2} | |
ASSEMBLE_COMMAND=${3} | |
ASSEMBLE_TESTS_COMMAND=${4} | |
ANDROID_SDK_VERSION=${5} |
This file contains 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
fun <T> magic(jobs: Observable<Completable>, hot: Observable<T>): Observable<T> { | |
return Observable.switchOnNext(jobs.map { it.andThen(hot) }.startWith(hot)) | |
} |
This file contains 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 MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(new FrameLayout(this) {{ | |
setId(42); | |
}}); | |
if (savedInstanceState == null) { |
This file contains 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
typealias Epic<State> = (actions: Observable<Action>, currentState: CurrentState<State>) -> Observable<Action> | |
typealias CurrentState<State> = () -> State | |
class EpicMiddleware<State: Any> constructor(): Middleware<State> { | |
private val epics = PublishSubject.create<Epic<State>>() | |
override fun invoke(store: Store<State>, nextDispatcher: Dispatcher) : Dispatcher { | |
val actions = PublishSubject.create<Action>() | |
epics |
OlderNewer