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 extends GameKey> 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 extends GameKey> 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 extends GameKey> 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;