revert: Move back cutout area behaviour

It's meant for "paged" reading mode only, gonna need to investigate more on how to handle the cutout feature
This commit is contained in:
ziro 2024-02-05 12:11:16 +07:00
parent 420d358765
commit 07adedfcb0
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 26 additions and 33 deletions

View file

@ -412,14 +412,6 @@ class BackupRestorer(val context: Context, val notifier: BackupNotifier) {
}
// end j2k fork differences
// <-- yokai
if (key == "cutout_short" && value is BooleanPreferenceValue) {
preferenceStore.getEnum(PreferenceKeys.pagerCutoutBehavior, CutoutBehaviour.SHOW)
.set(if (value.value) CutoutBehaviour.SHOW else CutoutBehaviour.HIDE)
return@forEach
}
// --> yokai
when (value) {
is IntPreferenceValue -> {
if (prefs[key] is Int?) {

View file

@ -126,31 +126,6 @@ class SettingsReaderController : SettingsController() {
titleRes = R.string.show_page_number
defaultValue = true
}
listPreference(activity) {
bindTo(readerPreferences.pagerCutoutBehavior())
titleRes = R.string.cutout_area_behavior
val values = CutoutBehaviour.entries
entriesRes = values.map { it.titleResId }.toTypedArray()
entryValues = values.map { it.name }.toTypedArray().toList()
// Calling this once to show only on cutout
isVisible = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetTop != null ||
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetBottom != null
} else {
false
} && preferences.fullscreen().get()
// Calling this a second time in case activity is recreated while on this page
// Keep the first so it shouldn't animate hiding the preference for phones without
// cutouts
activityBinding?.root?.post {
isVisible = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetTop != null ||
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetBottom != null
} else {
false
} && preferences.fullscreen().get()
}
}
listPreference(activity) {
bindTo(readerPreferences.landscapeCutoutBehavior())
title = "${context.getString(R.string.cutout_area_behavior)} (${context.getString(R.string.landscape)})"
@ -230,6 +205,32 @@ class SettingsReaderController : SettingsController() {
defaultValue = 1
}
listPreference(activity) {
bindTo(readerPreferences.pagerCutoutBehavior())
titleRes = R.string.cutout_area_behavior
val values = CutoutBehaviour.entries
entriesRes = values.map { it.titleResId }.toTypedArray()
entryValues = values.map { it.name }.toTypedArray().toList()
// Calling this once to show only on cutout
isVisible = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetTop != null ||
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetBottom != null
} else {
false
} && preferences.fullscreen().get()
// Calling this a second time in case activity is recreated while on this page
// Keep the first so it shouldn't animate hiding the preference for phones without
// cutouts
activityBinding?.root?.post {
isVisible = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetTop != null ||
activityBinding?.root?.rootWindowInsets?.displayCutout?.safeInsetBottom != null
} else {
false
} && preferences.fullscreen().get()
}
}
switchPreference {
bindTo(preferences.landscapeZoom())
titleRes = R.string.zoom_double_page_spreads