Giter Site home page Giter Site logo

lerist / router-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chenenyu/router

0.0 3.0 0.0 1.35 MB

๐Ÿš€๐Ÿš€๐Ÿš€ ไผ˜้›…็š„็ป„ไปถๅŒ–่ทฏ็”ฑๆก†ๆžถ.

License: Apache License 2.0

Java 92.92% Groovy 7.08%

router-2's Introduction

Build Status license [version] (https://github.com/chenenyu/Router/releases) API PullRequest

Router

A component based router library, featuring simple and flexible.

ๅปบ่ฎฎๆต่งˆไธญๆ–‡wiki.

screenshot

Getting started

You should use a version of the Android gradle plugin 2.2 or above to supoort annotation processor.

  • 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 or lib/build.gradle:
apply plugin: 'com.android.application/library'
apply plugin: 'com.chenenyu.router'

current router-gradle-plugin version: Download

current router version: Download

current router-compiler version: compiler

Simple useage

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 configed multiple route @Route({"test","wtf"}), both test and wtf can lead to TestActivity.

Advanced useage

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 infomations.

License

Apache 2.0

router-2's People

Contributors

chenenyu avatar leimsnow avatar

Watchers

James Cloos avatar Lerist avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.