From 7a31d9d93111faf206a8619dc01fd348c47483fe Mon Sep 17 00:00:00 2001 From: GilesMunn Date: Sat, 5 Nov 2022 19:16:28 +0000 Subject: [PATCH] Moved intent reading into loadIntentData() --- .../libretube/ui/activities/MainActivity.kt | 17 ++++++----------- app/src/main/res/xml/shortcuts.xml | 10 +++++----- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt index 4e6ed0b27..37621b826 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt @@ -108,17 +108,6 @@ class MainActivity : BaseActivity() { // navigate to the default fragment navController.navigate(startFragmentId) - // open appropriate fragment from shortcut - when (intent.extras?.getString("fragmentToOpen")) { - "subscriptions" -> - navController.navigate(R.id.subscriptionsFragment) - "library" -> - navController.navigate(R.id.libraryFragment) - else -> { - return - } - } - binding.bottomNav.setOnApplyWindowInsetsListener(null) binding.bottomNav.setOnItemSelectedListener { @@ -360,6 +349,12 @@ class MainActivity : BaseActivity() { intent?.getStringExtra(IntentData.videoId)?.let { loadVideo(it, intent?.getLongExtra(IntentData.timeStamp, 0L)) } + when (intent?.getStringExtra("fragmentToOpen")) { + "subscriptions" -> + navController.navigate(R.id.subscriptionsFragment) + "library" -> + navController.navigate(R.id.libraryFragment) + } } private fun loadVideo(videoId: String, timeStamp: Long?) { diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml index e13b529e8..8df6da32b 100644 --- a/app/src/main/res/xml/shortcuts.xml +++ b/app/src/main/res/xml/shortcuts.xml @@ -9,7 +9,7 @@ android:shortcutShortLabel="@string/startpage"> - + - + \ No newline at end of file