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

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