Merge pull request #81 from TouchInstinct/bugs/untilStop_fix
untilStop now working fine on samsung showing some activity above
This commit is contained in:
commit
5fd70d58a7
|
|
@ -48,6 +48,8 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
||||||
private final BehaviorSubject<Boolean> isCreatedSubject = BehaviorSubject.create();
|
private final BehaviorSubject<Boolean> isCreatedSubject = BehaviorSubject.create();
|
||||||
@NonNull
|
@NonNull
|
||||||
private final BehaviorSubject<Boolean> isStartedSubject = BehaviorSubject.create();
|
private final BehaviorSubject<Boolean> isStartedSubject = BehaviorSubject.create();
|
||||||
|
@NonNull
|
||||||
|
private final BehaviorSubject<Boolean> isInAfterSaving = BehaviorSubject.create(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call it on parent's onCreate method.
|
* Call it on parent's onCreate method.
|
||||||
|
|
@ -71,18 +73,14 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
||||||
* In that case onResume will be called after onSaveInstanceState so lifecycle object is becoming started.
|
* In that case onResume will be called after onSaveInstanceState so lifecycle object is becoming started.
|
||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
if (!isStartedSubject.hasValue() || !isStartedSubject.getValue()) {
|
isInAfterSaving.onNext(false);
|
||||||
isStartedSubject.onNext(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call it on parent's onSaveInstanceState method.
|
* Call it on parent's onSaveInstanceState method.
|
||||||
*/
|
*/
|
||||||
public void onSaveInstanceState() {
|
public void onSaveInstanceState() {
|
||||||
if (!isStartedSubject.hasValue() || isStartedSubject.getValue()) {
|
isInAfterSaving.onNext(true);
|
||||||
isStartedSubject.onNext(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -129,7 +127,9 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
||||||
@NonNull final Action1<T> onNextAction,
|
@NonNull final Action1<T> onNextAction,
|
||||||
@NonNull final Action1<Throwable> onErrorAction,
|
@NonNull final Action1<Throwable> onErrorAction,
|
||||||
@NonNull final Action0 onCompletedAction) {
|
@NonNull final Action0 onCompletedAction) {
|
||||||
return until(observable, isStartedSubject.map(started -> !started), onNextAction, onErrorAction, onCompletedAction);
|
return until(observable, isStartedSubject.map(started -> !started)
|
||||||
|
.delay(item -> isInAfterSaving.filter(inAfterSaving -> !inAfterSaving)),
|
||||||
|
onNextAction, onErrorAction, onCompletedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
@ -151,7 +151,9 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
||||||
public <T> Subscription untilStop(@NonNull final Single<T> single,
|
public <T> Subscription untilStop(@NonNull final Single<T> single,
|
||||||
@NonNull final Action1<T> onSuccessAction,
|
@NonNull final Action1<T> onSuccessAction,
|
||||||
@NonNull final Action1<Throwable> onErrorAction) {
|
@NonNull final Action1<Throwable> onErrorAction) {
|
||||||
return until(single.toObservable(), isStartedSubject.map(started -> !started), onSuccessAction, onErrorAction, Actions.empty());
|
return until(single.toObservable(), isStartedSubject.map(started -> !started)
|
||||||
|
.delay(item -> isInAfterSaving.filter(inAfterSaving -> !inAfterSaving)),
|
||||||
|
onSuccessAction, onErrorAction, Actions.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
@ -174,7 +176,9 @@ public class BaseLifecycleBindable implements LifecycleBindable {
|
||||||
public Subscription untilStop(@NonNull final Completable completable,
|
public Subscription untilStop(@NonNull final Completable completable,
|
||||||
@NonNull final Action0 onCompletedAction,
|
@NonNull final Action0 onCompletedAction,
|
||||||
@NonNull final Action1<Throwable> onErrorAction) {
|
@NonNull final Action1<Throwable> onErrorAction) {
|
||||||
return until(completable.toObservable(), isStartedSubject.map(started -> !started), Actions.empty(), onErrorAction, onCompletedAction);
|
return until(completable.toObservable(), isStartedSubject.map(started -> !started)
|
||||||
|
.delay(item -> isInAfterSaving.filter(inAfterSaving -> !inAfterSaving)),
|
||||||
|
Actions.empty(), onErrorAction, onCompletedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue