File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
app/src/main/kotlin/com/w2sv/autocrop Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
2323
2424 if (BuildConfig .DEBUG ) {
2525 findNavController(R .id.nav_host_fragment).apply {
26- setStartDestinationBasedOnStartWithCropScreen()
26+ if (savedInstanceState == null && BuildConfig .START_WITH_CROP_SCREEN ) {
27+ inflateGraphWithStartDestination(R .id.crop_nav_graph)
28+ }
2729 setupBackStackLogging(lifecycleScope)
2830 }
2931 }
@@ -40,12 +42,8 @@ private fun NavController.setupBackStackLogging(scope: CoroutineScope) {
4042 }
4143}
4244
43- private fun NavController.setStartDestinationBasedOnStartWithCropScreen () {
44- @Suppress(" KotlinConstantConditions" )
45- if (BuildConfig .START_WITH_CROP_SCREEN ) {
46- val graph = navInflater.inflate(R .navigation.nav_graph).apply {
47- setStartDestination(R .id.crop_nav_graph)
48- }
49- this .graph = graph
45+ private fun NavController.inflateGraphWithStartDestination (destinationId : Int ) {
46+ graph = navInflater.inflate(R .navigation.nav_graph).apply {
47+ setStartDestination(destinationId)
5048 }
5149}
You can’t perform that action at this time.
0 commit comments