├── app ├── .gitignore ├── .DS_Store ├── src │ ├── .DS_Store │ └── main │ │ ├── .DS_Store │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── anim │ │ │ ├── slide_in.xml │ │ │ └── slide_out.xml │ │ ├── drawable │ │ │ ├── ic_home_black_24dp.xml │ │ │ ├── ic_dashboard_black_24dp.xml │ │ │ └── ic_notifications_black_24dp.xml │ │ ├── layout │ │ │ ├── fragment_first.xml │ │ │ ├── fragment_second.xml │ │ │ ├── fragment_third.xml │ │ │ ├── activity_secondary.xml │ │ │ └── activity_main.xml │ │ └── menu │ │ │ └── navigation.xml │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── sasd97 │ │ │ └── android_router │ │ │ ├── FirstFragment.java │ │ │ ├── ThirdFragment.java │ │ │ ├── SecondFragment.java │ │ │ ├── SecondaryActivity.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── lib-router ├── .gitignore ├── .DS_Store ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── sasd97 │ │ │ └── lib_router │ │ │ ├── satellites │ │ │ ├── SatelliteTypes.java │ │ │ ├── Satellite.java │ │ │ ├── ActivitySatellite.java │ │ │ ├── ToastSatellite.java │ │ │ └── FragmentSatellite.java │ │ │ ├── commands │ │ │ ├── Command.java │ │ │ ├── messages │ │ │ │ ├── MessageCommand.java │ │ │ │ ├── Message.java │ │ │ │ └── ShowToast.java │ │ │ ├── activities │ │ │ │ ├── Back.java │ │ │ │ ├── And.java │ │ │ │ ├── ActivityCommand.java │ │ │ │ ├── ForwardIntent.java │ │ │ │ ├── FinishThis.java │ │ │ │ ├── Start.java │ │ │ │ └── StartForResult.java │ │ │ ├── CommandDecorator.java │ │ │ ├── fragments │ │ │ │ ├── And.java │ │ │ │ ├── FragmentCommand.java │ │ │ │ ├── AddToBackStack.java │ │ │ │ ├── Add.java │ │ │ │ ├── WithCustomAnimation.java │ │ │ │ └── Replace.java │ │ │ └── providers │ │ │ │ ├── ProviderCommand.java │ │ │ │ └── With.java │ │ │ ├── exceptions │ │ │ ├── SatelliteNotAttachedException.java │ │ │ └── CommandNotSupportedException.java │ │ │ ├── Router.java │ │ │ └── BaseRouter.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── .DS_Store ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── gradlew.bat ├── CODE_OF_CONDUCT.md ├── gradlew └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib-router/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':lib-router' 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/.DS_Store -------------------------------------------------------------------------------- /app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/.DS_Store -------------------------------------------------------------------------------- /app/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/.DS_Store -------------------------------------------------------------------------------- /lib-router/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/lib-router/.DS_Store -------------------------------------------------------------------------------- /app/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/.DS_Store -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /lib-router/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | lib-router 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/st235/AndroidRouter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/satellites/SatelliteTypes.java: -------------------------------------------------------------------------------- 1 | package com.github.sasd97.lib_router.satellites; 2 | 3 | @interface SatelliteTypes { 4 | int ACTIVITY = 0; 5 | int FRAGMENT = 1; 6 | int TOAST = 2; 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 22 00:47:22 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/Command.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands; 5 | 6 | /** 7 | * Navigation command. 8 | */ 9 | public interface Command { 10 | } 11 | -------------------------------------------------------------------------------- /lib-router/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | android-router 3 | SecondaryActivity 4 | Home 5 | Dashboard 6 | Notifications 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dashboard_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_first.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_third.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/messages/MessageCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands.messages; 5 | 6 | import com.github.sasd97.lib_router.commands.Command; 7 | 8 | /** 9 | * System messages command. 10 | * Can provide messages. 11 | */ 12 | public abstract class MessageCommand implements Command { 13 | public abstract Message getMessage(); 14 | } 15 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/activities/Back.java: -------------------------------------------------------------------------------- 1 | package com.github.sasd97.lib_router.commands.activities; 2 | 3 | import android.app.Activity; 4 | import android.support.annotation.NonNull; 5 | 6 | public class Back extends ActivityCommand { 7 | 8 | private Back() { 9 | } 10 | 11 | public static Back back() { 12 | return new Back(); 13 | } 14 | 15 | @Override 16 | public void apply(@NonNull Activity activity) { 17 | activity.onBackPressed(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/exceptions/SatelliteNotAttachedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.exceptions; 5 | 6 | /** 7 | * Throws when router cannot handle passed command by its satellites set. 8 | */ 9 | public class SatelliteNotAttachedException extends RuntimeException { 10 | 11 | public SatelliteNotAttachedException() { 12 | super("There is no active satellite attached to router"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/CommandDecorator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands; 5 | 6 | import android.support.annotation.NonNull; 7 | 8 | /** 9 | * {@link Command} wrapper. Helps chain commands. 10 | * @param command group. 11 | */ 12 | public abstract class CommandDecorator implements Command { 13 | 14 | protected T command; 15 | 16 | protected CommandDecorator() { 17 | } 18 | 19 | public CommandDecorator(@NonNull T command) { 20 | this.command = command; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/menu/navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/sasd97/android_router/FirstFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.sasd97.android_router; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * Created by alexander on 06/09/2017. 12 | */ 13 | 14 | public class FirstFragment extends Fragment { 15 | 16 | @Nullable 17 | @Override 18 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 19 | return inflater.inflate(R.layout.fragment_first, container, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/sasd97/android_router/ThirdFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.sasd97.android_router; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * Created by alexander on 06/09/2017. 12 | */ 13 | 14 | public class ThirdFragment extends Fragment { 15 | 16 | @Nullable 17 | @Override 18 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 19 | return inflater.inflate(R.layout.fragment_third, container, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/sasd97/android_router/SecondFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.sasd97.android_router; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * Created by alexander on 06/09/2017. 12 | */ 13 | 14 | public class SecondFragment extends Fragment { 15 | 16 | @Nullable 17 | @Override 18 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 19 | return inflater.inflate(R.layout.fragment_second, container, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/activities/And.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands.activities; 5 | 6 | import android.app.Activity; 7 | import android.support.annotation.NonNull; 8 | 9 | public final class And extends ActivityCommand { 10 | 11 | private And(@NonNull ActivityCommand command) { 12 | super(command); 13 | } 14 | 15 | public static And and(@NonNull ActivityCommand command) { 16 | return new And(command); 17 | } 18 | 19 | @Override 20 | public void apply(@NonNull Activity activity) { 21 | command.apply(activity); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/activities/ActivityCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands.activities; 5 | 6 | import android.app.Activity; 7 | import android.support.annotation.NonNull; 8 | 9 | import com.github.sasd97.lib_router.commands.CommandDecorator; 10 | 11 | public abstract class ActivityCommand extends CommandDecorator { 12 | 13 | protected ActivityCommand() { 14 | } 15 | 16 | protected ActivityCommand(@NonNull ActivityCommand command) { 17 | super(command); 18 | } 19 | 20 | public abstract void apply(@NonNull Activity activity); 21 | } 22 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/exceptions/CommandNotSupportedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.exceptions; 5 | 6 | import android.support.annotation.NonNull; 7 | 8 | import java.util.Locale; 9 | 10 | /** 11 | * Throws when satellite try to execute command, which is not applicable to it. 12 | */ 13 | public final class CommandNotSupportedException extends RuntimeException { 14 | 15 | public CommandNotSupportedException(@NonNull String group) { 16 | super( 17 | String.format(Locale.US, "Your type is not supported. Command must follow \'%1$s\' group.", group) 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib-router/src/main/java/com/github/sasd97/lib_router/commands/messages/Message.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 by Alexander Dadukin (st235@yandex.ru) 2 | // All rights reserved. 3 | 4 | package com.github.sasd97.lib_router.commands.messages; 5 | 6 | /** 7 | * Platform independent representation of system messages. 8 | */ 9 | public final class Message { 10 | 11 | private int duration; 12 | private String message; 13 | 14 | public int getDuration() { 15 | return duration; 16 | } 17 | 18 | public void setDuration(int duration) { 19 | this.duration = duration; 20 | } 21 | 22 | public String getMessage() { 23 | return message; 24 | } 25 | 26 | public void setMessage(String message) { 27 | this.message = message; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |