From d078017230f25b4cdb663269715b530e0614c7c6 Mon Sep 17 00:00:00 2001
From: bangarharshit
Date: Sat, 21 Oct 2017 12:00:41 +0530
Subject: [PATCH 01/16] RX lifecycle interop module added for autodipose
---
autodispose-rxlifecycle-interop/build.gradle | 40 ++++++
.../RXLifeCycleInterop.java | 54 ++++++++
.../rxlifecycleinterop/package-info.java | 23 ++++
.../LifeCycleProviderImpl.java | 52 +++++++
.../RXLifeCycleInteropTest.java | 129 ++++++++++++++++++
settings.gradle | 2 +
6 files changed, 300 insertions(+)
create mode 100644 autodispose-rxlifecycle-interop/build.gradle
create mode 100644 autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java
create mode 100644 autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java
create mode 100644 autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
create mode 100644 autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java
diff --git a/autodispose-rxlifecycle-interop/build.gradle b/autodispose-rxlifecycle-interop/build.gradle
new file mode 100644
index 000000000..ce89a2cd7
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/build.gradle
@@ -0,0 +1,40 @@
+buildscript {
+ repositories {
+ jcenter()
+ maven { url deps.build.repositories.plugins }
+ }
+ dependencies {
+ classpath deps.build.gradlePlugins.apt
+ classpath deps.build.gradlePlugins.errorProne
+ }
+}
+
+apply plugin: 'java-library'
+apply plugin: 'net.ltgt.apt'
+apply plugin: 'net.ltgt.errorprone'
+
+sourceCompatibility = "1.7"
+targetCompatibility = "1.7"
+
+test {
+ testLogging.showStandardStreams = true
+}
+
+dependencies {
+ apt deps.build.nullAway
+ testApt deps.build.nullAway
+
+ compile project(':autodispose')
+ compile 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
+ compileOnly deps.misc.errorProneAnnotations
+ compileOnly deps.misc.javaxExtras
+
+ errorprone deps.build.checkerFramework
+ errorprone deps.build.errorProne
+
+ testCompile project(':test-utils')
+}
+
+tasks.withType(JavaCompile) {
+ options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"]
+}
diff --git a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java b/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java
new file mode 100644
index 000000000..1ab25e2d5
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java
@@ -0,0 +1,54 @@
+package com.ubercab.autodispose.rxlifecycleinterop;
+
+import com.trello.rxlifecycle2.LifecycleProvider;
+import com.trello.rxlifecycle2.OutsideLifecycleException;
+import com.trello.rxlifecycle2.RxLifecycle;
+import com.uber.autodispose.AutoDispose;
+import com.uber.autodispose.LifecycleEndedException;
+import com.uber.autodispose.ScopeProvider;
+import io.reactivex.Maybe;
+
+/**
+ * Interop class for {@link RxLifecycle}. It provides static utility methods to convert {@link
+ * LifecycleProvider} to {@link ScopeProvider}
+ * There are several static utility converter
+ * methods such as {@link #bindLifecycle(LifecycleProvider)} for {@link
+ * LifecycleProvider#bindToLifecycle()} and {@link #bindUntilEvent(LifecycleProvider, Object)} for
+ * {@link LifecycleProvider#bindUntilEvent(Object)}
+ *
+ * Unlike {@link AutoDispose}, {@link RxLifecycle} treats the {@link OutsideLifecycleException}
+ * as normal terminal event. There is no mapping to {@link LifecycleEndedException} and in such
+ * cases the stream is normally disposed
+ */
+public final class RXLifeCycleInterop {
+
+ private RXLifeCycleInterop() {
+ throw new AssertionError("No Instances");
+ }
+
+ private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
+
+ static ScopeProvider bindLifecycle(final LifecycleProvider provider) {
+ return new ScopeProvider() {
+ @Override public Maybe> requestScope() {
+ return provider.lifecycle()
+ .compose(provider.bindToLifecycle())
+ .ignoreElements()
+ .toMaybe()
+ .defaultIfEmpty(DEFAULT_THROWAWAY_OBJECT);
+ }
+ };
+ }
+
+ static ScopeProvider bindUntilEvent(final LifecycleProvider provider, final E event) {
+ return new ScopeProvider() {
+ @Override public Maybe> requestScope() {
+ return provider.lifecycle()
+ .compose(provider.bindUntilEvent(event))
+ .ignoreElements()
+ .toMaybe()
+ .defaultIfEmpty(DEFAULT_THROWAWAY_OBJECT);
+ }
+ };
+ }
+}
diff --git a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java b/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java
new file mode 100644
index 000000000..8f4d68a7e
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * These are Observers AutoDispose uses when scoping an observable. They are exposed as a public API
+ * to allow for consumers to watch for them if they want, such as in RxJava plugins.
+ */
+@com.uber.javaxextras.FieldsMethodsAndParametersAreNonNullByDefault
+package com.ubercab.autodispose.rxlifecycleinterop;
+
diff --git a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java b/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
new file mode 100644
index 000000000..44ae32c50
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
@@ -0,0 +1,52 @@
+package com.ubercab.autodispose.rxlifecycleinterop;
+
+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;
+import javax.annotation.Nonnull;
+
+final class LifeCycleProviderImpl implements LifecycleProvider {
+
+ private static final Function CORRESPONDING_EVENTS = new Function() {
+ @Override public Event apply(Event event)
+ throws Exception {
+ switch (event) {
+ case CREATE:
+ return Event.DESTROY;
+ default:
+ throw new OutsideLifecycleException("Life cycle ended");
+ }
+ }
+ };
+ private final BehaviorSubject behaviorSubject = BehaviorSubject.create();
+
+ @Nonnull @Override public Observable lifecycle() {
+ return behaviorSubject.hide();
+ }
+
+ @Nonnull @Override
+ public LifecycleTransformer bindUntilEvent(@Nonnull Event event) {
+ return RxLifecycle.bindUntilEvent(behaviorSubject, event);
+ }
+
+ @Nonnull @Override public LifecycleTransformer bindToLifecycle() {
+ return RxLifecycle.bind(behaviorSubject, CORRESPONDING_EVENTS);
+ }
+
+ void onCreate() {
+ behaviorSubject.onNext(Event.CREATE);
+ }
+
+ void onDestroy() {
+ behaviorSubject.onNext(Event.DESTROY);
+ }
+
+ enum Event {
+ CREATE,
+ DESTROY
+ }
+}
diff --git a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java b/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java
new file mode 100644
index 000000000..b1734a046
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java
@@ -0,0 +1,129 @@
+package com.ubercab.autodispose.rxlifecycleinterop;
+
+import com.uber.autodispose.AutoDispose;
+import com.uber.autodispose.test.RecordingObserver;
+import io.reactivex.disposables.Disposable;
+import io.reactivex.observers.TestObserver;
+import io.reactivex.subjects.PublishSubject;
+import org.junit.Before;
+import org.junit.Test;
+
+import static com.google.common.truth.Truth.assertThat;
+
+public class RXLifeCycleInteropTest {
+
+ private static final RecordingObserver.Logger LOGGER = new RecordingObserver.Logger() {
+ @Override public void log(String message) {
+ System.out.println(RXLifeCycleInteropTest.class.getSimpleName() + ": " + message);
+ }
+ };
+
+ private LifeCycleProviderImpl lifeCycleProvider = new LifeCycleProviderImpl();
+
+ @Before
+ public void setup() {
+ lifeCycleProvider.onCreate();
+ }
+
+ @Test
+ public void bindLifecycle_normalTermination_completeTheStream() {
+ TestObserver o = new TestObserver<>();
+ PublishSubject source = PublishSubject.create();
+ Disposable d = source.to(AutoDispose.with(
+ RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ .subscribeWith(o);
+ o.assertSubscribed();
+
+ assertThat(source.hasObservers()).isTrue();
+
+ source.onNext(1);
+ o.assertValue(1);
+
+ source.onNext(2);
+ source.onComplete();
+ o.assertValues(1, 2);
+ o.assertComplete();
+ assertThat(d.isDisposed()).isFalse(); // Because it completed normally, was not disposed.
+ assertThat(source.hasObservers()).isFalse();
+ }
+
+ @Test
+ public void bindLifecycle_normalTermination_unsubscribe() {
+ RecordingObserver o = new RecordingObserver<>(LOGGER);
+ PublishSubject source = PublishSubject.create();
+ source.to(AutoDispose.with(
+ RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ .subscribe(o);
+ o.takeSubscribe();
+
+ assertThat(source.hasObservers()).isTrue();
+
+ source.onNext(1);
+ assertThat(o.takeNext()).isEqualTo(1);
+
+ lifeCycleProvider.onDestroy();
+ source.onNext(2);
+ o.assertNoMoreEvents();
+ assertThat(source.hasObservers()).isFalse();
+ }
+
+ @Test
+ public void bindLifecycle_errorTermination_unsubscribe() {
+ RecordingObserver o = new RecordingObserver<>(LOGGER);
+ PublishSubject source = PublishSubject.create();
+ lifeCycleProvider.onDestroy();
+ source
+ .to(AutoDispose.with(
+ RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ .subscribe(o);
+
+ o.takeSubscribe();
+
+ source.onNext(2);
+ o.assertNoMoreEvents();
+ assertThat(
+ source.hasObservers()).isFalse(); // Because RXLifeCycle treats lifecycle ended exception as terminal event.
+ }
+
+ @Test
+ public void bindUntilEvent_normalTermination_completeTheStream() {
+ TestObserver o = new TestObserver<>();
+ PublishSubject source = PublishSubject.create();
+ Disposable d = source.to(AutoDispose.with(RXLifeCycleInterop.bindUntilEvent(lifeCycleProvider,
+ LifeCycleProviderImpl.Event.DESTROY)).forObservable())
+ .subscribeWith(o);
+ o.assertSubscribed();
+
+ assertThat(source.hasObservers()).isTrue();
+
+ source.onNext(1);
+ o.assertValue(1);
+
+ source.onNext(2);
+ source.onComplete();
+ o.assertValues(1, 2);
+ o.assertComplete();
+ assertThat(d.isDisposed()).isFalse(); // Because it completed normally, was not disposed.
+ assertThat(source.hasObservers()).isFalse();
+ }
+
+ @Test
+ public void bindUntilEvent_interruptedTermination_unsubscribe() {
+ RecordingObserver o = new RecordingObserver<>(LOGGER);
+ PublishSubject source = PublishSubject.create();
+ source.to(AutoDispose.with(RXLifeCycleInterop.bindUntilEvent(lifeCycleProvider,
+ LifeCycleProviderImpl.Event.DESTROY)).forObservable())
+ .subscribe(o);
+ o.takeSubscribe();
+
+ assertThat(source.hasObservers()).isTrue();
+
+ source.onNext(1);
+ assertThat(o.takeNext()).isEqualTo(1);
+
+ lifeCycleProvider.onDestroy();
+ source.onNext(2);
+ o.assertNoMoreEvents();
+ assertThat(source.hasObservers()).isFalse();
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index b2f57264d..90bac0b39 100755
--- a/settings.gradle
+++ b/settings.gradle
@@ -25,3 +25,5 @@ include ':autodispose'
include ':autodispose-kotlin'
include ':sample'
include ':test-utils'
+include 'autodispose-rxlifecycle-interop'
+
From 159205acab517b1ca8f66bade07c7972c8347acd Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:08:16 +0530
Subject: [PATCH 02/16] Added pom artifact
---
autodispose-rxlifecycle-interop/build.gradle | 4 +++-
autodispose-rxlifecycle-interop/gradle.properties | 3 +++
gradle/dependencies.gradle | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
create mode 100755 autodispose-rxlifecycle-interop/gradle.properties
diff --git a/autodispose-rxlifecycle-interop/build.gradle b/autodispose-rxlifecycle-interop/build.gradle
index ce89a2cd7..1e0f22a1b 100644
--- a/autodispose-rxlifecycle-interop/build.gradle
+++ b/autodispose-rxlifecycle-interop/build.gradle
@@ -25,7 +25,7 @@ dependencies {
testApt deps.build.nullAway
compile project(':autodispose')
- compile 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
+ api deps.rx.lifecycle
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
@@ -38,3 +38,5 @@ dependencies {
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"]
}
+
+apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
diff --git a/autodispose-rxlifecycle-interop/gradle.properties b/autodispose-rxlifecycle-interop/gradle.properties
new file mode 100755
index 000000000..860728240
--- /dev/null
+++ b/autodispose-rxlifecycle-interop/gradle.properties
@@ -0,0 +1,3 @@
+POM_NAME=AutoDispose (RXLifeCycle Interop)
+POM_ARTIFACT_ID=autodispose-rxlifecycle-interop
+POM_PACKAGING=jar
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index 7f013ae71..66a99c1a9 100755
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -57,7 +57,8 @@ def misc = [
def rx = [
android: 'io.reactivex.rxjava2:rxandroid:2.0.1',
- java: 'io.reactivex.rxjava2:rxjava:2.1.0'
+ java: 'io.reactivex.rxjava2:rxjava:2.1.0',
+ lifecycle: 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
]
def support = [
From 25f3868a2542e9bfa736f1a21291dc63b17841b2 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:37:45 +0530
Subject: [PATCH 03/16] Renamed package, fixed javadoc and addressed other
review comments
---
.../LifeCycleProviderImpl.java | 52 -------------------
.../build.gradle | 0
.../gradle.properties | 2 +-
.../rxlifecycle/RXLifecycleInterop.java | 30 +++++------
.../rxlifecycle}/package-info.java | 5 +-
.../rxlifecycle/RXLifecycleInteropTest.java | 42 +++++++--------
.../rxlifecycle/TestLifecycleProvider.java | 52 +++++++++++++++++++
settings.gradle | 2 +-
8 files changed, 92 insertions(+), 93 deletions(-)
delete mode 100644 autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
rename {autodispose-rxlifecycle-interop => autodispose-rxlifecycle}/build.gradle (100%)
rename {autodispose-rxlifecycle-interop => autodispose-rxlifecycle}/gradle.properties (55%)
rename autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java => autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java (52%)
rename {autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop => autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle}/package-info.java (74%)
rename autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java => autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java (72%)
create mode 100644 autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
diff --git a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java b/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
deleted file mode 100644
index 44ae32c50..000000000
--- a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/LifeCycleProviderImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.ubercab.autodispose.rxlifecycleinterop;
-
-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;
-import javax.annotation.Nonnull;
-
-final class LifeCycleProviderImpl implements LifecycleProvider {
-
- private static final Function CORRESPONDING_EVENTS = new Function() {
- @Override public Event apply(Event event)
- throws Exception {
- switch (event) {
- case CREATE:
- return Event.DESTROY;
- default:
- throw new OutsideLifecycleException("Life cycle ended");
- }
- }
- };
- private final BehaviorSubject behaviorSubject = BehaviorSubject.create();
-
- @Nonnull @Override public Observable lifecycle() {
- return behaviorSubject.hide();
- }
-
- @Nonnull @Override
- public LifecycleTransformer bindUntilEvent(@Nonnull Event event) {
- return RxLifecycle.bindUntilEvent(behaviorSubject, event);
- }
-
- @Nonnull @Override public LifecycleTransformer bindToLifecycle() {
- return RxLifecycle.bind(behaviorSubject, CORRESPONDING_EVENTS);
- }
-
- void onCreate() {
- behaviorSubject.onNext(Event.CREATE);
- }
-
- void onDestroy() {
- behaviorSubject.onNext(Event.DESTROY);
- }
-
- enum Event {
- CREATE,
- DESTROY
- }
-}
diff --git a/autodispose-rxlifecycle-interop/build.gradle b/autodispose-rxlifecycle/build.gradle
similarity index 100%
rename from autodispose-rxlifecycle-interop/build.gradle
rename to autodispose-rxlifecycle/build.gradle
diff --git a/autodispose-rxlifecycle-interop/gradle.properties b/autodispose-rxlifecycle/gradle.properties
similarity index 55%
rename from autodispose-rxlifecycle-interop/gradle.properties
rename to autodispose-rxlifecycle/gradle.properties
index 860728240..b80f21a53 100755
--- a/autodispose-rxlifecycle-interop/gradle.properties
+++ b/autodispose-rxlifecycle/gradle.properties
@@ -1,3 +1,3 @@
POM_NAME=AutoDispose (RXLifeCycle Interop)
-POM_ARTIFACT_ID=autodispose-rxlifecycle-interop
+POM_ARTIFACT_ID=autodispose-rxlifecycle
POM_PACKAGING=jar
diff --git a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
similarity index 52%
rename from autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java
rename to autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
index 1ab25e2d5..74c0b8bc1 100644
--- a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
@@ -1,34 +1,34 @@
-package com.ubercab.autodispose.rxlifecycleinterop;
+package com.ubercab.autodispose.rxlifecycle;
import com.trello.rxlifecycle2.LifecycleProvider;
import com.trello.rxlifecycle2.OutsideLifecycleException;
-import com.trello.rxlifecycle2.RxLifecycle;
-import com.uber.autodispose.AutoDispose;
import com.uber.autodispose.LifecycleEndedException;
import com.uber.autodispose.ScopeProvider;
import io.reactivex.Maybe;
/**
- * Interop class for {@link RxLifecycle}. It provides static utility methods to convert {@link
- * LifecycleProvider} to {@link ScopeProvider}
- * There are several static utility converter
- * methods such as {@link #bindLifecycle(LifecycleProvider)} for {@link
- * LifecycleProvider#bindToLifecycle()} and {@link #bindUntilEvent(LifecycleProvider, Object)} for
- * {@link LifecycleProvider#bindUntilEvent(Object)}
+ * Interop class for RxLifecycle. It provides static utility methods to convert {@link
+ * LifecycleProvider} to {@link ScopeProvider}.
*
- * Unlike {@link AutoDispose}, {@link RxLifecycle} treats the {@link OutsideLifecycleException}
+ * There are several static utility converter
+ * methods such as {@link #fromBindLifecycle(LifecycleProvider)} for {@link
+ * LifecycleProvider#bindToLifecycle()} and {@link #fromBindUntilEvent(LifecycleProvider, Object)} for
+ * {@link LifecycleProvider#bindUntilEvent(Object)}.
+ *
+ *
+ * Note: RxLifecycle treats the {@link OutsideLifecycleException}
* as normal terminal event. There is no mapping to {@link LifecycleEndedException} and in such
- * cases the stream is normally disposed
+ * cases the stream is normally disposed.
*/
-public final class RXLifeCycleInterop {
+public final class RXLifecycleInterop {
- private RXLifeCycleInterop() {
+ private RXLifecycleInterop() {
throw new AssertionError("No Instances");
}
private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
- static ScopeProvider bindLifecycle(final LifecycleProvider provider) {
+ public static ScopeProvider fromBindLifecycle(final LifecycleProvider provider) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
@@ -40,7 +40,7 @@ static ScopeProvider bindLifecycle(final LifecycleProvider provider) {
};
}
- static ScopeProvider bindUntilEvent(final LifecycleProvider provider, final E event) {
+ public static ScopeProvider fromBindUntilEvent(final LifecycleProvider provider, final E event) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
diff --git a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
similarity index 74%
rename from autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java
rename to autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
index 8f4d68a7e..4c713e9d0 100644
--- a/autodispose-rxlifecycle-interop/src/main/java/com/ubercab/autodispose/rxlifecycleinterop/package-info.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
@@ -15,9 +15,8 @@
*/
/**
- * These are Observers AutoDispose uses when scoping an observable. They are exposed as a public API
- * to allow for consumers to watch for them if they want, such as in RxJava plugins.
+ * Interop for RxLifecycle.
*/
@com.uber.javaxextras.FieldsMethodsAndParametersAreNonNullByDefault
-package com.ubercab.autodispose.rxlifecycleinterop;
+package com.ubercab.autodispose.rxlifecycle;
diff --git a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
similarity index 72%
rename from autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java
rename to autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
index b1734a046..0bef19489 100644
--- a/autodispose-rxlifecycle-interop/src/test/java/com/ubercab/autodispose/rxlifecycleinterop/RXLifeCycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
@@ -1,36 +1,31 @@
-package com.ubercab.autodispose.rxlifecycleinterop;
+package com.ubercab.autodispose.rxlifecycle;
import com.uber.autodispose.AutoDispose;
import com.uber.autodispose.test.RecordingObserver;
import io.reactivex.disposables.Disposable;
import io.reactivex.observers.TestObserver;
import io.reactivex.subjects.PublishSubject;
-import org.junit.Before;
import org.junit.Test;
import static com.google.common.truth.Truth.assertThat;
-public class RXLifeCycleInteropTest {
+public class RXLifecycleInteropTest {
private static final RecordingObserver.Logger LOGGER = new RecordingObserver.Logger() {
@Override public void log(String message) {
- System.out.println(RXLifeCycleInteropTest.class.getSimpleName() + ": " + message);
+ System.out.println(RXLifecycleInteropTest.class.getSimpleName() + ": " + message);
}
};
- private LifeCycleProviderImpl lifeCycleProvider = new LifeCycleProviderImpl();
-
- @Before
- public void setup() {
- lifeCycleProvider.onCreate();
- }
+ private TestLifecycleProvider lifecycleProvider = new TestLifecycleProvider();
@Test
public void bindLifecycle_normalTermination_completeTheStream() {
+ lifecycleProvider.emitCreate();
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
Disposable d = source.to(AutoDispose.with(
- RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
.subscribeWith(o);
o.assertSubscribed();
@@ -49,10 +44,11 @@ public void bindLifecycle_normalTermination_completeTheStream() {
@Test
public void bindLifecycle_normalTermination_unsubscribe() {
+ lifecycleProvider.emitCreate();
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
source.to(AutoDispose.with(
- RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -61,20 +57,21 @@ public void bindLifecycle_normalTermination_unsubscribe() {
source.onNext(1);
assertThat(o.takeNext()).isEqualTo(1);
- lifeCycleProvider.onDestroy();
+ lifecycleProvider.emitDestroy();
source.onNext(2);
o.assertNoMoreEvents();
assertThat(source.hasObservers()).isFalse();
}
@Test
- public void bindLifecycle_errorTermination_unsubscribe() {
+ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
+ lifecycleProvider.emitCreate();
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
- lifeCycleProvider.onDestroy();
+ lifecycleProvider.emitDestroy();
source
.to(AutoDispose.with(
- RXLifeCycleInterop.bindLifecycle(lifeCycleProvider)).forObservable())
+ RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -87,10 +84,12 @@ public void bindLifecycle_errorTermination_unsubscribe() {
@Test
public void bindUntilEvent_normalTermination_completeTheStream() {
+ lifecycleProvider.emitCreate();
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
- Disposable d = source.to(AutoDispose.with(RXLifeCycleInterop.bindUntilEvent(lifeCycleProvider,
- LifeCycleProviderImpl.Event.DESTROY)).forObservable())
+ Disposable d = source.to(AutoDispose.with(RXLifecycleInterop.fromBindUntilEvent(
+ lifecycleProvider,
+ TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribeWith(o);
o.assertSubscribed();
@@ -109,10 +108,11 @@ public void bindUntilEvent_normalTermination_completeTheStream() {
@Test
public void bindUntilEvent_interruptedTermination_unsubscribe() {
+ lifecycleProvider.emitCreate();
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
- source.to(AutoDispose.with(RXLifeCycleInterop.bindUntilEvent(lifeCycleProvider,
- LifeCycleProviderImpl.Event.DESTROY)).forObservable())
+ source.to(AutoDispose.with(RXLifecycleInterop.fromBindUntilEvent(lifecycleProvider,
+ TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -121,7 +121,7 @@ public void bindUntilEvent_interruptedTermination_unsubscribe() {
source.onNext(1);
assertThat(o.takeNext()).isEqualTo(1);
- lifeCycleProvider.onDestroy();
+ lifecycleProvider.emitDestroy();
source.onNext(2);
o.assertNoMoreEvents();
assertThat(source.hasObservers()).isFalse();
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
new file mode 100644
index 000000000..281146ea2
--- /dev/null
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
@@ -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 {
+
+ private static final Function CORRESPONDING_EVENTS = new Function() {
+ @Override public Event apply(Event event)
+ throws Exception {
+ switch (event) {
+ case CREATE:
+ return Event.DESTROY;
+ default:
+ throw new OutsideLifecycleException("Lifecycle ended");
+ }
+ }
+ };
+
+ private final BehaviorSubject lifecycle = BehaviorSubject.create();
+
+ @Override public Observable lifecycle() {
+ return lifecycle.hide();
+ }
+
+ @Override
+ public LifecycleTransformer bindUntilEvent(Event event) {
+ return RxLifecycle.bindUntilEvent(lifecycle, event);
+ }
+
+ @Override public LifecycleTransformer bindToLifecycle() {
+ return RxLifecycle.bind(lifecycle, CORRESPONDING_EVENTS);
+ }
+
+ void emitCreate() {
+ lifecycle.onNext(Event.CREATE);
+ }
+
+ void emitDestroy() {
+ lifecycle.onNext(Event.DESTROY);
+ }
+
+ enum Event {
+ CREATE,
+ DESTROY
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index 90bac0b39..a74b395c8 100755
--- a/settings.gradle
+++ b/settings.gradle
@@ -23,7 +23,7 @@ include ':android:autodispose-android-archcomponents-test'
include ':android:autodispose-android-archcomponents-test-kotlin'
include ':autodispose'
include ':autodispose-kotlin'
+include 'autodispose-rxlifecycle'
include ':sample'
include ':test-utils'
-include 'autodispose-rxlifecycle-interop'
From 19a044532e06527f0f5dac46aca1c967f7644259 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:45:33 +0530
Subject: [PATCH 04/16] Fixed lifecycle everywhere and moved rxlifecycle to
misc in dependencies.gradle
---
autodispose-rxlifecycle/build.gradle | 2 +-
autodispose-rxlifecycle/gradle.properties | 2 +-
.../autodispose/rxlifecycle/RXLifecycleInteropTest.java | 2 +-
gradle/dependencies.gradle | 6 +++---
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/autodispose-rxlifecycle/build.gradle b/autodispose-rxlifecycle/build.gradle
index 1e0f22a1b..ed13f577c 100644
--- a/autodispose-rxlifecycle/build.gradle
+++ b/autodispose-rxlifecycle/build.gradle
@@ -25,7 +25,7 @@ dependencies {
testApt deps.build.nullAway
compile project(':autodispose')
- api deps.rx.lifecycle
+ api deps.misc.lifecycle
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
diff --git a/autodispose-rxlifecycle/gradle.properties b/autodispose-rxlifecycle/gradle.properties
index b80f21a53..0c397298f 100755
--- a/autodispose-rxlifecycle/gradle.properties
+++ b/autodispose-rxlifecycle/gradle.properties
@@ -1,3 +1,3 @@
-POM_NAME=AutoDispose (RXLifeCycle Interop)
+POM_NAME=AutoDispose (RXLifecycle Interop)
POM_ARTIFACT_ID=autodispose-rxlifecycle
POM_PACKAGING=jar
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
index 0bef19489..402b211a9 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
@@ -79,7 +79,7 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
source.onNext(2);
o.assertNoMoreEvents();
assertThat(
- source.hasObservers()).isFalse(); // Because RXLifeCycle treats lifecycle ended exception as terminal event.
+ source.hasObservers()).isFalse(); // Because RXLifecycle treats lifecycle ended exception as terminal event.
}
@Test
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index 66a99c1a9..f2b871577 100755
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -52,13 +52,13 @@ def kotlin = [
def misc = [
errorProneAnnotations: "com.google.errorprone:error_prone_annotations:${versions.errorProne}",
javaxExtras: "com.uber.javaxextras:javax-extras:0.1.0",
- jsr305: 'com.google.code.findbugs:jsr305:3.0.2'
+ jsr305: 'com.google.code.findbugs:jsr305:3.0.2',
+ lifecycle: 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
]
def rx = [
android: 'io.reactivex.rxjava2:rxandroid:2.0.1',
- java: 'io.reactivex.rxjava2:rxjava:2.1.0',
- lifecycle: 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
+ java: 'io.reactivex.rxjava2:rxjava:2.1.0'
]
def support = [
From 12840a95a30a7921811f03c3f1c27f53f70187f2 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:48:30 +0530
Subject: [PATCH 05/16] Fixed javadoc
---
.../com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
index 74c0b8bc1..7f16b9e15 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
@@ -14,7 +14,7 @@
* methods such as {@link #fromBindLifecycle(LifecycleProvider)} for {@link
* LifecycleProvider#bindToLifecycle()} and {@link #fromBindUntilEvent(LifecycleProvider, Object)} for
* {@link LifecycleProvider#bindUntilEvent(Object)}.
- *
+ *
*
* Note: RxLifecycle treats the {@link OutsideLifecycleException}
* as normal terminal event. There is no mapping to {@link LifecycleEndedException} and in such
From 335f22b62857ca4e095b9355495ce03153a5c685 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:54:44 +0530
Subject: [PATCH 06/16] Renamed RXLifecycle to RxLifecycle and method name fix
---
autodispose-rxlifecycle/gradle.properties | 2 +-
...cycleInterop.java => RxLifecycleInterop.java} | 12 ++++++------
...eropTest.java => RxLifecycleInteropTest.java} | 16 ++++++++--------
3 files changed, 15 insertions(+), 15 deletions(-)
rename autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/{RXLifecycleInterop.java => RxLifecycleInterop.java} (76%)
rename autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/{RXLifecycleInteropTest.java => RxLifecycleInteropTest.java} (86%)
diff --git a/autodispose-rxlifecycle/gradle.properties b/autodispose-rxlifecycle/gradle.properties
index 0c397298f..5e7f815f5 100755
--- a/autodispose-rxlifecycle/gradle.properties
+++ b/autodispose-rxlifecycle/gradle.properties
@@ -1,3 +1,3 @@
-POM_NAME=AutoDispose (RXLifecycle Interop)
+POM_NAME=AutoDispose (RxLifecycle Interop)
POM_ARTIFACT_ID=autodispose-rxlifecycle
POM_PACKAGING=jar
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
similarity index 76%
rename from autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
rename to autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index 7f16b9e15..70d93ff2d 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -11,8 +11,8 @@
* LifecycleProvider} to {@link ScopeProvider}.
*
* There are several static utility converter
- * methods such as {@link #fromBindLifecycle(LifecycleProvider)} for {@link
- * LifecycleProvider#bindToLifecycle()} and {@link #fromBindUntilEvent(LifecycleProvider, Object)} for
+ * methods such as {@link #fromLifecycle(LifecycleProvider)} for {@link
+ * LifecycleProvider#bindToLifecycle()} and {@link #fromUntilEvent(LifecycleProvider, Object)} for
* {@link LifecycleProvider#bindUntilEvent(Object)}.
*
*
@@ -20,15 +20,15 @@
* as normal terminal event. There is no mapping to {@link LifecycleEndedException} and in such
* cases the stream is normally disposed.
*/
-public final class RXLifecycleInterop {
+public final class RxLifecycleInterop {
- private RXLifecycleInterop() {
+ private RxLifecycleInterop() {
throw new AssertionError("No Instances");
}
private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
- public static ScopeProvider fromBindLifecycle(final LifecycleProvider provider) {
+ public static ScopeProvider fromLifecycle(final LifecycleProvider provider) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
@@ -40,7 +40,7 @@ public static ScopeProvider fromBindLifecycle(final LifecycleProvider pro
};
}
- public static ScopeProvider fromBindUntilEvent(final LifecycleProvider provider, final E event) {
+ public static ScopeProvider fromUntilEvent(final LifecycleProvider provider, final E event) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
similarity index 86%
rename from autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
rename to autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
index 402b211a9..08330628c 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RXLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
@@ -9,11 +9,11 @@
import static com.google.common.truth.Truth.assertThat;
-public class RXLifecycleInteropTest {
+public class RxLifecycleInteropTest {
private static final RecordingObserver.Logger LOGGER = new RecordingObserver.Logger() {
@Override public void log(String message) {
- System.out.println(RXLifecycleInteropTest.class.getSimpleName() + ": " + message);
+ System.out.println(RxLifecycleInteropTest.class.getSimpleName() + ": " + message);
}
};
@@ -25,7 +25,7 @@ public void bindLifecycle_normalTermination_completeTheStream() {
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
Disposable d = source.to(AutoDispose.with(
- RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
.subscribeWith(o);
o.assertSubscribed();
@@ -48,7 +48,7 @@ public void bindLifecycle_normalTermination_unsubscribe() {
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
source.to(AutoDispose.with(
- RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -71,7 +71,7 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
lifecycleProvider.emitDestroy();
source
.to(AutoDispose.with(
- RXLifecycleInterop.fromBindLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -79,7 +79,7 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
source.onNext(2);
o.assertNoMoreEvents();
assertThat(
- source.hasObservers()).isFalse(); // Because RXLifecycle treats lifecycle ended exception as terminal event.
+ source.hasObservers()).isFalse(); // Because RxLifecycle treats lifecycle ended exception as terminal event.
}
@Test
@@ -87,7 +87,7 @@ public void bindUntilEvent_normalTermination_completeTheStream() {
lifecycleProvider.emitCreate();
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
- Disposable d = source.to(AutoDispose.with(RXLifecycleInterop.fromBindUntilEvent(
+ Disposable d = source.to(AutoDispose.with(RxLifecycleInterop.fromUntilEvent(
lifecycleProvider,
TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribeWith(o);
@@ -111,7 +111,7 @@ public void bindUntilEvent_interruptedTermination_unsubscribe() {
lifecycleProvider.emitCreate();
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
- source.to(AutoDispose.with(RXLifecycleInterop.fromBindUntilEvent(lifecycleProvider,
+ source.to(AutoDispose.with(RxLifecycleInterop.fromUntilEvent(lifecycleProvider,
TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribe(o);
o.takeSubscribe();
From 5f2be305737be288baa395edf71d1fa082266ba9 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 14:58:34 +0530
Subject: [PATCH 07/16] Renamed depdencies in dependency.gradle and removed
class from javadoc
---
autodispose-rxlifecycle/build.gradle | 2 +-
.../com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java | 2 +-
gradle/dependencies.gradle | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/autodispose-rxlifecycle/build.gradle b/autodispose-rxlifecycle/build.gradle
index ed13f577c..3aa6164ae 100644
--- a/autodispose-rxlifecycle/build.gradle
+++ b/autodispose-rxlifecycle/build.gradle
@@ -25,7 +25,7 @@ dependencies {
testApt deps.build.nullAway
compile project(':autodispose')
- api deps.misc.lifecycle
+ api deps.misc.rxlifecycle
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index 70d93ff2d..9e6523f37 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -7,7 +7,7 @@
import io.reactivex.Maybe;
/**
- * Interop class for RxLifecycle. It provides static utility methods to convert {@link
+ * Interop for RxLifecycle. It provides static utility methods to convert {@link
* LifecycleProvider} to {@link ScopeProvider}.
*
* There are several static utility converter
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index f2b871577..c6bec0e6d 100755
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -53,7 +53,7 @@ def misc = [
errorProneAnnotations: "com.google.errorprone:error_prone_annotations:${versions.errorProne}",
javaxExtras: "com.uber.javaxextras:javax-extras:0.1.0",
jsr305: 'com.google.code.findbugs:jsr305:3.0.2',
- lifecycle: 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
+ rxlifecycle: 'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
]
def rx = [
From 11f61747613a02b3b4d4f02544ed72dc204acfb9 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 15:02:19 +0530
Subject: [PATCH 08/16] Renamed methods in RXLifecycle to from() for
consistency
---
.../autodispose/rxlifecycle/RxLifecycleInterop.java | 8 ++++----
.../rxlifecycle/RxLifecycleInteropTest.java | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index 9e6523f37..7190c9cd8 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -11,8 +11,8 @@
* LifecycleProvider} to {@link ScopeProvider}.
*
* There are several static utility converter
- * methods such as {@link #fromLifecycle(LifecycleProvider)} for {@link
- * LifecycleProvider#bindToLifecycle()} and {@link #fromUntilEvent(LifecycleProvider, Object)} for
+ * methods such as {@link #from(LifecycleProvider)} for {@link
+ * LifecycleProvider#bindToLifecycle()} and {@link #from(LifecycleProvider, Object)} for
* {@link LifecycleProvider#bindUntilEvent(Object)}.
*
*
@@ -28,7 +28,7 @@ private RxLifecycleInterop() {
private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
- public static ScopeProvider fromLifecycle(final LifecycleProvider provider) {
+ public static ScopeProvider from(final LifecycleProvider provider) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
@@ -40,7 +40,7 @@ public static ScopeProvider fromLifecycle(final LifecycleProvider provide
};
}
- public static ScopeProvider fromUntilEvent(final LifecycleProvider provider, final E event) {
+ public static ScopeProvider from(final LifecycleProvider provider, final E event) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
return provider.lifecycle()
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
index 08330628c..5dd0dafd0 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
@@ -25,7 +25,7 @@ public void bindLifecycle_normalTermination_completeTheStream() {
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
Disposable d = source.to(AutoDispose.with(
- RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.from(lifecycleProvider)).forObservable())
.subscribeWith(o);
o.assertSubscribed();
@@ -48,7 +48,7 @@ public void bindLifecycle_normalTermination_unsubscribe() {
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
source.to(AutoDispose.with(
- RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.from(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -71,7 +71,7 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
lifecycleProvider.emitDestroy();
source
.to(AutoDispose.with(
- RxLifecycleInterop.fromLifecycle(lifecycleProvider)).forObservable())
+ RxLifecycleInterop.from(lifecycleProvider)).forObservable())
.subscribe(o);
o.takeSubscribe();
@@ -87,7 +87,7 @@ public void bindUntilEvent_normalTermination_completeTheStream() {
lifecycleProvider.emitCreate();
TestObserver o = new TestObserver<>();
PublishSubject source = PublishSubject.create();
- Disposable d = source.to(AutoDispose.with(RxLifecycleInterop.fromUntilEvent(
+ Disposable d = source.to(AutoDispose.with(RxLifecycleInterop.from(
lifecycleProvider,
TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribeWith(o);
@@ -111,7 +111,7 @@ public void bindUntilEvent_interruptedTermination_unsubscribe() {
lifecycleProvider.emitCreate();
RecordingObserver o = new RecordingObserver<>(LOGGER);
PublishSubject source = PublishSubject.create();
- source.to(AutoDispose.with(RxLifecycleInterop.fromUntilEvent(lifecycleProvider,
+ source.to(AutoDispose.with(RxLifecycleInterop.from(lifecycleProvider,
TestLifecycleProvider.Event.DESTROY)).forObservable())
.subscribe(o);
o.takeSubscribe();
From ce1495755892a0af87c8a779b48d06b5d58aac9d Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 15:22:56 +0530
Subject: [PATCH 09/16] Added javadoc for individual methods
---
.../rxlifecycle/RxLifecycleInterop.java | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index 7190c9cd8..9a5046c0c 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -2,6 +2,7 @@
import com.trello.rxlifecycle2.LifecycleProvider;
import com.trello.rxlifecycle2.OutsideLifecycleException;
+import com.uber.autodispose.AutoDispose.ScopeHandler;
import com.uber.autodispose.LifecycleEndedException;
import com.uber.autodispose.ScopeProvider;
import io.reactivex.Maybe;
@@ -28,6 +29,21 @@ private RxLifecycleInterop() {
private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
+ /**
+ * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
+ * It disposes the source when the next reasonable event occurs.
+ *
+ * Example usage:
+ *
+ * Observable.just(1)
+ * .to(RxLifecycleInterop.from(lifecycleProvider))
+ * .subscribe(...)
+ *
+ *
+ * @param the lifecycle event.
+ * @param provider the {@link LifecycleProvider} for RxLifecycle.
+ * @return a {@link ScopeHandler} to create AutoDisposing transformation
+ */
public static ScopeProvider from(final LifecycleProvider provider) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
@@ -40,6 +56,22 @@ public static ScopeProvider from(final LifecycleProvider provider) {
};
}
+ /**
+ * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
+ * It disposes the source when a specific event occurs.
+ *
+ * Example usage:
+ *
+ * Observable.just(1)
+ * .to(RxLifecycleInterop.from(lifecycleProvider, event))
+ * .subscribe(...)
+ *
+ *
+ * @param the lifecycle event.
+ * @param provider the {@link LifecycleProvider} for RxLifecycle.
+ * @param event the event at which the source is disposed.
+ * @return a {@link ScopeHandler} to create AutoDisposing transformation
+ */
public static ScopeProvider from(final LifecycleProvider provider, final E event) {
return new ScopeProvider() {
@Override public Maybe> requestScope() {
From c38dd9c7fb38867d97c057739fd855aba0b4085c Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 15:29:24 +0530
Subject: [PATCH 10/16] Removed double space
---
.../ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index 9a5046c0c..e909f5fe3 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -30,7 +30,7 @@ private RxLifecycleInterop() {
private static final Object DEFAULT_THROWAWAY_OBJECT = new Object();
/**
- * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
+ * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
* It disposes the source when the next reasonable event occurs.
*
* Example usage:
@@ -57,7 +57,7 @@ public static ScopeProvider from(final LifecycleProvider provider) {
}
/**
- * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
+ * Converter for transforming {@link LifecycleProvider} to {@link ScopeProvider}.
* It disposes the source when a specific event occurs.
*
* Example usage:
From f33e1c79486b46bd58a7155bdeaea4fb5f48fe85 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 16:01:56 +0530
Subject: [PATCH 11/16] Fixed checkstyle for test
---
.../autodispose/rxlifecycle/RxLifecycleInteropTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
index 5dd0dafd0..294138586 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
@@ -79,7 +79,8 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
source.onNext(2);
o.assertNoMoreEvents();
assertThat(
- source.hasObservers()).isFalse(); // Because RxLifecycle treats lifecycle ended exception as terminal event.
+ source.hasObservers()).isFalse(); // Because RxLifecycle
+ // treats lifecycle ended exception as terminal event.
}
@Test
From 06be7fbaebdecf70b9958800f63f8d8f8363c100 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 16:03:44 +0530
Subject: [PATCH 12/16] fixed exception name
---
.../ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
index 294138586..c14957956 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
@@ -80,7 +80,7 @@ public void bindLifecycle_outsideLifecycleBound_unsubscribe() {
o.assertNoMoreEvents();
assertThat(
source.hasObservers()).isFalse(); // Because RxLifecycle
- // treats lifecycle ended exception as terminal event.
+ // treats OutsideLifecycleException as terminal event.
}
@Test
From 51d79895cf90c239af45daf0a1f5e77cc9a02e2b Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 22:08:41 +0530
Subject: [PATCH 13/16] API replaced with implementation to avoid transitive
compile time dependencies
---
autodispose/build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/autodispose/build.gradle b/autodispose/build.gradle
index 7d00387fc..ec5dd628a 100755
--- a/autodispose/build.gradle
+++ b/autodispose/build.gradle
@@ -39,7 +39,7 @@ dependencies {
apt deps.build.nullAway
testApt deps.build.nullAway
- api deps.rx.java
+ implementation deps.rx.java
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
From 7182d545e98809d2eef1ddc23420fe54f90a91a1 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sat, 21 Oct 2017 22:14:08 +0530
Subject: [PATCH 14/16] Reverted the incorrect api
---
autodispose-rxlifecycle/build.gradle | 2 +-
autodispose/build.gradle | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/autodispose-rxlifecycle/build.gradle b/autodispose-rxlifecycle/build.gradle
index 3aa6164ae..ee22f0649 100644
--- a/autodispose-rxlifecycle/build.gradle
+++ b/autodispose-rxlifecycle/build.gradle
@@ -25,7 +25,7 @@ dependencies {
testApt deps.build.nullAway
compile project(':autodispose')
- api deps.misc.rxlifecycle
+ compile deps.misc.rxlifecycle
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
diff --git a/autodispose/build.gradle b/autodispose/build.gradle
index ec5dd628a..7d00387fc 100755
--- a/autodispose/build.gradle
+++ b/autodispose/build.gradle
@@ -39,7 +39,7 @@ dependencies {
apt deps.build.nullAway
testApt deps.build.nullAway
- implementation deps.rx.java
+ api deps.rx.java
compileOnly deps.misc.errorProneAnnotations
compileOnly deps.misc.javaxExtras
From e463be672369a0f758516ad0cc61614f1cc67035 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sun, 22 Oct 2017 05:53:10 +0530
Subject: [PATCH 15/16] Added more javadoc in package-info.java and license
header to all the files
---
autodispose-rxlifecycle/build.gradle | 16 ++++++++++++++++
autodispose-rxlifecycle/gradle.properties | 16 ++++++++++++++++
.../rxlifecycle/RxLifecycleInterop.java | 16 ++++++++++++++++
.../autodispose/rxlifecycle/package-info.java | 4 +++-
.../rxlifecycle/RxLifecycleInteropTest.java | 16 ++++++++++++++++
.../rxlifecycle/TestLifecycleProvider.java | 16 ++++++++++++++++
6 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/autodispose-rxlifecycle/build.gradle b/autodispose-rxlifecycle/build.gradle
index ee22f0649..56c49924d 100644
--- a/autodispose-rxlifecycle/build.gradle
+++ b/autodispose-rxlifecycle/build.gradle
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
buildscript {
repositories {
jcenter()
diff --git a/autodispose-rxlifecycle/gradle.properties b/autodispose-rxlifecycle/gradle.properties
index 5e7f815f5..d1f035f8d 100755
--- a/autodispose-rxlifecycle/gradle.properties
+++ b/autodispose-rxlifecycle/gradle.properties
@@ -1,3 +1,19 @@
+#
+# Copyright (C) 2017. Uber Technologies
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
POM_NAME=AutoDispose (RxLifecycle Interop)
POM_ARTIFACT_ID=autodispose-rxlifecycle
POM_PACKAGING=jar
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
index e909f5fe3..a11185687 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInterop.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.ubercab.autodispose.rxlifecycle;
import com.trello.rxlifecycle2.LifecycleProvider;
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
index 4c713e9d0..7566b6b7f 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
@@ -15,7 +15,9 @@
*/
/**
- * Interop for RxLifecycle.
+ * Interop for RxLifecycle. It could understand RxLifecycle's
+ * LifecycleProvider mechanics, which in turn lend support to different
+ * components such as RxActivity. It does so by providing converters to retrieve ScopeProvider.
*/
@com.uber.javaxextras.FieldsMethodsAndParametersAreNonNullByDefault
package com.ubercab.autodispose.rxlifecycle;
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
index c14957956..cf6101a86 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/RxLifecycleInteropTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.ubercab.autodispose.rxlifecycle;
import com.uber.autodispose.AutoDispose;
diff --git a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
index 281146ea2..7cac2cb8c 100644
--- a/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
+++ b/autodispose-rxlifecycle/src/test/java/com/ubercab/autodispose/rxlifecycle/TestLifecycleProvider.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.ubercab.autodispose.rxlifecycle;
import com.trello.rxlifecycle2.LifecycleProvider;
From 7f3e1a87bb905848c38251a68a79861612033919 Mon Sep 17 00:00:00 2001
From: Harshit Bangar
Date: Sun, 22 Oct 2017 06:01:20 +0530
Subject: [PATCH 16/16] Fixed javadoc
---
.../com/ubercab/autodispose/rxlifecycle/package-info.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
index 7566b6b7f..6a9760a72 100644
--- a/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
+++ b/autodispose-rxlifecycle/src/main/java/com/ubercab/autodispose/rxlifecycle/package-info.java
@@ -15,9 +15,8 @@
*/
/**
- * Interop for RxLifecycle. It could understand RxLifecycle's
- * LifecycleProvider mechanics, which in turn lend support to different
- * components such as RxActivity. It does so by providing converters to retrieve ScopeProvider.
+ * AutoDispose extensions for interop with RxLifecycle. This namely supports
+ * {@link com.trello.rxlifecycle2.LifecycleProvider}.
*/
@com.uber.javaxextras.FieldsMethodsAndParametersAreNonNullByDefault
package com.ubercab.autodispose.rxlifecycle;