RxRouter
A lightweight, simple, smart and powerful Android routing library.
Getting started
Setting up the dependency
Add to your project build.gradle file:
(Please replace x
and y
and z
with the latest version numbers: )
For Kotlin
you should use kapt
instead of annotationProcessor
Hello World
First add the @url
annotation to the activity we need to route:
Then create a class that is annotated with @Router
to tell RxRouter that there is a router:
This class doesn't need to have any remaining code. RxRouter will automatically generate a RouterProvider
based on the class name of the class. For example, MainRouter
will generate MainRouterProvider
.
Then we need to add these routers to RxRouterProviders
:
Finally, we can start our performance:
Parameters
Routing with parameters:
With the with
method, you can add a series of parameters to this route.
No longer needs the onActivityResult
method
Want to get the value returned by the route? No longer have to write a bunch of onActivityResult
methods! One step in place with RxJava!
If there is a result return, it will be processed in subscribe.
Routing through Class
Do not want to use Url annotations? No problem, RxRouter also supports the original jump of the specified class name, in the same way:
Routing through Action
Similarly, RxRouter also supports system Actions and custom Actions.
Routing through custom Action:
Routing through system action:
Firewall
The RxRouter has a small and powerful firewall that can be intercepted according to firewall rules before routing. You can add one or more firewalls.
License
Copyright 2018 Season.Zlc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.