├── .art ├── modules.png └── navigation_graph.png ├── app ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── 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 │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── layout │ │ │ └── activity_main.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── navigation │ │ │ └── application_nav_graph.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ └── com │ │ │ └── mctech │ │ │ └── single_activity │ │ │ ├── App.kt │ │ │ ├── navigation │ │ │ ├── FeatureTwoNavigationImpl.kt │ │ │ ├── SplashScreenNavigationImpl.kt │ │ │ └── FeatureOneNavigationImpl.kt │ │ │ ├── presentation │ │ │ └── MainActivity.kt │ │ │ └── di │ │ │ ├── DependenciesInitializer.kt │ │ │ └── modules │ │ │ └── NavigatorModule.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── features ├── feature-one │ ├── src │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── mctech │ │ │ │ └── feature │ │ │ │ └── one │ │ │ │ ├── FeatureOneNavigation.kt │ │ │ │ ├── FragmentFeatureOneScreenOne.kt │ │ │ │ └── FragmentFeatureOneScreenTwo.kt │ │ │ └── res │ │ │ ├── values │ │ │ └── strings.xml │ │ │ └── layout │ │ │ ├── fragment_two_feature_one.xml │ │ │ └── fragment_one_feature_one.xml │ └── build.gradle ├── feature-two │ ├── src │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── mctech │ │ │ │ └── feature │ │ │ │ └── two │ │ │ │ ├── FeatureTwoNavigation.kt │ │ │ │ ├── FragmentFeatureTwoScreenTwo.kt │ │ │ │ └── FragmentFeatureTwoScreenOne.kt │ │ │ └── res │ │ │ ├── values │ │ │ └── strings.xml │ │ │ └── layout │ │ │ ├── fragment_one_feature_two.xml │ │ │ └── fragment_two_feature_two.xml │ └── build.gradle └── feature-splashscreen │ ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ └── strings.xml │ │ └── layout │ │ │ └── fragment_splashscreen.xml │ │ └── java │ │ └── com │ │ └── mctech │ │ └── feature │ │ └── splashscreen │ │ ├── SplashScreenNavigation.kt │ │ └── FragmentSplashScreen.kt │ └── build.gradle ├── libraries └── library-shared-architecture │ ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── mctech │ │ └── library │ │ └── shared_architecture │ │ ├── Navigation.kt │ │ ├── BaseNavigator.kt │ │ └── BaseFragmentExample.kt │ └── build.gradle ├── settings.gradle ├── gradle.properties ├── .gitignore ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /.art/modules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/.art/modules.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Single Activity Example 3 | 4 | -------------------------------------------------------------------------------- /.art/navigation_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/.art/navigation_graph.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /features/feature-one/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /features/feature-two/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | library-shared-architecture 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/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/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /features/feature-splashscreen/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MayconCardoso/Modularized-Single-Activity-Navigation/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/MayconCardoso/Modularized-Single-Activity-Navigation/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/MayconCardoso/Modularized-Single-Activity-Navigation/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='Single Activity Example' 2 | 3 | include ':app' 4 | 5 | include ':features:feature-splashscreen' 6 | include ':features:feature-one' 7 | include ':features:feature-two' 8 | 9 | include ':libraries:library-shared-architecture' -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 20 21:51:24 BRST 2019 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-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /features/feature-two/src/main/java/com/mctech/feature/two/FeatureTwoNavigation.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.two 2 | 3 | import com.mctech.library.shared_architecture.Navigation 4 | 5 | /** 6 | * @author MAYCON CARDOSO on 2019-11-21. 7 | */ 8 | interface FeatureTwoNavigation : Navigation{ 9 | fun navigateToScreenTwo() 10 | } -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /features/feature-one/src/main/java/com/mctech/feature/one/FeatureOneNavigation.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.one 2 | 3 | import com.mctech.library.shared_architecture.Navigation 4 | 5 | /** 6 | * @author MAYCON CARDOSO on 2019-11-21. 7 | */ 8 | interface FeatureOneNavigation : Navigation{ 9 | fun navigateToScreenTwo() 10 | fun navigateToFeatureTwo() 11 | } -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/java/com/mctech/library/shared_architecture/Navigation.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.library.shared_architecture 2 | 3 | import androidx.navigation.NavController 4 | 5 | /** 6 | * @author MAYCON CARDOSO on 2019-11-21. 7 | */ 8 | interface Navigation { 9 | fun bind(navController: NavController) 10 | fun unbind() 11 | } -------------------------------------------------------------------------------- /features/feature-splashscreen/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Splash Screen 3 | This is the splash screen 4 | Start feature ONE 5 | Start feature TWO 6 | 7 | -------------------------------------------------------------------------------- /features/feature-one/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | This is the feature ONE - Screen ONE 3 | This is the feature ONE - Screen TWO 4 | Go to feature TWO 5 | Go to screen TWO 6 | 7 | -------------------------------------------------------------------------------- /features/feature-splashscreen/src/main/java/com/mctech/feature/splashscreen/SplashScreenNavigation.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.splashscreen 2 | 3 | import com.mctech.library.shared_architecture.Navigation 4 | 5 | /** 6 | * @author MAYCON CARDOSO on 2019-11-21. 7 | */ 8 | interface SplashScreenNavigation : Navigation{ 9 | fun navigateToFeatureOne() 10 | fun navigateToFeatureTwo() 11 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/App.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity 2 | 3 | import android.app.Application 4 | import com.mctech.single_activity.di.DependenciesInitializer 5 | 6 | /** 7 | * @author MAYCON CARDOSO on 2019-11-21. 8 | */ 9 | class App : Application(){ 10 | override fun onCreate() { 11 | super.onCreate() 12 | DependenciesInitializer.invoke(this) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /libraries/library-shared-architecture/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | dependencies { 6 | implementation globalDependencies.kotlinStdLib 7 | 8 | implementation globalDependencies.appCompact 9 | 10 | implementation globalDependencies.navigationFragment 11 | implementation globalDependencies.navigationFragmentUi 12 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /features/feature-two/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | dependencies { 6 | implementation project(path: submodulesLibraries.sharedArc) 7 | 8 | implementation globalDependencies.kotlinStdLib 9 | implementation globalDependencies.koin 10 | 11 | implementation globalDependencies.appCompact 12 | implementation globalDependencies.constraintlayout 13 | } -------------------------------------------------------------------------------- /features/feature-one/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | dependencies { 6 | implementation project(path: submodulesLibraries.sharedArc) 7 | 8 | implementation globalDependencies.kotlinStdLib 9 | implementation globalDependencies.koin 10 | 11 | implementation globalDependencies.appCompact 12 | implementation globalDependencies.constraintlayout 13 | } 14 | -------------------------------------------------------------------------------- /features/feature-splashscreen/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | dependencies { 6 | implementation project(path: submodulesLibraries.sharedArc) 7 | 8 | implementation globalDependencies.kotlinStdLib 9 | implementation globalDependencies.koin 10 | 11 | implementation globalDependencies.appCompact 12 | implementation globalDependencies.constraintlayout 13 | } -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /features/feature-two/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | feature-two 3 | This is the feature TWO - Screen ONE 4 | This is the feature TWO - Screen TWO 5 | Go to Feature One 6 | Go to screen TWO 7 | If it helped you, please give us a star on Github 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/navigation/FeatureTwoNavigationImpl.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.navigation 2 | 3 | import com.mctech.feature.two.FeatureTwoNavigation 4 | import com.mctech.single_activity.R 5 | 6 | /** 7 | * @author MAYCON CARDOSO on 2019-11-21. 8 | */ 9 | internal class FeatureTwoNavigationImpl : com.mctech.library.shared_architecture.BaseNavigator(), FeatureTwoNavigation { 10 | override fun navigateToScreenTwo() { 11 | navController?.navigate(R.id.action_fragmentFeatureOneScreenOne_to_fragmentFeatureTwoScreenTwo) 12 | } 13 | } -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/java/com/mctech/library/shared_architecture/BaseNavigator.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.library.shared_architecture 2 | 3 | import androidx.navigation.NavController 4 | 5 | /** 6 | * @author MAYCON CARDOSO on 2019-11-21. 7 | */ 8 | abstract class BaseNavigator : Navigation { 9 | protected var navController: NavController? = null 10 | 11 | override fun bind(navController: NavController) { 12 | this.navController = navController 13 | } 14 | 15 | override fun unbind() { 16 | navController = null 17 | } 18 | } -------------------------------------------------------------------------------- /features/feature-two/src/main/java/com/mctech/feature/two/FragmentFeatureTwoScreenTwo.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.two 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-20. 11 | */ 12 | class FragmentFeatureTwoScreenTwo : Fragment() { 13 | override fun onCreateView( 14 | inflater: LayoutInflater, 15 | container: ViewGroup?, 16 | savedInstanceState: Bundle? 17 | ): View? { 18 | return inflater.inflate(R.layout.fragment_two_feature_two, container, false) 19 | } 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/navigation/SplashScreenNavigationImpl.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.navigation 2 | 3 | import com.mctech.feature.splashscreen.SplashScreenNavigation 4 | import com.mctech.single_activity.R 5 | 6 | /** 7 | * @author MAYCON CARDOSO on 2019-11-21. 8 | */ 9 | internal class SplashScreenNavigationImpl : com.mctech.library.shared_architecture.BaseNavigator(), SplashScreenNavigation { 10 | override fun navigateToFeatureOne() { 11 | navController?.navigate(R.id.action_global_feature_one) 12 | } 13 | 14 | override fun navigateToFeatureTwo() { 15 | navController?.navigate(R.id.action_global_feature_two) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/navigation/FeatureOneNavigationImpl.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.navigation 2 | 3 | import com.mctech.feature.one.FeatureOneNavigation 4 | import com.mctech.single_activity.R 5 | 6 | /** 7 | * @author MAYCON CARDOSO on 2019-11-21. 8 | */ 9 | internal class FeatureOneNavigationImpl : com.mctech.library.shared_architecture.BaseNavigator(), FeatureOneNavigation { 10 | override fun navigateToScreenTwo() { 11 | navController?.navigate(R.id.action_fragmentFeatureOneScreenOne_to_fragmentFeatureOneScreenTwo) 12 | } 13 | 14 | override fun navigateToFeatureTwo() { 15 | navController?.navigate(R.id.action_global_feature_two) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/presentation/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.presentation 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.navigation.findNavController 6 | import com.mctech.feature.splashscreen.SplashScreenNavigation 7 | import com.mctech.single_activity.R 8 | import org.koin.android.ext.android.inject 9 | 10 | /** 11 | * @author MAYCON CARDOSO on 2019-11-21. 12 | */ 13 | class MainActivity : AppCompatActivity() { 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | setContentView(R.layout.activity_main) 17 | } 18 | 19 | override fun onSupportNavigateUp(): Boolean { 20 | return findNavController(R.id.application_nav_graph).navigateUp() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/di/DependenciesInitializer.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.di 2 | 3 | import android.app.Application 4 | import com.mctech.single_activity.di.modules.navigatorModule 5 | import org.koin.android.ext.koin.androidContext 6 | import org.koin.android.ext.koin.androidLogger 7 | import org.koin.core.context.startKoin 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-21. 11 | */ 12 | class DependenciesInitializer { 13 | companion object { 14 | operator fun invoke(application: Application) { 15 | startKoin { 16 | androidLogger() 17 | androidContext(application) 18 | modules( 19 | listOf( 20 | navigatorModule 21 | ) 22 | ) 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /features/feature-one/src/main/java/com/mctech/feature/one/FragmentFeatureOneScreenOne.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.one 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import com.mctech.library.shared_architecture.BaseFragmentExample 6 | import kotlinx.android.synthetic.main.fragment_one_feature_one.* 7 | import org.koin.android.ext.android.inject 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-20. 11 | */ 12 | class FragmentFeatureOneScreenOne : BaseFragmentExample() { 13 | override val navigator: FeatureOneNavigation by inject() 14 | 15 | override fun getLayoutResource() = R.layout.fragment_one_feature_one 16 | 17 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 18 | btGoToScreenTwo.setOnClickListener { 19 | navigator.navigateToScreenTwo() 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /features/feature-one/src/main/java/com/mctech/feature/one/FragmentFeatureOneScreenTwo.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.one 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import com.mctech.library.shared_architecture.BaseFragmentExample 6 | import kotlinx.android.synthetic.main.fragment_two_feature_one.* 7 | import org.koin.android.ext.android.inject 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-20. 11 | */ 12 | class FragmentFeatureOneScreenTwo : BaseFragmentExample() { 13 | 14 | override val navigator: FeatureOneNavigation by inject() 15 | 16 | override fun getLayoutResource() = R.layout.fragment_two_feature_one 17 | 18 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 19 | btGoToFeatureTwo.setOnClickListener { 20 | navigator.navigateToFeatureTwo() 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /features/feature-two/src/main/java/com/mctech/feature/two/FragmentFeatureTwoScreenOne.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.two 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import com.mctech.library.shared_architecture.BaseFragmentExample 6 | import kotlinx.android.synthetic.main.fragment_one_feature_two.* 7 | import org.koin.android.ext.android.inject 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-20. 11 | */ 12 | class FragmentFeatureTwoScreenOne : BaseFragmentExample() { 13 | 14 | override val navigator: FeatureTwoNavigation by inject() 15 | 16 | override fun getLayoutResource() = R.layout.fragment_one_feature_two 17 | 18 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 19 | btGoToScreenTwo.setOnClickListener { 20 | navigator.navigateToScreenTwo() 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mctech/single_activity/di/modules/NavigatorModule.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.single_activity.di.modules 2 | 3 | import com.mctech.feature.one.FeatureOneNavigation 4 | import com.mctech.feature.splashscreen.SplashScreenNavigation 5 | import com.mctech.feature.two.FeatureTwoNavigation 6 | import com.mctech.single_activity.navigation.FeatureOneNavigationImpl 7 | import com.mctech.single_activity.navigation.FeatureTwoNavigationImpl 8 | import com.mctech.single_activity.navigation.SplashScreenNavigationImpl 9 | import org.koin.dsl.module 10 | 11 | /** 12 | * @author MAYCON CARDOSO on 2019-11-21. 13 | */ 14 | val navigatorModule = module { 15 | 16 | factory { 17 | SplashScreenNavigationImpl() 18 | } 19 | 20 | factory { 21 | FeatureOneNavigationImpl() 22 | } 23 | 24 | factory { 25 | FeatureTwoNavigationImpl() 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /features/feature-splashscreen/src/main/java/com/mctech/feature/splashscreen/FragmentSplashScreen.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.feature.splashscreen 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import com.mctech.library.shared_architecture.BaseFragmentExample 6 | import kotlinx.android.synthetic.main.fragment_splashscreen.* 7 | import org.koin.android.ext.android.inject 8 | 9 | /** 10 | * @author MAYCON CARDOSO on 2019-11-20. 11 | */ 12 | class FragmentSplashScreen : BaseFragmentExample() { 13 | 14 | override val navigator: SplashScreenNavigation by inject() 15 | 16 | override fun getLayoutResource() = R.layout.fragment_splashscreen 17 | 18 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 19 | btGoFeatureOne.setOnClickListener { 20 | navigator.navigateToFeatureOne() 21 | } 22 | 23 | btGoFeatureTwo.setOnClickListener { 24 | navigator.navigateToFeatureTwo() 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /libraries/library-shared-architecture/src/main/java/com/mctech/library/shared_architecture/BaseFragmentExample.kt: -------------------------------------------------------------------------------- 1 | package com.mctech.library.shared_architecture 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import androidx.navigation.fragment.findNavController 9 | 10 | /** 11 | * @author MAYCON CARDOSO on 2019-11-20. 12 | */ 13 | abstract class BaseFragmentExample