一款小而美的路由框架

RusCannon 7年前
   <h2>RouterSDK</h2>    <p>RouterSDK is an excellent Router Framwork ,it is easy to integrate in your project. You can start an application through the web page by the custom parameters. In addition, it can also provides a number of useful features such as dynamic routing configuration, jump animation, task station, jump pretreatment, etc.</p>    <h2>Screenshot</h2>    <p><img src="https://simg.open-open.com/show/4954f98c523bde20c0623777a64921c2.gif"></p>    <h2>Build</h2>    <p>Step 1. Add the JitPack repository to your build file</p>    <p>add the JitPack maven to your project in root build.gradle</p>    <pre>  <code class="language-java">allprojects {      repositories {          maven { url 'https://jitpack.io' }      }  }</code></pre>    <p>Step 2. Add module dependency build.gradle</p>    <pre>  <code class="language-java">dependencies {       compile 'com.github.Jomes:routerSDK:v1.0.3-alpha'   }</code></pre>    <p>That's it!</p>    <h2>How to use</h2>    <p>init RouteTable in application</p>    <pre>  <code class="language-java">Router.initRouteTable(new IRouteTableMapping() {         @Override         public void operaRouterTable(Map<String, Class<? extends Activity>> map) {             map.put("jomeslu://www", OneActivity.class);             map.put("jomeslu://loginactivity", LoginActivity.class);         }   });</code></pre>    <p>Router Jump page</p>    <pre>  <code class="language-java">Router.build("http://androidblog.cn/index.php/Source").start(MainActivity.this);</code></pre>    <p>Definition Of type</p>    <ul>     <li>Scheme:suggest to define application name which router to use</li>     <li>Host: suggest to define page where to go, such activity</li>     <li>path : Transfer parameter,customer type</li>    </ul>    <table>     <thead>      <tr>       <th>key format</th>       <th>{i:ikey}</th>       <th>{f:key}</th>       <th>{l:key}</th>       <th>{d:key}</th>       <th>{s:key}</th>       <th>{b:key}</th>      </tr>     </thead>     <tbody>      <tr>       <td>type</td>       <td>integer</td>       <td>float</td>       <td>long</td>       <td>double</td>       <td>string</td>       <td>boolean</td>      </tr>     </tbody>    </table>    <p>eg :From A page to B page use url :jomeslu://www?{i:id}=168&{s:jomeslu}=jomeslu</p>    <p>A page</p>    <pre>  <code class="language-java">Router.build("jomeslu://www?{i:id}=168&{s:jomeslu}=jomeslu").setIRouteInterceptor(new IRouteInterceptor() {          @Override          public boolean interceptor() {             Router.build("jomeslu://loginactivity?{i:id}=168&{s:jomeslu}=jomeslu").start(MainActivity.this);             Toast.makeText(MainActivity.this, "login...", Toast.LENGTH_LONG).show();              return true;          }   }).start(MainActivity.this);;</code></pre>    <p>B Page Receive parameter as normal</p>    <pre>  <code class="language-java">String jomeslu = getIntent().getStringExtra("jomeslu");    int id = getIntent().getIntExtra("id", -1);</code></pre>    <h2>License</h2>    <ul>     <li><a href="/misc/goto?guid=4958532747981099206" rel="nofollow,noindex">Apache Version 2.0</a></li>    </ul>    <p> </p>    <p> </p>