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 99a7f3af2..24092e33b 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 @@ -106,20 +106,15 @@ class MainActivity : BaseActivity() { binding.bottomNav.setOnItemSelectedListener { // clear backstack if it's the start fragment if (startFragmentId == it.itemId) navController.backQueue.clear() - // set menu item on click listeners - removeSearchFocus() - when (it.itemId) { - R.id.homeFragment -> { - navController.navigate(R.id.homeFragment) - } - R.id.subscriptionsFragment -> { - binding.bottomNav.removeBadge(R.id.subscriptionsFragment) - navController.navigate(R.id.subscriptionsFragment) - } - R.id.libraryFragment -> { - navController.navigate(R.id.libraryFragment) - } + + if (it.itemId == R.id.subscriptionsFragment) { + binding.bottomNav.removeBadge(R.id.subscriptionsFragment) } + + removeSearchFocus() + + // navigate to the selected fragment + navController.navigate(it.itemId) false } diff --git a/app/src/main/java/com/github/libretube/util/NavBarHelper.kt b/app/src/main/java/com/github/libretube/util/NavBarHelper.kt index 3a478996e..6190982fa 100644 --- a/app/src/main/java/com/github/libretube/util/NavBarHelper.kt +++ b/app/src/main/java/com/github/libretube/util/NavBarHelper.kt @@ -37,7 +37,8 @@ object NavBarHelper { defaultNavBarItems.add( NavBarItem( it.itemId, - it.title.toString() + it.title.toString(), + it.isEnabled ) ) } diff --git a/app/src/main/res/menu/bottom_menu.xml b/app/src/main/res/menu/bottom_menu.xml index f5badbc88..131a9a0ad 100644 --- a/app/src/main/res/menu/bottom_menu.xml +++ b/app/src/main/res/menu/bottom_menu.xml @@ -5,13 +5,27 @@ android:id="@+id/homeFragment" android:icon="@drawable/ic_home" android:title="@string/startpage" /> + + + + + + \ No newline at end of file