[] (https://github.com/chenenyu/Router/releases)
A component based router library, featuring simple and flexible.
建议浏览中文wiki.
You should use a version of the Android gradle plugin 2.2 or above to supoort annotation processor. Router
also supports jackandjill toolchain.
- Add dependencies by adding the following lines to your top level
project/build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.x ↑'
classpath 'com.chenenyu.router:gradle-plugin:latest.integration'
}
}
// Optional. Specify the dependencies version, default to the latest version.
ext {
...
routerVersion = "x.y.z"
compilerVersion = "x.y.z"
}
- Apply router plugin in your
app/build.gradle
orlib/build.gradle
:
apply plugin: 'com.android.application/library'
apply plugin: 'com.chenenyu.router'
current router-gradle-plugin
version:
current router-compiler
version:
router-gradle-plugin version | router version | router-compiler version |
---|---|---|
0.1.0 | 0.4.0 | 0.2.0 |
0.2.0 | 0.5.0 | 0.2.0 |
0.3.0 | 0.7.0 | 0.3.0 |
0.4.0 | 0.8.0 | 0.4.0 |
Router
uses annotation to specify the mapping relationship.
@Route("test")
public class TestActivity extends AppCompatActivity {
...
}
Then you can just call Router.build("test").go(context)
to open TestActivity
, so cool! :clap::clap::clap:
If you configured multiple route @Route({"test","wtf"})
, both test
and wtf
can lead to TestActivity
.
The whole api looks like this:
Router.build(uri)
.extras(bundle)
.requestCode(int)
.anim(enter, exit)
.addFlags(int)
.callback(new RouteCallBack() {
@Override
public void succeed(Uri uri) {
Log.i(TAG, "succeed: " + uri.toString());
}
@Override
public void error(Uri uri, String message) {
Log.w(TAG, "error: " + uri + ", " + message);
}
}).go(this);
Please refer to the wiki for more informations.
# Router
-keep class com.chenenyu.router.** {*;}
QQ group: 271849001
SuperAdater: Adapter knife(万能的Adapter).
img-optimizer-gradle-plugin : 一款用于优化png图片的gradle插件.