|
|
@ -91,10 +91,14 @@ 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 -> |
|
|
|
R.id.menu_discovery -> openPage(idExplore) |
|
|
|
viewPagerMain.setCurrentItem(0, false) |
|
|
|
R.id.menu_rss -> openPage(idRss) |
|
|
|
R.id.menu_discovery -> |
|
|
|
R.id.menu_my_config -> openPage(idMy) |
|
|
|
viewPagerMain.setCurrentItem(realPositions.indexOf(idExplore), false) |
|
|
|
|
|
|
|
R.id.menu_rss -> |
|
|
|
|
|
|
|
viewPagerMain.setCurrentItem(realPositions.indexOf(idRss), false) |
|
|
|
|
|
|
|
R.id.menu_my_config -> |
|
|
|
|
|
|
|
viewPagerMain.setCurrentItem(realPositions.indexOf(idMy), false) |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
@ -118,12 +122,6 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun openPage(id: Int) { |
|
|
|
|
|
|
|
realPositions.indexOf(id).let { index -> |
|
|
|
|
|
|
|
binding.viewPagerMain.setCurrentItem(index, false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun upVersion() { |
|
|
|
private fun upVersion() { |
|
|
|
if (LocalConfig.versionCode != appInfo.versionCode) { |
|
|
|
if (LocalConfig.versionCode != appInfo.versionCode) { |
|
|
|
LocalConfig.versionCode = appInfo.versionCode |
|
|
|
LocalConfig.versionCode = appInfo.versionCode |
|
|
|