-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed package, fixed javadoc and addressed other review comments
- Loading branch information
1 parent
d7a237c
commit ad33a87
Showing
8 changed files
with
92 additions
and
93 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
...terop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ose-rxlifecycle-interop/gradle.properties → autodispose-rxlifecycle/gradle.properties
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
POM_NAME=AutoDispose (RXLifeCycle Interop) | ||
POM_ARTIFACT_ID=autodispose-rxlifecycle-interop | ||
POM_ARTIFACT_ID=autodispose-rxlifecycle | ||
POM_PACKAGING=jar |
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
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
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
52 changes: 52 additions & 0 deletions
52
...-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.ubercab.autodispose.rxlifecycle; | ||
|
||
import com.trello.rxlifecycle2.LifecycleProvider; | ||
import com.trello.rxlifecycle2.LifecycleTransformer; | ||
import com.trello.rxlifecycle2.OutsideLifecycleException; | ||
import com.trello.rxlifecycle2.RxLifecycle; | ||
import io.reactivex.Observable; | ||
import io.reactivex.functions.Function; | ||
import io.reactivex.subjects.BehaviorSubject; | ||
|
||
final class TestLifecycleProvider implements LifecycleProvider<TestLifecycleProvider.Event> { | ||
|
||
private static final Function<Event, Event> CORRESPONDING_EVENTS = new Function<Event, Event>() { | ||
@Override public Event apply(Event event) | ||
throws Exception { | ||
switch (event) { | ||
case CREATE: | ||
return Event.DESTROY; | ||
default: | ||
throw new OutsideLifecycleException("Lifecycle ended"); | ||
} | ||
} | ||
}; | ||
|
||
private final BehaviorSubject<Event> lifecycle = BehaviorSubject.create(); | ||
|
||
@Override public Observable<Event> lifecycle() { | ||
return lifecycle.hide(); | ||
} | ||
|
||
@Override | ||
public <T> LifecycleTransformer<T> bindUntilEvent(Event event) { | ||
return RxLifecycle.bindUntilEvent(lifecycle, event); | ||
} | ||
|
||
@Override public <T> LifecycleTransformer<T> bindToLifecycle() { | ||
return RxLifecycle.bind(lifecycle, CORRESPONDING_EVENTS); | ||
} | ||
|
||
void emitCreate() { | ||
lifecycle.onNext(Event.CREATE); | ||
} | ||
|
||
void emitDestroy() { | ||
lifecycle.onNext(Event.DESTROY); | ||
} | ||
|
||
enum Event { | ||
CREATE, | ||
DESTROY | ||
} | ||
} |
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