Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b8fbd4

Browse files
author
wangshuwen15222
committed
chore:update readme
1 parent 687272b commit 3b8fbd4

File tree

12 files changed

+64
-46
lines changed

12 files changed

+64
-46
lines changed

README.md

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
![](media/XRouter.png)
22

33
# XRRouter
4+
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://www.apache.org/licenses/LICENSE-2.0)
45

56
#### 最新版本
67

7-
| 模块 | xrouter_annotation | xrouter_complier|xrouter_core|
8-
| ------------ | ------------ | ------------ | ------------ |
9-
| 最新版本 | 1.0.5| 1.0.5 |1.0.5 |
10-
11-
8+
| 模块 | xrouter-annotation | xrouter-compiler|xrouter-core|xrouter-plugin|
9+
| ------------ | ------------ | ------------ | ------------ |------------ |
10+
| 最新版本 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-annotation/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-annotation) |[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-compiler/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-compiler) |[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-core) |[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.wangshuwen1107/xrouter-plugin)|
1211

1312
#### 添加依赖和配置
1413

@@ -19,18 +18,30 @@ allprojects {
1918
repositories {
2019
mavenCentral()
2120
}
21+
dependencies {
22+
classpath "io.github.wangshuwen1107:xrouter-plugin:x.x.x"
23+
}
2224
}
2325
```
2426

2527
2.module build.gradle
2628

2729
```gradle
2830
dependencies {
29-
implementation 'cn.cheney.xrouter:core:x.x.x'
30-
annotationProcessor 'cn.cheney.xrouter:compiler:x.x.x'
31+
implementation 'io.github.wangshuwen1107:xrouter-core:x.x.x'
32+
annotationProcessor 'io.github.wangshuwen1107:xrouter-compiler:x.x.x'
3133
}
3234
```
3335

36+
3.application build.gradle
37+
38+
```gradle
39+
apply plugin: 'XRouter'
40+
```
41+
42+
43+
44+
3445
#### 功能&说明
3546

3647
url : `scheme://moduleName/methodName?key=value`
@@ -47,31 +58,13 @@ public class App extends Application {
4758

4859
@Override
4960
public void onCreate() {
50-
super.onCreate();
51-
//初始化
52-
XRouter.init(this, "scheme");
53-
//增加拦截器
54-
XRouter.getInstance().addInterceptor(new RouterInterceptor() {
55-
@Override
56-
public Invokable intercept(Chain chain) {
57-
BaseCall call = chain.call();
58-
String urlStr = call.getUri().toString();
59-
Logger.d(" RouterInterceptor urlStr=" + urlStr);
60-
return chain.proceed(call);
61-
}
62-
});
63-
//全局路由错误处理
64-
XRouter.getInstance().setErroHandler(new RouterErrorHandler() {
65-
@Override
66-
public void onError(String url, String errorMsg) {
67-
Logger.e("Url:" + url + " errorMsg:" + errorMsg);
68-
}
69-
});
61+
super.onCreate();
62+
XRouter.init(this, "scheme");
7063
}
7164
}
7265
```
7366

74-
2.注解
67+
2.路由注册
7568

7669
```java
7770
@XRoute(path = "pageName", module = "moduleName")
@@ -105,7 +98,24 @@ public class YourModule{
10598
}
10699
```
107100

108-
3.调用
101+
3.拦截器注册
102+
103+
```java
104+
@XInterceptor(modules = {"moduleA"}, priority = 1)
105+
public class TestInterceptorA implements RouterInterceptor {
106+
107+
@Override
108+
public Object intercept(Chain chain) {
109+
Logger.d("TestInterceptorA url=" + chain.call().getUri().toString());
110+
return chain.proceed();
111+
}
112+
113+
}
114+
```
115+
116+
117+
118+
4.路由调用
109119

110120
```java
111121
//跳转界面

