All Projects → st235 → AndroidRouter

st235 / AndroidRouter

Licence: MIT license
Simple way to make navigation in Android Application 🔫

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to AndroidRouter

Androidproject
Android 技术中台,但愿人长久,搬砖不再有
Stars: ✭ 4,398 (+15065.52%)
Mutual labels:  mvp, android-sdk
webtrekk-android-sdk-v5
Webtrekk Android SDK V5
Stars: ✭ 13 (-55.17%)
Mutual labels:  android-sdk
fastglue
Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.
Stars: ✭ 71 (+144.83%)
Mutual labels:  routing
Android-sdk-examples
Примеры работы с Android SDK
Stars: ✭ 27 (-6.9%)
Mutual labels:  android-sdk
powerauth-mobile-sdk
PowerAuth Mobile SDK for adds capability for authentication and transaction signing into the mobile apps (ios, watchos, android).
Stars: ✭ 27 (-6.9%)
Mutual labels:  android-sdk
laroute
Generate Laravel route URLs from JavaScript.
Stars: ✭ 33 (+13.79%)
Mutual labels:  routing
Biometric-Authentication-Android
A sample implementation of AndroidX biometrics API using Kotlin. Authenticate using biometrics or PIN/Password if biometrics isn't available on device. Fully implemented in Jetpack compose using Material 3 dynamic theming and also has a separate implementation in xml with MDC 3.
Stars: ✭ 29 (+0%)
Mutual labels:  android-sdk
MVPFramework
基本框架已搭建出,后续可根据需求增加
Stars: ✭ 29 (+0%)
Mutual labels:  mvp
QueryMovies
This repository shows a Android project with Clean Architecture, Functional Reactive Programming and MVP+Dagger
Stars: ✭ 16 (-44.83%)
Mutual labels:  mvp
vlm
Virtual loup de mer (aka Vlm) is an opensource sailing simulation
Stars: ✭ 25 (-13.79%)
Mutual labels:  routing
MVPDemo
MVP+动态代理的模式框架例子
Stars: ✭ 12 (-58.62%)
Mutual labels:  mvp
Swift-MVP-Sample
It's an iOS simple project that how I implement MVP (Model-View-Presenter) and Clean Architecture in Swift.
Stars: ✭ 27 (-6.9%)
Mutual labels:  mvp
eyepetizer kotlin
一款仿开眼短视频App,分别采用MVP、MVVM两种模式实现。一、组件化 + Kotlin + MVP + RxJava + Retrofit + OkHttp 二、组件化 + Kotlin + MVVM + LiveData + DataBinding + Coroutines + RxJava + Retrofit + OkHttp
Stars: ✭ 83 (+186.21%)
Mutual labels:  mvp
cAndroid
cAndroid is tool for control your PC by Android phone
Stars: ✭ 23 (-20.69%)
Mutual labels:  android-sdk
Router-deprecated
🛣 Simple Navigation for iOS - ⚠️ Deprecated
Stars: ✭ 458 (+1479.31%)
Mutual labels:  routing
easyRNRoute
https://medium.com/@kevinle/comprehensive-routing-and-navigation-in-react-native-made-easy-6383e6cdc293#.nttfeeq3p
Stars: ✭ 25 (-13.79%)
Mutual labels:  routing
routy
Routy is a lightweight high performance HTTP request router for Racket
Stars: ✭ 20 (-31.03%)
Mutual labels:  routing
BBB-routing
🅱🅱🅱-routing - a simulation of Network layer protocols with Byzantine Robustness
Stars: ✭ 15 (-48.28%)
Mutual labels:  routing
wanandroid java
🎨 玩安卓客户端 ,MD + Retrofit + RxJava + MVP + AndroidX
Stars: ✭ 32 (+10.34%)
Mutual labels:  mvp
Android-MonetizeApp
A sample which uses Google's Play Billing Library and it makes In-app Purchases and Subscriptions.
Stars: ✭ 149 (+413.79%)
Mutual labels:  android-sdk

Android Router

Download

Installation

Gradle

implementation 'com.github.st235:android-router:0.1.0'

Maven

<dependency>
  <groupId>com.github.st235</groupId>
  <artifactId>android-router</artifactId>
  <version>0.1.0</version>
  <type>pom</type>
</dependency>

Concepts

We realized that Android-framework needs its own routing system, but there is no unified solution or any unified concepts.So we came up with our design pattern. Routing in Android is not an easy thing. It was suggested to divide all entities into 2 levels of abstraction: depending on the framework (platform satellites) and independent entities - routers.

Platform-specific entities implement specific functions, such as, system messages handling, showing of dialogs, routing between activities & fragments.

How to use

We implemented base router and 2 satellites out of the box. There are activities and fragments satellites and several following commands.

First of all, you need to attach satellite to router.

    private Router router = new BaseRouter();
    private Satellite satellite;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        satellite = new ActivitySatellite(this);
        router.addSatellite(satellite);
    }

Available activity commands

  • start
  • startForResult
  • forwardIntent
  • finish
  • with
  • and (Sugar 🍬)
router.pushCommand(start(SecondaryActivity.class));
router.pushCommand(finishThis(and(start(SecondaryActivity.class))));
Bundle args = new Bundle();
args.putInt("args", 1);
router.pushCommand(start(SecondaryActivity.class, with(args)));

Available fragments commands

  • addToBackStack
  • and (Sugar 🍬)
  • replace
  • add
  • animate
router.pushCommand(replace(new FirstFragment(), null, and(addToBackStack(null))));

System messages show

  • showToast
router.pushCommand(showToast(Toast.LENGTH_SHORT, "Hello world!"));

Note: You can find all usage examples in app folder.

Extension

You can extend your own routing system by one of three ways. The first way is to add new command to existing commands group.

Add command

To add command you need to inherit new one from command group.

Example:

    public final class Start extends ActivityCommand {
        ...
    }
    
    public class Replace extends FragmentCommand {
        ...
    }

If you need more complex functionality to manipulate command stack you can create your own satellite

Add satellite

To add satellite you need to implement satellite interface

public final class ActivitySatellite implements Satellite {
    ...
}

Satellite interface

public interface Satellite {
    /**
     * Get current satellite type.
     * @return unique id for satellite group (for example, activity group).
     */
    int getType();

    /**
     * Execute passed command by satellite.
     * @param command or command chain which contains navigation info.
     */
    void execute(@NonNull Command command);

    /**
     * Checks whether satellite can handle command or not.
     * @param command or command chain which contains navigation info.
     * @return true if satellite can handle command else otherwise.
     */
    boolean isApplicable(@NonNull Command command);
}

And the last one opportunity to add misc functions to router is to write your own custom router.

Add router

To add router you need to implement router interface

public class BaseRouter implements Router {
    ...
}

Router interface

public interface Router {
    void pushCommand(@NonNull Command command);

    void addSatellite(@NonNull Satellite satellite);
    void removeSatellite(@NonNull Satellite satellite);
}

License

MIT License

Copyright (c) 2017-present Alexander Dadukin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].