Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

added first level of deep linking to demo-app #154

Open
wants to merge 77 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
25cb51c
updated android build tools to 2.2.2
tmtron Nov 7, 2016
81db35d
implemented first level of deep linking
tmtron Nov 7, 2016
104d96e
Filled out @Nullable and @NonNull annotations throughout the library
EricKuck Nov 9, 2016
07a579b
Fixed incorrect child router backstack handling if controllers were V…
EricKuck Nov 9, 2016
9948cb4
Navigation Demos: "GO UP" is hidden in "Controller #0" - closes #158 …
tmtron Nov 9, 2016
803c20e
Added UiThread annotations - closes #145
EricKuck Nov 9, 2016
977db6b
Merge branch 'develop' of github.com:bluelinelabs/Conductor into develop
EricKuck Nov 9, 2016
1118545
Fixed nullable annotations for menu callbacks
EricKuck Nov 9, 2016
db359d9
Un-deprecated getChildRouter with a tag. Fixes #160.
EricKuck Nov 10, 2016
96e068d
Fixes a controller's internal backstack when `setBackstack` is used o…
EricKuck Nov 11, 2016
638b2ad
Version bump
EricKuck Nov 11, 2016
1ba0bf5
the deep link navigation will now also work, when the activity is alr…
tmtron Nov 12, 2016
ae42ee1
Attempted fix for #165
EricKuck Dec 1, 2016
285eb59
add rxlifecycle2 support, fixes #148 (#171)
burntcookie90 Dec 1, 2016
2388fa2
Added a demo for the new RxLifecycle2Controller
EricKuck Dec 1, 2016
95baa8b
Fixes #172
EricKuck Dec 2, 2016
acce9b1
Simplified setRoot implementation
EricKuck Dec 7, 2016
9655170
Fixes tests
EricKuck Dec 7, 2016
7ea4872
Updated ordering of calls in backstack to be in line with other backs…
EricKuck Dec 8, 2016
7334ed5
ControllerPagerAdapter updates to enable using a per-page router if n…
EricKuck Dec 12, 2016
43c825f
- Child backstack is now properly restored when Android kills the pro…
EricKuck Dec 12, 2016
c8640af
Remove saveState option for RouterPagerAdapters, as users can configu…
EricKuck Dec 12, 2016
9cd225e
Controllers now throw an exception when the user forgets to pass fals…
EricKuck Dec 12, 2016
4a814af
Fixes #166
EricKuck Dec 13, 2016
48dc4ab
Version bump
EricKuck Dec 13, 2016
553bae0
Updated readme to include mention of RxLifecycle2
EricKuck Dec 14, 2016
01df673
Switched lint checks to the new PSI based api (closes #184)
EricKuck Dec 15, 2016
09ce640
Fixes #183
EricKuck Dec 15, 2016
54cdc51
Added license to travis.yml
EricKuck Dec 15, 2016
0ac8176
Travis.yml licenses fix
EricKuck Dec 15, 2016
23a4dbb
Travis yml fix
EricKuck Dec 15, 2016
e7c195d
Now internally ensures that ControllerChangeHandlers aren't reused, u…
EricKuck Dec 15, 2016
44ed198
Fixes #185
EricKuck Dec 15, 2016
d15f2b6
Added missing files from e7c195d9105d457abe3a9bba0cc7f525230233a5
EricKuck Dec 16, 2016
27f5275
Now throws an exception when a destroyed controller is pushed in orde…
EricKuck Dec 26, 2016
e390261
Fixes #197
EricKuck Jan 15, 2017
dfb0138
Fixes #199
EricKuck Jan 17, 2017
efbdf91
Fixes #201
EricKuck Jan 18, 2017
77ad6b4
Now sets ClassLoader for view state Bundle - potential fix for #198
EricKuck Jan 18, 2017
2ce8c0a
Version bump
EricKuck Jan 18, 2017
f74f839
Fixes #204 (also mentioned in #199)
EricKuck Jan 19, 2017
f16f7b6
Fixes #205
EricKuck Jan 19, 2017
be40900
#Fixes 206 (#207)
Jan 19, 2017
04d40a5
Minor ViewAttachHandler optimizations
EricKuck Jan 19, 2017
6834df7
Fixes #203
EricKuck Jan 19, 2017
10a1c8a
Version bump
EricKuck Jan 19, 2017
60d0fab
Fixes #208
EricKuck Jan 20, 2017
44bcd0f
Fixes #205
EricKuck Jan 20, 2017
90e015b
Now correctly calls onDetach when the host activity is stopped, even …
EricKuck Feb 1, 2017
690001e
Fixes issue when retrieving an existing controller from a ControllerP…
blazeroni Feb 1, 2017
6ffa94e
Added documentation for @Nullable’s. Fixes #218
EricKuck Feb 1, 2017
a9bdf0d
Revamped how child backtacks are handled to be more reliable with unf…
EricKuck Feb 2, 2017
afa4b69
Version bump
EricKuck Feb 2, 2017
769d552
Fixed typo in lifecycle diagram
EricKuck Feb 2, 2017
f4ef47c
Added missing nullity annotations for the pager adapters (#219)
PaulWoitaschek Feb 2, 2017
314ee2b
Routers now properly remove views of all owned controllers on destroy…
EricKuck Feb 7, 2017
97878b1
List simplification (#225)
PaulWoitaschek Feb 8, 2017
86227ae
TransitionChangeHandler is now much more flexible (doesn’t force you …
EricKuck Feb 14, 2017
df68655
Added missing comments to new methods
EricKuck Feb 14, 2017
a888073
DialogToFabTransition (#229)
nomisRev Feb 16, 2017
c2ad655
Added fade to dialog’s immersive background
EricKuck Feb 16, 2017
0a53b9f
Dependency updates
epool Feb 16, 2017
c4d881a
Added some better shared element demos
EricKuck Feb 17, 2017
7d5cc26
Replaced png icon with vector drawable
EricKuck Feb 17, 2017
d13af31
Dialog background no longer fades out over the top of the outgoing di…
EricKuck Feb 17, 2017
b7611e1
Added a RecyclerView -> RecyclerView shared element transition demo
EricKuck Feb 20, 2017
3d1c2d3
Added startIntentSenderForResult method to controller. Fixes #235
EricKuck Feb 23, 2017
671a117
Added ability to specify the maximum number of pages for which states…
EricKuck Feb 23, 2017
0057782
Moved popToTransaction calls over to use setBackstack internally. Fix…
EricKuck Mar 1, 2017
75ad389
Fixed a few warnings
EricKuck Mar 1, 2017
0df11e3
Build tools updates
EricKuck Mar 3, 2017
893ffc0
Version bump
EricKuck Mar 3, 2017
2b32a30
Version bump
EricKuck Mar 3, 2017
bb8ef1a
implemented first level of deep linking
tmtron Nov 7, 2016
c09003c
the deep link navigation will now also work, when the activity is alr…
tmtron Nov 12, 2016
f952951
updated build tools to 25.0.2
Apr 1, 2017
16a6891
Merge remote-tracking branch 'origin/develop' into develop
Apr 1, 2017
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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ language: android
android:
components:
- tools
- build-tools-23.0.2
- android-23
- build-tools-25.0.0
- android-25
- extra-android-m2repository
licenses:
- '.+'

script:
- ./gradlew test
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ Conductor is architecture-agnostic and does not try to force any design decision
## Installation

```gradle
compile 'com.bluelinelabs:conductor:2.0.3'
compile 'com.bluelinelabs:conductor:2.1.1'

// If you want the components that go along with
// Android's support libraries (currently just a PagerAdapter):
compile 'com.bluelinelabs:conductor-support:2.0.3'
compile 'com.bluelinelabs:conductor-support:2.1.1'

// If you want RxJava/RxAndroid lifecycle support:
compile 'com.bluelinelabs:conductor-rxlifecycle:2.0.3'
// If you want RxJava lifecycle support:
compile 'com.bluelinelabs:conductor-rxlifecycle:2.1.1'

// If you want RxJava2 lifecycle support:
compile 'com.bluelinelabs:conductor-rxlifecycle2:2.1.1'
```

SNAPSHOT:

```gradle
compile 'com.bluelinelabs:conductor:2.0.4-SNAPSHOT'
compile 'com.bluelinelabs:conductor-support:2.0.4-SNAPSHOT'
compile 'com.bluelinelabs:conductor-rxlifecycle:2.0.4-SNAPSHOT'
compile 'com.bluelinelabs:conductor:2.1.2-SNAPSHOT'
compile 'com.bluelinelabs:conductor-support:2.1.2-SNAPSHOT'
compile 'com.bluelinelabs:conductor-rxlifecycle:2.1.2-SNAPSHOT'
compile 'com.bluelinelabs:conductor-rxlifecycle2:2.1.2-SNAPSHOT'
```

You also have to add the url to the snapshot repository:
Expand Down
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.3.0'
}
}

allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
}

task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}

apply from: rootProject.file('dependencies.gradle')
6 changes: 6 additions & 0 deletions conductor-lint/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
apply plugin: 'java'

targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_7

configurations {
lintChecks
}
Expand All @@ -8,6 +11,9 @@ dependencies {
compile rootProject.ext.lintapi
compile rootProject.ext.lintchecks

testCompile rootProject.ext.lint
testCompile rootProject.ext.lintTests

lintChecks files(jar)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
package com.bluelinelabs.conductor.lint;

import com.android.annotations.NonNull;
import com.android.tools.lint.client.api.JavaParser.ResolvedClass;
import com.android.tools.lint.client.api.JavaEvaluator;
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Detector;
import com.android.tools.lint.detector.api.Implementation;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.JavaContext;
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;
import com.android.tools.lint.detector.api.Speed;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;

import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.List;

import lombok.ast.ClassDeclaration;
import lombok.ast.ConstructorDeclaration;
import lombok.ast.Node;
import lombok.ast.NormalTypeBody;
import lombok.ast.StrictListAccessor;
import lombok.ast.TypeMember;
import lombok.ast.VariableDefinition;

public final class ControllerChangeHandlerIssueDetector extends Detector implements Detector.JavaScanner, Detector.ClassScanner {
public final class ControllerChangeHandlerIssueDetector extends Detector implements Detector.JavaPsiScanner {

public static final Issue ISSUE =
Issue.create("ValidControllerChangeHandler", "ControllerChangeHandler not instantiatable",
Expand All @@ -34,67 +25,45 @@ public final class ControllerChangeHandlerIssueDetector extends Detector impleme

public ControllerChangeHandlerIssueDetector() { }

@NonNull
@Override
public Speed getSpeed() {
return Speed.FAST;
}

@Override
public List<String> applicableSuperClasses() {
return Collections.singletonList("com.bluelinelabs.conductor.ControllerChangeHandler");
}

@Override
public void checkClass(@NonNull JavaContext context, ClassDeclaration node,
@NonNull Node declarationOrAnonymous, @NonNull ResolvedClass cls) {

if (node == null) {
public void checkClass(JavaContext context, PsiClass declaration) {
final JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(declaration)) {
return;
}

final int flags = node.astModifiers().getEffectiveModifierFlags();
if ((flags & Modifier.ABSTRACT) != 0) {
if (!evaluator.isPublic(declaration)) {
String message = String.format("This ControllerChangeHandler class should be public (%1$s)", declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
return;
}

if ((flags & Modifier.PUBLIC) == 0) {
String message = String.format("This ControllerChangeHandler class should be public (%1$s)", cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
if (declaration.getContainingClass() != null && !evaluator.isStatic(declaration)) {
String message = String.format("This ControllerChangeHandler inner class should be static (%1$s)", declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
return;
}

if (cls.getContainingClass() != null && (flags & Modifier.STATIC) == 0) {
String message = String.format("This ControllerChangeHandler inner class should be static (%1$s)", cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
return;
}

boolean hasConstructor = false;
boolean hasDefaultConstructor = false;
NormalTypeBody body = node.astBody();
if (body != null) {
for (TypeMember member : body.astMembers()) {
if (member instanceof ConstructorDeclaration) {
hasConstructor = true;
ConstructorDeclaration constructor = (ConstructorDeclaration)member;

if (constructor.astModifiers().isPublic()) {
StrictListAccessor<VariableDefinition, ConstructorDeclaration> params = constructor.astParameters();
if (params.isEmpty()) {
hasDefaultConstructor = true;
break;
}
}
PsiMethod[] constructors = declaration.getConstructors();
for (PsiMethod constructor : constructors) {
if (evaluator.isPublic(constructor)) {
if (constructor.getParameterList().getParametersCount() == 0) {
hasDefaultConstructor = true;
break;
}
}
}

if (hasConstructor && !hasDefaultConstructor) {
if (constructors.length > 0 && !hasDefaultConstructor) {
String message = String.format(
"This ControllerChangeHandler needs to have a public default constructor (`%1$s`)",
cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
"This ControllerChangeHandler needs to have a public default constructor (`%1$s`)", declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
package com.bluelinelabs.conductor.lint;

import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.tools.lint.client.api.JavaParser.ResolvedClass;
import com.android.tools.lint.client.api.JavaEvaluator;
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Detector;
import com.android.tools.lint.detector.api.Implementation;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.JavaContext;
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;
import com.android.tools.lint.detector.api.Speed;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;

import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.List;

import lombok.ast.ClassDeclaration;
import lombok.ast.ConstructorDeclaration;
import lombok.ast.Node;
import lombok.ast.NormalTypeBody;
import lombok.ast.StrictListAccessor;
import lombok.ast.TypeMember;
import lombok.ast.VariableDefinition;

public final class ControllerIssueDetector extends Detector implements Detector.JavaScanner, Detector.ClassScanner {
public final class ControllerIssueDetector extends Detector implements Detector.JavaPsiScanner {

public static final Issue ISSUE =
Issue.create("ValidController", "Controller not instantiatable",
Expand All @@ -35,74 +27,56 @@ public final class ControllerIssueDetector extends Detector implements Detector.

public ControllerIssueDetector() { }

@NonNull
@Override
public Speed getSpeed() {
return Speed.FAST;
}

@Override
public List<String> applicableSuperClasses() {
return Collections.singletonList("com.bluelinelabs.conductor.Controller");
}

@Override
public void checkClass(@NonNull JavaContext context, ClassDeclaration node,
@NonNull Node declarationOrAnonymous, @NonNull ResolvedClass cls) {

if (node == null) {
public void checkClass(JavaContext context, PsiClass declaration) {
final JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(declaration)) {
return;
}

final int flags = node.astModifiers().getEffectiveModifierFlags();
if ((flags & Modifier.ABSTRACT) != 0) {
if (!evaluator.isPublic(declaration)) {
String message = String.format("This Controller class should be public (%1$s)", declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
return;
}

if ((flags & Modifier.PUBLIC) == 0) {
String message = String.format("This Controller class should be public (%1$s)", cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
if (declaration.getContainingClass() != null && !evaluator.isStatic(declaration)) {
String message = String.format("This Controller inner class should be static (%1$s)", declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
return;
}

if (cls.getContainingClass() != null && (flags & Modifier.STATIC) == 0) {
String message = String.format("This Controller inner class should be static (%1$s)", cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
return;
}

boolean hasConstructor = false;
boolean hasDefaultConstructor = false;
boolean hasBundleConstructor = false;
NormalTypeBody body = node.astBody();
if (body != null) {
for (TypeMember member : body.astMembers()) {
if (member instanceof ConstructorDeclaration) {
hasConstructor = true;
ConstructorDeclaration constructor = (ConstructorDeclaration)member;

if (constructor.astModifiers().isPublic()) {
StrictListAccessor<VariableDefinition, ConstructorDeclaration> params = constructor.astParameters();
if (params.isEmpty()) {
hasDefaultConstructor = true;
break;
} else if (params.size() == 1 &&
(params.first().astTypeReference().getTypeName().equals(SdkConstants.CLASS_BUNDLE)) ||
params.first().astTypeReference().getTypeName().equals("Bundle")) {
hasBundleConstructor = true;
break;
}
}
PsiMethod[] constructors = declaration.getConstructors();
for (PsiMethod constructor : constructors) {
if (evaluator.isPublic(constructor)) {
PsiParameter[] parameters = constructor.getParameterList().getParameters();

if (parameters.length == 0) {
hasDefaultConstructor = true;
break;
} else if (parameters.length == 1 &&
parameters[0].getType().equalsToText(SdkConstants.CLASS_BUNDLE) ||
parameters[0].getType().equalsToText("Bundle")) {
hasBundleConstructor = true;
break;
}
}
}

if (hasConstructor && !hasDefaultConstructor && !hasBundleConstructor) {
if (constructors.length > 0 && !hasDefaultConstructor && !hasBundleConstructor) {
String message = String.format(
"This Controller needs to have either a public default constructor or a" +
" public single-argument constructor that takes a Bundle. (`%1$s`)",
cls.getName());
context.report(ISSUE, node, context.getLocation(node.astName()), message);
declaration.getQualifiedName());
context.report(ISSUE, declaration, context.getLocation(declaration), message);
}
}
}
Loading