mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 21:01:51 +01:00
Adding cutout options in reader settings
Also setting default to pad area, cuz people get confused
This commit is contained in:
parent
42d297c02f
commit
3c08b81a94
@ -91,7 +91,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun pageTransitions() = flowPrefs.getBoolean(Keys.enableTransitions, true)
|
||||
|
||||
fun pagerCutoutBehavior() = flowPrefs.getInt(Keys.pagerCutoutBehavior, 1)
|
||||
fun pagerCutoutBehavior() = flowPrefs.getInt(Keys.pagerCutoutBehavior, 0)
|
||||
|
||||
fun doubleTapAnimSpeed() = flowPrefs.getInt(Keys.doubleTapAnimationSpeed, 500)
|
||||
|
||||
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
||||
import eu.kanade.tachiyomi.util.lang.addBetaTag
|
||||
import eu.kanade.tachiyomi.util.view.activityBinding
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
@ -179,6 +180,38 @@ class SettingsReaderController : SettingsController() {
|
||||
entryRange = 1..6
|
||||
defaultValue = 1
|
||||
}
|
||||
|
||||
intListPreference(activity) {
|
||||
key = Keys.pagerCutoutBehavior
|
||||
titleRes = R.string.cutout_area_behavior
|
||||
entriesRes = arrayOf(
|
||||
R.string.pad_cutout_areas,
|
||||
R.string.start_past_cutout,
|
||||
R.string.ignore_cutout_areas,
|
||||
)
|
||||
summaryRes = R.string.cutout_behavior_only_applies
|
||||
entryRange = 0..2
|
||||
defaultValue = 0
|
||||
// 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
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
intListPreference(activity) {
|
||||
key = Keys.zoomStart
|
||||
titleRes = R.string.zoom_start_position
|
||||
|
@ -408,6 +408,7 @@
|
||||
<string name="pad_cutout_areas">Pad cutout areas</string>
|
||||
<string name="start_past_cutout">Start past cutout</string>
|
||||
<string name="ignore_cutout_areas">Ignore cutout areas</string>
|
||||
<string name="cutout_behavior_only_applies">Cutout area behavior only applies in portrait mode with certain scale types</string>
|
||||
<string name="page_layout">Page layout</string>
|
||||
<string name="automatic_can_still_switch">While using automatic page layout, you can still switch between layouts while reading without overriding this setting</string>
|
||||
<string name="automatic_orientation">Automatic (based on orientation)</string>
|
||||
|
Loading…
Reference in New Issue
Block a user