mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
add more items to navbar
This commit is contained in:
parent
48b3a916b7
commit
e2eb131069
@ -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
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,8 @@ object NavBarHelper {
|
||||
defaultNavBarItems.add(
|
||||
NavBarItem(
|
||||
it.itemId,
|
||||
it.title.toString()
|
||||
it.title.toString(),
|
||||
it.isEnabled
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -5,13 +5,27 @@
|
||||
android:id="@+id/homeFragment"
|
||||
android:icon="@drawable/ic_home"
|
||||
android:title="@string/startpage" />
|
||||
|
||||
<item
|
||||
android:id="@+id/subscriptionsFragment"
|
||||
android:icon="@drawable/ic_subscriptions"
|
||||
android:title="@string/subscriptions" />
|
||||
|
||||
<item
|
||||
android:id="@+id/libraryFragment"
|
||||
android:icon="@drawable/ic_library"
|
||||
android:title="@string/library" />
|
||||
|
||||
<item
|
||||
android:id="@+id/downloadsFragment"
|
||||
android:icon="@drawable/ic_download_filled"
|
||||
android:title="@string/downloads"
|
||||
android:enabled="false" />
|
||||
|
||||
<item
|
||||
android:id="@+id/watchHistoryFragment"
|
||||
android:icon="@drawable/ic_history_filled"
|
||||
android:title="@string/history"
|
||||
android:enabled="false" />
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user