Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Android Routes beast way to use android intent

Notifications You must be signed in to change notification settings

moh-abdullah-it/android-routes

Repository files navigation

Android Routes

Android Routes library is easy way to use android Intent

Installation

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	implementation 'com.github.moh-abdullah-it:android-routes:0.1.2.0'
}

Usage

  • Create your Route Class
public class Route extends BaseRoute {

    public Route(Context context) {
        super(context);
    }
    /*
     * write routes hear
     */
    ....
}
  • add routes to Route.java example:
    public Route mainActivity() {
        to(MainActivity.class);
        return this;
    }
  • in any place from your project can use route
    Route route;

    route = new Route(this);

    route.mainActivity().start();
  • withData:
    route.mainActivity()
         .withData("id",10)
         .withData("title","activity title")
         .start();
  • check condition before start:
    route.mainActivity()
         .withData("id",10)
         .withData("title","activity title")
         .start(your condition here);
  • start route on click view:
    route.mainActivity()
        .startOnClick(view);
  • check route has data:
    if(route.has("id")){
      //this is true
    }
  • get data from route:
    Int id = route.getInt("id");
    String title = route.getString("title");
  • call phone number:
    route.call("phone number").start()
  • browse url:
    route.url("your url").start()
  • shear text and url:
    route.shareTextUrl("title","url").start()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.