|
|
@ -92,7 +92,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(), |
|
|
|
override fun onNavigationItemSelected(item: MenuItem): Boolean = binding.run { |
|
|
|
override fun onNavigationItemSelected(item: MenuItem): Boolean = binding.run { |
|
|
|
when (item.itemId) { |
|
|
|
when (item.itemId) { |
|
|
|
R.id.menu_bookshelf -> viewPagerMain.setCurrentItem(0, false) |
|
|
|
R.id.menu_bookshelf -> viewPagerMain.setCurrentItem(0, false) |
|
|
|
R.id.menu_discovery -> viewPagerMain.setCurrentItem(1, false) |
|
|
|
R.id.menu_discovery -> openPage(idExplore) |
|
|
|
R.id.menu_rss -> openPage(idRss) |
|
|
|
R.id.menu_rss -> openPage(idRss) |
|
|
|
R.id.menu_my_config -> openPage(idMy) |
|
|
|
R.id.menu_my_config -> openPage(idMy) |
|
|
|
} |
|
|
|
} |
|
|
@ -119,9 +119,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun openPage(id: Int) { |
|
|
|
private fun openPage(id: Int) { |
|
|
|
realPositions.firstOrNull { |
|
|
|
realPositions.indexOf(id).let { index -> |
|
|
|
it == id |
|
|
|
|
|
|
|
}?.let { index -> |
|
|
|
|
|
|
|
binding.viewPagerMain.setCurrentItem(index, false) |
|
|
|
binding.viewPagerMain.setCurrentItem(index, false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|