From edeee54fb2ebe09466bddd6be0abc64180955fc0 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 5 Jun 2021 09:52:06 -0400 Subject: [PATCH] Set orientation icon correctly when opening reader --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 3 +-- .../java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 95ca41bd6..9570cad65 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -422,8 +422,6 @@ class ReaderActivity : BaseRxActivity() presenter.setMangaOrientationType(newOrientation.flagValue) - updateOrientationShortcut(newOrientation.flagValue) - menuToggleToast?.cancel() menuToggleToast = toast(newOrientation.stringRes) } @@ -792,6 +790,7 @@ class ReaderActivity : BaseRxActivity() if (newOrientation.flag != requestedOrientation) { requestedOrientation = newOrientation.flag } + updateOrientationShortcut(presenter.getMangaOrientationType(resolveDefault = false)) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index e10d8924e..77d7fbecb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/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 } }