mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
fix fragment order
This commit is contained in:
parent
b7d9d510f6
commit
9f6341ee1e
@ -81,6 +81,7 @@ class MainActivity : AppCompatActivity() {
|
||||
} else {
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||
|
||||
navController = findNavController(R.id.fragment)
|
||||
@ -91,13 +92,20 @@ class MainActivity : AppCompatActivity() {
|
||||
if (hideTrendingPage) binding.bottomNav.menu.findItem(R.id.homeFragment).isVisible =
|
||||
false
|
||||
|
||||
// navigate to the default start tab
|
||||
when (PreferenceHelper.getString(this, "default_tab", "home")) {
|
||||
"home" -> navController.navigate(R.id.homeFragment)
|
||||
"subscriptions" -> navController.navigate(R.id.subscriptionsFragment)
|
||||
"library" -> navController.navigate(R.id.libraryFragment)
|
||||
// save start tab fragment id
|
||||
val fragmentId = when (PreferenceHelper.getString(this, "default_tab", "home")) {
|
||||
"home" -> R.id.homeFragment
|
||||
"subscriptions" -> R.id.subscriptionsFragment
|
||||
"library" -> R.id.libraryFragment
|
||||
else -> R.id.homeFragment
|
||||
}
|
||||
|
||||
// set default tab as start fragment
|
||||
navController.graph.setStartDestination(fragmentId)
|
||||
|
||||
// navigate to the default fragment
|
||||
navController.navigate(fragmentId)
|
||||
|
||||
binding.bottomNav.setOnItemSelectedListener {
|
||||
when (it.itemId) {
|
||||
R.id.homeFragment -> {
|
||||
|
Loading…
Reference in New Issue
Block a user