-
Notifications
You must be signed in to change notification settings - Fork 8
Get Started
Rabbits focuses on just one thing, navigation through pages. Maybe Rabbits will support more features like arguments binding or methods invocations later, but for now, Rabbits’s aim is simplify the programing of navigation both through native pages and web pages. Rabbits can be a bridge between native pages and web pages.
Before you can use Rabbits to navigate, you have 3 steps to do.
- import Rabbits in build.gradle:
dependencies {
implementation "com.kyleduo.rabbits:rabbits:1.0.0"
annotationProcessor "com.kyleduo.rabbits:compiler:1.0.0"
}
- Initial Rabbits in Application’s onCreate method
Rabbit.init(RabbitConfig.get()
.schemes("demo")
.domains("rabbits.kyleduo.com")
.debug(true));
If you need add interceptors, handle Fragment navigation or handle navigation fallbacks, you can call addInterceptor(Interceptor)
, registerNavigator(int, Navigator)
and registerFallbackNavigator(Navigator)
following.
- Annotate an Activity with url path.
@Page("/test")
public class TestActivity {}
After these steps, you can navigate using Rabbits. A simple example is like this:
// MainActivity.java
Rabbit.from(this).to(P.P_TEST).start();
This line of code can navigate to TestActivity. Every time when you read this, you will know immediately what does it mean and what it will do.