mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
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:
parent
420d358765
commit
07adedfcb0
2 changed files with 26 additions and 33 deletions
|
@ -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?) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue