Skip to content

Commit

Permalink
Merge pull request #37 from chenenyu/dev
Browse files Browse the repository at this point in the history
1.2.2
  • Loading branch information
chenenyu committed Jul 3, 2017
2 parents 0fe36d7 + 5ef37fc commit 361b067
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 82 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ buildscript {
}
dependencies {
...
classpath 'com.chenenyu.router:gradle-plugin:1.2.1'
classpath 'com.chenenyu.router:gradle-plugin:1.2.2'
}
}
// 可选. 指定版本号.
// 可选配置.
ext {
...
routerVersion = "x.y.z" // 指定特定的router版本
Expand Down
14 changes: 14 additions & 0 deletions Sample/app/src/main/java/com/chenenyu/router/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ public void handle(Map<String, Class<?>> map) {
map.put("dynamic", DynamicActivity.class);
}
});

// Router.handleInterceptorTable(new InterceptorTable() {
// @Override
// public void handle(Map<String, Class<? extends RouteInterceptor>> map) {
// Log.d("InterceptorTable", map.toString());
// }
// });

// Router.handleTargetInterceptors(new TargetInterceptors() {
// @Override
// public void handle(Map<Class<?>, String[]> map) {
// Log.d("TargetInterceptors", map.toString());
// }
// });
}

@Override
Expand Down
152 changes: 79 additions & 73 deletions Sample/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,88 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
android:layout_height="match_parent">

<EditText
android:id="@+id/edit_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="路由地址"
android:minWidth="300dp" />
<LinearLayout
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">

<Button
android:id="@+id/btn0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="跳转到" />
<EditText
android:id="@+id/edit_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="路由地址"
android:minWidth="300dp" />

<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="https://m.baidu.com" />
<Button
android:id="@+id/btn0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="跳转到" />

<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="@string/dynamic_route" />
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="https://m.baidu.com" />

<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="startActivityForResult" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="@string/dynamic_route" />

<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="测试网页链接" />
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="startActivityForResult" />

<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="隐式跳转" />
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="测试网页链接" />

<Button
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="http://example.com/user?id=9527&amp;status=success" />
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="隐式跳转" />

<Button
android:id="@+id/btn7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="打开module1" />
<Button
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="http://example.com/user?id=9527&amp;status=success" />

<Button
android:id="@+id/btn8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="打开module2" />
<Button
android:id="@+id/btn7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="打开module1" />

<Button
android:id="@+id/btn9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="测试自定义拦截器" />
<Button
android:id="@+id/btn8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="打开module2" />

</LinearLayout>
<Button
android:id="@+id/btn9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="测试自定义拦截器" />

</LinearLayout>

</ScrollView>
6 changes: 3 additions & 3 deletions VERSION.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# router gradle plugin version
GRADLE_PLUGIN_VERSION=1.2.1
GRADLE_PLUGIN_VERSION=1.2.2
# router library version
ROUTER_VERSION=1.2.1
ROUTER_VERSION=1.2.2
# compiler library version
COMPILER_VERSION=1.2.1
COMPILER_VERSION=1.2.2
# annotation library version
ANNOTATION_VERSION=0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class RouterPlugin implements Plugin<Project> {
}
}
} else {
String routerVersion = "1.2.1"
String compilerVersion = "1.2.1"
String routerVersion = "1.2.2"
String compilerVersion = "1.2.2"
// org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension
ExtraPropertiesExtension ext = project.rootProject.ext
if (ext.has("routerVersion")) {
Expand Down
4 changes: 2 additions & 2 deletions router/src/main/java/com/chenenyu/router/AptHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AptHub {
private static final String ROUTER_BUILD_INFO = "RouterBuildInfo";
private static final String BUILD_INFO_FIELD = "ALL_MODULES";
private static final String ROUTE_TABLE = "RouteTable";
private static final String INTERCEPTORS = "Interceptors";
private static final String INTERCEPTOR_TABLE = "InterceptorTable";
private static final String TARGET_INTERCEPTORS = "TargetInterceptors";
static final String PARAM_CLASS_SUFFIX = "$$Router$$ParamInjector";

Expand Down Expand Up @@ -88,7 +88,7 @@ synchronized static void init() {
String interceptorName;
for (String moduleName : modules) {
try {
interceptorName = PACKAGE_NAME + DOT + capitalize(moduleName) + INTERCEPTORS;
interceptorName = PACKAGE_NAME + DOT + capitalize(moduleName) + INTERCEPTOR_TABLE;
Class<?> clz = Class.forName(interceptorName);
Constructor constructor = clz.getConstructor();
InterceptorTable instance = (InterceptorTable) constructor.newInstance();
Expand Down

0 comments on commit 361b067

Please sign in to comment.