Fixes to free rotation in reader

This commit is contained in:
Jay 2019-11-22 23:18:50 -08:00
parent 10c6d4f8f2
commit 2bb960c24b

View File

@ -202,7 +202,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
if (menuStickyVisible)
setMenuVisibility(false)
else
setMenuVisibility(menuVisible, animate = false)
setMenuVisibility(menuVisible, animate = false)
}
}
@ -303,7 +303,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
*/
private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
menuVisible = visible
coroutine?.cancel()
if (visible) coroutine?.cancel()
if (visible) {
systemUi?.show()
reader_menu.visibility = View.VISIBLE
@ -340,6 +340,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
reader_menu_bottom.startAnimation(bottomAnimation)
}
}
else
reader_menu.visibility = View.GONE
}
menuStickyVisible = false
}
@ -567,8 +569,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
if (visible) {
coroutine = launchUI {
delay(2000)
setMenuVisibility(false)
menuStickyVisible = false
if (systemUi?.isShowing == true) {
menuStickyVisible = false
setMenuVisibility(false)
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
window.navigationBarColor = getColor(android.R.color.transparent)
@ -585,6 +589,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
}
}
else {
if (menuStickyVisible && !menuVisible) {
setMenuVisibility(false, animate = false)
}
coroutine?.cancel()
}
}