TODO.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1.路由跳转的成功失败回调
2+
2.编译路由扫描文档生成
3+
3.fragment支持
4+
5+

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
implementation project(":xrouter_core")
4646
annotationProcessor project(':xrouter_compiler')
4747
} else {
48-
implementation "io.github.wangshuwen1107:xrouter-core:$sdkVersion"
49-
annotationProcessor "io.github.wangshuwen1107:xrouter-compiler:$sdkVersion"
48+
implementation "io.github.wangshuwen1107:xrouter-core:$coreVersion"
49+
annotationProcessor "io.github.wangshuwen1107:xrouter-compiler:$compilerVersion"
5050
}
5151
}

app/src/main/java/cn/cheney/app/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) {
5555
book.name = "Kotlin";
5656
XRouter.<Book>method("moduleA/setBookInfo?info={\"key\":{\"name\":\"wang\"}}")
5757
.put("book", book).call(result ->
58-
AlertUtil.showAlert(MainActivity.this, result.toString()));
58+
AlertUtil.showAlert(MainActivity.this, result==null?"null":result.toString()));
5959
});
6060

6161

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
1010
}
1111
dependencies {
12-
classpath "io.github.wangshuwen1107:xrouter-plugin:$sdkVersion"
12+
classpath "io.github.wangshuwen1107:xrouter-plugin:$pluginVersion"
1313
classpath 'com.android.tools.build:gradle:3.3.2'
1414
}
1515
}

gradle.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ android.useAndroidX=true
1818
# Automatically convert third-party libraries to use AndroidX
1919
android.enableJetifier=true
2020

21-
debug = true
22-
sdkVersion = 1.0.5.4
21+
debug = false
22+
pluginVersion = 1.0.6
23+
annotationVersion = 1.0.6
24+
compilerVersion = 1.0.7
25+
coreVersion = 1.0.7

m_test/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
implementation project(":xrouter_core")
3737
annotationProcessor project(':xrouter_compiler')
3838
} else {
39-
implementation "io.github.wangshuwen1107:xrouter-core:$sdkVersion"
40-
annotationProcessor "io.github.wangshuwen1107:xrouter-compiler:$sdkVersion"
39+
implementation "io.github.wangshuwen1107:xrouter-core:$coreVersion"
40+
annotationProcessor "io.github.wangshuwen1107:xrouter-compiler:$compilerVersion"
4141
}
4242
}

m_test/src/main/java/cn/cheney/mtest/module/ModuleA.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ModuleA {
2121
public static Book getBookName(Context context) {
2222
Log.i(TAG, "getBookName context=" + context);
2323
Book book = new Book();
24-
book.name = "从入门到放弃";
24+
book.name = "kotlin";
2525
return book;
2626
}
2727

xrouter_annotation/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'java-library'
33
ext {
44
PUBLISH_GROUP_ID = "io.github.wangshuwen1107"
55
PUBLISH_ARTIFACT_ID = 'xrouter-annotation'
6-
PUBLISH_VERSION = "$sdkVersion"
6+
PUBLISH_VERSION = "$annotationVersion"
77
}
88
apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
99

xrouter_compiler/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'java-library'
33
ext {
44
PUBLISH_GROUP_ID = "io.github.wangshuwen1107"
55
PUBLISH_ARTIFACT_ID = 'xrouter-compiler'
6-
PUBLISH_VERSION = "$sdkVersion"
6+
PUBLISH_VERSION = "$coreVersion"
77
}
88
apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
99

@@ -16,7 +16,7 @@ dependencies {
1616
if (debug == "true") {
1717
implementation project(":xrouter_annotation")
1818
} else {
19-
implementation "io.github.wangshuwen1107:xrouter-annotation:$sdkVersion"
19+
implementation "io.github.wangshuwen1107:xrouter-annotation:$annotationVersion"
2020
}
2121
compileOnly 'com.google.auto.service:auto-service-annotations:1.0-rc7'
2222
implementation 'com.squareup:javapoet:1.10.0'

0 commit comments

Comments
 (0)