diff --git a/.travis.yml b/.travis.yml index af60c51c..6fe3a82d 100755 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ jobs: script: - cd android - - ./gradlew build + - ./gradlew spotlessCheck build env: - secure: "X1BegtP1L5RJwLKsb198RanMxXjHz0q9ta5GGqmRSuROI3sunp2tJFzQHxiYKbHNJ6t98a5tEGgX+rboQKvRA6zWZWXnGRiVZ2fBW/uIxI55yNPo5tRssjbzVUhllo9ffd/NONtFRJ7pS4csDqQtW/AvLTIl5JXj3K3ciBSc1ErLgnh7T0ycmivwoIgGVj3rI8/KVrD9QJ95p2T39UR3DdMseAUymrCeHpYxZqPhEHxWfPWWw2YVTd7tDoywALy2KFo2zGjsltqkRl4AICJE+c9DBGl4K4zrhDUGEfbqbtL1I+jnfhCjiB4AhqW2ysQNdSLRldpRVgi8hn3tWyIfuLOFD7kk99cHRCZEI1H3hqH+GveEC05y6N2JpI/UFBJ7bl4Vcz3P1xKIMxLauS+tg6yXIebia3ca7f8Kih5B8pyuFW2D3sUsmU6nFIT203WDZzYs/QOpplWUYXd6QqJqUPQk8Yi3WVxYlyIuY3M6aat0Uj1TMMWmrtFSe/SFXC7foZLKJNtgJ/FE+g6kt4IJSMW5M7Ecbgqds/d803k9A7/Qjf94bTgqFhb6E5mIEszI5mtb03GYc6rPJsNGiojvhil9szn3DDqlKZAmgyV2/RBFXwUcOK61KIU5/B+KS8dEAD3CWPaFvkIwcUrjd+JiYWhNFzxTbuqWqCMt1aG+wrI=" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcc5d77d..61433c2f 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,10 +15,23 @@ For big features, please open an issue so that we can agree on the direction, an Small pull requests for things like typos, bug fixes, etc are always welcome. +### Code style + +This project uses [ktfmt](https://github.com/facebookincubator/ktfmt), [ktlint](https://github.com/pinterest/ktlint), and [GJF](https://github.com/google/google-java-format), +provided via the [spotless](https://github.com/diffplug/spotless) gradle plugin. + +If you find that one of your pull reviews does not pass the CI server check due to a code style +conflict, you can easily fix it by running: `./gradlew spotlessApply`. + +Generally speaking - we use ktfmt, vanilla ktlint + 2space indents, and vanilla GJF. You can integrate both of +these in IntelliJ code style via either [GJF's official plugin](https://plugins.jetbrains.com/plugin/8527-google-java-format) or applying code style from Jetbrains' official style. + +No star imports please! + DOs and DON'Ts -------------- -* DO follow our [coding style](https://github.com/uber/java-code-styles) +* DO follow our [coding style](https://github.com/uber/java-code-styles) * DO include tests when adding new features. When fixing bugs, start with adding a test that highlights how the current behavior is broken. * DO keep the discussions focused. When a new or related topic comes up it's often better to create new issue than to side track the discussion. diff --git a/android/build.gradle b/android/build.gradle index 5b6116e3..c8a4cafa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, @@ -28,6 +28,7 @@ buildscript { dependencies { classpath deps.build.gradlePlugins.android classpath deps.build.gradlePlugins.errorprone + classpath deps.build.gradlePlugins.spotless } } @@ -59,10 +60,35 @@ subprojects { maven { url deps.build.gradlePluginsUrl } } - apply plugin: 'checkstyle' + apply plugin: 'com.diffplug.spotless' + spotless { + format 'misc', { + target '**/*.md', '**/.gitignore' - checkstyle { -> rootProject - configFile rootProject.file('config/checkstyle/checkstyle.xml') + trimTrailingWhitespace() + endWithNewline() + } + kotlin { + target "**/*.kt" + ktlint(deps.versions.ktlint).userData(['indent_size': '2', 'continuation_indent_size' : '2']) + ktfmt(deps.versions.ktfmt) + licenseHeaderFile rootProject.file('config/spotless/copyright.kt') + trimTrailingWhitespace() + endWithNewline() + } + java { + target "src/*/java/**/*.java" + googleJavaFormat(deps.versions.gjf) + licenseHeaderFile rootProject.file('config/spotless/copyright.java') + removeUnusedImports() + trimTrailingWhitespace() + endWithNewline() + } + groovyGradle { + target '**/*.gradle' + trimTrailingWhitespace() + endWithNewline() + } } boolean isAndroidLibrary = project.name in androidLibraryProjects diff --git a/android/config/checkstyle/checkstyle-suppressions.xml b/android/config/checkstyle/checkstyle-suppressions.xml deleted file mode 100644 index d51daada..00000000 --- a/android/config/checkstyle/checkstyle-suppressions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/android/config/checkstyle/checkstyle-test.xml b/android/config/checkstyle/checkstyle-test.xml deleted file mode 100644 index b56a1c52..00000000 --- a/android/config/checkstyle/checkstyle-test.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/config/checkstyle/checkstyle.xml b/android/config/checkstyle/checkstyle.xml deleted file mode 100644 index e068ed32..00000000 --- a/android/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/config/spotless/copyright.java b/android/config/spotless/copyright.java new file mode 100644 index 00000000..14190bf8 --- /dev/null +++ b/android/config/spotless/copyright.java @@ -0,0 +1,15 @@ +/* + * Copyright (C) $YEAR. 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. + */ \ No newline at end of file diff --git a/android/config/spotless/copyright.kt b/android/config/spotless/copyright.kt new file mode 100644 index 00000000..14190bf8 --- /dev/null +++ b/android/config/spotless/copyright.kt @@ -0,0 +1,15 @@ +/* + * Copyright (C) $YEAR. 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. + */ \ No newline at end of file diff --git a/android/demos/memory-leaks/build.gradle b/android/demos/memory-leaks/build.gradle index 766b9f4b..b889b38e 100644 --- a/android/demos/memory-leaks/build.gradle +++ b/android/demos/memory-leaks/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/RootActivity.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/RootActivity.java index 8d876722..da6fc03e 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/RootActivity.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.view.ViewGroup; - import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; @@ -25,7 +23,7 @@ import com.uber.rib.root.RootBuilder; /** The sample app's single activity. */ public class RootActivity extends RibActivity { - //public Object object; + // public Object object; @SuppressWarnings("unchecked") @Override diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/SampleApplication.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/SampleApplication.java index 4752df6e..1c09eef9 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; - import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; import com.uber.rib.core.RibRefWatcher; - import java.util.concurrent.TimeUnit; public class SampleApplication extends Application { @@ -30,31 +27,30 @@ public class SampleApplication extends Application { public void onCreate() { super.onCreate(); if (!LeakCanary.isInAnalyzerProcess(this)) { - // This process is dedicated to LeakCanary for heap analysis. You should not init your app in this process. + // This process is dedicated to LeakCanary for heap analysis. You should not init your app in + // this process. installLeakCanary(); } } - /** - * Install leak canary for both activities and RIBs. - */ + /** Install leak canary for both activities and RIBs. */ private void installLeakCanary() { - final RefWatcher refWatcher = LeakCanary - .refWatcher(this) - .watchDelay(2, TimeUnit.SECONDS) - .buildAndInstall(); + final RefWatcher refWatcher = + LeakCanary.refWatcher(this).watchDelay(2, TimeUnit.SECONDS).buildAndInstall(); LeakCanary.install(this); - RibRefWatcher.getInstance().setReferenceWatcher(new RibRefWatcher.ReferenceWatcher() { - @Override - public void watch(Object object) { - refWatcher.watch(object); - } + RibRefWatcher.getInstance() + .setReferenceWatcher( + new RibRefWatcher.ReferenceWatcher() { + @Override + public void watch(Object object) { + refWatcher.watch(object); + } - @Override - public void logBreadcrumb(String eventType, String data, String parent) { - // Ignore for now. Useful for collecting production analytics. - } - }); + @Override + public void logBreadcrumb(String eventType, String data, String parent) { + // Ignore for now. Useful for collecting production analytics. + } + }); RibRefWatcher.getInstance().enableLeakCanary(); } } diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootBuilder.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootBuilder.java index 34ebf7ac..2d942337 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -22,19 +21,17 @@ import android.view.LayoutInflater; import android.view.ViewGroup; import com.uber.rib.core.InteractorBaseComponent; import com.uber.rib.core.ViewBuilder; +import com.uber.rib.memory_leak.R; import com.uber.rib.root.logged_in.LoggedInBuilder; import com.uber.rib.root.logged_out.LoggedOutBuilder; import com.uber.rib.root.logged_out.LoggedOutInteractor; -import com.uber.rib.memory_leak.R; import dagger.Binds; import dagger.BindsInstance; import dagger.Provides; import java.lang.annotation.Retention; import javax.inject.Scope; -/** - * Builder for the {@link RootScope}. - */ +/** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { public RootBuilder(ParentComponent dependency) { @@ -50,11 +47,12 @@ public class RootBuilder extends ViewBuilder, - LoggedOutBuilder.ParentComponent, - LoggedInBuilder.ParentComponent, - BuilderComponent { + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component + extends InteractorBaseComponent, + LoggedOutBuilder.ParentComponent, + LoggedInBuilder.ParentComponent, + BuilderComponent { @dagger.Component.Builder interface Builder { @@ -125,7 +120,5 @@ public class RootBuilder extends ViewBuilder { @@ -47,10 +44,6 @@ public class RootInteractor extends Interactor { private final LoggedOutBuilder loggedOutBuilder; diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootView.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootView.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java index 5a0a4597..5e00917f 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,23 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; +import static java.lang.annotation.RetentionPolicy.CLASS; + import com.uber.rib.core.Builder; import com.uber.rib.core.EmptyPresenter; import com.uber.rib.core.InteractorBaseComponent; import com.uber.rib.root.RootView; - -import java.lang.annotation.Retention; - -import javax.inject.Qualifier; -import javax.inject.Scope; - import dagger.BindsInstance; import dagger.Provides; - -import static java.lang.annotation.RetentionPolicy.CLASS; +import java.lang.annotation.Retention; +import javax.inject.Qualifier; +import javax.inject.Scope; public class LoggedInBuilder extends Builder { @@ -44,10 +40,11 @@ public class LoggedInBuilder extends Builder, - BuilderComponent { + public interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder interface Builder { @@ -88,7 +83,6 @@ public class LoggedInBuilder extends Builder { } +public class LoggedInInteractor extends Interactor {} diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java index 3aec3391..6fb535a2 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,18 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import com.uber.rib.core.Router; -/** - * Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. - */ +/** Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. */ public class LoggedInRouter extends Router { - LoggedInRouter( - LoggedInInteractor interactor, - LoggedInBuilder.Component component) { + LoggedInRouter(LoggedInInteractor interactor, LoggedInBuilder.Component component) { super(interactor, component); } } diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java index e21378ba..3097fed4 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link LoggedOutScope}. - */ +/** Builder for the {@link LoggedOutScope}. */ public class LoggedOutBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class LoggedOutBuilder public LoggedOutRouter build(ViewGroup parentViewGroup) { LoggedOutView view = createView(parentViewGroup); LoggedOutInteractor interactor = new LoggedOutInteractor(); - Component component = DaggerLoggedOutBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerLoggedOutBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.loggedoutRouter(); } @@ -77,9 +75,7 @@ public class LoggedOutBuilder @LoggedOutScope @Provides static LoggedOutRouter router( - Component component, - LoggedOutView view, - LoggedOutInteractor interactor) { + Component component, LoggedOutView view, LoggedOutInteractor interactor) { return new LoggedOutRouter(view, interactor, component); } @@ -87,8 +83,7 @@ public class LoggedOutBuilder } @LoggedOutScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -113,13 +108,9 @@ public class LoggedOutBuilder @Scope @Retention(CLASS) - @interface LoggedOutScope { - - } + @interface LoggedOutScope {} @Qualifier @Retention(CLASS) - @interface LoggedOutInternal { - - } + @interface LoggedOutInternal {} } diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java index 7c197b63..41fb46c9 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import androidx.annotation.Nullable; @@ -21,17 +20,13 @@ import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; import com.uber.rib.root.logged_out.LoggedOutBuilder.LoggedOutScope; - -import java.util.concurrent.TimeUnit; - import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Consumer; +import java.util.concurrent.TimeUnit; import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link LoggedOutScope}. - */ +/** Coordinates Business Logic for {@link LoggedOutScope}. */ @RibInteractor public class LoggedOutInteractor extends Interactor { @@ -45,33 +40,33 @@ public class LoggedOutInteractor super.didBecomeActive(savedInstanceState); presenter .loginName() - .subscribe(new Consumer() { - @Override - public void accept(String name) throws Exception { - if (!isEmpty(name)) { - listener.login(name); - } - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(String name) throws Exception { + if (!isEmpty(name)) { + listener.login(name); + } + } + }); // BUG: Subscribe to some long running operation and forget to unsubscribe. Observable.timer(2000, TimeUnit.DAYS) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Consumer() { - @Override - public void accept(Long aLong) throws Exception { - listener.login("Really slow person."); - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(Long aLong) throws Exception { + listener.login("Really slow person."); + } + }); } private boolean isEmpty(@Nullable String string) { return string == null || string.length() == 0; } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface LoggedOutPresenter { Observable loginName(); @@ -81,5 +76,4 @@ public class LoggedOutInteractor void login(String userName); } - } diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java index 960988a7..7ae9a757 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. - */ -public class LoggedOutRouter extends - ViewRouter { +/** Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. */ +public class LoggedOutRouter extends ViewRouter { public LoggedOutRouter( - LoggedOutView view, - LoggedOutInteractor interactor, - LoggedOutBuilder.Component component) { + LoggedOutView view, LoggedOutInteractor interactor, LoggedOutBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java index 8b5432f1..5d614289 100644 --- a/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java +++ b/android/demos/memory-leaks/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java @@ -1,9 +1,3 @@ -package com.uber.rib.root.logged_out; - -import android.content.Context; -import androidx.annotation.Nullable; -import android.util.AttributeSet; -import android.widget.LinearLayout; /* * Copyright (C) 2017. Uber Technologies * @@ -11,7 +5,7 @@ import android.widget.LinearLayout; * 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 + * 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, @@ -19,16 +13,19 @@ import android.widget.LinearLayout; * See the License for the specific language governing permissions and * limitations under the License. */ +package com.uber.rib.root.logged_out; +import android.content.Context; +import android.util.AttributeSet; +import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.memory_leak.R; import io.reactivex.Observable; import io.reactivex.functions.Function; -/** - * Top level view for {@link LoggedOutBuilder.LoggedOutScope}. - */ +/** Top level view for {@link LoggedOutBuilder.LoggedOutScope}. */ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.LoggedOutPresenter { public LoggedOutView(Context context) { @@ -46,12 +43,13 @@ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.L @Override public Observable loginName() { return RxView.clicks(findViewById(R.id.login_button)) - .map(new Function() { - @Override - public String apply(Object o) throws Exception { - TextView textView = (TextView) findViewById(R.id.edit_text); - return textView.getText().toString(); - } - }); + .map( + new Function() { + @Override + public String apply(Object o) throws Exception { + TextView textView = (TextView) findViewById(R.id.edit_text); + return textView.getText().toString(); + } + }); } } diff --git a/android/gradle/dependencies.gradle b/android/gradle/dependencies.gradle index a578b0f2..f6c91278 100755 --- a/android/gradle/dependencies.gradle +++ b/android/gradle/dependencies.gradle @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,17 +15,21 @@ */ def versions = [ - dagger: "2.22.1", androidx: [ annotations: '1.1.0', appcompat: '1.2.0', percent: '1.0.0' ], autodispose: '1.4.0', - robolectric: "4.4", + dagger: "2.22.1", + errorProne: '2.3.3', + gjf: '1.7', intellij: "2017.2", + ktfmt: '0.23', + ktlint: '0.41.0', rave: "2.0.0", - errorProne: '2.3.3' + robolectric: "4.4", + spotless: '5.11.0' ] def apt = [ @@ -63,7 +67,8 @@ def build = [ android: 'com.android.tools.build:gradle:3.6.2', errorprone: "net.ltgt.gradle:gradle-errorprone-plugin:1.3.0", nullaway: "net.ltgt.gradle:gradle-nullaway-plugin:1.0.2", - apt: "net.ltgt.gradle:gradle-apt-plugin:0.21" + apt: "net.ltgt.gradle:gradle-apt-plugin:0.21", + spotless: "com.diffplug.spotless:spotless-plugin-gradle:${versions.spotless}" ] ] diff --git a/android/gradle/gradle-mvn-push.gradle b/android/gradle/gradle-mvn-push.gradle index 35726220..49fdf836 100755 --- a/android/gradle/gradle-mvn-push.gradle +++ b/android/gradle/gradle-mvn-push.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android-core/build.gradle b/android/libraries/rib-android-core/build.gradle index 7db3b154..20b6c40a 100644 --- a/android/libraries/rib-android-core/build.gradle +++ b/android/libraries/rib-android-core/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/ActivityDelegate.java b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/ActivityDelegate.java index b1f6a9f3..d454fbd2 100644 --- a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/ActivityDelegate.java +++ b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/ActivityDelegate.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/CoreAppCompatActivity.java b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/CoreAppCompatActivity.java index 5e4380d0..a42d73fd 100644 --- a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/CoreAppCompatActivity.java +++ b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/CoreAppCompatActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/HasActivityDelegate.java b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/HasActivityDelegate.java index a27fdb63..a2909024 100644 --- a/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/HasActivityDelegate.java +++ b/android/libraries/rib-android-core/src/main/java/com/uber/rib/core/HasActivityDelegate.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/build.gradle b/android/libraries/rib-android/build.gradle index 03542ef0..a4cce378 100644 --- a/android/libraries/rib-android/build.gradle +++ b/android/libraries/rib-android/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityContext.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityContext.java index 713c1811..b5705743 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityContext.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityContext.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,11 +15,11 @@ */ package com.uber.rib.core; -import javax.inject.Qualifier; -import java.lang.annotation.Retention; - import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import javax.inject.Qualifier; + /** Injection qualifier for an Activity Context. */ @Qualifier @Retention(RUNTIME) diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityStarter.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityStarter.java index 24f0501a..6c53de02 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityStarter.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ActivityStarter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/BasicViewRouter.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/BasicViewRouter.java index 951c386c..e05d81f4 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/BasicViewRouter.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/BasicViewRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreator.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreator.java index db14cee3..70e7141e 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreator.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreatorImpl.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreatorImpl.java index ab4a43a9..91b80ca8 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreatorImpl.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentCreatorImpl.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentFactory.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentFactory.java index c8eefd8c..fe7cfc06 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentFactory.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/IntentFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibActivity.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibActivity.java index 4fbd0efa..3c88a7c1 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibActivity.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibDebugOverlay.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibDebugOverlay.java index 199ed6ae..c326355e 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibDebugOverlay.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RibDebugOverlay.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RxActivityEvents.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RxActivityEvents.java index b9f62933..a942b317 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/RxActivityEvents.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/RxActivityEvents.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewBuilder.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewBuilder.java index 4dc2f039..7005a83f 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewBuilder.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewPresenter.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewPresenter.java index fa0d63e7..a9784dfc 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewPresenter.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewPresenter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewRouter.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewRouter.java index 12bd8ede..3acc1352 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewRouter.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/ViewRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/XRay.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/XRay.java index 818ae5f1..748c8180 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/XRay.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/XRay.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityCallbackEvent.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityCallbackEvent.java index 44ffb27d..b03f0d35 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityCallbackEvent.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityCallbackEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityEvent.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityEvent.java index e29e8d99..94558e58 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityEvent.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityLifecycleEvent.java b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityLifecycleEvent.java index 0eec2ec9..ea6fbc00 100644 --- a/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityLifecycleEvent.java +++ b/android/libraries/rib-android/src/main/java/com/uber/rib/core/lifecycle/ActivityLifecycleEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-android/src/test/java/com/uber/rib/core/BundleTest.java b/android/libraries/rib-android/src/test/java/com/uber/rib/core/BundleTest.java index 575a34d3..e22ef6d1 100644 --- a/android/libraries/rib-android/src/test/java/com/uber/rib/core/BundleTest.java +++ b/android/libraries/rib-android/src/test/java/com/uber/rib/core/BundleTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,13 +15,13 @@ */ package com.uber.rib.core; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import static com.google.common.truth.Truth.assertThat; - @RunWith(RobolectricTestRunner.class) public class BundleTest { diff --git a/android/libraries/rib-android/src/test/java/com/uber/rib/core/RibActivityTest.java b/android/libraries/rib-android/src/test/java/com/uber/rib/core/RibActivityTest.java index db4e5637..c9002494 100644 --- a/android/libraries/rib-android/src/test/java/com/uber/rib/core/RibActivityTest.java +++ b/android/libraries/rib-android/src/test/java/com/uber/rib/core/RibActivityTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,19 +15,28 @@ */ package com.uber.rib.core; +import static com.google.common.truth.Truth.assertThat; +import static com.uber.autodispose.AutoDispose.autoDisposable; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.robolectric.Robolectric.buildActivity; +import static org.robolectric.Robolectric.setupActivity; + import android.app.Activity; import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; - +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.uber.autodispose.lifecycle.LifecycleEndedException; import com.uber.rib.android.R; import com.uber.rib.core.lifecycle.ActivityCallbackEvent; import com.uber.rib.core.lifecycle.ActivityLifecycleEvent; - +import io.reactivex.Observable; +import io.reactivex.functions.Predicate; +import io.reactivex.observers.TestObserver; +import io.reactivex.subjects.PublishSubject; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; @@ -35,18 +44,6 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.android.controller.ActivityController; -import io.reactivex.Observable; -import io.reactivex.functions.Predicate; -import io.reactivex.observers.TestObserver; -import io.reactivex.subjects.PublishSubject; - -import static com.uber.autodispose.AutoDispose.autoDisposable; -import static com.google.common.truth.Truth.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.robolectric.Robolectric.buildActivity; -import static org.robolectric.Robolectric.setupActivity; - @RunWith(RobolectricTestRunner.class) public class RibActivityTest { @@ -244,8 +241,7 @@ public class RibActivityTest { } } - private static class EmptyRouter - extends ViewRouter> { + private static class EmptyRouter extends ViewRouter> { EmptyRouter( @NonNull FrameLayout view, diff --git a/android/libraries/rib-android/src/test/java/com/uber/rib/core/ViewBuilderTest.java b/android/libraries/rib-android/src/test/java/com/uber/rib/core/ViewBuilderTest.java index 7ac2e16a..b0046334 100644 --- a/android/libraries/rib-android/src/test/java/com/uber/rib/core/ViewBuilderTest.java +++ b/android/libraries/rib-android/src/test/java/com/uber/rib/core/ViewBuilderTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,23 +15,21 @@ */ package com.uber.rib.core; +import static com.google.common.truth.Truth.assertThat; + import android.content.Context; -import androidx.annotation.NonNull; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; - +import androidx.annotation.NonNull; import com.uber.rib.android.R; - import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import static com.google.common.truth.Truth.assertThat; - @RunWith(RobolectricTestRunner.class) public class ViewBuilderTest { diff --git a/android/libraries/rib-android/src/test/java/com/uber/rib/core/XRayTest.java b/android/libraries/rib-android/src/test/java/com/uber/rib/core/XRayTest.java index 1b0f8b0b..7ec161c6 100644 --- a/android/libraries/rib-android/src/test/java/com/uber/rib/core/XRayTest.java +++ b/android/libraries/rib-android/src/test/java/com/uber/rib/core/XRayTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -15,22 +15,21 @@ */ package com.uber.rib.core; -import android.content.Context; -import android.graphics.drawable.Drawable; -import android.view.View; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; - import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.view.View; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; + @RunWith(RobolectricTestRunner.class) public class XRayTest { diff --git a/android/libraries/rib-base/build.gradle b/android/libraries/rib-base/build.gradle index ba81c19a..867f92ec 100644 --- a/android/libraries/rib-base/build.gradle +++ b/android/libraries/rib-base/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicInteractor.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicInteractor.java index 7b9948f6..c89b3d1a 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicInteractor.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicRouter.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicRouter.java index d945b726..4aa3330a 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicRouter.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/BasicRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Builder.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Builder.java index 4635746a..5a618ede 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Builder.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Builder.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Bundle.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Bundle.java index 89299267..3beca8b8 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Bundle.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Bundle.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/EmptyPresenter.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/EmptyPresenter.java index 0d81149c..ec7f4dab 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/EmptyPresenter.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/EmptyPresenter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Initializer.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Initializer.java index 5ed637ad..e150edcc 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Initializer.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Initializer.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Interactor.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Interactor.java index 42c74184..474b9e1d 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Interactor.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Interactor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorAndViewModule.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorAndViewModule.java index 02d5cfc3..10238b27 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorAndViewModule.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorAndViewModule.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorBaseComponent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorBaseComponent.java index 101ca66f..6a8b8bad 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorBaseComponent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorBaseComponent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorComponent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorComponent.java index 6a4e8acd..9d022ee1 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorComponent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorComponent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorModule.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorModule.java index 012c83f9..a2083249 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorModule.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/InteractorModule.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Presenter.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Presenter.java index 345bdd4c..b53e3a97 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Presenter.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Presenter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Rib.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Rib.java index 05e160d2..03e00e47 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Rib.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Rib.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibBuilder.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibBuilder.java index cdc636b6..7d1c5a07 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibBuilder.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvent.java index 27cce98d..b0025492 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEventType.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEventType.java index 2c779c49..d7c8ad75 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEventType.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEventType.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvents.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvents.java index 7da815f3..bd9bfdc9 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvents.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibEvents.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibInteractor.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibInteractor.java index 1233547f..431309df 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibInteractor.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibRefWatcher.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibRefWatcher.java index 81440cab..4a045552 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibRefWatcher.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/RibRefWatcher.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Router.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Router.java index ac4001c6..269b0faf 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Router.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Router.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -22,7 +22,6 @@ import androidx.annotation.CallSuper; import androidx.annotation.MainThread; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; - import java.util.List; import java.util.Locale; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Worker.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Worker.java index 31c1e48c..dc60cd2b 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/Worker.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/Worker.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerBinder.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerBinder.java index 221409cb..27045523 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerBinder.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerBinder.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerScopeProvider.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerScopeProvider.java index 4766864a..c8fe2aea 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerScopeProvider.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerScopeProvider.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerUnbinder.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerUnbinder.java index 19bc2ab0..e64f39f9 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerUnbinder.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/WorkerUnbinder.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/InteractorEvent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/InteractorEvent.java index 57f05591..1055a2eb 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/InteractorEvent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/InteractorEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/PresenterEvent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/PresenterEvent.java index 6cce33a5..d17a2698 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/PresenterEvent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/PresenterEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/WorkerEvent.java b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/WorkerEvent.java index 4aafd5c1..b93b460b 100644 --- a/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/WorkerEvent.java +++ b/android/libraries/rib-base/src/main/java/com/uber/rib/core/lifecycle/WorkerEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/android/os/Bundle.java b/android/libraries/rib-base/src/test/java/android/os/Bundle.java index 54bc9d21..c5e162da 100644 --- a/android/libraries/rib-base/src/test/java/android/os/Bundle.java +++ b/android/libraries/rib-base/src/test/java/android/os/Bundle.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/android/os/Parcelable.java b/android/libraries/rib-base/src/test/java/android/os/Parcelable.java index 29b467e9..1ce89b97 100644 --- a/android/libraries/rib-base/src/test/java/android/os/Parcelable.java +++ b/android/libraries/rib-base/src/test/java/android/os/Parcelable.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/InteractorAndRouterTest.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/InteractorAndRouterTest.java index 4a308abb..e70a55b7 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/InteractorAndRouterTest.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/InteractorAndRouterTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RecordingObserver.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RecordingObserver.java index dce1ac27..faccd4f0 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RecordingObserver.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RecordingObserver.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RibRefWatcherTest.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RibRefWatcherTest.java index 3d54af53..ec0b4351 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RibRefWatcherTest.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RibRefWatcherTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RouterTest.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RouterTest.java index 432d8e77..3f0c5a8d 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/RouterTest.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/RouterTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerBinderTest.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerBinderTest.java index baf476f1..28b67d1d 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerBinderTest.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerBinderTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerScopeProviderTest.java b/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerScopeProviderTest.java index af643db5..0cdfca4d 100644 --- a/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerScopeProviderTest.java +++ b/android/libraries/rib-base/src/test/java/com/uber/rib/core/WorkerScopeProviderTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.core; import com.jakewharton.rxrelay2.BehaviorRelay; @@ -48,4 +63,4 @@ public class WorkerScopeProviderTest { testObserver.assertComplete(); testObserver.assertNoErrors(); } -} \ No newline at end of file +} diff --git a/android/libraries/rib-compiler-app/build.gradle b/android/libraries/rib-compiler-app/build.gradle index da8f039c..e0769700 100644 --- a/android/libraries/rib-compiler-app/build.gradle +++ b/android/libraries/rib-compiler-app/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotatedClass.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotatedClass.java index 10f15c11..21245179 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotatedClass.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotatedClass.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotationVerifier.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotationVerifier.java index 7a284b1c..8edcdb60 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotationVerifier.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/AnnotationVerifier.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/CompilerUtils.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/CompilerUtils.java index 916559fc..b66a15a5 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/CompilerUtils.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/CompilerUtils.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Constants.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Constants.java index 18a42ea0..9740ab04 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Constants.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Constants.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ErrorReporter.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ErrorReporter.java index e68b87ce..4906b7e1 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ErrorReporter.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ErrorReporter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Generator.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Generator.java index 54f716fe..4d0b4351 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Generator.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/Generator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotatedClass.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotatedClass.java index 0eeacfa8..82ddf2ac 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotatedClass.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotatedClass.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotationVerifier.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotationVerifier.java index 50040f8e..51e6e2d7 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotationVerifier.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/InteractorAnnotationVerifier.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessContext.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessContext.java index 9cdc5ad6..aadb569c 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessContext.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessContext.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessorPipeline.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessorPipeline.java index 41f24a3e..9d730b91 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessorPipeline.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/ProcessorPipeline.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibInteractorProcessorPipeline.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibInteractorProcessorPipeline.java index 0e3cebe4..0be2c8b6 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibInteractorProcessorPipeline.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibInteractorProcessorPipeline.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibProcessor.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibProcessor.java index 69ae3435..3c58d919 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibProcessor.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/RibProcessor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/TypeProcessorPipeline.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/TypeProcessorPipeline.java index ee20d585..500f00df 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/TypeProcessorPipeline.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/TypeProcessorPipeline.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/VerificationFailedException.java b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/VerificationFailedException.java index 1ab6ed63..b1297213 100644 --- a/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/VerificationFailedException.java +++ b/android/libraries/rib-compiler-app/src/main/java/com/uber/rib/compiler/VerificationFailedException.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorAnnotationVerifierTest.java b/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorAnnotationVerifierTest.java index 489c00a9..a8ef5ddb 100644 --- a/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorAnnotationVerifierTest.java +++ b/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorAnnotationVerifierTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorProcessorTestBase.java b/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorProcessorTestBase.java index b03377ea..516a7eea 100644 --- a/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorProcessorTestBase.java +++ b/android/libraries/rib-compiler-app/src/test/java/com/uber/rib/compiler/InteractorProcessorTestBase.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractor.java b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractor.java index b6002b0e..17dc9191 100644 --- a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractor.java +++ b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractorNoSuffix.java b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractorNoSuffix.java index e9c6d723..64594e08 100644 --- a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractorNoSuffix.java +++ b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedInteractorNoSuffix.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedNonInteractor.java b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedNonInteractor.java index 7b7805c3..f9e17fbe 100644 --- a/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedNonInteractor.java +++ b/android/libraries/rib-compiler-app/src/test/resources/fixtures/AnnotatedNonInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-app/src/test/resources/fixtures/CustomConstructorInteractor.java b/android/libraries/rib-compiler-app/src/test/resources/fixtures/CustomConstructorInteractor.java index d641bb69..edfc7054 100644 --- a/android/libraries/rib-compiler-app/src/test/resources/fixtures/CustomConstructorInteractor.java +++ b/android/libraries/rib-compiler-app/src/test/resources/fixtures/CustomConstructorInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/build.gradle b/android/libraries/rib-compiler-test/build.gradle index 6ede7c84..45d89bb8 100644 --- a/android/libraries/rib-compiler-test/build.gradle +++ b/android/libraries/rib-compiler-test/build.gradle @@ -7,7 +7,7 @@ import org.gradle.internal.jvm.Jvm * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/Constants.java b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/Constants.java index 4219afec..41378cc5 100644 --- a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/Constants.java +++ b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/Constants.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/InteractorTestGenerator.java b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/InteractorTestGenerator.java index eda123a9..74763ce6 100644 --- a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/InteractorTestGenerator.java +++ b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/InteractorTestGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/RibTestProcessor.java b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/RibTestProcessor.java index b669594e..f80d9219 100644 --- a/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/RibTestProcessor.java +++ b/android/libraries/rib-compiler-test/src/main/java/com/uber/rib/compiler/RibTestProcessor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorProcessorTestBase.java b/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorProcessorTestBase.java index a3afd78f..beed1e54 100644 --- a/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorProcessorTestBase.java +++ b/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorProcessorTestBase.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorTest.java b/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorTest.java index 24b971fa..87e32862 100644 --- a/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorTest.java +++ b/android/libraries/rib-compiler-test/src/test/java/com/uber/rib/compiler/InteractorTestGeneratorTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-debug-utils/build.gradle b/android/libraries/rib-debug-utils/build.gradle index b64f55b5..0cdeab76 100644 --- a/android/libraries/rib-debug-utils/build.gradle +++ b/android/libraries/rib-debug-utils/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-debug-utils/src/main/java/com/uber/rib/core/RouterDebugUtils.java b/android/libraries/rib-debug-utils/src/main/java/com/uber/rib/core/RouterDebugUtils.java index 194ffdfa..84dbe0e3 100644 --- a/android/libraries/rib-debug-utils/src/main/java/com/uber/rib/core/RouterDebugUtils.java +++ b/android/libraries/rib-debug-utils/src/main/java/com/uber/rib/core/RouterDebugUtils.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -36,7 +36,7 @@ public final class RouterDebugUtils { } private static void printRouterSubtree( - final Router router, final String prefix, final boolean isTail) { + final Router router, final String prefix, final boolean isTail) { Rib.getConfiguration() .handleDebugMessage(prefix + (isTail ? ARM_RIGHT : INTERSECTION) + router.getTag()); diff --git a/android/libraries/rib-router-navigator/README.md b/android/libraries/rib-router-navigator/README.md index a48d3a2c..9544ef5d 100644 --- a/android/libraries/rib-router-navigator/README.md +++ b/android/libraries/rib-router-navigator/README.md @@ -1,4 +1,4 @@ # rib-router-navigator -A utility for handling multiple mutually exclusive child routers. These module is by no means a +A utility for handling multiple mutually exclusive child routers. These module is by no means a mandatory part of the RIB framework. diff --git a/android/libraries/rib-router-navigator/build.gradle b/android/libraries/rib-router-navigator/build.gradle index 3d4602de..9df8f80d 100644 --- a/android/libraries/rib-router-navigator/build.gradle +++ b/android/libraries/rib-router-navigator/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigator.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigator.java index bbda21d5..454c669e 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigator.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvent.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvent.java index 96c93bf9..7e68fe71 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvent.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEventType.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEventType.java index 27b72ef8..d35ce75d 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEventType.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEventType.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvents.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvents.java index d0e94c46..72639810 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvents.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorEvents.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorFactory.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorFactory.java index 4d066155..58fb9c85 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorFactory.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorFactory.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorState.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorState.java index c9c1d199..b06fc379 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorState.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/RouterNavigatorState.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/StackRouterNavigator.java b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/StackRouterNavigator.java index f1f4fd5b..15ae6980 100644 --- a/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/StackRouterNavigator.java +++ b/android/libraries/rib-router-navigator/src/main/java/com/uber/rib/core/StackRouterNavigator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-router-navigator/src/test/java/com/uber/rib/core/StackRouterNavigatorTest.java b/android/libraries/rib-router-navigator/src/test/java/com/uber/rib/core/StackRouterNavigatorTest.java index d2dfcc02..6cc4ebcb 100644 --- a/android/libraries/rib-router-navigator/src/test/java/com/uber/rib/core/StackRouterNavigatorTest.java +++ b/android/libraries/rib-router-navigator/src/test/java/com/uber/rib/core/StackRouterNavigatorTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -558,10 +558,10 @@ public class StackRouterNavigatorTest { routerNavigator.pushState(TestState.STATE_2, attachTransition2, detachTransition2); routerNavigator.pushState( - TestState.STATE_3, - StackRouterNavigator.Flag.REPLACE_TOP, - attachTransition3, - detachTransition3); + TestState.STATE_3, + StackRouterNavigator.Flag.REPLACE_TOP, + attachTransition3, + detachTransition3); assertThat(routerNavigator.peekState()).isEqualTo(TestState.STATE_3); assertThat(routerNavigator.size()).isEqualTo(2); @@ -573,10 +573,10 @@ public class StackRouterNavigatorTest { @Test public void pushReplaceTop_whenStackIsEmpty_shouldPushNewStateToTopOfStack() { routerNavigator.pushState( - TestState.STATE_1, - StackRouterNavigator.Flag.REPLACE_TOP, - attachTransition3, - detachTransition3); + TestState.STATE_1, + StackRouterNavigator.Flag.REPLACE_TOP, + attachTransition3, + detachTransition3); assertThat(routerNavigator.peekState()).isEqualTo(TestState.STATE_1); assertThat(routerNavigator.size()).isEqualTo(1); diff --git a/android/libraries/rib-router-navigator/src/test/java/os/Bundle.java b/android/libraries/rib-router-navigator/src/test/java/os/Bundle.java index 33905adf..d9980675 100644 --- a/android/libraries/rib-router-navigator/src/test/java/os/Bundle.java +++ b/android/libraries/rib-router-navigator/src/test/java/os/Bundle.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package os; import java.util.HashMap; diff --git a/android/libraries/rib-router-navigator/src/test/java/os/Parcelable.java b/android/libraries/rib-router-navigator/src/test/java/os/Parcelable.java index 605f9254..00d5c298 100644 --- a/android/libraries/rib-router-navigator/src/test/java/os/Parcelable.java +++ b/android/libraries/rib-router-navigator/src/test/java/os/Parcelable.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package os; /** Stub class to have pure Java unit tests. */ diff --git a/android/libraries/rib-screen-stack-base/README.md b/android/libraries/rib-screen-stack-base/README.md index 20c055ae..b5ac8eb7 100644 --- a/android/libraries/rib-screen-stack-base/README.md +++ b/android/libraries/rib-screen-stack-base/README.md @@ -2,7 +2,7 @@ This module defines the interface for a `ScreenStack` utility. This utility can be used when you want to push an entirely new "Screen". - + Visually, this acts similarly to pushing a new activity. However, the pushed RIB becomes a child of the existing RIB in the RIB hierarchy. As a result it can access state from its parent's DI graph. diff --git a/android/libraries/rib-screen-stack-base/build.gradle b/android/libraries/rib-screen-stack-base/build.gradle index 7742d3ef..34cf2443 100644 --- a/android/libraries/rib-screen-stack-base/build.gradle +++ b/android/libraries/rib-screen-stack-base/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ScreenStackBase.java b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ScreenStackBase.java index 307f72b0..fa6abfea 100644 --- a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ScreenStackBase.java +++ b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ScreenStackBase.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.core.screenstack; import androidx.annotation.IntRange; diff --git a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ViewProvider.java b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ViewProvider.java index 44319e11..47b5e0ee 100644 --- a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ViewProvider.java +++ b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/ViewProvider.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,17 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.core.screenstack; -import androidx.annotation.CallSuper; import android.view.View; import android.view.ViewGroup; - +import androidx.annotation.CallSuper; import com.jakewharton.rxrelay2.BehaviorRelay; import com.jakewharton.rxrelay2.Relay; import com.uber.rib.core.screenstack.lifecycle.ScreenStackEvent; - import io.reactivex.Observable; /** Interface to provide {@link View} instances to {@link ScreenStackBase}. */ diff --git a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/lifecycle/ScreenStackEvent.java b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/lifecycle/ScreenStackEvent.java index f63f3460..89250d66 100644 --- a/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/lifecycle/ScreenStackEvent.java +++ b/android/libraries/rib-screen-stack-base/src/main/java/com/uber/rib/core/screenstack/lifecycle/ScreenStackEvent.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.core.screenstack.lifecycle; import com.uber.rib.core.screenstack.ScreenStackBase; diff --git a/android/libraries/rib-test/build.gradle b/android/libraries/rib-test/build.gradle index 2cf5aa24..0921857f 100644 --- a/android/libraries/rib-test/build.gradle +++ b/android/libraries/rib-test/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/AndroidRecordingRx2Observer.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/AndroidRecordingRx2Observer.java index 27daac14..ddfda7a4 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/AndroidRecordingRx2Observer.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/AndroidRecordingRx2Observer.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeComponent.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeComponent.java index 70de1ba1..5c796e79 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeComponent.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeComponent.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeInteractor.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeInteractor.java index 19e8fe0e..da058655 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeInteractor.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakePresenter.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakePresenter.java index b81585fc..71a5fdc6 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakePresenter.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakePresenter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeRouter.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeRouter.java index 2276693d..d5c1828a 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeRouter.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/FakeRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/InteractorHelper.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/InteractorHelper.java index e574e650..fe979333 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/InteractorHelper.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/InteractorHelper.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/PresenterHelper.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/PresenterHelper.java index 00d01e12..e2525993 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/PresenterHelper.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/PresenterHelper.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/RibTestBasePlaceholder.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/RibTestBasePlaceholder.java index fd857115..828310f7 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/RibTestBasePlaceholder.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/RibTestBasePlaceholder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.core; -public class RibTestBasePlaceholder { } +public class RibTestBasePlaceholder {} diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/RouterHelper.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/RouterHelper.java index 568e141d..c2280317 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/RouterHelper.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/RouterHelper.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-test/src/main/java/com/uber/rib/core/WorkerHelper.java b/android/libraries/rib-test/src/main/java/com/uber/rib/core/WorkerHelper.java index 6c496868..8852f5f5 100644 --- a/android/libraries/rib-test/src/main/java/com/uber/rib/core/WorkerHelper.java +++ b/android/libraries/rib-test/src/main/java/com/uber/rib/core/WorkerHelper.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow-test/build.gradle b/android/libraries/rib-workflow-test/build.gradle index 377299fa..85dda6c1 100644 --- a/android/libraries/rib-workflow-test/build.gradle +++ b/android/libraries/rib-workflow-test/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow-test/src/main/java/com/uber/rib/workflow/core/StepTester.java b/android/libraries/rib-workflow-test/src/main/java/com/uber/rib/workflow/core/StepTester.java index d2385e31..e7c7a654 100644 --- a/android/libraries/rib-workflow-test/src/main/java/com/uber/rib/workflow/core/StepTester.java +++ b/android/libraries/rib-workflow-test/src/main/java/com/uber/rib/workflow/core/StepTester.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/build.gradle b/android/libraries/rib-workflow/build.gradle index 72b6581f..c987a646 100644 --- a/android/libraries/rib-workflow/build.gradle +++ b/android/libraries/rib-workflow/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/ActionableItem.java b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/ActionableItem.java index 34943bf5..b64b1474 100644 --- a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/ActionableItem.java +++ b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/ActionableItem.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Step.java b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Step.java index d151a4ed..ff5f51d9 100644 --- a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Step.java +++ b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Step.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Workflow.java b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Workflow.java index aa771920..01e4d29f 100644 --- a/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Workflow.java +++ b/android/libraries/rib-workflow/src/main/java/com/uber/rib/workflow/core/Workflow.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/AndroidSchedulersRule.java b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/AndroidSchedulersRule.java index b4b58402..d56ed95f 100644 --- a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/AndroidSchedulersRule.java +++ b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/AndroidSchedulersRule.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,22 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.workflow.core; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; - -import java.util.concurrent.Callable; +import static com.uber.rib.workflow.core.DelegatingScheduler.SchedulerType.MAIN_THREAD; import io.reactivex.Scheduler; import io.reactivex.android.plugins.RxAndroidPlugins; import io.reactivex.functions.Function; +import java.util.concurrent.Callable; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; -import static com.uber.rib.workflow.core.DelegatingScheduler.SchedulerType.MAIN_THREAD; - -/** JUnit rule to set AndroidSchedulers for tests. Inlined into this - * module to facilitate testing. */ +/** + * JUnit rule to set AndroidSchedulers for tests. Inlined into this module to facilitate testing. + */ class AndroidSchedulersRule extends TestWatcher { private DelegatingScheduler delegatingMainThreadScheduler = @@ -96,4 +94,4 @@ class AndroidSchedulersRule extends TestWatcher { public final synchronized void setMainThreadScheduler(Scheduler scheduler) { delegatingMainThreadScheduler.setActiveScheduler(scheduler); } -} \ No newline at end of file +} diff --git a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/DelegatingScheduler.java b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/DelegatingScheduler.java index 9efc240a..5aed7e40 100644 --- a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/DelegatingScheduler.java +++ b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/DelegatingScheduler.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,19 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.workflow.core; +import static androidx.annotation.RestrictTo.Scope.GROUP_ID; + import androidx.annotation.RestrictTo; import androidx.annotation.VisibleForTesting; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - import io.reactivex.Scheduler; import io.reactivex.schedulers.Schedulers; - -import static androidx.annotation.RestrictTo.Scope.GROUP_ID; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; @RestrictTo(GROUP_ID) class DelegatingScheduler extends Scheduler { diff --git a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/StepTest.java b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/StepTest.java index c7ddc26f..903378b8 100644 --- a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/StepTest.java +++ b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/StepTest.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/WorkflowTest.java b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/WorkflowTest.java index c73066c0..e4cae31d 100644 --- a/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/WorkflowTest.java +++ b/android/libraries/rib-workflow/src/test/java/com/uber/rib/workflow/core/WorkflowTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -46,7 +46,7 @@ public class WorkflowTest { @After public void cleanup() { - RxAndroidPlugins.reset(); + RxAndroidPlugins.reset(); } @Test diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateAction.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateAction.java index b87ef0da..027e05a6 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateAction.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateAction.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -46,17 +46,12 @@ import com.intellij.psi.PsiPackage; import com.intellij.refactoring.PackageWrapper; import com.intellij.refactoring.util.RefactoringUtil; import com.uber.presidio.intellij_plugin.generator.Generator; - +import java.util.List; +import javax.swing.JOptionPane; import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes; import org.jetbrains.jps.model.java.JavaSourceRootType; -import java.util.List; - -import javax.swing.JOptionPane; - -/** - * Base action to generate Java source and test source files with {@link Generator}. - */ +/** Base action to generate Java source and test source files with {@link Generator}. */ public abstract class GenerateAction extends AnAction { private DataContext dataContext; @@ -81,7 +76,7 @@ public abstract class GenerateAction extends AnAction { /** * Writes a source file generated by a {@link Generator} to disk. * - * @param project to write file in. + * @param project to write file in. * @param generator to generate file with. * @param directory to write file to. */ @@ -114,9 +109,7 @@ public abstract class GenerateAction extends AnAction { */ protected void generate( final List mainSourceGenerators, final List testSourceGenerators) { - /** - * Preconditions have been validated by {@link GenerateRibAction#isAvailable(DataContext)}. - */ + /** Preconditions have been validated by {@link GenerateRibAction#isAvailable(DataContext)}. */ final Project project = Preconditions.checkNotNull(CommonDataKeys.PROJECT.getData(dataContext)); final IdeView view = Preconditions.checkNotNull(LangDataKeys.IDE_VIEW.getData(dataContext)); final PsiDirectory directory = Preconditions.checkNotNull(view.getOrChooseDirectory()); @@ -161,9 +154,7 @@ public abstract class GenerateAction extends AnAction { }); } - /** - * @return gets the current package name for an executing action. - */ + /** @return gets the current package name for an executing action. */ protected final String getPackageName() { /** Preconditions have been validated by {@link GenerateAction#isAvailable(DataContext)}. */ final Project project = Preconditions.checkNotNull(CommonDataKeys.PROJECT.getData(dataContext)); @@ -177,12 +168,14 @@ public abstract class GenerateAction extends AnAction { /** * Checked whether or not this action can be enabled. + * *

