Bläddra i källkod

Set orientation icon correctly when opening reader

arkon 3 år sedan
förälder
incheckning
edeee54fb2

+ 1 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt

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

+ 4 - 3
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt

@@ -527,10 +527,11 @@ class ReaderPresenter(
     /**
      * 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()
-        return when (manga?.orientationType) {
-            OrientationType.DEFAULT.flagValue -> default
+        val orientation = OrientationType.fromPreference(manga?.orientationType)
+        return when {
+            resolveDefault && orientation == OrientationType.DEFAULT -> default
             else -> manga?.orientationType ?: default
         }
     }