Set orientation icon correctly when opening reader

(cherry picked from commit edeee54fb2ebe09466bddd6be0abc64180955fc0)
This commit is contained in:
arkon 2021-06-05 09:52:06 -04:00 committed by Jobobby04
parent 89249c9895
commit 9275d9ab55
2 changed files with 5 additions and 5 deletions

View File

@ -540,8 +540,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
presenter.setMangaOrientationType(newOrientation.flagValue) presenter.setMangaOrientationType(newOrientation.flagValue)
updateOrientationShortcut(newOrientation.flagValue)
menuToggleToast?.cancel() menuToggleToast?.cancel()
menuToggleToast = toast(newOrientation.stringRes) menuToggleToast = toast(newOrientation.stringRes)
} }
@ -1351,6 +1349,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
if (newOrientation.flag != requestedOrientation) { if (newOrientation.flag != requestedOrientation) {
requestedOrientation = newOrientation.flag requestedOrientation = newOrientation.flag
} }
updateOrientationShortcut(presenter.getMangaOrientationType(resolveDefault = false))
} }
/** /**

View File

@ -639,10 +639,11 @@ class ReaderPresenter(
/** /**
* Returns the orientation type used by this manga or the default one. * Returns the orientation type used by this manga or the default one.
*/ */
fun getMangaOrientationType(): Int { fun getMangaOrientationType(resolveDefault: Boolean = true): Int {
val default = preferences.defaultOrientationType() val default = preferences.defaultOrientationType()
return when (manga?.orientationType) { val orientation = OrientationType.fromPreference(manga?.orientationType)
OrientationType.DEFAULT.flagValue -> default return when {
resolveDefault && orientation == OrientationType.DEFAULT -> default
else -> manga?.orientationType ?: default else -> manga?.orientationType ?: default
} }
} }