[修复] 切换平板UI后,标签在此次无法正常使用 #352
This commit is contained in:
@@ -139,7 +139,6 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
|||||||
upBottomMenu()
|
upBottomMenu()
|
||||||
initView()
|
initView()
|
||||||
upHomePage()
|
upHomePage()
|
||||||
bindNavigationListener()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@@ -387,7 +386,7 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
|||||||
realPositions[index] = idMy
|
realPositions[index] = idMy
|
||||||
bottomMenuCount = index + 1
|
bottomMenuCount = index + 1
|
||||||
|
|
||||||
binding.viewPagerMain.adapter = TabFragmentPageAdapter(this)
|
binding.viewPagerMain.adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
if (AppConfig.showBottomView) {
|
if (AppConfig.showBottomView) {
|
||||||
window.setNavigationBarColorAuto(themeColor(com.google.android.material.R.attr.colorSurfaceContainer))
|
window.setNavigationBarColorAuto(themeColor(com.google.android.material.R.attr.colorSurfaceContainer))
|
||||||
@@ -460,16 +459,16 @@ open class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun bindNavigationListener() {
|
|
||||||
val navView = getNavigationBarView()
|
|
||||||
navView.setOnItemSelectedListener { onNavigationItemSelected(it) }
|
navView.setOnItemSelectedListener { onNavigationItemSelected(it) }
|
||||||
navView.setOnItemReselectedListener { onNavigationItemReselected(it) }
|
navView.setOnItemReselectedListener { onNavigationItemReselected(it) }
|
||||||
|
|
||||||
binding.viewPagerMain.post {
|
binding.viewPagerMain.post {
|
||||||
binding.viewPagerMain.setCurrentItem(pagePosition, false)
|
val currentPosition = if (pagePosition < bottomMenuCount) pagePosition else 0
|
||||||
getNavigationBarView().menu[pagePosition].isChecked = true
|
binding.viewPagerMain.setCurrentItem(currentPosition, false)
|
||||||
|
getNavigationBarView().menu[currentPosition].isChecked = true
|
||||||
|
updateBackCallbackState()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun upHomePage() {
|
private fun upHomePage() {
|
||||||
|
|||||||
Reference in New Issue
Block a user