Add manga-wised rotation mode settings (#4841)

* Add manga-wised rotation mode settings

Based on #3522

Co-authored-by: bboyz269 <4453811+bboyz269@users.noreply.github.com>

* Fix small mistakes

* Complete TODOs

* Rename functions

rotation -> orientation

* Fix orientation icon not changing

Bug from video

* Fix bug with force portrait not being force if a default value

Bug from video

* Backup viewer_flag as a seperate field in so legacy/forks doesn't crash

* Make viewer_flags nullable so old backups viewer gets restored

* Add migration for old rotation and viewer to new defaults ones

* Rename variable in enums

* Fix migration after OrientationType was changed

* Remove untrue comment

Co-authored-by: bboyz269 <4453811+bboyz269@users.noreply.github.com>
This commit is contained in:
Andreas
2021-04-28 14:32:47 +02:00
committed by GitHub
parent 93e6136795
commit 0fef546a0d
30 changed files with 313 additions and 234 deletions
@@ -5,6 +5,8 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceValues.TappingInvertMode
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.entriesRes
import eu.kanade.tachiyomi.util.preference.intListPreference
@@ -23,7 +25,7 @@ class SettingsReaderController : SettingsController() {
titleRes = R.string.pref_category_reader
intListPreference {
key = Keys.defaultViewer
key = Keys.defaultReadingMode
titleRes = R.string.pref_viewer_type
entriesRes = arrayOf(
R.string.left_to_right_viewer,
@@ -32,8 +34,9 @@ class SettingsReaderController : SettingsController() {
R.string.webtoon_viewer,
R.string.vertical_plus_viewer
)
entryValues = arrayOf("1", "2", "3", "4", "5")
defaultValue = "2"
entryValues = ReadingModeType.values().drop(1)
.map { value -> "${value.flagValue}" }.toTypedArray()
defaultValue = "${ReadingModeType.RIGHT_TO_LEFT.flagValue}"
summary = "%s"
}
intListPreference {
@@ -74,7 +77,7 @@ class SettingsReaderController : SettingsController() {
titleRes = R.string.pref_category_display
intListPreference {
key = Keys.rotation
key = Keys.defaultOrientationType
titleRes = R.string.pref_rotation_type
entriesRes = arrayOf(
R.string.rotation_free,
@@ -83,8 +86,9 @@ class SettingsReaderController : SettingsController() {
R.string.rotation_force_portrait,
R.string.rotation_force_landscape,
)
entryValues = arrayOf("1", "2", "3", "4", "5")
defaultValue = "1"
entryValues = OrientationType.values().drop(1)
.map { value -> "${value.flagValue}" }.toTypedArray()
defaultValue = "${OrientationType.FREE.flagValue}"
summary = "%s"
}
intListPreference {