Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#176: master/detail controller implementation #564

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'develop' into dev/master-detail
# Conflicts:
#	conductor/src/main/java/com/bluelinelabs/conductor/Controller.java
#	conductor/src/main/java/com/bluelinelabs/conductor/RouterTransaction.java
#	conductor/src/test/java/com/bluelinelabs/conductor/ControllerLifecycleActivityReferenceTests.java
#	conductor/src/test/java/com/bluelinelabs/conductor/ControllerLifecycleCallbacksTests.java
  • Loading branch information
sdelaysam committed Apr 5, 2020
commit 926103703896c43cec7926ef0efeb4abdc1793cb
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@
.checkstyle

# IntelliJ IDEA
.idea
*.iml
*.ipr
*.iws
*.idea/dictionaries
classes
gen-external-apklibs

8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Travis Build](https://travis-ci.org/bluelinelabs/Conductor.svg)](https://travis-ci.org/bluelinelabs/Conductor) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Conductor-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/3361) [![Javadocs](http://javadoc.io/badge/com.bluelinelabs/conductor.svg)](http://javadoc.io/doc/com.bluelinelabs/conductor)
[![Travis Build](https://travis-ci.com/bluelinelabs/Conductor.svg)](https://travis-ci.com/bluelinelabs/Conductor) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Conductor-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/3361) [![Javadocs](http://javadoc.io/badge/com.bluelinelabs/conductor.svg)](http://javadoc.io/doc/com.bluelinelabs/conductor)

# Conductor

@@ -20,23 +20,22 @@ Conductor is architecture-agnostic and does not try to force any design decision
## Installation

```gradle
implementation 'com.bluelinelabs:conductor:3.0.0-rc1'
implementation 'com.bluelinelabs:conductor:3.0.0-rc4'

// If you want the components that go along with
// Android's support libraries (currently just a PagerAdapter):
implementation 'com.bluelinelabs:conductor-support:3.0.0-rc1'
// AndroidX Transition change handlers:
implementation 'com.bluelinelabs:conductor-androidx-transition:3.0.0-rc4'

// If you want RxJava lifecycle support:
implementation 'com.bluelinelabs:conductor-rxlifecycle:3.0.0-rc1'
// ViewPager PagerAdapter:
implementation 'com.bluelinelabs:conductor-viewpager:3.0.0-rc4'

// If you want RxJava2 lifecycle support:
implementation 'com.bluelinelabs:conductor-rxlifecycle2:3.0.0-rc1'
// RxJava2 lifecycle support:
implementation 'com.bluelinelabs:conductor-rxlifecycle2:3.0.0-rc4'

// If you want RxJava2 Autodispose support:
implementation 'com.bluelinelabs:conductor-autodispose:3.0.0-rc1'
// RxJava2 Autodispose support:
implementation 'com.bluelinelabs:conductor-autodispose:3.0.0-rc4'

// If you want Controllers that are Lifecycle-aware (architecture components):
implementation 'com.bluelinelabs:conductor-archlifecycle:3.0.0-rc1'
// Lifecycle-aware Controllers (architecture components):
implementation 'com.bluelinelabs:conductor-archlifecycle:3.0.0-rc4'
```

**SNAPSHOT**
@@ -58,7 +57,7 @@ allprojects {
__Controller__ | The Controller is the View wrapper that will give you all of your lifecycle management features. Think of it as a lighter-weight and more predictable Fragment alternative with an easier to manage lifecycle.
__Router__ | A Router implements navigation and backstack handling for Controllers. Router objects are attached to Activity/containing ViewGroup pairs. Routers do not directly render or push Views to the container ViewGroup, but instead defer this responsibility to the ControllerChangeHandler specified in a given transaction.
__ControllerChangeHandler__ | ControllerChangeHandlers are responsible for swapping the View for one Controller to the View of another. They can be useful for performing animations and transitions between Controllers. Several default ControllerChangeHandlers are included.
__ControllerTransaction__ | Transactions are used to define data about adding Controllers. RouterControllerTransactions are used to push a Controller to a Router with specified ControllerChangeHandlers, while ChildControllerTransactions are used to add child Controllers.
__RouterTransaction__ | Transactions are used to define data about adding Controllers. RouterTransactions are used to push a Controller to a Router with specified ControllerChangeHandlers, while ChildControllerTransactions are used to add child Controllers.

## Getting Started

@@ -99,7 +98,7 @@ public class MainActivity extends Activity {
public class HomeController extends Controller {

@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container, @Nullable Bundle savedViewState) {
View view = inflater.inflate(R.layout.controller_home, container, false);
((TextView) view.findViewById(R.id.tv_title)).setText("Hello World");
return view;
@@ -142,7 +141,7 @@ The community has provided several helpful modules to make developing apps with

## License
```
Copyright 2016 BlueLine Labs, Inc.
Copyright 2020 BlueLine Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
24 changes: 23 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
buildscript {

apply from: rootProject.file('dependencies.gradle')

repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

@@ -14,6 +18,24 @@ allprojects {
maven { url 'https://maven.google.com' }
jcenter()
}

plugins.withType(com.android.build.gradle.BasePlugin).configureEach { plugin ->
plugin.extension.compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

tasks.withType(JavaCompile).configureEach { task ->
task.sourceCompatibility = JavaVersion.VERSION_1_8
task.targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile).configureEach { task ->
task.kotlinOptions {
jvmTarget = "1.8"
}
}
}

apply from: rootProject.file('dependencies.gradle')
13 changes: 4 additions & 9 deletions conductor-lint/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
apply plugin: 'java'

targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_7
apply plugin: 'java-library'

configurations {
lintChecks
}

dependencies {
implementation rootProject.ext.lintapi
implementation rootProject.ext.lintchecks
compileOnly rootProject.ext.lintapi
compileOnly rootProject.ext.lintchecks

testImplementation rootProject.ext.lint
testImplementation rootProject.ext.lintTests

lintChecks files(jar)
}

jar {
manifest {
attributes('Lint-Registry': 'com.bluelinelabs.conductor.lint.IssueRegistry')
attributes('Lint-Registry-v2': 'com.bluelinelabs.conductor.lint.IssueRegistry')
}
}

Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.uast.UClass;
import org.jetbrains.uast.UElement;
import org.jetbrains.uast.UMethod;
@@ -18,9 +19,10 @@
import java.util.Collections;
import java.util.List;

@SuppressWarnings("UnstableApiUsage")
public final class ControllerChangeHandlerIssueDetector extends Detector implements Detector.UastScanner {

public static final Issue ISSUE =
static final Issue ISSUE =
Issue.create("ValidControllerChangeHandler", "ControllerChangeHandler not instantiatable",
"Non-abstract ControllerChangeHandler instances must have a default constructor for the"
+ " system to re-create them in the case of the process being killed.",
@@ -41,7 +43,7 @@ public UElementHandler createUastHandler(final JavaContext context) {
return new UElementHandler() {

@Override
public void visitClass(UClass node) {
public void visitClass(@NotNull UClass node) {
if (evaluator.isAbstract(node)) {
return;
}
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.uast.UClass;
import org.jetbrains.uast.UElement;
import org.jetbrains.uast.UMethod;
@@ -20,9 +21,10 @@
import java.util.Collections;
import java.util.List;

@SuppressWarnings("UnstableApiUsage")
public final class ControllerIssueDetector extends Detector implements Detector.UastScanner {

public static final Issue ISSUE =
static final Issue ISSUE =
Issue.create("ValidController", "Controller not instantiatable",
"Non-abstract Controller instances must have a default or single-argument constructor"
+ " that takes a Bundle in order for the system to re-create them in the"
@@ -42,7 +44,7 @@ public UElementHandler createUastHandler(final JavaContext context) {

return new UElementHandler() {
@Override
public void visitClass(UClass node) {
public void visitClass(@NotNull UClass node) {
if (evaluator.isAbstract(node)) {
return;
}
@@ -100,5 +102,5 @@ public void visitClass(UClass node) {
}
};
}

}
Original file line number Diff line number Diff line change
@@ -7,13 +7,15 @@

import static com.android.tools.lint.detector.api.ApiKt.CURRENT_API;

@SuppressWarnings({"unused", "UnstableApiUsage"})
public final class IssueRegistry extends com.android.tools.lint.client.api.IssueRegistry {

@Override
public List<Issue> getIssues() {
return Arrays.asList(
ControllerIssueDetector.ISSUE,
ControllerChangeHandlerIssueDetector.ISSUE);
ControllerChangeHandlerIssueDetector.ISSUE
);
}

@Override
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.