+ * *

Requirements to be enabled: * User must be in a Java source folder. * * @param dataContext to figure out where the user is. * @return {@code true} when the action is available, {@code false} when the action is not - * available. + * available. */ private boolean isAvailable(DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); @@ -198,7 +191,7 @@ public abstract class GenerateAction extends AnAction { ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); for (PsiDirectory dir : view.getDirectories()) { if (projectFileIndex.isUnderSourceRootOfType( - dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) + dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) && checkPackageExists(dir)) { return true; } diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibAction.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibAction.java index 197488ca..126d05bc 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibAction.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibAction.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -19,8 +19,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.uber.presidio.intellij_plugin.generator.GeneratorPair; /** - * This action will ask generate files required for a new Rib based on a name provided by the - * user. + * This action will ask generate files required for a new Rib based on a name provided by the user. */ public class GenerateRibAction extends GenerateAction implements GenerateRibDialog.Listener { @@ -31,12 +30,14 @@ public class GenerateRibAction extends GenerateAction implements GenerateRibDial } @Override - public void onGenerateClicked(String ribName, boolean createPresenterAndView, boolean isKotlinSelected) { + public void onGenerateClicked( + String ribName, boolean createPresenterAndView, boolean isKotlinSelected) { final GeneratorPair generators = - createPresenterAndView - ? Generators.getGeneratorsForRibWithPresenterAndView(getPackageName(), ribName, isKotlinSelected) - : Generators.getGeneratorsForRibWithoutPresenterAndView( - getPackageName(), ribName, isKotlinSelected); + createPresenterAndView + ? Generators.getGeneratorsForRibWithPresenterAndView( + getPackageName(), ribName, isKotlinSelected) + : Generators.getGeneratorsForRibWithoutPresenterAndView( + getPackageName(), ribName, isKotlinSelected); generate(generators.getMainSourceSetGenerators(), generators.getTestSourceSetGenerators()); } -} \ No newline at end of file +} diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibDialog.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibDialog.java index cecc48e2..8fdff76e 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibDialog.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/GenerateRibDialog.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -16,17 +16,13 @@ package com.uber.presidio.intellij_plugin.action.rib; import com.intellij.openapi.ui.DialogWrapper; - -import org.jetbrains.annotations.Nullable; - import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextField; +import org.jetbrains.annotations.Nullable; -/** - * Dialog that prompts the user for information required to generate a new rib. - */ +/** Dialog that prompts the user for information required to generate a new rib. */ public class GenerateRibDialog extends DialogWrapper { private final Listener listener; @@ -60,18 +56,17 @@ public class GenerateRibDialog extends DialogWrapper { createKotlinCode.isSelected()); } - /** - * Listener interface to be implemented by consumers of the dialog. - */ + /** Listener interface to be implemented by consumers of the dialog. */ public interface Listener { /** * Called when the user clicks OK on the generate dialog. * - * @param ribName name for new rib. + * @param ribName name for new rib. * @param createPresenterAndView {@code true} when a presenter and a corresponding view should - * be created, {@code false} otherwise. + * be created, {@code false} otherwise. */ - void onGenerateClicked(String ribName, boolean createPresenterAndView, boolean isKotlinSelected); + void onGenerateClicked( + String ribName, boolean createPresenterAndView, boolean isKotlinSelected); } } diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/Generators.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/Generators.java index 14a92fc9..c2106052 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/Generators.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/action/rib/Generators.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -29,17 +29,14 @@ import com.uber.presidio.intellij_plugin.generator.rib.ViewGenerator; import com.uber.presidio.intellij_plugin.generator.rib.ViewRouterGenerator; import com.uber.presidio.intellij_plugin.generator.rib.ViewRouterTestGenerator; -/** - * Utility methods for getting lists of generators in different configurations. - */ +/** Utility methods for getting lists of generators in different configurations. */ public final class Generators { - private Generators() { - } + private Generators() {} /** * @param packageName to use for generators. - * @param ribName to use for generators. + * @param ribName to use for generators. * @return a list of generators to use when generating a rib with a presenter and view. */ public static GeneratorPair getGeneratorsForRibWithPresenterAndView( @@ -47,9 +44,11 @@ public final class Generators { InteractorWithPresenterGenerator interactorGenerator = new InteractorWithPresenterGenerator(packageName, ribName, isKotlinSelected); - ViewBuilderGenerator viewBuilderGenerator = new ViewBuilderGenerator(packageName, ribName, isKotlinSelected); + ViewBuilderGenerator viewBuilderGenerator = + new ViewBuilderGenerator(packageName, ribName, isKotlinSelected); ViewGenerator viewGenerator = new ViewGenerator(packageName, ribName, isKotlinSelected); - ViewRouterGenerator viewRouterGenerator = new ViewRouterGenerator(packageName, ribName, isKotlinSelected); + ViewRouterGenerator viewRouterGenerator = + new ViewRouterGenerator(packageName, ribName, isKotlinSelected); InteractorWithPresenterTestGenerator interactorWithPresenterTestGenerator = new InteractorWithPresenterTestGenerator(packageName, ribName, isKotlinSelected); @@ -58,28 +57,27 @@ public final class Generators { return new GeneratorPair( ImmutableList.of( - interactorGenerator, - viewBuilderGenerator, - viewGenerator, - viewRouterGenerator), + interactorGenerator, viewBuilderGenerator, viewGenerator, viewRouterGenerator), ImmutableList.of(interactorWithPresenterTestGenerator, viewRouterTestGenerator)); } /** * @param packageName to use for generators. - * @param ribName to use for generators. + * @param ribName to use for generators. * @return a list of generators to use when generating a rib without a presenter and view. */ public static GeneratorPair getGeneratorsForRibWithoutPresenterAndView( String packageName, String ribName, boolean isKotlinSelected) { InteractorWithEmptyPresenterGenerator interactorGenerator = new InteractorWithEmptyPresenterGenerator(packageName, ribName, isKotlinSelected); - BuilderGenerator builderGenerator = new BuilderGenerator(packageName, ribName, isKotlinSelected); + BuilderGenerator builderGenerator = + new BuilderGenerator(packageName, ribName, isKotlinSelected); RouterGenerator routerGenerator = new RouterGenerator(packageName, ribName, isKotlinSelected); InteractorWithEmptyPresenterTestGenerator interactorWithEmptyPresenterTestGenerator = new InteractorWithEmptyPresenterTestGenerator(packageName, ribName, isKotlinSelected); - RouterTestGenerator routerTestGenerator = new RouterTestGenerator(packageName, ribName, isKotlinSelected); + RouterTestGenerator routerTestGenerator = + new RouterTestGenerator(packageName, ribName, isKotlinSelected); return new GeneratorPair( ImmutableList.of(interactorGenerator, builderGenerator, routerGenerator), diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/Generator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/Generator.java index 4c65a712..1f8dd026 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/Generator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/Generator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -18,9 +18,6 @@ package com.uber.presidio.intellij_plugin.generator; import com.google.common.base.Charsets; import com.google.common.base.Preconditions; import com.google.common.io.CharStreams; - -import org.apache.commons.lang.text.StrSubstitutor; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -35,10 +32,13 @@ import java.util.Map; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import org.apache.commons.lang.text.StrSubstitutor; /** * Base class for generating rib classes. + * *

+ * *

Templates are tokenized using a ${token_name} syntax. {@code package_name} and {@code * rib_name} token values are provided by the base generate - however subclasses can add custom * paramaters when needed using {@link Generator#getTemplateValuesMap()}. @@ -56,8 +56,8 @@ public abstract class Generator { private final Map templateValuesMap; /** - * @param packageName rib package name. - * @param ribName rib name. + * @param packageName rib package name. + * @param ribName rib name. * @param templateName template to be used by this generate. */ public Generator(String packageName, String ribName, boolean isKotlin, String templateName) { @@ -98,8 +98,7 @@ public abstract class Generator { resource = "/templates/kotlin/" + templateName + ".kt.template"; } - InputStream resourceAsStream1 = - Generator.class.getResourceAsStream(resource); + InputStream resourceAsStream1 = Generator.class.getResourceAsStream(resource); templateString = Preconditions.checkNotNull( CharStreams.toString(new InputStreamReader(resourceAsStream1, Charsets.UTF_8))); @@ -108,21 +107,15 @@ public abstract class Generator { } } - /** - * @return the class name for the generated file. - */ + /** @return the class name for the generated file. */ public abstract String getClassName(); - /** - * @return the package name for the generated file. - */ + /** @return the package name for the generated file. */ public final String getPackageName() { return packageName; } - /** - * @return the rib name for the generator. - */ + /** @return the rib name for the generator. */ public final String getRibName() { return ribName; } @@ -136,16 +129,12 @@ public abstract class Generator { return ".java"; } - /** - * @return the template values map, to add more template paramters. - */ + /** @return the template values map, to add more template paramters. */ protected final Map getTemplateValuesMap() { return templateValuesMap; } - /** - * @return the source for the generated file. - */ + /** @return the source for the generated file. */ public final String generate() { StrSubstitutor substitutor = new StrSubstitutor(templateValuesMap); String newFile = substitutor.replace(templateString); @@ -159,7 +148,7 @@ public abstract class Generator { * http://stackoverflow.com/questions/6247144/how-to-load-a-folder-from-a-jar. * * @param clazz Any java class that lives in the same place as the resources you want. - * @param path Should end with "/", but not start with one. + * @param path Should end with "/", but not start with one. * @return Just the name of each member item, not the full paths. * @throws URISyntaxException * @throws IOException diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/GeneratorPair.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/GeneratorPair.java index d3e88aa6..e5721fbb 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/GeneratorPair.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/GeneratorPair.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/BuilderGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/BuilderGenerator.java index 1054fa04..56c27ec3 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/BuilderGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/BuilderGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterGenerator.java index a71221fe..b8c230a3 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -21,7 +21,8 @@ public class InteractorWithEmptyPresenterGenerator extends Generator { private static final String TEMPLATE_NAME = "RibInteractorWithEmptyPresenter"; - public InteractorWithEmptyPresenterGenerator(String packageName, String ribName, boolean isKotlinSelected) { + public InteractorWithEmptyPresenterGenerator( + String packageName, String ribName, boolean isKotlinSelected) { super(packageName, ribName, isKotlinSelected, TEMPLATE_NAME); } diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterTestGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterTestGenerator.java index 4f2f9d1c..c235e5f1 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterTestGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithEmptyPresenterTestGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.presidio.intellij_plugin.generator.rib; +package com.uber.presidio.intellij_plugin.generator.rib; import com.uber.presidio.intellij_plugin.generator.Generator; public class InteractorWithEmptyPresenterTestGenerator extends Generator { - private static final String TEMPLATE_NAME = - "RibInteractorWithEmptyPresenterTest"; + private static final String TEMPLATE_NAME = "RibInteractorWithEmptyPresenterTest"; - public InteractorWithEmptyPresenterTestGenerator(String packageName, String ribName, boolean isKotlinSelected) { + public InteractorWithEmptyPresenterTestGenerator( + String packageName, String ribName, boolean isKotlinSelected) { super(packageName, ribName, isKotlinSelected, TEMPLATE_NAME); } diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterGenerator.java index abc41c4d..06203ee6 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.presidio.intellij_plugin.generator.rib; +package com.uber.presidio.intellij_plugin.generator.rib; import com.uber.presidio.intellij_plugin.generator.Generator; @@ -21,10 +21,10 @@ public class InteractorWithPresenterGenerator extends Generator { private static final String TEMPLATE_NAME = "RibInteractorWithPresenter"; - public InteractorWithPresenterGenerator(String packageName, String ribName, boolean isKotlinSelected) { + public InteractorWithPresenterGenerator( + String packageName, String ribName, boolean isKotlinSelected) { super(packageName, ribName, isKotlinSelected, TEMPLATE_NAME); - } @Override diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterTestGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterTestGenerator.java index 9ad330cd..7f426c80 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterTestGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/InteractorWithPresenterTestGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -21,7 +21,8 @@ public class InteractorWithPresenterTestGenerator extends Generator { private static final String TEMPLATE_NAME = "RibInteractorWithPresenterTest"; - public InteractorWithPresenterTestGenerator(String packageName, String ribName, boolean isKotlinSelected) { + public InteractorWithPresenterTestGenerator( + String packageName, String ribName, boolean isKotlinSelected) { super(packageName, ribName, isKotlinSelected, TEMPLATE_NAME); } diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterGenerator.java index 7e7a6226..a59ffc02 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterTestGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterTestGenerator.java index 54028d01..9ca1724e 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterTestGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/RouterTestGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewBuilderGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewBuilderGenerator.java index d02458d0..9321e63f 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewBuilderGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewBuilderGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewGenerator.java index 2c98d94f..91b2d438 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -17,9 +17,7 @@ package com.uber.presidio.intellij_plugin.generator.rib; import com.uber.presidio.intellij_plugin.generator.Generator; -/** - * Generate subclass that uses a view template. - */ +/** Generate subclass that uses a view template. */ public class ViewGenerator extends Generator { private static final String TEMPLATE_NAME = "RibView"; diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterGenerator.java index 0e13208f..04dd628d 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterTestGenerator.java b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterTestGenerator.java index 936a1539..2d455ada 100755 --- a/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterTestGenerator.java +++ b/android/tooling/rib-intellij-plugin/src/main/java/com/uber/presidio/intellij_plugin/generator/rib/ViewRouterTestGenerator.java @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tooling/rib-intellij-plugin/src/test/java/com/uber/presidio/intellij_plugin/action/rib/RibGeneratorsTest.java b/android/tooling/rib-intellij-plugin/src/test/java/com/uber/presidio/intellij_plugin/action/rib/RibGeneratorsTest.java index f62c40db..6a9a35f5 100644 --- a/android/tooling/rib-intellij-plugin/src/test/java/com/uber/presidio/intellij_plugin/action/rib/RibGeneratorsTest.java +++ b/android/tooling/rib-intellij-plugin/src/test/java/com/uber/presidio/intellij_plugin/action/rib/RibGeneratorsTest.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,27 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.presidio.intellij_plugin.action.rib; +package com.uber.presidio.intellij_plugin.action.rib; + +import static com.google.common.truth.Truth.assert_; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; import androidx.annotation.NonNull; - import com.google.testing.compile.JavaFileObjects; import com.uber.presidio.intellij_plugin.generator.Generator; import com.uber.presidio.intellij_plugin.generator.GeneratorPair; import com.uber.rib.compiler.RibTestProcessor; - -import org.junit.Ignore; -import org.junit.Test; - +import dagger.internal.codegen.ComponentProcessor; import java.util.ArrayList; import java.util.List; - import javax.tools.JavaFileObject; - -import dagger.internal.codegen.ComponentProcessor; - -import static com.google.common.truth.Truth.assert_; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import org.junit.Ignore; +import org.junit.Test; public class RibGeneratorsTest { @@ -42,14 +37,19 @@ public class RibGeneratorsTest { @Test public void ribGenerators_shouldGenerateClassesThatCompiler() { - testWithGenerators(Generators.getGeneratorsForRibWithoutPresenterAndView(TEST_PACKAGE_NAME, TEST_RIBLET_NAME, false)); + testWithGenerators( + Generators.getGeneratorsForRibWithoutPresenterAndView( + TEST_PACKAGE_NAME, TEST_RIBLET_NAME, false)); } @Test - @Ignore("This test only passes when using buck+okbuck. Gradle is unable to import the rib-android aar as a test " - + "dependency for this java module.") + @Ignore( + "This test only passes when using buck+okbuck. Gradle is unable to import the rib-android aar as a test " + + "dependency for this java module.") public void viewRibGenerators_shouldGenerateClassesThatCompile() { - testWithGenerators(Generators.getGeneratorsForRibWithPresenterAndView(TEST_PACKAGE_NAME, TEST_RIBLET_NAME, false)); + testWithGenerators( + Generators.getGeneratorsForRibWithPresenterAndView( + TEST_PACKAGE_NAME, TEST_RIBLET_NAME, false)); } private static void testWithGenerators(@NonNull GeneratorPair generators) { @@ -59,19 +59,19 @@ public class RibGeneratorsTest { generateSourceFiles(javaFileObjects, generators.getTestSourceSetGenerators()); assert_() - .about(javaSources()) - .that(javaFileObjects) - .processedWith(new ComponentProcessor(), new RibTestProcessor()) - .compilesWithoutError(); + .about(javaSources()) + .that(javaFileObjects) + .processedWith(new ComponentProcessor(), new RibTestProcessor()) + .compilesWithoutError(); } private static void generateSourceFiles( - List javaFileObjects, List generators) { + List javaFileObjects, List generators) { for (Generator generator : generators) { javaFileObjects.add( - JavaFileObjects.forSourceString( - String.format("%s.%s", generator.getPackageName(), generator.getClassName()), - generator.generate())); + JavaFileObjects.forSourceString( + String.format("%s.%s", generator.getPackageName(), generator.getClassName()), + generator.generate())); } } } diff --git a/android/tutorials/tutorial1/build.gradle b/android/tutorials/tutorial1/build.gradle index 854e3bcb..8e3ca46b 100644 --- a/android/tutorials/tutorial1/build.gradle +++ b/android/tutorials/tutorial1/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, @@ -64,4 +64,3 @@ dependencies { errorprone deps.build.errorProne errorprone deps.build.guavaJre } - diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/RootActivity.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/RootActivity.java index 36ad64d5..17fd2e35 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/RootActivity.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.view.ViewGroup; @@ -21,16 +20,13 @@ import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; -/** - * The sample app's single activity. - */ +/** The sample app's single activity. */ public class RootActivity extends RibActivity { @SuppressWarnings("unchecked") @Override protected ViewRouter createRouter(ViewGroup parentViewGroup) { - RootBuilder rootBuilder = new RootBuilder(new RootBuilder.ParentComponent() { - }); + RootBuilder rootBuilder = new RootBuilder(new RootBuilder.ParentComponent() {}); return rootBuilder.build(parentViewGroup); } } diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/SampleApplication.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/SampleApplication.java index 623429fa..9e89db77 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootBuilder.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootBuilder.java index 122ace3e..4dfe801b 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,25 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; +import static java.lang.annotation.RetentionPolicy.CLASS; + import android.view.LayoutInflater; import android.view.ViewGroup; - import com.uber.rib.core.InteractorBaseComponent; import com.uber.rib.core.ViewBuilder; import com.uber.rib.tutorial1.R; - -import java.lang.annotation.Retention; - -import javax.inject.Scope; - import dagger.Binds; import dagger.BindsInstance; import dagger.Provides; - -import static java.lang.annotation.RetentionPolicy.CLASS; +import java.lang.annotation.Retention; +import javax.inject.Scope; /** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { @@ -49,7 +44,8 @@ public class RootBuilder extends ViewBuilder, BuilderComponent { @dagger.Component.Builder diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootInteractor.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootInteractor.java index ad548ace..69bb5458 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootInteractor.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import androidx.annotation.Nullable; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; - import javax.inject.Inject; /** Coordinates Business Logic for {@link RootBuilder.RootScope}. */ diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootRouter.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootRouter.java index 6042e63d..57ffbb55 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootRouter.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import com.uber.rib.core.ViewRouter; diff --git a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootView.java b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootView.java +++ b/android/tutorials/tutorial1/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootInteractorTest.java b/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootInteractorTest.java index 65bc87c3..6626f0ca 100644 --- a/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootInteractorTest.java +++ b/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootInteractorTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import org.junit.Before; diff --git a/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootRouterTest.java b/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootRouterTest.java index 2ca0b677..e5839507 100644 --- a/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootRouterTest.java +++ b/android/tutorials/tutorial1/src/test/java/com/uber/rib/root/RootRouterTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import org.junit.Before; diff --git a/android/tutorials/tutorial2/build.gradle b/android/tutorials/tutorial2/build.gradle index edf073ff..a001d264 100644 --- a/android/tutorials/tutorial2/build.gradle +++ b/android/tutorials/tutorial2/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/RootActivity.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/RootActivity.java index df8729c2..17fd2e35 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/RootActivity.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.view.ViewGroup; - import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/SampleApplication.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/SampleApplication.java index 623429fa..9e89db77 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootBuilder.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootBuilder.java index 678d56d8..d6d7d6e6 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,26 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; +import static java.lang.annotation.RetentionPolicy.CLASS; + import android.view.LayoutInflater; import android.view.ViewGroup; - import com.uber.rib.core.InteractorBaseComponent; import com.uber.rib.core.ViewBuilder; -import com.uber.rib.tutorial1.R; import com.uber.rib.root.logged_out.LoggedOutBuilder; - -import java.lang.annotation.Retention; - -import javax.inject.Scope; - +import com.uber.rib.tutorial1.R; import dagger.Binds; import dagger.BindsInstance; import dagger.Provides; - -import static java.lang.annotation.RetentionPolicy.CLASS; +import java.lang.annotation.Retention; +import javax.inject.Scope; /** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { @@ -50,7 +45,8 @@ public class RootBuilder extends ViewBuilder, - LoggedOutBuilder.ParentComponent, - BuilderComponent { + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component + extends InteractorBaseComponent, + LoggedOutBuilder.ParentComponent, + BuilderComponent { @dagger.Component.Builder interface Builder { diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootInteractor.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootInteractor.java index f0f58be5..55445eb6 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootInteractor.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import androidx.annotation.Nullable; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; - import javax.inject.Inject; /** Coordinates Business Logic for {@link RootBuilder.RootScope}. */ diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootRouter.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootRouter.java index adf9e689..fc1a4992 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootRouter.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import androidx.annotation.Nullable; - import com.uber.rib.core.ViewRouter; import com.uber.rib.root.logged_out.LoggedOutBuilder; import com.uber.rib.root.logged_out.LoggedOutRouter; @@ -44,11 +42,7 @@ public class RootRouter extends ViewRouter { getView().addView(loggedOutRouter.getView()); } - public void attachLoggedIn() { + public void attachLoggedIn() {} - } - - public void detachLoggedOut() { - - } + public void detachLoggedOut() {} } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootView.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootView.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java index e02afa7b..a7dc157c 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,30 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; -import android.view.LayoutInflater; -import android.view.ViewGroup; - -import com.uber.rib.core.InteractorBaseComponent; -import com.uber.rib.core.ViewBuilder; -import com.uber.rib.tutorial1.R; - -import java.lang.annotation.Retention; - -import javax.inject.Qualifier; -import javax.inject.Scope; - -import dagger.Binds; -import dagger.BindsInstance; -import dagger.Provides; - import static java.lang.annotation.RetentionPolicy.CLASS; -/** - * Builder for the {@link OffGameScope}. - */ +import android.view.LayoutInflater; +import android.view.ViewGroup; +import com.uber.rib.core.InteractorBaseComponent; +import com.uber.rib.core.ViewBuilder; +import com.uber.rib.tutorial1.R; +import dagger.Binds; +import dagger.BindsInstance; +import dagger.Provides; +import java.lang.annotation.Retention; +import javax.inject.Qualifier; +import javax.inject.Scope; + +/** Builder for the {@link OffGameScope}. */ public class OffGameBuilder extends ViewBuilder { @@ -53,11 +46,12 @@ public class OffGameBuilder public OffGameRouter build(ViewGroup parentViewGroup) { OffGameView view = createView(parentViewGroup); OffGameInteractor interactor = new OffGameInteractor(); - Component component = DaggerOffGameBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerOffGameBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.offgameRouter(); } @@ -81,16 +75,13 @@ public class OffGameBuilder @OffGameScope @Provides static OffGameRouter router( - Component component, - OffGameView view, - OffGameInteractor interactor) { + Component component, OffGameView view, OffGameInteractor interactor) { return new OffGameRouter(view, interactor, component); } } @OffGameScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -115,13 +106,9 @@ public class OffGameBuilder @Scope @Retention(CLASS) - @interface OffGameScope { - - } + @interface OffGameScope {} @Qualifier @Retention(CLASS) - @interface OffGameInternal { - - } + @interface OffGameInternal {} } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java index cd837ff2..f31232f6 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,23 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import androidx.annotation.Nullable; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; - -import javax.inject.Inject; - import io.reactivex.Observable; import io.reactivex.functions.Consumer; +import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link OffGameScope}. - */ +/** Coordinates Business Logic for {@link OffGameScope}. */ @RibInteractor public class OffGameInteractor extends Interactor { @@ -43,12 +37,13 @@ public class OffGameInteractor presenter .startGameRequest() - .subscribe(new Consumer() { - @Override - public void accept(Object object) throws Exception { - listener.onStartGame(); - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(Object object) throws Exception { + listener.onStartGame(); + } + }); } public interface Listener { @@ -56,9 +51,7 @@ public class OffGameInteractor void onStartGame(); } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface OffGamePresenter { Observable startGameRequest(); diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java index 7e8f11fd..d16eab12 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link OffGameBuilder.OffGameScope}. - */ -public class OffGameRouter extends - ViewRouter { +/** Adds and removes children of {@link OffGameBuilder.OffGameScope}. */ +public class OffGameRouter extends ViewRouter { public OffGameRouter( - OffGameView view, - OffGameInteractor interactor, - OffGameBuilder.Component component) { + OffGameView view, OffGameInteractor interactor, OffGameBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java index e6e51b10..104cdb26 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,24 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.Button; import android.widget.LinearLayout; - +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; - import io.reactivex.Observable; -/** - * Top level view for {@link OffGameBuilder.OffGameScope}. - */ +/** Top level view for {@link OffGameBuilder.OffGameScope}. */ public class OffGameView extends LinearLayout implements OffGameInteractor.OffGamePresenter { private Button button; diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java index adbcc206..ecdb8ec5 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import javax.inject.Inject; @@ -37,9 +36,7 @@ class Board { } } - /** - * Return true if it is a draw (i.e., no more EMPTY cell) - */ + /** Return true if it is a draw (i.e., no more EMPTY cell) */ boolean isDraw() { for (int row = 0; row < ROWS; ++row) { for (int col = 0; col < COLS; ++col) { @@ -51,24 +48,22 @@ class Board { return !hasWon(MarkerType.CROSS) && !hasWon(MarkerType.NOUGHT); } - /** - * Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) - */ + /** Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) */ boolean hasWon(MarkerType theSeed) { return ((cells[currentRow][0] == theSeed - && cells[currentRow][1] == theSeed - && cells[currentRow][2] == theSeed) + && cells[currentRow][1] == theSeed + && cells[currentRow][2] == theSeed) || (cells[0][currentCol] == theSeed - && cells[1][currentCol] == theSeed - && cells[2][currentCol] == theSeed) + && cells[1][currentCol] == theSeed + && cells[2][currentCol] == theSeed) || (currentRow == currentCol - && cells[0][0] == theSeed - && cells[1][1] == theSeed - && cells[2][2] == theSeed) + && cells[0][0] == theSeed + && cells[1][1] == theSeed + && cells[2][2] == theSeed) || (currentRow + currentCol == 2 - && cells[0][2] == theSeed - && cells[1][1] == theSeed - && cells[2][0] == theSeed)); + && cells[0][2] == theSeed + && cells[1][1] == theSeed + && cells[2][0] == theSeed)); } enum MarkerType { diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java index dd886bb0..fea509d4 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; class BoardCoordinate { diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java index 19a33eec..3867d895 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,30 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; -import android.view.LayoutInflater; -import android.view.ViewGroup; - -import com.uber.rib.core.InteractorBaseComponent; -import com.uber.rib.core.ViewBuilder; -import com.uber.rib.tutorial1.R; - -import java.lang.annotation.Retention; - -import javax.inject.Qualifier; -import javax.inject.Scope; - -import dagger.Binds; -import dagger.BindsInstance; -import dagger.Provides; - import static java.lang.annotation.RetentionPolicy.CLASS; -/** - * Builder for the {@link TicTacToeScope}. - */ +import android.view.LayoutInflater; +import android.view.ViewGroup; +import com.uber.rib.core.InteractorBaseComponent; +import com.uber.rib.core.ViewBuilder; +import com.uber.rib.tutorial1.R; +import dagger.Binds; +import dagger.BindsInstance; +import dagger.Provides; +import java.lang.annotation.Retention; +import javax.inject.Qualifier; +import javax.inject.Scope; + +/** Builder for the {@link TicTacToeScope}. */ public class TicTacToeBuilder extends ViewBuilder { @@ -53,11 +46,12 @@ public class TicTacToeBuilder public TicTacToeRouter build(ViewGroup parentViewGroup) { TicTacToeView view = createView(parentViewGroup); TicTacToeInteractor interactor = new TicTacToeInteractor(); - Component component = DaggerTicTacToeBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerTicTacToeBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.tictactoeRouter(); } @@ -80,16 +74,13 @@ public class TicTacToeBuilder @TicTacToeScope @Provides static TicTacToeRouter router( - Component component, - TicTacToeView view, - TicTacToeInteractor interactor) { + Component component, TicTacToeView view, TicTacToeInteractor interactor) { return new TicTacToeRouter(view, interactor, component); } } @TicTacToeScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -114,13 +105,9 @@ public class TicTacToeBuilder @Scope @Retention(CLASS) - @interface TicTacToeScope { - - } + @interface TicTacToeScope {} @Qualifier @Retention(CLASS) - @interface TicTacToeInternal { - - } + @interface TicTacToeInternal {} } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java index 7a5ed509..ec59842d 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,27 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import androidx.annotation.Nullable; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; import com.uber.rib.root.logged_in.tic_tac_toe.Board.MarkerType; - -import javax.inject.Inject; - import io.reactivex.Observable; import io.reactivex.functions.Consumer; +import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link TicTacToeScope}. - */ +/** Coordinates Business Logic for {@link TicTacToeScope}. */ @RibInteractor public class TicTacToeInteractor - extends Interactor { + extends Interactor { @Inject Board board; @Inject TicTacToePresenter presenter; @@ -48,37 +42,37 @@ public class TicTacToeInteractor super.didBecomeActive(savedInstanceState); presenter - .squareClicks() - .subscribe( - new Consumer() { - @Override - public void accept(BoardCoordinate xy) throws Exception { - if (board.cells[xy.getX()][xy.getY()] == null) { - if (currentPlayer == MarkerType.CROSS) { - board.cells[xy.getX()][xy.getY()] = MarkerType.CROSS; - board.currentRow = xy.getX(); - board.currentCol = xy.getY(); - presenter.addCross(xy); - currentPlayer = MarkerType.NOUGHT; - } else { - board.cells[xy.getX()][xy.getY()] = MarkerType.NOUGHT; - board.currentRow = xy.getX(); - board.currentCol = xy.getY(); - presenter.addNought(xy); - currentPlayer = MarkerType.CROSS; - } - } - if (board.hasWon(MarkerType.CROSS)) { - presenter.setPlayerWon(playerOne); - } else if (board.hasWon(MarkerType.NOUGHT)) { - presenter.setPlayerWon(playerTwo); - } else if (board.isDraw()) { - presenter.setPlayerTie(); - } else { - updateCurrentPlayer(); - } - } - }); + .squareClicks() + .subscribe( + new Consumer() { + @Override + public void accept(BoardCoordinate xy) throws Exception { + if (board.cells[xy.getX()][xy.getY()] == null) { + if (currentPlayer == MarkerType.CROSS) { + board.cells[xy.getX()][xy.getY()] = MarkerType.CROSS; + board.currentRow = xy.getX(); + board.currentCol = xy.getY(); + presenter.addCross(xy); + currentPlayer = MarkerType.NOUGHT; + } else { + board.cells[xy.getX()][xy.getY()] = MarkerType.NOUGHT; + board.currentRow = xy.getX(); + board.currentCol = xy.getY(); + presenter.addNought(xy); + currentPlayer = MarkerType.CROSS; + } + } + if (board.hasWon(MarkerType.CROSS)) { + presenter.setPlayerWon(playerOne); + } else if (board.hasWon(MarkerType.NOUGHT)) { + presenter.setPlayerWon(playerTwo); + } else if (board.isDraw()) { + presenter.setPlayerTie(); + } else { + updateCurrentPlayer(); + } + } + }); updateCurrentPlayer(); } @@ -90,10 +84,7 @@ public class TicTacToeInteractor } } - - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface TicTacToePresenter { Observable squareClicks(); @@ -108,7 +99,5 @@ public class TicTacToeInteractor void addNought(BoardCoordinate xy); } - public interface Listener { - - } + public interface Listener {} } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java index d138fa43..51095cac 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeRouter extends - ViewRouter { +/** Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeRouter extends ViewRouter { public TicTacToeRouter( - TicTacToeView view, - TicTacToeInteractor interactor, - TicTacToeBuilder.Component component) { + TicTacToeView view, TicTacToeInteractor interactor, TicTacToeBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java index 85b6c9c1..91ca7347 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,29 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import android.content.Context; -import androidx.annotation.Nullable; -import androidx.percentlayout.widget.PercentRelativeLayout; import android.util.AttributeSet; import android.widget.TextView; - +import androidx.annotation.Nullable; +import androidx.percentlayout.widget.PercentRelativeLayout; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; - -import java.util.ArrayList; - import io.reactivex.Observable; import io.reactivex.functions.Function; +import java.util.ArrayList; -/** - * Top level view for {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeView extends PercentRelativeLayout implements - TicTacToeInteractor.TicTacToePresenter { +/** Top level view for {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeView extends PercentRelativeLayout + implements TicTacToeInteractor.TicTacToePresenter { private TextView[][] imageButtons; private TextView titleView; @@ -58,22 +52,22 @@ public class TicTacToeView extends PercentRelativeLayout implements super.onFinishInflate(); imageButtons = new TextView[3][]; imageButtons[0] = - new TextView[]{ - (TextView) findViewById(R.id.button11), - (TextView) findViewById(R.id.button12), - (TextView) findViewById(R.id.button13) + new TextView[] { + (TextView) findViewById(R.id.button11), + (TextView) findViewById(R.id.button12), + (TextView) findViewById(R.id.button13) }; imageButtons[1] = - new TextView[]{ - (TextView) findViewById(R.id.button21), - (TextView) findViewById(R.id.button22), - (TextView) findViewById(R.id.button23) + new TextView[] { + (TextView) findViewById(R.id.button21), + (TextView) findViewById(R.id.button22), + (TextView) findViewById(R.id.button23) }; imageButtons[2] = - new TextView[]{ - (TextView) findViewById(R.id.button31), - (TextView) findViewById(R.id.button32), - (TextView) findViewById(R.id.button33) + new TextView[] { + (TextView) findViewById(R.id.button31), + (TextView) findViewById(R.id.button32), + (TextView) findViewById(R.id.button33) }; titleView = (TextView) findViewById(R.id.title); } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java index 8922fc32..215fd51e 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java @@ -1,103 +1,113 @@ +/* + * 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.uber.rib.root.logged_out; -import android.view.LayoutInflater; -import android.view.ViewGroup; - -import com.uber.rib.core.InteractorBaseComponent; -import com.uber.rib.core.ViewBuilder; -import com.uber.rib.tutorial1.R; - -import java.lang.annotation.Retention; - -import javax.inject.Scope; -import javax.inject.Qualifier; - -import dagger.Provides; -import dagger.Binds; -import dagger.BindsInstance; - import static java.lang.annotation.RetentionPolicy.CLASS; -/** - * Builder for the {@link LoggedOutScope}. - */ +import android.view.LayoutInflater; +import android.view.ViewGroup; +import com.uber.rib.core.InteractorBaseComponent; +import com.uber.rib.core.ViewBuilder; +import com.uber.rib.tutorial1.R; +import dagger.Binds; +import dagger.BindsInstance; +import dagger.Provides; +import java.lang.annotation.Retention; +import javax.inject.Qualifier; +import javax.inject.Scope; + +/** Builder for the {@link LoggedOutScope}. */ public class LoggedOutBuilder - extends ViewBuilder { + extends ViewBuilder { - public LoggedOutBuilder(ParentComponent dependency) { - super(dependency); - } + public LoggedOutBuilder(ParentComponent dependency) { + super(dependency); + } - /** - * Builds a new {@link LoggedOutRouter}. - * - * @param parentViewGroup parent view group that this router's view will be added to. - * @return a new {@link LoggedOutRouter}. - */ - public LoggedOutRouter build(ViewGroup parentViewGroup) { - LoggedOutView view = createView(parentViewGroup); - LoggedOutInteractor interactor = new LoggedOutInteractor(); - Component component = DaggerLoggedOutBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); - return component.loggedoutRouter(); - } + /** + * Builds a new {@link LoggedOutRouter}. + * + * @param parentViewGroup parent view group that this router's view will be added to. + * @return a new {@link LoggedOutRouter}. + */ + public LoggedOutRouter build(ViewGroup parentViewGroup) { + LoggedOutView view = createView(parentViewGroup); + LoggedOutInteractor interactor = new LoggedOutInteractor(); + Component component = + DaggerLoggedOutBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); + return component.loggedoutRouter(); + } - @Override - protected LoggedOutView inflateView(LayoutInflater inflater, ViewGroup parentViewGroup) { - return (LoggedOutView) inflater.inflate(R.layout.logged_out_rib, parentViewGroup, false); - } + @Override + protected LoggedOutView inflateView(LayoutInflater inflater, ViewGroup parentViewGroup) { + return (LoggedOutView) inflater.inflate(R.layout.logged_out_rib, parentViewGroup, false); + } - public interface ParentComponent { - // TODO: Define dependencies required from your parent interactor here. - } + public interface ParentComponent { + // TODO: Define dependencies required from your parent interactor here. + } - @dagger.Module - public abstract static class Module { - - @LoggedOutScope - @Binds - abstract LoggedOutInteractor.LoggedOutPresenter presenter(LoggedOutView view); - - @LoggedOutScope - @Provides - static LoggedOutRouter router( - Component component, - LoggedOutView view, - LoggedOutInteractor interactor) { - return new LoggedOutRouter(view, interactor, component); - } - - // TODO: Create provider methods for dependencies created by this Rib. These should be static. - } + @dagger.Module + public abstract static class Module { @LoggedOutScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) - interface Component extends InteractorBaseComponent, BuilderComponent { + @Binds + abstract LoggedOutInteractor.LoggedOutPresenter presenter(LoggedOutView view); - @dagger.Component.Builder - interface Builder { - @BindsInstance - Builder interactor(LoggedOutInteractor interactor); - @BindsInstance - Builder view(LoggedOutView view); - Builder parentComponent(ParentComponent component); - Component build(); - } + @LoggedOutScope + @Provides + static LoggedOutRouter router( + Component component, LoggedOutView view, LoggedOutInteractor interactor) { + return new LoggedOutRouter(view, interactor, component); } - interface BuilderComponent { - LoggedOutRouter loggedoutRouter(); + // TODO: Create provider methods for dependencies created by this Rib. These should be static. + } + + @LoggedOutScope + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component extends InteractorBaseComponent, BuilderComponent { + + @dagger.Component.Builder + interface Builder { + @BindsInstance + Builder interactor(LoggedOutInteractor interactor); + + @BindsInstance + Builder view(LoggedOutView view); + + Builder parentComponent(ParentComponent component); + + Component build(); } + } - @Scope - @Retention(CLASS) - @interface LoggedOutScope { } + interface BuilderComponent { + LoggedOutRouter loggedoutRouter(); + } - @Qualifier - @Retention(CLASS) - @interface LoggedOutInternal { } + @Scope + @Retention(CLASS) + @interface LoggedOutScope {} + + @Qualifier + @Retention(CLASS) + @interface LoggedOutInternal {} } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java index a70ced70..6df79102 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java @@ -1,45 +1,53 @@ +/* + * 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.uber.rib.root.logged_out; -import androidx.annotation.Nullable; import android.util.Log; -import android.widget.Toast; - +import androidx.annotation.Nullable; import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; import com.uber.rib.root.logged_out.LoggedOutBuilder.LoggedOutScope; - -import javax.inject.Inject; - import io.reactivex.Observable; import io.reactivex.functions.Consumer; +import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link LoggedOutScope}. - */ +/** Coordinates Business Logic for {@link LoggedOutScope}. */ @RibInteractor public class LoggedOutInteractor - extends Interactor { + extends Interactor { - @Inject LoggedOutPresenter presenter; + @Inject LoggedOutPresenter presenter; - @Override - protected void didBecomeActive(@Nullable Bundle savedInstanceState) { - super.didBecomeActive(savedInstanceState); - presenter - .loginName() - .subscribe(new Consumer() { - @Override - public void accept(String name) throws Exception { - Log.d("MOO", name); - } + @Override + protected void didBecomeActive(@Nullable Bundle savedInstanceState) { + super.didBecomeActive(savedInstanceState); + presenter + .loginName() + .subscribe( + new Consumer() { + @Override + public void accept(String name) throws Exception { + Log.d("MOO", name); + } }); - } + } - /** - * Presenter interface implemented by this RIB's view. - */ - interface LoggedOutPresenter { - Observable loginName(); - } + /** Presenter interface implemented by this RIB's view. */ + interface LoggedOutPresenter { + Observable loginName(); + } } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java index 9286b985..7ae9a757 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java @@ -1,17 +1,27 @@ +/* + * 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.uber.rib.root.logged_out; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. - */ -public class LoggedOutRouter extends - ViewRouter { +/** Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. */ +public class LoggedOutRouter extends ViewRouter { - public LoggedOutRouter( - LoggedOutView view, - LoggedOutInteractor interactor, - LoggedOutBuilder.Component component) { - super(view, interactor, component); - } + public LoggedOutRouter( + LoggedOutView view, LoggedOutInteractor interactor, LoggedOutBuilder.Component component) { + super(view, interactor, component); + } } diff --git a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java index 8ec553a9..c949816e 100644 --- a/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java +++ b/android/tutorials/tutorial2/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java @@ -1,44 +1,55 @@ +/* + * 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.uber.rib.root.logged_out; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; -import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; - +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.tutorial1.R; - import io.reactivex.Observable; import io.reactivex.functions.Function; -/** - * Top level view for {@link LoggedOutBuilder.LoggedOutScope}. - */ +/** Top level view for {@link LoggedOutBuilder.LoggedOutScope}. */ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.LoggedOutPresenter { - public LoggedOutView(Context context) { - this(context, null); - } + public LoggedOutView(Context context) { + this(context, null); + } - public LoggedOutView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } + public LoggedOutView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } - public LoggedOutView(Context context, @Nullable AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } + public LoggedOutView(Context context, @Nullable AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } - @Override - public Observable loginName() { - return RxView.clicks(findViewById(R.id.login_button)) - .map(new Function() { - @Override - public String apply(Object o) throws Exception { - TextView textView = (TextView) findViewById(R.id.edit_text); - return textView.getText().toString(); - } + @Override + public Observable loginName() { + return RxView.clicks(findViewById(R.id.login_button)) + .map( + new Function() { + @Override + public String apply(Object o) throws Exception { + TextView textView = (TextView) findViewById(R.id.edit_text); + return textView.getText().toString(); + } }); - } + } } diff --git a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootInteractorTest.java b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootInteractorTest.java index 65bc87c3..6626f0ca 100644 --- a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootInteractorTest.java +++ b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootInteractorTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import org.junit.Before; diff --git a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootRouterTest.java b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootRouterTest.java index cc9ee721..e9b7f6a4 100644 --- a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootRouterTest.java +++ b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/RootRouterTest.java @@ -1,7 +1,21 @@ +/* + * 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.uber.rib.root; import com.uber.rib.root.logged_out.LoggedOutBuilder; - import org.junit.Before; import org.mockito.Mock; import org.mockito.MockitoAnnotations; diff --git a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java index 5d65db1b..98a29756 100644 --- a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java +++ b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java @@ -1,8 +1,21 @@ +/* + * 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.uber.rib.root.logged_out; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.InteractorHelper; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -11,22 +24,19 @@ import org.mockito.MockitoAnnotations; @SuppressWarnings("NullAway") public class LoggedOutInteractorTest extends RibTestBasePlaceholder { - @Mock LoggedOutInteractor.LoggedOutPresenter presenter; - @Mock LoggedOutRouter router; + @Mock LoggedOutInteractor.LoggedOutPresenter presenter; + @Mock LoggedOutRouter router; - private LoggedOutInteractor interactor; + private LoggedOutInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestLoggedOutInteractor.create(presenter); - } - - /** - * TODO: Delete this example and add real tests. - */ - @Test - public void anExampleTest_withSomeConditions_shouldPass() { } + interactor = TestLoggedOutInteractor.create(presenter); + } + /** TODO: Delete this example and add real tests. */ + @Test + public void anExampleTest_withSomeConditions_shouldPass() {} } diff --git a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java index 69fa1e2d..223453fb 100644 --- a/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java +++ b/android/tutorials/tutorial2/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java @@ -1,24 +1,36 @@ +/* + * 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.uber.rib.root.logged_out; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @SuppressWarnings("NullAway") public class LoggedOutRouterTest extends RibTestBasePlaceholder { - @Mock LoggedOutBuilder.Component component; - @Mock LoggedOutInteractor interactor; - @Mock LoggedOutView view; + @Mock LoggedOutBuilder.Component component; + @Mock LoggedOutInteractor interactor; + @Mock LoggedOutView view; - private LoggedOutRouter router; + private LoggedOutRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } } diff --git a/android/tutorials/tutorial3-completed/build.gradle b/android/tutorials/tutorial3-completed/build.gradle index 8d97e577..eba13160 100644 --- a/android/tutorials/tutorial3-completed/build.gradle +++ b/android/tutorials/tutorial3-completed/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/RootActivity.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/RootActivity.java index df8729c2..17fd2e35 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/RootActivity.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.view.ViewGroup; - import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/SampleApplication.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/SampleApplication.java index 623429fa..9e89db77 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootBuilder.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootBuilder.java index 0594fbb1..d3791825 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -32,9 +31,7 @@ import dagger.Provides; import java.lang.annotation.Retention; import javax.inject.Scope; -/** - * Builder for the {@link RootScope}. - */ +/** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { public RootBuilder(ParentComponent dependency) { @@ -50,11 +47,12 @@ public class RootBuilder extends ViewBuilder, - LoggedOutBuilder.ParentComponent, - LoggedInBuilder.ParentComponent, - BuilderComponent { + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component + extends InteractorBaseComponent, + LoggedOutBuilder.ParentComponent, + LoggedInBuilder.ParentComponent, + BuilderComponent { @dagger.Component.Builder interface Builder { @@ -125,7 +120,5 @@ public class RootBuilder extends ViewBuilder { @@ -47,10 +44,6 @@ public class RootInteractor extends Interactor { private final LoggedOutBuilder loggedOutBuilder; diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootView.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootView.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java index 16ec3f93..53e1473f 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -44,10 +43,11 @@ public class LoggedInBuilder extends Builder, - BuilderComponent, - OffGameBuilder.ParentComponent, - TicTacToeBuilder.ParentComponent { + BuilderComponent, + OffGameBuilder.ParentComponent, + TicTacToeBuilder.ParentComponent { @dagger.Component.Builder interface Builder { @@ -104,7 +103,6 @@ public class LoggedInBuilder extends Builder { @@ -35,7 +32,6 @@ public class LoggedInInteractor extends Interactor { +/** Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. */ +public class LoggedInRouter extends Router { private final ViewGroup parentView; private final OffGameBuilder offGameBuilder; diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java index d9820f47..a7dc157c 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link OffGameScope}. - */ +/** Builder for the {@link OffGameScope}. */ public class OffGameBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class OffGameBuilder public OffGameRouter build(ViewGroup parentViewGroup) { OffGameView view = createView(parentViewGroup); OffGameInteractor interactor = new OffGameInteractor(); - Component component = DaggerOffGameBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerOffGameBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.offgameRouter(); } @@ -77,16 +75,13 @@ public class OffGameBuilder @OffGameScope @Provides static OffGameRouter router( - Component component, - OffGameView view, - OffGameInteractor interactor) { + Component component, OffGameView view, OffGameInteractor interactor) { return new OffGameRouter(view, interactor, component); } } @OffGameScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -111,13 +106,9 @@ public class OffGameBuilder @Scope @Retention(CLASS) - @interface OffGameScope { - - } + @interface OffGameScope {} @Qualifier @Retention(CLASS) - @interface OffGameInternal { - - } + @interface OffGameInternal {} } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java index 553159ff..f31232f6 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import androidx.annotation.Nullable; @@ -24,9 +23,7 @@ import io.reactivex.Observable; import io.reactivex.functions.Consumer; import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link OffGameScope}. - */ +/** Coordinates Business Logic for {@link OffGameScope}. */ @RibInteractor public class OffGameInteractor extends Interactor { @@ -40,12 +37,13 @@ public class OffGameInteractor presenter .startGameRequest() - .subscribe(new Consumer() { - @Override - public void accept(Object object) throws Exception { - listener.onStartGame(); - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(Object object) throws Exception { + listener.onStartGame(); + } + }); } public interface Listener { @@ -53,9 +51,7 @@ public class OffGameInteractor void onStartGame(); } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface OffGamePresenter { Observable startGameRequest(); diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java index 7e8f11fd..d16eab12 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link OffGameBuilder.OffGameScope}. - */ -public class OffGameRouter extends - ViewRouter { +/** Adds and removes children of {@link OffGameBuilder.OffGameScope}. */ +public class OffGameRouter extends ViewRouter { public OffGameRouter( - OffGameView view, - OffGameInteractor interactor, - OffGameBuilder.Component component) { + OffGameView view, OffGameInteractor interactor, OffGameBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java index f4583eb9..0559e65b 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,24 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; import io.reactivex.Observable; -import java.util.Locale; -/** - * Top level view for {@link OffGameBuilder.OffGameScope}. - */ +/** Top level view for {@link OffGameBuilder.OffGameScope}. */ public class OffGameView extends LinearLayout implements OffGameInteractor.OffGamePresenter { private Button button; diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java index adbcc206..ecdb8ec5 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import javax.inject.Inject; @@ -37,9 +36,7 @@ class Board { } } - /** - * Return true if it is a draw (i.e., no more EMPTY cell) - */ + /** Return true if it is a draw (i.e., no more EMPTY cell) */ boolean isDraw() { for (int row = 0; row < ROWS; ++row) { for (int col = 0; col < COLS; ++col) { @@ -51,24 +48,22 @@ class Board { return !hasWon(MarkerType.CROSS) && !hasWon(MarkerType.NOUGHT); } - /** - * Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) - */ + /** Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) */ boolean hasWon(MarkerType theSeed) { return ((cells[currentRow][0] == theSeed - && cells[currentRow][1] == theSeed - && cells[currentRow][2] == theSeed) + && cells[currentRow][1] == theSeed + && cells[currentRow][2] == theSeed) || (cells[0][currentCol] == theSeed - && cells[1][currentCol] == theSeed - && cells[2][currentCol] == theSeed) + && cells[1][currentCol] == theSeed + && cells[2][currentCol] == theSeed) || (currentRow == currentCol - && cells[0][0] == theSeed - && cells[1][1] == theSeed - && cells[2][2] == theSeed) + && cells[0][0] == theSeed + && cells[1][1] == theSeed + && cells[2][2] == theSeed) || (currentRow + currentCol == 2 - && cells[0][2] == theSeed - && cells[1][1] == theSeed - && cells[2][0] == theSeed)); + && cells[0][2] == theSeed + && cells[1][1] == theSeed + && cells[2][0] == theSeed)); } enum MarkerType { diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java index dd886bb0..fea509d4 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; class BoardCoordinate { diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java index dc792012..3867d895 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link TicTacToeScope}. - */ +/** Builder for the {@link TicTacToeScope}. */ public class TicTacToeBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class TicTacToeBuilder public TicTacToeRouter build(ViewGroup parentViewGroup) { TicTacToeView view = createView(parentViewGroup); TicTacToeInteractor interactor = new TicTacToeInteractor(); - Component component = DaggerTicTacToeBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerTicTacToeBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.tictactoeRouter(); } @@ -76,16 +74,13 @@ public class TicTacToeBuilder @TicTacToeScope @Provides static TicTacToeRouter router( - Component component, - TicTacToeView view, - TicTacToeInteractor interactor) { + Component component, TicTacToeView view, TicTacToeInteractor interactor) { return new TicTacToeRouter(view, interactor, component); } } @TicTacToeScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -110,13 +105,9 @@ public class TicTacToeBuilder @Scope @Retention(CLASS) - @interface TicTacToeScope { - - } + @interface TicTacToeScope {} @Qualifier @Retention(CLASS) - @interface TicTacToeInternal { - - } + @interface TicTacToeInternal {} } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java index 0879d822..ec59842d 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import androidx.annotation.Nullable; @@ -24,14 +23,11 @@ import com.uber.rib.root.logged_in.tic_tac_toe.Board.MarkerType; import io.reactivex.Observable; import io.reactivex.functions.Consumer; import javax.inject.Inject; -import javax.inject.Named; -/** - * Coordinates Business Logic for {@link TicTacToeScope}. - */ +/** Coordinates Business Logic for {@link TicTacToeScope}. */ @RibInteractor public class TicTacToeInteractor - extends Interactor { + extends Interactor { @Inject Board board; @Inject TicTacToePresenter presenter; @@ -46,37 +42,37 @@ public class TicTacToeInteractor super.didBecomeActive(savedInstanceState); presenter - .squareClicks() - .subscribe( - new Consumer() { - @Override - public void accept(BoardCoordinate xy) throws Exception { - if (board.cells[xy.getX()][xy.getY()] == null) { - if (currentPlayer == MarkerType.CROSS) { - board.cells[xy.getX()][xy.getY()] = MarkerType.CROSS; - board.currentRow = xy.getX(); - board.currentCol = xy.getY(); - presenter.addCross(xy); - currentPlayer = MarkerType.NOUGHT; - } else { - board.cells[xy.getX()][xy.getY()] = MarkerType.NOUGHT; - board.currentRow = xy.getX(); - board.currentCol = xy.getY(); - presenter.addNought(xy); - currentPlayer = MarkerType.CROSS; - } - } - if (board.hasWon(MarkerType.CROSS)) { - presenter.setPlayerWon(playerOne); - } else if (board.hasWon(MarkerType.NOUGHT)) { - presenter.setPlayerWon(playerTwo); - } else if (board.isDraw()) { - presenter.setPlayerTie(); - } else { - updateCurrentPlayer(); - } - } - }); + .squareClicks() + .subscribe( + new Consumer() { + @Override + public void accept(BoardCoordinate xy) throws Exception { + if (board.cells[xy.getX()][xy.getY()] == null) { + if (currentPlayer == MarkerType.CROSS) { + board.cells[xy.getX()][xy.getY()] = MarkerType.CROSS; + board.currentRow = xy.getX(); + board.currentCol = xy.getY(); + presenter.addCross(xy); + currentPlayer = MarkerType.NOUGHT; + } else { + board.cells[xy.getX()][xy.getY()] = MarkerType.NOUGHT; + board.currentRow = xy.getX(); + board.currentCol = xy.getY(); + presenter.addNought(xy); + currentPlayer = MarkerType.CROSS; + } + } + if (board.hasWon(MarkerType.CROSS)) { + presenter.setPlayerWon(playerOne); + } else if (board.hasWon(MarkerType.NOUGHT)) { + presenter.setPlayerWon(playerTwo); + } else if (board.isDraw()) { + presenter.setPlayerTie(); + } else { + updateCurrentPlayer(); + } + } + }); updateCurrentPlayer(); } @@ -88,10 +84,7 @@ public class TicTacToeInteractor } } - - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface TicTacToePresenter { Observable squareClicks(); @@ -106,7 +99,5 @@ public class TicTacToeInteractor void addNought(BoardCoordinate xy); } - public interface Listener { - - } + public interface Listener {} } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java index d138fa43..51095cac 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeRouter extends - ViewRouter { +/** Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeRouter extends ViewRouter { public TicTacToeRouter( - TicTacToeView view, - TicTacToeInteractor interactor, - TicTacToeBuilder.Component component) { + TicTacToeView view, TicTacToeInteractor interactor, TicTacToeBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java index 85b6c9c1..91ca7347 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,29 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import android.content.Context; -import androidx.annotation.Nullable; -import androidx.percentlayout.widget.PercentRelativeLayout; import android.util.AttributeSet; import android.widget.TextView; - +import androidx.annotation.Nullable; +import androidx.percentlayout.widget.PercentRelativeLayout; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; - -import java.util.ArrayList; - import io.reactivex.Observable; import io.reactivex.functions.Function; +import java.util.ArrayList; -/** - * Top level view for {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeView extends PercentRelativeLayout implements - TicTacToeInteractor.TicTacToePresenter { +/** Top level view for {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeView extends PercentRelativeLayout + implements TicTacToeInteractor.TicTacToePresenter { private TextView[][] imageButtons; private TextView titleView; @@ -58,22 +52,22 @@ public class TicTacToeView extends PercentRelativeLayout implements super.onFinishInflate(); imageButtons = new TextView[3][]; imageButtons[0] = - new TextView[]{ - (TextView) findViewById(R.id.button11), - (TextView) findViewById(R.id.button12), - (TextView) findViewById(R.id.button13) + new TextView[] { + (TextView) findViewById(R.id.button11), + (TextView) findViewById(R.id.button12), + (TextView) findViewById(R.id.button13) }; imageButtons[1] = - new TextView[]{ - (TextView) findViewById(R.id.button21), - (TextView) findViewById(R.id.button22), - (TextView) findViewById(R.id.button23) + new TextView[] { + (TextView) findViewById(R.id.button21), + (TextView) findViewById(R.id.button22), + (TextView) findViewById(R.id.button23) }; imageButtons[2] = - new TextView[]{ - (TextView) findViewById(R.id.button31), - (TextView) findViewById(R.id.button32), - (TextView) findViewById(R.id.button33) + new TextView[] { + (TextView) findViewById(R.id.button31), + (TextView) findViewById(R.id.button32), + (TextView) findViewById(R.id.button33) }; titleView = (TextView) findViewById(R.id.title); } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java index d1abf835..2923e674 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link LoggedOutScope}. - */ +/** Builder for the {@link LoggedOutScope}. */ public class LoggedOutBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class LoggedOutBuilder public LoggedOutRouter build(ViewGroup parentViewGroup) { LoggedOutView view = createView(parentViewGroup); LoggedOutInteractor interactor = new LoggedOutInteractor(); - Component component = DaggerLoggedOutBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerLoggedOutBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.loggedoutRouter(); } @@ -77,9 +75,7 @@ public class LoggedOutBuilder @LoggedOutScope @Provides static LoggedOutRouter router( - Component component, - LoggedOutView view, - LoggedOutInteractor interactor) { + Component component, LoggedOutView view, LoggedOutInteractor interactor) { return new LoggedOutRouter(view, interactor, component); } @@ -87,8 +83,7 @@ public class LoggedOutBuilder } @LoggedOutScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -113,13 +108,9 @@ public class LoggedOutBuilder @Scope @Retention(CLASS) - @interface LoggedOutScope { - - } + @interface LoggedOutScope {} @Qualifier @Retention(CLASS) - @interface LoggedOutInternal { - - } + @interface LoggedOutInternal {} } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java index 01cde109..fe89272d 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import androidx.annotation.Nullable; import androidx.core.util.Pair; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; @@ -27,9 +25,7 @@ import io.reactivex.Observable; import io.reactivex.functions.Consumer; import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link LoggedOutScope}. - */ +/** Coordinates Business Logic for {@link LoggedOutScope}. */ @RibInteractor public class LoggedOutInteractor extends Interactor { @@ -42,23 +38,22 @@ public class LoggedOutInteractor super.didBecomeActive(savedInstanceState); presenter .loginName() - .subscribe(new Consumer>() { - @Override - public void accept(Pair names) throws Exception { - if (!isEmpty(names.first) && !isEmpty(names.second)) { - listener.login(names.first, names.second); - } - } - }); + .subscribe( + new Consumer>() { + @Override + public void accept(Pair names) throws Exception { + if (!isEmpty(names.first) && !isEmpty(names.second)) { + listener.login(names.first, names.second); + } + } + }); } private boolean isEmpty(@Nullable String string) { return string == null || string.length() == 0; } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface LoggedOutPresenter { Observable> loginName(); @@ -67,5 +62,4 @@ public class LoggedOutInteractor public interface Listener { void login(String userNameA, String userNameB); } - } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java index 960988a7..7ae9a757 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. - */ -public class LoggedOutRouter extends - ViewRouter { +/** Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. */ +public class LoggedOutRouter extends ViewRouter { public LoggedOutRouter( - LoggedOutView view, - LoggedOutInteractor interactor, - LoggedOutBuilder.Component component) { + LoggedOutView view, LoggedOutInteractor interactor, LoggedOutBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java index d5b5f1ce..ea1cecda 100644 --- a/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java +++ b/android/tutorials/tutorial3-completed/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java @@ -1,10 +1,3 @@ -package com.uber.rib.root.logged_out; - -import android.content.Context; -import androidx.annotation.Nullable; -import androidx.core.util.Pair; -import android.util.AttributeSet; -import android.widget.LinearLayout; /* * Copyright (C) 2017. Uber Technologies * @@ -12,7 +5,7 @@ import android.widget.LinearLayout; * 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 + * 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, @@ -20,16 +13,20 @@ import android.widget.LinearLayout; * See the License for the specific language governing permissions and * limitations under the License. */ +package com.uber.rib.root.logged_out; +import android.content.Context; +import android.util.AttributeSet; +import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.core.util.Pair; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.tutorial1.R; import io.reactivex.Observable; import io.reactivex.functions.Function; -/** - * Top level view for {@link LoggedOutBuilder.LoggedOutScope}. - */ +/** Top level view for {@link LoggedOutBuilder.LoggedOutScope}. */ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.LoggedOutPresenter { public LoggedOutView(Context context) { @@ -47,13 +44,15 @@ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.L @Override public Observable> loginName() { return RxView.clicks(findViewById(R.id.login_button)) - .map(new Function>() { - @Override - public Pair apply(Object o) throws Exception { - TextView playerNameOne = (TextView) findViewById(R.id.player_name_1); - TextView playerNameTwo = (TextView) findViewById(R.id.player_name_2); - return Pair.create(playerNameOne.getText().toString(), playerNameTwo.getText().toString()); - } - }); + .map( + new Function>() { + @Override + public Pair apply(Object o) throws Exception { + TextView playerNameOne = (TextView) findViewById(R.id.player_name_1); + TextView playerNameTwo = (TextView) findViewById(R.id.player_name_2); + return Pair.create( + playerNameOne.getText().toString(), playerNameTwo.getText().toString()); + } + }); } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootInteractorTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootInteractorTest.java index 445a9708..5fa44ec5 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootInteractorTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootInteractorTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import org.junit.Before; diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootRouterTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootRouterTest.java index 4a16d02e..7b823e92 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootRouterTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/RootRouterTest.java @@ -1,8 +1,22 @@ +/* + * 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.uber.rib.root; import com.uber.rib.root.logged_in.LoggedInBuilder; import com.uber.rib.root.logged_out.LoggedOutBuilder; - import org.junit.Before; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -19,11 +33,12 @@ public class RootRouterTest { public void setup() { MockitoAnnotations.initMocks(this); - router = new RootRouter( - view, - interactor, - component, - new LoggedOutBuilder(component), - new LoggedInBuilder(component)); + router = + new RootRouter( + view, + interactor, + component, + new LoggedOutBuilder(component), + new LoggedInBuilder(component)); } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java index ff3a5b4d..f0eba659 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in; -import com.uber.rib.core.RibTestBasePlaceholder; import com.uber.rib.core.EmptyPresenter; -import com.uber.rib.core.InteractorHelper; - +import com.uber.rib.core.RibTestBasePlaceholder; import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class LoggedInInteractorTest extends RibTestBasePlaceholder { - @Mock EmptyPresenter presenter; - @Mock LoggedInRouter router; + @Mock EmptyPresenter presenter; + @Mock LoggedInRouter router; - private LoggedInInteractor interactor; + private LoggedInInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestLoggedInInteractor.create(); - } + interactor = TestLoggedInInteractor.create(); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java index 9714a58c..5bc83055 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java @@ -1,35 +1,43 @@ +/* + * 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.uber.rib.root.logged_in; import android.view.ViewGroup; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import com.uber.rib.root.logged_in.off_game.OffGameBuilder; import com.uber.rib.root.logged_in.tic_tac_toe.TicTacToeBuilder; import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class LoggedInRouterTest extends RibTestBasePlaceholder { - @Mock LoggedInBuilder.Component component; - @Mock LoggedInInteractor interactor; - @Mock ViewGroup parentView; - @Mock OffGameBuilder offGameBuilder; - @Mock TicTacToeBuilder ticTacToeBuilder; + @Mock LoggedInBuilder.Component component; + @Mock LoggedInInteractor interactor; + @Mock ViewGroup parentView; + @Mock OffGameBuilder offGameBuilder; + @Mock TicTacToeBuilder ticTacToeBuilder; - private LoggedInRouter router; + private LoggedInRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new LoggedInRouter( - interactor, - component, - parentView, - offGameBuilder, - ticTacToeBuilder); - } + router = + new LoggedInRouter(interactor, component, parentView, offGameBuilder, ticTacToeBuilder); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java index 439eb69d..1210fd84 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.off_game; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.InteractorHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class OffGameInteractorTest extends RibTestBasePlaceholder { - @Mock OffGameInteractor.Listener listener; - @Mock OffGameInteractor.OffGamePresenter presenter; - @Mock OffGameRouter router; + @Mock OffGameInteractor.Listener listener; + @Mock OffGameInteractor.OffGamePresenter presenter; + @Mock OffGameRouter router; - private OffGameInteractor interactor; + private OffGameInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestOffGameInteractor.create(listener, presenter); - } + interactor = TestOffGameInteractor.create(listener, presenter); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java index 4ca5fa89..6961e538 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.off_game; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class OffGameRouterTest extends RibTestBasePlaceholder { - @Mock OffGameBuilder.Component component; - @Mock OffGameInteractor interactor; - @Mock OffGameView view; + @Mock OffGameBuilder.Component component; + @Mock OffGameInteractor interactor; + @Mock OffGameView view; - private OffGameRouter router; + private OffGameRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new OffGameRouter(view, interactor, component); - } + router = new OffGameRouter(view, interactor, component); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java index 749d96a0..daeb37cc 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.InteractorHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class TicTacToeInteractorTest extends RibTestBasePlaceholder { - @Mock TicTacToeInteractor.TicTacToePresenter presenter; - @Mock TicTacToeRouter router; - @Mock Board board; + @Mock TicTacToeInteractor.TicTacToePresenter presenter; + @Mock TicTacToeRouter router; + @Mock Board board; - private TicTacToeInteractor interactor; + private TicTacToeInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestTicTacToeInteractor.create(board, presenter); - } + interactor = TestTicTacToeInteractor.create(board, presenter); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java index bb6ea3c9..5d7768c3 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class TicTacToeRouterTest extends RibTestBasePlaceholder { - @Mock TicTacToeBuilder.Component component; - @Mock TicTacToeInteractor interactor; - @Mock TicTacToeView view; + @Mock TicTacToeBuilder.Component component; + @Mock TicTacToeInteractor interactor; + @Mock TicTacToeView view; - private TicTacToeRouter router; + private TicTacToeRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new TicTacToeRouter(view, interactor, component); - } + router = new TicTacToeRouter(view, interactor, component); + } } diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java index 6a29e6df..daa583f2 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java @@ -1,12 +1,26 @@ +/* + * 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.uber.rib.root.logged_out; -import androidx.core.util.Pair; - import static org.mockito.Matchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import androidx.core.util.Pair; import com.uber.rib.core.InteractorHelper; import com.uber.rib.core.RibTestBasePlaceholder; import io.reactivex.Observable; @@ -30,7 +44,6 @@ public class LoggedOutInteractorTest extends RibTestBasePlaceholder { interactor = TestLoggedOutInteractor.create(listener, presenter); } - @Test public void attach_whenViewEmitsName_shouldCallListener() { when(presenter.loginName()).thenReturn(Observable.just(Pair.create("fakename", "fakename"))); diff --git a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java index d9557574..e6b8ebb8 100644 --- a/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java +++ b/android/tutorials/tutorial3-completed/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root.logged_out; import com.uber.rib.core.RibTestBasePlaceholder; diff --git a/android/tutorials/tutorial3/build.gradle b/android/tutorials/tutorial3/build.gradle index 3b671377..311fbd2a 100644 --- a/android/tutorials/tutorial3/build.gradle +++ b/android/tutorials/tutorial3/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/RootActivity.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/RootActivity.java index df8729c2..17fd2e35 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/RootActivity.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.view.ViewGroup; - import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/SampleApplication.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/SampleApplication.java index 623429fa..9e89db77 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootBuilder.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootBuilder.java index 0594fbb1..d3791825 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -32,9 +31,7 @@ import dagger.Provides; import java.lang.annotation.Retention; import javax.inject.Scope; -/** - * Builder for the {@link RootScope}. - */ +/** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { public RootBuilder(ParentComponent dependency) { @@ -50,11 +47,12 @@ public class RootBuilder extends ViewBuilder, - LoggedOutBuilder.ParentComponent, - LoggedInBuilder.ParentComponent, - BuilderComponent { + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component + extends InteractorBaseComponent, + LoggedOutBuilder.ParentComponent, + LoggedInBuilder.ParentComponent, + BuilderComponent { @dagger.Component.Builder interface Builder { @@ -125,7 +120,5 @@ public class RootBuilder extends ViewBuilder { @@ -47,10 +44,6 @@ public class RootInteractor extends Interactor { private final LoggedOutBuilder loggedOutBuilder; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootView.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootView.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java index 7bafb9a8..3adb9989 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -47,17 +46,17 @@ public class LoggedInBuilder extends Builder, - BuilderComponent, - OffGameBuilder.ParentComponent, - TicTacToeBuilder.ParentComponent { + BuilderComponent, + OffGameBuilder.ParentComponent, + TicTacToeBuilder.ParentComponent { @dagger.Component.Builder interface Builder { @@ -134,7 +132,6 @@ public class LoggedInBuilder extends Builder { @@ -39,7 +36,6 @@ public class LoggedInInteractor extends Interactor { +/** Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. */ +public class LoggedInRouter extends Router { private final ViewGroup parentView; private final OffGameBuilder offGameBuilder; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java index 9b94c69d..db8d9421 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import com.google.common.collect.ImmutableMap; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java index af90811d..256d86ec 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import com.google.common.collect.ImmutableMap; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java index 43aaefe8..c031c6db 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -32,9 +31,7 @@ import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link OffGameScope}. - */ +/** Builder for the {@link OffGameScope}. */ public class OffGameBuilder extends ViewBuilder { @@ -51,11 +48,12 @@ public class OffGameBuilder public OffGameRouter build(ViewGroup parentViewGroup) { OffGameView view = createView(parentViewGroup); OffGameInteractor interactor = new OffGameInteractor(); - Component component = DaggerOffGameBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerOffGameBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.offgameRouter(); } @@ -66,9 +64,11 @@ public class OffGameBuilder public interface ParentComponent { - @Named("player_one") String playerOne(); + @Named("player_one") + String playerOne(); - @Named("player_two") String playerTwo(); + @Named("player_two") + String playerTwo(); OffGameInteractor.Listener listener(); @@ -85,16 +85,13 @@ public class OffGameBuilder @OffGameScope @Provides static OffGameRouter router( - Component component, - OffGameView view, - OffGameInteractor interactor) { + Component component, OffGameView view, OffGameInteractor interactor) { return new OffGameRouter(view, interactor, component); } } @OffGameScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -119,13 +116,9 @@ public class OffGameBuilder @Scope @Retention(CLASS) - @interface OffGameScope { - - } + @interface OffGameScope {} @Qualifier @Retention(CLASS) - @interface OffGameInternal { - - } + @interface OffGameInternal {} } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java index 64171157..29a97404 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import androidx.annotation.Nullable; @@ -28,20 +27,23 @@ import io.reactivex.functions.Consumer; import javax.inject.Inject; import javax.inject.Named; -/** - * Coordinates Business Logic for {@link OffGameScope}. - */ +/** Coordinates Business Logic for {@link OffGameScope}. */ @RibInteractor public class OffGameInteractor extends Interactor { - @Inject @Named("player_one") String playerOne; - @Inject @Named("player_two") String playerTwo; + @Inject + @Named("player_one") + String playerOne; + + @Inject + @Named("player_two") + String playerTwo; + @Inject Listener listener; @Inject OffGamePresenter presenter; @Inject ScoreStream scoreStream; - @Override protected void didBecomeActive(@Nullable Bundle savedInstanceState) { super.didBecomeActive(savedInstanceState); @@ -49,24 +51,26 @@ public class OffGameInteractor presenter.setPlayerNames(playerOne, playerTwo); presenter .startGameRequest() - .subscribe(new Consumer() { - @Override - public void accept(Object object) throws Exception { - listener.onStartGame(); - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(Object object) throws Exception { + listener.onStartGame(); + } + }); - scoreStream.scores() + scoreStream + .scores() .as(AutoDispose.>autoDisposable(this)) - .subscribe(new Consumer>() { - @Override - public void accept(ImmutableMap scores) - throws Exception { - Integer playerOneScore = scores.get(playerOne); - Integer playerTwoScore = scores.get(playerTwo); - presenter.setScores(playerOneScore, playerTwoScore); - } - }); + .subscribe( + new Consumer>() { + @Override + public void accept(ImmutableMap scores) throws Exception { + Integer playerOneScore = scores.get(playerOne); + Integer playerTwoScore = scores.get(playerTwo); + presenter.setScores(playerOneScore, playerTwoScore); + } + }); } public interface Listener { @@ -74,9 +78,7 @@ public class OffGameInteractor void onStartGame(); } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface OffGamePresenter { void setPlayerNames(String playerOne, String playerTwo); diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java index 7e8f11fd..d16eab12 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link OffGameBuilder.OffGameScope}. - */ -public class OffGameRouter extends - ViewRouter { +/** Adds and removes children of {@link OffGameBuilder.OffGameScope}. */ +public class OffGameRouter extends ViewRouter { public OffGameRouter( - OffGameView view, - OffGameInteractor interactor, - OffGameBuilder.Component component) { + OffGameView view, OffGameInteractor interactor, OffGameBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java index 5561c117..02bcdc3a 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,24 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; import io.reactivex.Observable; import java.util.Locale; -/** - * Top level view for {@link OffGameBuilder.OffGameScope}. - */ +/** Top level view for {@link OffGameBuilder.OffGameScope}. */ public class OffGameView extends LinearLayout implements OffGameInteractor.OffGamePresenter { private Button button; diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java index adbcc206..ecdb8ec5 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import javax.inject.Inject; @@ -37,9 +36,7 @@ class Board { } } - /** - * Return true if it is a draw (i.e., no more EMPTY cell) - */ + /** Return true if it is a draw (i.e., no more EMPTY cell) */ boolean isDraw() { for (int row = 0; row < ROWS; ++row) { for (int col = 0; col < COLS; ++col) { @@ -51,24 +48,22 @@ class Board { return !hasWon(MarkerType.CROSS) && !hasWon(MarkerType.NOUGHT); } - /** - * Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) - */ + /** Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) */ boolean hasWon(MarkerType theSeed) { return ((cells[currentRow][0] == theSeed - && cells[currentRow][1] == theSeed - && cells[currentRow][2] == theSeed) + && cells[currentRow][1] == theSeed + && cells[currentRow][2] == theSeed) || (cells[0][currentCol] == theSeed - && cells[1][currentCol] == theSeed - && cells[2][currentCol] == theSeed) + && cells[1][currentCol] == theSeed + && cells[2][currentCol] == theSeed) || (currentRow == currentCol - && cells[0][0] == theSeed - && cells[1][1] == theSeed - && cells[2][2] == theSeed) + && cells[0][0] == theSeed + && cells[1][1] == theSeed + && cells[2][2] == theSeed) || (currentRow + currentCol == 2 - && cells[0][2] == theSeed - && cells[1][1] == theSeed - && cells[2][0] == theSeed)); + && cells[0][2] == theSeed + && cells[1][1] == theSeed + && cells[2][0] == theSeed)); } enum MarkerType { diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java index dd886bb0..fea509d4 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; class BoardCoordinate { diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java index e215f224..1309c2bd 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -31,9 +30,7 @@ import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link TicTacToeScope}. - */ +/** Builder for the {@link TicTacToeScope}. */ public class TicTacToeBuilder extends ViewBuilder { @@ -50,11 +47,12 @@ public class TicTacToeBuilder public TicTacToeRouter build(ViewGroup parentViewGroup) { TicTacToeView view = createView(parentViewGroup); TicTacToeInteractor interactor = new TicTacToeInteractor(); - Component component = DaggerTicTacToeBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerTicTacToeBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.tictactoeRouter(); } @@ -67,9 +65,11 @@ public class TicTacToeBuilder TicTacToeInteractor.Listener ticTacToeListener(); - @Named("player_one") String playerOne(); + @Named("player_one") + String playerOne(); - @Named("player_two") String playerTwo(); + @Named("player_two") + String playerTwo(); } @dagger.Module @@ -82,16 +82,13 @@ public class TicTacToeBuilder @TicTacToeScope @Provides static TicTacToeRouter router( - Component component, - TicTacToeView view, - TicTacToeInteractor interactor) { + Component component, TicTacToeView view, TicTacToeInteractor interactor) { return new TicTacToeRouter(view, interactor, component); } } @TicTacToeScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -116,13 +113,9 @@ public class TicTacToeBuilder @Scope @Retention(CLASS) - @interface TicTacToeScope { - - } + @interface TicTacToeScope {} @Qualifier @Retention(CLASS) - @interface TicTacToeInternal { - - } + @interface TicTacToeInternal {} } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java index 5cb84c4a..fb1dcc32 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import androidx.annotation.Nullable; @@ -26,9 +25,7 @@ import io.reactivex.functions.Consumer; import javax.inject.Inject; import javax.inject.Named; -/** - * Coordinates Business Logic for {@link TicTacToeScope}. - */ +/** Coordinates Business Logic for {@link TicTacToeScope}. */ @RibInteractor public class TicTacToeInteractor extends Interactor { @@ -37,9 +34,13 @@ public class TicTacToeInteractor @Inject Listener listener; @Inject TicTacToePresenter presenter; - @Inject @Named("player_one") String playerOne; + @Inject + @Named("player_one") + String playerOne; - @Inject @Named("player_two") String playerTwo; + @Inject + @Named("player_two") + String playerTwo; private MarkerType currentPlayer = MarkerType.CROSS; @@ -93,10 +94,7 @@ public class TicTacToeInteractor } } - - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface TicTacToePresenter { Observable squareClicks(); diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java index d138fa43..51095cac 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeRouter extends - ViewRouter { +/** Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeRouter extends ViewRouter { public TicTacToeRouter( - TicTacToeView view, - TicTacToeInteractor interactor, - TicTacToeBuilder.Component component) { + TicTacToeView view, TicTacToeInteractor interactor, TicTacToeBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java index 8159e093..91ca7347 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import android.content.Context; -import androidx.annotation.Nullable; -import androidx.percentlayout.widget.PercentRelativeLayout; import android.util.AttributeSet; import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.percentlayout.widget.PercentRelativeLayout; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial1.R; @@ -28,11 +27,9 @@ import io.reactivex.Observable; import io.reactivex.functions.Function; import java.util.ArrayList; -/** - * Top level view for {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeView extends PercentRelativeLayout implements - TicTacToeInteractor.TicTacToePresenter { +/** Top level view for {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeView extends PercentRelativeLayout + implements TicTacToeInteractor.TicTacToePresenter { private TextView[][] imageButtons; private TextView titleView; @@ -55,22 +52,22 @@ public class TicTacToeView extends PercentRelativeLayout implements super.onFinishInflate(); imageButtons = new TextView[3][]; imageButtons[0] = - new TextView[]{ - (TextView) findViewById(R.id.button11), - (TextView) findViewById(R.id.button12), - (TextView) findViewById(R.id.button13) + new TextView[] { + (TextView) findViewById(R.id.button11), + (TextView) findViewById(R.id.button12), + (TextView) findViewById(R.id.button13) }; imageButtons[1] = - new TextView[]{ - (TextView) findViewById(R.id.button21), - (TextView) findViewById(R.id.button22), - (TextView) findViewById(R.id.button23) + new TextView[] { + (TextView) findViewById(R.id.button21), + (TextView) findViewById(R.id.button22), + (TextView) findViewById(R.id.button23) }; imageButtons[2] = - new TextView[]{ - (TextView) findViewById(R.id.button31), - (TextView) findViewById(R.id.button32), - (TextView) findViewById(R.id.button33) + new TextView[] { + (TextView) findViewById(R.id.button31), + (TextView) findViewById(R.id.button32), + (TextView) findViewById(R.id.button33) }; titleView = (TextView) findViewById(R.id.title); } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java index d1abf835..2923e674 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link LoggedOutScope}. - */ +/** Builder for the {@link LoggedOutScope}. */ public class LoggedOutBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class LoggedOutBuilder public LoggedOutRouter build(ViewGroup parentViewGroup) { LoggedOutView view = createView(parentViewGroup); LoggedOutInteractor interactor = new LoggedOutInteractor(); - Component component = DaggerLoggedOutBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerLoggedOutBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.loggedoutRouter(); } @@ -77,9 +75,7 @@ public class LoggedOutBuilder @LoggedOutScope @Provides static LoggedOutRouter router( - Component component, - LoggedOutView view, - LoggedOutInteractor interactor) { + Component component, LoggedOutView view, LoggedOutInteractor interactor) { return new LoggedOutRouter(view, interactor, component); } @@ -87,8 +83,7 @@ public class LoggedOutBuilder } @LoggedOutScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -113,13 +108,9 @@ public class LoggedOutBuilder @Scope @Retention(CLASS) - @interface LoggedOutScope { - - } + @interface LoggedOutScope {} @Qualifier @Retention(CLASS) - @interface LoggedOutInternal { - - } + @interface LoggedOutInternal {} } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java index 8ec90dd9..49fb75b4 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import androidx.annotation.Nullable; @@ -26,9 +25,7 @@ import io.reactivex.Observable; import io.reactivex.functions.Consumer; import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link LoggedOutScope}. - */ +/** Coordinates Business Logic for {@link LoggedOutScope}. */ @RibInteractor public class LoggedOutInteractor extends Interactor { @@ -41,23 +38,22 @@ public class LoggedOutInteractor super.didBecomeActive(savedInstanceState); presenter .playerNames() - .subscribe(new Consumer>() { - @Override - public void accept(Pair names) throws Exception { - if (!isEmpty(names.first) && !isEmpty(names.second)) { - listener.requestLogin(names.first, names.second); - } - } - }); + .subscribe( + new Consumer>() { + @Override + public void accept(Pair names) throws Exception { + if (!isEmpty(names.first) && !isEmpty(names.second)) { + listener.requestLogin(names.first, names.second); + } + } + }); } private boolean isEmpty(@Nullable String string) { return string == null || string.length() == 0; } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface LoggedOutPresenter { Observable> playerNames(); @@ -67,5 +63,4 @@ public class LoggedOutInteractor void requestLogin(String playerOne, String playerTwo); } - } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java index 960988a7..7ae9a757 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. - */ -public class LoggedOutRouter extends - ViewRouter { +/** Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. */ +public class LoggedOutRouter extends ViewRouter { public LoggedOutRouter( - LoggedOutView view, - LoggedOutInteractor interactor, - LoggedOutBuilder.Component component) { + LoggedOutView view, LoggedOutInteractor interactor, LoggedOutBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java index 8a09c9f2..d221d853 100644 --- a/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java +++ b/android/tutorials/tutorial3/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java @@ -1,18 +1,3 @@ -package com.uber.rib.root.logged_out; - -import android.content.Context; -import androidx.annotation.Nullable; -import androidx.core.util.Pair; -import android.util.AttributeSet; -import android.widget.Button; -import android.widget.EditText; -import android.widget.LinearLayout; -import com.jakewharton.rxbinding2.view.RxView; -import com.uber.rib.core.Initializer; -import com.uber.rib.tutorial1.R; -import io.reactivex.Observable; -import io.reactivex.functions.Function; - /* * Copyright (C) 2017. Uber Technologies * @@ -20,7 +5,7 @@ import io.reactivex.functions.Function; * 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 + * 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, @@ -28,10 +13,22 @@ import io.reactivex.functions.Function; * See the License for the specific language governing permissions and * limitations under the License. */ +package com.uber.rib.root.logged_out; -/** - * Top level view for {@link LoggedOutBuilder.LoggedOutScope}. - */ +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import androidx.annotation.Nullable; +import androidx.core.util.Pair; +import com.jakewharton.rxbinding2.view.RxView; +import com.uber.rib.core.Initializer; +import com.uber.rib.tutorial1.R; +import io.reactivex.Observable; +import io.reactivex.functions.Function; + +/** Top level view for {@link LoggedOutBuilder.LoggedOutScope}. */ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.LoggedOutPresenter { private Button loginButton; diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootInteractorTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootInteractorTest.java index 445a9708..5fa44ec5 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootInteractorTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootInteractorTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import org.junit.Before; diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootRouterTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootRouterTest.java index 4a16d02e..7b823e92 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootRouterTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/RootRouterTest.java @@ -1,8 +1,22 @@ +/* + * 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.uber.rib.root; import com.uber.rib.root.logged_in.LoggedInBuilder; import com.uber.rib.root.logged_out.LoggedOutBuilder; - import org.junit.Before; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -19,11 +33,12 @@ public class RootRouterTest { public void setup() { MockitoAnnotations.initMocks(this); - router = new RootRouter( - view, - interactor, - component, - new LoggedOutBuilder(component), - new LoggedInBuilder(component)); + router = + new RootRouter( + view, + interactor, + component, + new LoggedOutBuilder(component), + new LoggedInBuilder(component)); } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java index 9fe4f4ef..6d90e276 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInInteractorTest.java @@ -1,26 +1,38 @@ +/* + * 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.uber.rib.root.logged_in; -import com.uber.rib.core.RibTestBasePlaceholder; import com.uber.rib.core.EmptyPresenter; -import com.uber.rib.core.InteractorHelper; - +import com.uber.rib.core.RibTestBasePlaceholder; import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class LoggedInInteractorTest extends RibTestBasePlaceholder { - @Mock EmptyPresenter presenter; - @Mock LoggedInRouter router; - @Mock MutableScoreStream scoreStream; + @Mock EmptyPresenter presenter; + @Mock LoggedInRouter router; + @Mock MutableScoreStream scoreStream; - private LoggedInInteractor interactor; + private LoggedInInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestLoggedInInteractor.create(scoreStream); - } + interactor = TestLoggedInInteractor.create(scoreStream); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java index 9714a58c..5bc83055 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/LoggedInRouterTest.java @@ -1,35 +1,43 @@ +/* + * 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.uber.rib.root.logged_in; import android.view.ViewGroup; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import com.uber.rib.root.logged_in.off_game.OffGameBuilder; import com.uber.rib.root.logged_in.tic_tac_toe.TicTacToeBuilder; import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class LoggedInRouterTest extends RibTestBasePlaceholder { - @Mock LoggedInBuilder.Component component; - @Mock LoggedInInteractor interactor; - @Mock ViewGroup parentView; - @Mock OffGameBuilder offGameBuilder; - @Mock TicTacToeBuilder ticTacToeBuilder; + @Mock LoggedInBuilder.Component component; + @Mock LoggedInInteractor interactor; + @Mock ViewGroup parentView; + @Mock OffGameBuilder offGameBuilder; + @Mock TicTacToeBuilder ticTacToeBuilder; - private LoggedInRouter router; + private LoggedInRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new LoggedInRouter( - interactor, - component, - parentView, - offGameBuilder, - ticTacToeBuilder); - } + router = + new LoggedInRouter(interactor, component, parentView, offGameBuilder, ticTacToeBuilder); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java index 915395ac..231790e0 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameInteractorTest.java @@ -1,37 +1,43 @@ +/* + * 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.uber.rib.root.logged_in.off_game; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.InteractorHelper; - import com.uber.rib.root.logged_in.ScoreStream; import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class OffGameInteractorTest extends RibTestBasePlaceholder { - private final String playerOne = "playerOne"; - private final String playerTwo = "playerTwo"; + private final String playerOne = "playerOne"; + private final String playerTwo = "playerTwo"; - @Mock OffGameInteractor.Listener listener; - @Mock OffGameInteractor.OffGamePresenter presenter; - @Mock OffGameRouter router; - @Mock ScoreStream scoreStream; + @Mock OffGameInteractor.Listener listener; + @Mock OffGameInteractor.OffGamePresenter presenter; + @Mock OffGameRouter router; + @Mock ScoreStream scoreStream; + private OffGameInteractor interactor; + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - private OffGameInteractor interactor; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - - interactor = TestOffGameInteractor.create( - playerOne, - playerTwo, - listener, - presenter, - scoreStream); - } + interactor = + TestOffGameInteractor.create(playerOne, playerTwo, listener, presenter, scoreStream); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java index 4ca5fa89..6961e538 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/off_game/OffGameRouterTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.off_game; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class OffGameRouterTest extends RibTestBasePlaceholder { - @Mock OffGameBuilder.Component component; - @Mock OffGameInteractor interactor; - @Mock OffGameView view; + @Mock OffGameBuilder.Component component; + @Mock OffGameInteractor interactor; + @Mock OffGameView view; - private OffGameRouter router; + private OffGameRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new OffGameRouter(view, interactor, component); - } + router = new OffGameRouter(view, interactor, component); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java index b2fe4182..81c390c4 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractorTest.java @@ -1,34 +1,41 @@ +/* + * 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.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.InteractorHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class TicTacToeInteractorTest extends RibTestBasePlaceholder { - private final String playerOne = "playerOne"; - private final String playerTwo = "playerTwo"; + private final String playerOne = "playerOne"; + private final String playerTwo = "playerTwo"; - @Mock Board board; - @Mock TicTacToeInteractor.Listener listener; - @Mock TicTacToeInteractor.TicTacToePresenter presenter; - @Mock TicTacToeRouter router; + @Mock Board board; + @Mock TicTacToeInteractor.Listener listener; + @Mock TicTacToeInteractor.TicTacToePresenter presenter; + @Mock TicTacToeRouter router; - private TicTacToeInteractor interactor; + private TicTacToeInteractor interactor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - interactor = TestTicTacToeInteractor.create( - board, - listener, - presenter, - playerOne, - playerTwo); - } + interactor = TestTicTacToeInteractor.create(board, listener, presenter, playerOne, playerTwo); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java index bb6ea3c9..5d7768c3 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouterTest.java @@ -1,25 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.RibTestBasePlaceholder; -import com.uber.rib.core.RouterHelper; - import org.junit.Before; -import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; public class TicTacToeRouterTest extends RibTestBasePlaceholder { - @Mock TicTacToeBuilder.Component component; - @Mock TicTacToeInteractor interactor; - @Mock TicTacToeView view; + @Mock TicTacToeBuilder.Component component; + @Mock TicTacToeInteractor interactor; + @Mock TicTacToeView view; - private TicTacToeRouter router; + private TicTacToeRouter router; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); + @Before + public void setup() { + MockitoAnnotations.initMocks(this); - router = new TicTacToeRouter(view, interactor, component); - } + router = new TicTacToeRouter(view, interactor, component); + } } diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java index 5156a55d..b89144bb 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutInteractorTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root.logged_out; import static org.mockito.Matchers.any; diff --git a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java index d9557574..e6b8ebb8 100644 --- a/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java +++ b/android/tutorials/tutorial3/src/test/java/com/uber/rib/root/logged_out/LoggedOutRouterTest.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root.logged_out; import com.uber.rib.core.RibTestBasePlaceholder; diff --git a/android/tutorials/tutorial4/build.gradle b/android/tutorials/tutorial4/build.gradle index 478d92c3..6e2f79cf 100644 --- a/android/tutorials/tutorial4/build.gradle +++ b/android/tutorials/tutorial4/build.gradle @@ -5,7 +5,7 @@ * 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 + * 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, diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/RootActivity.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/RootActivity.java index 048a4b25..97ee21c8 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/RootActivity.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/RootActivity.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,18 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.ViewGroup; - +import androidx.annotation.Nullable; +import com.google.common.base.Optional; import com.uber.autodispose.AutoDispose; import com.uber.rave.Rave; import com.uber.rave.RaveException; -import com.google.common.base.Optional; import com.uber.rib.core.RibActivity; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.RootBuilder; @@ -32,9 +31,6 @@ import com.uber.rib.root.RootInteractor; import com.uber.rib.root.RootRouter; import com.uber.rib.root.RootWorkflow; import com.uber.rib.root.WorkflowFactory; - -import androidx.annotation.Nullable; - import io.reactivex.functions.Consumer; /** The sample app's single activity. */ @@ -79,7 +75,5 @@ public class RootActivity extends RibActivity { } } - private class RootReturnValue { - - } + private class RootReturnValue {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/SampleApplication.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/SampleApplication.java index 623429fa..9e89db77 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/SampleApplication.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/SampleApplication.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib; import android.app.Application; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootActionableItem.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootActionableItem.java index 15b1afe2..c5a3946b 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootActionableItem.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootActionableItem.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import com.uber.rib.workflow.core.ActionableItem; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootBuilder.java index 13b93ac0..49b7e0ff 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -32,9 +31,7 @@ import dagger.Provides; import java.lang.annotation.Retention; import javax.inject.Scope; -/** - * Builder for the {@link RootScope}. - */ +/** Builder for the {@link RootScope}. */ public class RootBuilder extends ViewBuilder { public RootBuilder(ParentComponent dependency) { @@ -50,11 +47,12 @@ public class RootBuilder extends ViewBuilder, - LoggedOutBuilder.ParentComponent, - LoggedInBuilder.ParentComponent, - BuilderComponent { + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component + extends InteractorBaseComponent, + LoggedOutBuilder.ParentComponent, + LoggedInBuilder.ParentComponent, + BuilderComponent { @dagger.Component.Builder interface Builder { @@ -125,7 +120,5 @@ public class RootBuilder extends ViewBuilder +public class RootInteractor extends Interactor implements RootActionableItem { @Inject RootPresenter presenter; @@ -49,8 +45,6 @@ public class RootInteractor } } - /** - * Presenter interface implemented by this RIB's view. - */ - interface RootPresenter { } + /** Presenter interface implemented by this RIB's view. */ + interface RootPresenter {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootRouter.java index 061df867..a698a250 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import androidx.annotation.Nullable; - -import com.jakewharton.rxrelay2.BehaviorRelay; import com.google.common.base.Optional; +import com.jakewharton.rxrelay2.BehaviorRelay; import com.uber.rib.core.ViewRouter; import com.uber.rib.root.logged_in.LoggedInActionableItem; import com.uber.rib.root.logged_in.LoggedInBuilder; @@ -27,9 +25,7 @@ import com.uber.rib.root.logged_in.LoggedInRouter; import com.uber.rib.root.logged_out.LoggedOutBuilder; import com.uber.rib.root.logged_out.LoggedOutRouter; -/** - * Adds and removes children of {@link RootBuilder.RootScope}. - */ +/** Adds and removes children of {@link RootBuilder.RootScope}. */ public class RootRouter extends ViewRouter { private final LoggedOutBuilder loggedOutBuilder; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootView.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootView.java index 3174d612..23608db0 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootView.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.annotation.Nullable; /** Top level view for {@link RootBuilder.RootScope}. */ public class RootView extends FrameLayout implements RootInteractor.RootPresenter { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflow.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflow.java index 2fc8c87b..d5bd632d 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflow.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflow.java @@ -1,10 +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. + */ package com.uber.rib.root; import android.content.Intent; - import com.uber.rib.workflow.core.Step; import com.uber.rib.workflow.core.Workflow; - import java.io.Serializable; /** diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflowModel.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflowModel.java index f8c6fa08..83c21cad 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflowModel.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/RootWorkflowModel.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root; import java.io.Serializable; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/TrainingSessionsValidationFactory.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/TrainingSessionsValidationFactory.java index 3a651003..93361c7d 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/TrainingSessionsValidationFactory.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/TrainingSessionsValidationFactory.java @@ -1,7 +1,21 @@ +/* + * 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.uber.rib.root; import androidx.annotation.NonNull; - import com.uber.rave.BaseValidator; import com.uber.rave.ValidatorFactory; import com.uber.rave.annotation.Validated; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/UserName.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/UserName.java index 86369802..7743279a 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/UserName.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/UserName.java @@ -1,7 +1,21 @@ +/* + * 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.uber.rib.root; import androidx.annotation.NonNull; - import com.google.auto.value.AutoValue; @AutoValue diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/WorkflowFactory.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/WorkflowFactory.java index a16924e6..8bea5b8e 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/WorkflowFactory.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/WorkflowFactory.java @@ -1,7 +1,21 @@ +/* + * 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.uber.rib.root; import android.content.Intent; - import androidx.annotation.Nullable; public class WorkflowFactory { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameKey.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameKey.java index 74434fd3..83260484 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameKey.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameKey.java @@ -1,5 +1,20 @@ +/* + * 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.uber.rib.root.logged_in; public interface GameKey { - String gameName(); -} \ No newline at end of file + String gameName(); +} diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameProvider.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameProvider.java index 286def95..82dc3a2c 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameProvider.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/GameProvider.java @@ -1,11 +1,25 @@ +/* + * 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.uber.rib.root.logged_in; import android.view.ViewGroup; - import com.uber.rib.core.ViewRouter; public interface GameProvider extends GameKey { - String gameName(); - ViewRouter viewRouter(ViewGroup viewGroup); -} + String gameName(); + ViewRouter viewRouter(ViewGroup viewGroup); +} diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInActionableItem.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInActionableItem.java index de1f09b2..c373f5af 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInActionableItem.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInActionableItem.java @@ -1,5 +1,20 @@ +/* + * 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.uber.rib.root.logged_in; import com.uber.rib.workflow.core.ActionableItem; -public interface LoggedInActionableItem extends ActionableItem {} \ No newline at end of file +public interface LoggedInActionableItem extends ActionableItem {} diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java index c29e2f23..450aa524 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; -import android.view.ViewGroup; - import static java.lang.annotation.RetentionPolicy.CLASS; +import android.view.ViewGroup; import com.google.common.collect.Lists; import com.uber.rib.core.Builder; import com.uber.rib.core.EmptyPresenter; @@ -38,7 +36,6 @@ import dagger.BindsInstance; import dagger.Provides; import java.lang.annotation.Retention; import java.util.List; - import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; @@ -56,17 +53,17 @@ public class LoggedInBuilder extends Builder gameProviders(final Component component) { // Decorate the game builders with a "name" key so we can treat them generically elsewhere. - GameProvider ticTacToeGame = new GameProvider() { - @Override - public String gameName() { - return "TicTacToe"; - } + GameProvider ticTacToeGame = + new GameProvider() { + @Override + public String gameName() { + return "TicTacToe"; + } - @Override - public ViewRouter viewRouter(ViewGroup viewGroup) { - return new TicTacToeBuilder(component).build(viewGroup); - } - }; - GameProvider randomWinnerGame = new GameProvider() { - @Override - public String gameName() { - return "RandomWinner"; - } + @Override + public ViewRouter viewRouter(ViewGroup viewGroup) { + return new TicTacToeBuilder(component).build(viewGroup); + } + }; + GameProvider randomWinnerGame = + new GameProvider() { + @Override + public String gameName() { + return "RandomWinner"; + } - @Override - public ViewRouter viewRouter(ViewGroup viewGroup) { - return new RandomWinnerBuilder(component).build(viewGroup); - } - }; + @Override + public ViewRouter viewRouter(ViewGroup viewGroup) { + return new RandomWinnerBuilder(component).build(viewGroup); + } + }; return Lists.newArrayList(ticTacToeGame, randomWinnerGame); } @@ -164,10 +164,10 @@ public class LoggedInBuilder extends Builder, - BuilderComponent, - OffGameBuilder.ParentComponent, - TicTacToeBuilder.ParentComponent, - RandomWinnerBuilder.ParentComponent { + BuilderComponent, + OffGameBuilder.ParentComponent, + TicTacToeBuilder.ParentComponent, + RandomWinnerBuilder.ParentComponent { @dagger.Component.Builder interface Builder { @@ -185,7 +185,6 @@ public class LoggedInBuilder extends Builder +public class LoggedInInteractor extends Interactor implements LoggedInActionableItem { @Inject @LoggedInInternal MutableScoreStream scoreStream; @@ -49,7 +42,6 @@ public class LoggedInInteractor // when first logging in we should be in the OffGame state getRouter().attachOffGame(); - } class OffGameListener implements OffGameInteractor.Listener { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java index 53b30836..b1acb69e 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/LoggedInRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import android.view.ViewGroup; @@ -23,11 +22,8 @@ import com.uber.rib.root.logged_in.off_game.OffGameBuilder; import com.uber.rib.root.logged_in.off_game.OffGameRouter; import com.uber.rib.root.logged_in.tic_tac_toe.TicTacToeBuilder; -/** - * Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. - */ -public class LoggedInRouter - extends Router { +/** Adds and removes children of {@link LoggedInBuilder.LoggedInScope}. */ +public class LoggedInRouter extends Router { private final ViewGroup parentView; private final OffGameBuilder offGameBuilder; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java index 2ffd10a8..b61d5ed5 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/MutableScoreStream.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import com.google.common.collect.ImmutableMap; import com.jakewharton.rxrelay2.BehaviorRelay; import com.uber.rib.root.UserName; - import io.reactivex.Observable; import java.util.Map; diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java index 397e9595..dac62979 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/ScoreStream.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in; import com.google.common.collect.ImmutableMap; import com.uber.rib.root.UserName; - import io.reactivex.Observable; public interface ScoreStream { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java index 84d0af2d..4ac59c97 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -31,14 +30,11 @@ import dagger.BindsInstance; import dagger.Provides; import java.lang.annotation.Retention; import java.util.List; - import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link OffGameScope}. - */ +/** Builder for the {@link OffGameScope}. */ public class OffGameBuilder extends ViewBuilder { @@ -55,11 +51,12 @@ public class OffGameBuilder public OffGameRouter build(ViewGroup parentViewGroup) { OffGameView view = createView(parentViewGroup); OffGameInteractor interactor = new OffGameInteractor(); - Component component = DaggerOffGameBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerOffGameBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.offgameRouter(); } @@ -69,10 +66,16 @@ public class OffGameBuilder } public interface ParentComponent { - @Named("player_one") UserName playerOne(); - @Named("player_two") UserName playerTwo(); + @Named("player_one") + UserName playerOne(); + + @Named("player_two") + UserName playerTwo(); + OffGameInteractor.Listener listener(); + ScoreStream scoreStream(); + List gameKeys(); } @@ -86,16 +89,13 @@ public class OffGameBuilder @OffGameScope @Provides static OffGameRouter router( - Component component, - OffGameView view, - OffGameInteractor interactor) { + Component component, OffGameView view, OffGameInteractor interactor) { return new OffGameRouter(view, interactor, component); } } @OffGameScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -119,9 +119,9 @@ public class OffGameBuilder @Scope @Retention(CLASS) - @interface OffGameScope { } + @interface OffGameScope {} @Qualifier @Retention(CLASS) - @interface OffGameInternal { } + @interface OffGameInternal {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java index 819abe08..3f9944d6 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import androidx.annotation.Nullable; @@ -25,11 +24,9 @@ import com.uber.rib.core.RibInteractor; import com.uber.rib.root.UserName; import com.uber.rib.root.logged_in.GameKey; import com.uber.rib.root.logged_in.ScoreStream; - -import java.util.List; - import io.reactivex.Observable; import io.reactivex.functions.Consumer; +import java.util.List; import javax.inject.Inject; import javax.inject.Named; @@ -37,14 +34,19 @@ import javax.inject.Named; public class OffGameInteractor extends Interactor { - @Inject @Named("player_one") UserName playerOne; - @Inject @Named("player_two") UserName playerTwo; + @Inject + @Named("player_one") + UserName playerOne; + + @Inject + @Named("player_two") + UserName playerTwo; + @Inject Listener listener; @Inject OffGamePresenter presenter; @Inject ScoreStream scoreStream; @Inject List gameNames; - @Override protected void didBecomeActive(@Nullable Bundle savedInstanceState) { super.didBecomeActive(savedInstanceState); @@ -52,24 +54,26 @@ public class OffGameInteractor presenter.setPlayerNames(playerOne.getUserName(), playerTwo.getUserName()); presenter .startGameRequest(gameNames) - .subscribe(new Consumer() { - @Override - public void accept(GameKey gameKey) throws Exception { - listener.onStartGame(gameKey); - } - }); + .subscribe( + new Consumer() { + @Override + public void accept(GameKey gameKey) throws Exception { + listener.onStartGame(gameKey); + } + }); - scoreStream.scores() + scoreStream + .scores() .as(AutoDispose.>autoDisposable(this)) - .subscribe(new Consumer>() { - @Override - public void accept(ImmutableMap scores) - throws Exception { - Integer playerOneScore = scores.get(playerOne); - Integer playerTwoScore = scores.get(playerTwo); - presenter.setScores(playerOneScore, playerTwoScore); - } - }); + .subscribe( + new Consumer>() { + @Override + public void accept(ImmutableMap scores) throws Exception { + Integer playerOneScore = scores.get(playerOne); + Integer playerTwoScore = scores.get(playerTwo); + presenter.setScores(playerOneScore, playerTwoScore); + } + }); } public interface Listener { @@ -77,9 +81,7 @@ public class OffGameInteractor void onStartGame(GameKey gameKey); } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface OffGamePresenter { void setPlayerNames(String playerOne, String playerTwo); diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java index 7e8f11fd..d16eab12 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link OffGameBuilder.OffGameScope}. - */ -public class OffGameRouter extends - ViewRouter { +/** Adds and removes children of {@link OffGameBuilder.OffGameScope}. */ +public class OffGameRouter extends ViewRouter { public OffGameRouter( - OffGameView view, - OffGameInteractor interactor, - OffGameBuilder.Component component) { + OffGameView view, OffGameInteractor interactor, OffGameBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java index f881e952..159f7a10 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/off_game/OffGameView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,31 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.off_game; import android.content.Context; -import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.root.logged_in.GameKey; import com.uber.rib.tutorial4.R; - import io.reactivex.Observable; import io.reactivex.functions.Function; - import java.util.ArrayList; import java.util.List; import java.util.Locale; -/** - * Top level view for {@link OffGameBuilder.OffGameScope}. - */ +/** Top level view for {@link OffGameBuilder.OffGameScope}. */ public class OffGameView extends LinearLayout implements OffGameInteractor.OffGamePresenter { private TextView playerOneName; @@ -85,16 +80,18 @@ public class OffGameView extends LinearLayout implements OffGameInteractor.OffGa public Observable startGameRequest(List gameKeys) { List> observables = new ArrayList<>(); for (final GameKey gameKey : gameKeys) { - Button button = (Button) LayoutInflater.from(getContext()).inflate(R.layout.game_button, this, false); + Button button = + (Button) LayoutInflater.from(getContext()).inflate(R.layout.game_button, this, false); button.setText(gameKey.gameName()); - Observable observable = RxView - .clicks(button) - .map(new Function() { - @Override - public GameKey apply(Object o) throws Exception { - return gameKey; - } - }); + Observable observable = + RxView.clicks(button) + .map( + new Function() { + @Override + public GameKey apply(Object o) throws Exception { + return gameKey; + } + }); observables.add(observable); addView(button); } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerBuilder.java index 80ac6118..775ee77f 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerBuilder.java @@ -1,105 +1,122 @@ +/* + * 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.uber.rib.root.logged_in.random_winner; +import static java.lang.annotation.RetentionPolicy.CLASS; + import android.view.LayoutInflater; import android.view.ViewGroup; - import com.uber.rib.core.InteractorBaseComponent; import com.uber.rib.core.ViewBuilder; import com.uber.rib.root.UserName; - +import dagger.Binds; +import dagger.BindsInstance; +import dagger.Provides; import java.lang.annotation.Retention; - import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; -import dagger.Binds; -import dagger.BindsInstance; -import dagger.Provides; - -import static java.lang.annotation.RetentionPolicy.CLASS; - /** - * Builder for the {@link RandomWinnerScope}. Not a real game. This just picks a random winner than exits. + * Builder for the {@link RandomWinnerScope}. Not a real game. This just picks a random winner than + * exits. */ public class RandomWinnerBuilder - extends ViewBuilder { + extends ViewBuilder { - public RandomWinnerBuilder(ParentComponent dependency) { - super(dependency); - } + public RandomWinnerBuilder(ParentComponent dependency) { + super(dependency); + } - /** - * Builds a new {@link RandomWinnerRouter}. - * - * @param parentViewGroup parent view group that this router's view will be added to. - * @return a new {@link RandomWinnerRouter}. - */ - public RandomWinnerRouter build(ViewGroup parentViewGroup) { - RandomWinnerView view = createView(parentViewGroup); - RandomWinnerInteractor interactor = new RandomWinnerInteractor(); - Component component = DaggerRandomWinnerBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); - return component.randomwinnerRouter(); - } + /** + * Builds a new {@link RandomWinnerRouter}. + * + * @param parentViewGroup parent view group that this router's view will be added to. + * @return a new {@link RandomWinnerRouter}. + */ + public RandomWinnerRouter build(ViewGroup parentViewGroup) { + RandomWinnerView view = createView(parentViewGroup); + RandomWinnerInteractor interactor = new RandomWinnerInteractor(); + Component component = + DaggerRandomWinnerBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); + return component.randomwinnerRouter(); + } - @Override - protected RandomWinnerView inflateView(LayoutInflater inflater, ViewGroup parentViewGroup) { - // Just inflate a silly useless view that does nothing. - return new RandomWinnerView(parentViewGroup.getContext()); - } + @Override + protected RandomWinnerView inflateView(LayoutInflater inflater, ViewGroup parentViewGroup) { + // Just inflate a silly useless view that does nothing. + return new RandomWinnerView(parentViewGroup.getContext()); + } - public interface ParentComponent { - RandomWinnerInteractor.Listener randomWinnerListener(); - @Named("player_one") UserName playerOne(); - @Named("player_two") UserName playerTwo(); - } + public interface ParentComponent { + RandomWinnerInteractor.Listener randomWinnerListener(); - @dagger.Module - public abstract static class Module { + @Named("player_one") + UserName playerOne(); - @RandomWinnerScope - @Binds - abstract RandomWinnerInteractor.RandomWinnerPresenter presenter(RandomWinnerView view); + @Named("player_two") + UserName playerTwo(); + } - @RandomWinnerScope - @Provides - static RandomWinnerRouter router( - Component component, - RandomWinnerView view, - RandomWinnerInteractor interactor) { - return new RandomWinnerRouter(view, interactor, component); - } - } + @dagger.Module + public abstract static class Module { @RandomWinnerScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) - interface Component extends InteractorBaseComponent, BuilderComponent { + @Binds + abstract RandomWinnerInteractor.RandomWinnerPresenter presenter(RandomWinnerView view); - @dagger.Component.Builder - interface Builder { - @BindsInstance - Builder interactor(RandomWinnerInteractor interactor); - @BindsInstance - Builder view(RandomWinnerView view); - Builder parentComponent(ParentComponent component); - Component build(); - } + @RandomWinnerScope + @Provides + static RandomWinnerRouter router( + Component component, RandomWinnerView view, RandomWinnerInteractor interactor) { + return new RandomWinnerRouter(view, interactor, component); } + } - interface BuilderComponent { - RandomWinnerRouter randomwinnerRouter(); + @RandomWinnerScope + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) + interface Component extends InteractorBaseComponent, BuilderComponent { + + @dagger.Component.Builder + interface Builder { + @BindsInstance + Builder interactor(RandomWinnerInteractor interactor); + + @BindsInstance + Builder view(RandomWinnerView view); + + Builder parentComponent(ParentComponent component); + + Component build(); } + } - @Scope - @Retention(CLASS) - @interface RandomWinnerScope { } + interface BuilderComponent { + RandomWinnerRouter randomwinnerRouter(); + } - @Qualifier - @Retention(CLASS) - @interface RandomWinnerInternal { } + @Scope + @Retention(CLASS) + @interface RandomWinnerScope {} + + @Qualifier + @Retention(CLASS) + @interface RandomWinnerInternal {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerInteractor.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerInteractor.java index b96694d6..fe76a5de 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerInteractor.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerInteractor.java @@ -1,47 +1,63 @@ +/* + * 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.uber.rib.root.logged_in.random_winner; import androidx.annotation.Nullable; - import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; import com.uber.rib.root.UserName; - import java.util.Random; - import javax.inject.Inject; import javax.inject.Named; @RibInteractor public class RandomWinnerInteractor - extends Interactor { + extends Interactor { - @Inject Listener listener; - @Inject @Named("player_one") UserName playerOne; - @Inject @Named("player_two") UserName playerTwo; + @Inject Listener listener; - @Override - protected void didBecomeActive(@Nullable Bundle savedInstanceState) { - super.didBecomeActive(savedInstanceState); - if (new Random(System.currentTimeMillis()).nextBoolean()) { - listener.gameWon(playerOne); - } else { - listener.gameWon(playerTwo); - } + @Inject + @Named("player_one") + UserName playerOne; + + @Inject + @Named("player_two") + UserName playerTwo; + + @Override + protected void didBecomeActive(@Nullable Bundle savedInstanceState) { + super.didBecomeActive(savedInstanceState); + if (new Random(System.currentTimeMillis()).nextBoolean()) { + listener.gameWon(playerOne); + } else { + listener.gameWon(playerTwo); } + } + + /** Presenter interface implemented by this RIB's view. */ + interface RandomWinnerPresenter {} + + public interface Listener { /** - * Presenter interface implemented by this RIB's view. + * Called when the game is over. + * + * @param winner player that won, or null if it's a tie. */ - interface RandomWinnerPresenter { } - - public interface Listener { - - /** - * Called when the game is over. - * - * @param winner player that won, or null if it's a tie. - */ - void gameWon(UserName winner); - } + void gameWon(UserName winner); + } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerRouter.java index 5fcd0e64..2a65e643 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerRouter.java @@ -1,3 +1,18 @@ +/* + * 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.uber.rib.root.logged_in.random_winner; import com.uber.rib.core.ViewRouter; @@ -5,15 +20,14 @@ import com.uber.rib.core.ViewRouter; /** * Adds and removes children of {@link RandomWinnerBuilder.RandomWinnerScope}. * - * TODO describe the possible child configurations of this scope. + *

TODO describe the possible child configurations of this scope. */ -public class RandomWinnerRouter extends - ViewRouter { +public class RandomWinnerRouter extends ViewRouter { - public RandomWinnerRouter( - RandomWinnerView view, - RandomWinnerInteractor interactor, - RandomWinnerBuilder.Component component) { - super(view, interactor, component); - } + public RandomWinnerRouter( + RandomWinnerView view, + RandomWinnerInteractor interactor, + RandomWinnerBuilder.Component component) { + super(view, interactor, component); + } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerView.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerView.java index f5111085..d6d28f08 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerView.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/random_winner/RandomWinnerView.java @@ -1,26 +1,37 @@ +/* + * 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.uber.rib.root.logged_in.random_winner; import android.content.Context; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.util.AttributeSet; -import android.view.View; import android.widget.FrameLayout; +import androidx.annotation.Nullable; -/** - * Top level view for {@link RandomWinnerBuilder.RandomWinnerScope}. - */ +/** Top level view for {@link RandomWinnerBuilder.RandomWinnerScope}. */ class RandomWinnerView extends FrameLayout implements RandomWinnerInteractor.RandomWinnerPresenter { - public RandomWinnerView(Context context) { - this(context, null); - } + public RandomWinnerView(Context context) { + this(context, null); + } - public RandomWinnerView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } + public RandomWinnerView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } - public RandomWinnerView(Context context, @Nullable AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } + public RandomWinnerView(Context context, @Nullable AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java index adbcc206..ecdb8ec5 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/Board.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import javax.inject.Inject; @@ -37,9 +36,7 @@ class Board { } } - /** - * Return true if it is a draw (i.e., no more EMPTY cell) - */ + /** Return true if it is a draw (i.e., no more EMPTY cell) */ boolean isDraw() { for (int row = 0; row < ROWS; ++row) { for (int col = 0; col < COLS; ++col) { @@ -51,24 +48,22 @@ class Board { return !hasWon(MarkerType.CROSS) && !hasWon(MarkerType.NOUGHT); } - /** - * Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) - */ + /** Return true if the player with "theSeed" has won after placing at (currentRow, currentCol) */ boolean hasWon(MarkerType theSeed) { return ((cells[currentRow][0] == theSeed - && cells[currentRow][1] == theSeed - && cells[currentRow][2] == theSeed) + && cells[currentRow][1] == theSeed + && cells[currentRow][2] == theSeed) || (cells[0][currentCol] == theSeed - && cells[1][currentCol] == theSeed - && cells[2][currentCol] == theSeed) + && cells[1][currentCol] == theSeed + && cells[2][currentCol] == theSeed) || (currentRow == currentCol - && cells[0][0] == theSeed - && cells[1][1] == theSeed - && cells[2][2] == theSeed) + && cells[0][0] == theSeed + && cells[1][1] == theSeed + && cells[2][2] == theSeed) || (currentRow + currentCol == 2 - && cells[0][2] == theSeed - && cells[1][1] == theSeed - && cells[2][0] == theSeed)); + && cells[0][2] == theSeed + && cells[1][1] == theSeed + && cells[2][0] == theSeed)); } enum MarkerType { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java index dd886bb0..fea509d4 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/BoardCoordinate.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; class BoardCoordinate { diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java index ae321eab..61c186bd 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -32,9 +31,7 @@ import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link TicTacToeScope}. - */ +/** Builder for the {@link TicTacToeScope}. */ public class TicTacToeBuilder extends ViewBuilder { @@ -51,11 +48,12 @@ public class TicTacToeBuilder public TicTacToeRouter build(ViewGroup parentViewGroup) { TicTacToeView view = createView(parentViewGroup); TicTacToeInteractor interactor = new TicTacToeInteractor(); - Component component = DaggerTicTacToeBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerTicTacToeBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.tictactoeRouter(); } @@ -66,8 +64,12 @@ public class TicTacToeBuilder public interface ParentComponent { TicTacToeInteractor.Listener ticTacToeListener(); - @Named("player_one") UserName playerOne(); - @Named("player_two") UserName playerTwo(); + + @Named("player_one") + UserName playerOne(); + + @Named("player_two") + UserName playerTwo(); } @dagger.Module @@ -80,16 +82,13 @@ public class TicTacToeBuilder @TicTacToeScope @Provides static TicTacToeRouter router( - Component component, - TicTacToeView view, - TicTacToeInteractor interactor) { + Component component, TicTacToeView view, TicTacToeInteractor interactor) { return new TicTacToeRouter(view, interactor, component); } } @TicTacToeScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -114,13 +113,9 @@ public class TicTacToeBuilder @Scope @Retention(CLASS) - @interface TicTacToeScope { - - } + @interface TicTacToeScope {} @Qualifier @Retention(CLASS) - @interface TicTacToeInternal { - - } + @interface TicTacToeInternal {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java index 2c8f7e3a..2672975a 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import androidx.annotation.Nullable; @@ -27,9 +26,7 @@ import io.reactivex.functions.Consumer; import javax.inject.Inject; import javax.inject.Named; -/** - * Coordinates Business Logic for {@link TicTacToeScope}. - */ +/** Coordinates Business Logic for {@link TicTacToeScope}. */ @RibInteractor public class TicTacToeInteractor extends Interactor { @@ -37,8 +34,14 @@ public class TicTacToeInteractor @Inject Board board; @Inject Listener listener; @Inject TicTacToePresenter presenter; - @Inject @Named("player_one") UserName playerOne; - @Inject @Named("player_two") UserName playerTwo; + + @Inject + @Named("player_one") + UserName playerOne; + + @Inject + @Named("player_two") + UserName playerTwo; private MarkerType currentPlayer = MarkerType.CROSS; @@ -92,10 +95,7 @@ public class TicTacToeInteractor } } - - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface TicTacToePresenter { Observable squareClicks(); diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java index d138fa43..51095cac 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeRouter extends - ViewRouter { +/** Adds and removes children of {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeRouter extends ViewRouter { public TicTacToeRouter( - TicTacToeView view, - TicTacToeInteractor interactor, - TicTacToeBuilder.Component component) { + TicTacToeView view, TicTacToeInteractor interactor, TicTacToeBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java index 150008bb..0328f737 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_in/tic_tac_toe/TicTacToeView.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_in.tic_tac_toe; import android.content.Context; -import androidx.annotation.Nullable; -import androidx.percentlayout.widget.PercentRelativeLayout; import android.util.AttributeSet; import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.percentlayout.widget.PercentRelativeLayout; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial4.R; @@ -28,11 +27,9 @@ import io.reactivex.Observable; import io.reactivex.functions.Function; import java.util.ArrayList; -/** - * Top level view for {@link TicTacToeBuilder.TicTacToeScope}. - */ -public class TicTacToeView extends PercentRelativeLayout implements - TicTacToeInteractor.TicTacToePresenter { +/** Top level view for {@link TicTacToeBuilder.TicTacToeScope}. */ +public class TicTacToeView extends PercentRelativeLayout + implements TicTacToeInteractor.TicTacToePresenter { private TextView[][] imageButtons; private TextView titleView; @@ -55,22 +52,22 @@ public class TicTacToeView extends PercentRelativeLayout implements super.onFinishInflate(); imageButtons = new TextView[3][]; imageButtons[0] = - new TextView[]{ - (TextView) findViewById(R.id.button11), - (TextView) findViewById(R.id.button12), - (TextView) findViewById(R.id.button13) + new TextView[] { + (TextView) findViewById(R.id.button11), + (TextView) findViewById(R.id.button12), + (TextView) findViewById(R.id.button13) }; imageButtons[1] = - new TextView[]{ - (TextView) findViewById(R.id.button21), - (TextView) findViewById(R.id.button22), - (TextView) findViewById(R.id.button23) + new TextView[] { + (TextView) findViewById(R.id.button21), + (TextView) findViewById(R.id.button22), + (TextView) findViewById(R.id.button23) }; imageButtons[2] = - new TextView[]{ - (TextView) findViewById(R.id.button31), - (TextView) findViewById(R.id.button32), - (TextView) findViewById(R.id.button33) + new TextView[] { + (TextView) findViewById(R.id.button31), + (TextView) findViewById(R.id.button32), + (TextView) findViewById(R.id.button33) }; titleView = (TextView) findViewById(R.id.title); } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java index ff1461ad..52c9a4dc 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutBuilder.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import static java.lang.annotation.RetentionPolicy.CLASS; @@ -30,9 +29,7 @@ import java.lang.annotation.Retention; import javax.inject.Qualifier; import javax.inject.Scope; -/** - * Builder for the {@link LoggedOutScope}. - */ +/** Builder for the {@link LoggedOutScope}. */ public class LoggedOutBuilder extends ViewBuilder { @@ -49,11 +46,12 @@ public class LoggedOutBuilder public LoggedOutRouter build(ViewGroup parentViewGroup) { LoggedOutView view = createView(parentViewGroup); LoggedOutInteractor interactor = new LoggedOutInteractor(); - Component component = DaggerLoggedOutBuilder_Component.builder() - .parentComponent(getDependency()) - .view(view) - .interactor(interactor) - .build(); + Component component = + DaggerLoggedOutBuilder_Component.builder() + .parentComponent(getDependency()) + .view(view) + .interactor(interactor) + .build(); return component.loggedoutRouter(); } @@ -77,9 +75,7 @@ public class LoggedOutBuilder @LoggedOutScope @Provides static LoggedOutRouter router( - Component component, - LoggedOutView view, - LoggedOutInteractor interactor) { + Component component, LoggedOutView view, LoggedOutInteractor interactor) { return new LoggedOutRouter(view, interactor, component); } @@ -87,8 +83,7 @@ public class LoggedOutBuilder } @LoggedOutScope - @dagger.Component(modules = Module.class, - dependencies = ParentComponent.class) + @dagger.Component(modules = Module.class, dependencies = ParentComponent.class) interface Component extends InteractorBaseComponent, BuilderComponent { @dagger.Component.Builder @@ -113,13 +108,9 @@ public class LoggedOutBuilder @Scope @Retention(CLASS) - @interface LoggedOutScope { - - } + @interface LoggedOutScope {} @Qualifier @Retention(CLASS) - @interface LoggedOutInternal { - - } + @interface LoggedOutInternal {} } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java index c66e5b5e..d8fda0dc 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutInteractor.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; -import androidx.annotation.Nullable; import android.util.Pair; +import androidx.annotation.Nullable; import com.uber.rib.core.Bundle; import com.uber.rib.core.Interactor; import com.uber.rib.core.RibInteractor; @@ -27,9 +26,7 @@ import io.reactivex.Observable; import io.reactivex.functions.Consumer; import javax.inject.Inject; -/** - * Coordinates Business Logic for {@link LoggedOutScope}. - */ +/** Coordinates Business Logic for {@link LoggedOutScope}. */ @RibInteractor public class LoggedOutInteractor extends Interactor { @@ -42,23 +39,23 @@ public class LoggedOutInteractor super.didBecomeActive(savedInstanceState); presenter .playerNames() - .subscribe(new Consumer>() { - @Override - public void accept(Pair names) throws Exception { - if (!isEmpty(names.first) && !isEmpty(names.second)) { - listener.requestLogin(UserName.create(names.first), UserName.create(names.second)); - } - } - }); + .subscribe( + new Consumer>() { + @Override + public void accept(Pair names) throws Exception { + if (!isEmpty(names.first) && !isEmpty(names.second)) { + listener.requestLogin( + UserName.create(names.first), UserName.create(names.second)); + } + } + }); } private boolean isEmpty(@Nullable String string) { return string == null || string.length() == 0; } - /** - * Presenter interface implemented by this RIB's view. - */ + /** Presenter interface implemented by this RIB's view. */ interface LoggedOutPresenter { Observable> playerNames(); @@ -68,5 +65,4 @@ public class LoggedOutInteractor void requestLogin(UserName playerOne, UserName playerTwo); } - } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java index 960988a7..7ae9a757 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutRouter.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -13,21 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.uber.rib.root.logged_out; import com.uber.rib.core.ViewRouter; -/** - * Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. - */ -public class LoggedOutRouter extends - ViewRouter { +/** Adds and removes children of {@link LoggedOutBuilder.LoggedOutScope}. */ +public class LoggedOutRouter extends ViewRouter { public LoggedOutRouter( - LoggedOutView view, - LoggedOutInteractor interactor, - LoggedOutBuilder.Component component) { + LoggedOutView view, LoggedOutInteractor interactor, LoggedOutBuilder.Component component) { super(view, interactor, component); } } diff --git a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java index 6c387e84..6c5cebbd 100644 --- a/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java +++ b/android/tutorials/tutorial4/src/main/java/com/uber/rib/root/logged_out/LoggedOutView.java @@ -1,12 +1,3 @@ -package com.uber.rib.root.logged_out; - -import android.content.Context; -import androidx.annotation.Nullable; -import android.util.AttributeSet; -import android.util.Pair; -import android.widget.Button; -import android.widget.EditText; -import android.widget.LinearLayout; /* * Copyright (C) 2017. Uber Technologies * @@ -14,7 +5,7 @@ import android.widget.LinearLayout; * 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 + * 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, @@ -22,17 +13,22 @@ import android.widget.LinearLayout; * See the License for the specific language governing permissions and * limitations under the License. */ +package com.uber.rib.root.logged_out; -import android.widget.TextView; +import android.content.Context; +import android.util.AttributeSet; +import android.util.Pair; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import androidx.annotation.Nullable; import com.jakewharton.rxbinding2.view.RxView; import com.uber.rib.core.Initializer; import com.uber.rib.tutorial4.R; import io.reactivex.Observable; import io.reactivex.functions.Function; -/** - * Top level view for {@link LoggedOutBuilder.LoggedOutScope}. - */ +/** Top level view for {@link LoggedOutBuilder.LoggedOutScope}. */ public class LoggedOutView extends LinearLayout implements LoggedOutInteractor.LoggedOutPresenter { private Button loginButton;