mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-26 23:25:27 +01:00
Made feature persistent, removed option from settings
This commit is contained in:
parent
bcec01c48b
commit
3b7be37268
@ -72,8 +72,6 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true)
|
fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true)
|
||||||
|
|
||||||
fun notchDefaultCutoutMode() = rxPrefs.getBoolean(Keys.isDefaultNotchMode, false)
|
|
||||||
|
|
||||||
fun keepScreenOn() = rxPrefs.getBoolean(Keys.keepScreenOn, true)
|
fun keepScreenOn() = rxPrefs.getBoolean(Keys.keepScreenOn, true)
|
||||||
|
|
||||||
fun customBrightness() = rxPrefs.getBoolean(Keys.customBrightness, false)
|
fun customBrightness() = rxPrefs.getBoolean(Keys.customBrightness, false)
|
||||||
|
@ -686,9 +686,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
subscriptions += preferences.colorFilterMode().asObservable()
|
subscriptions += preferences.colorFilterMode().asObservable()
|
||||||
.subscribe { setColorFilter(preferences.colorFilter().getOrDefault()) }
|
.subscribe { setColorFilter(preferences.colorFilter().getOrDefault()) }
|
||||||
|
|
||||||
subscriptions += preferences.notchDefaultCutoutMode().asObservable()
|
this.setNotchCutoutMode()
|
||||||
.subscribe { setNotchCutoutMode(preferences.notchDefaultCutoutMode().getOrDefault()) }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -803,12 +801,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets notch cutout mode to "DEFAULT" mode if true and "NEVER" mode if false.
|
* Sets notch cutout mode to "NEVER", if mobile is in a landscape view
|
||||||
* In "NEVER" mode the space next to the notch won't be used and filled with a black background.
|
|
||||||
*/
|
*/
|
||||||
private fun setNotchCutoutMode(isDefault: Boolean) {
|
private fun setNotchCutoutMode() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
if (!isDefault) {
|
|
||||||
val currentOrientation = resources.configuration.orientation
|
val currentOrientation = resources.configuration.orientation
|
||||||
|
|
||||||
if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
@ -817,7 +814,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
|
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,18 +88,6 @@ class SettingsReaderController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
||||||
val cutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout
|
|
||||||
|
|
||||||
switchPreference {
|
|
||||||
key = Keys.isDefaultNotchMode
|
|
||||||
titleRes = R.string.pref_notch_display
|
|
||||||
summaryRes = R.string.pref_notch_display_summary
|
|
||||||
defaultValue = false
|
|
||||||
isEnabled = cutout != null // display option only when a mobile has a notch
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.pager_viewer
|
titleRes = R.string.pager_viewer
|
||||||
|
|
||||||
|
@ -215,8 +215,6 @@
|
|||||||
<string name="pref_double_tap_anim_speed">Szybkość podwójnego stuknięcia</string>
|
<string name="pref_double_tap_anim_speed">Szybkość podwójnego stuknięcia</string>
|
||||||
<string name="pref_show_page_number">Pokazuj numer strony</string>
|
<string name="pref_show_page_number">Pokazuj numer strony</string>
|
||||||
<string name="pref_true_color">Kolor 32 bitowy</string>
|
<string name="pref_true_color">Kolor 32 bitowy</string>
|
||||||
<string name="pref_notch_display">Użyj przestrzeni sąsiadującej z notchem</string>
|
|
||||||
<string name="pref_notch_display_summary">Działa tylko w widoku horyzontalnym, tak by notch nachodził na wyświetlaną stronę</string>
|
|
||||||
<string name="pref_crop_borders">Przycinaj krawędzie</string>
|
<string name="pref_crop_borders">Przycinaj krawędzie</string>
|
||||||
<string name="pref_custom_brightness">Niestandardowa jasność</string>
|
<string name="pref_custom_brightness">Niestandardowa jasność</string>
|
||||||
<string name="pref_custom_color_filter">Niestandardowy filtr kolorów</string>
|
<string name="pref_custom_color_filter">Niestandardowy filtr kolorów</string>
|
||||||
|
@ -216,8 +216,6 @@
|
|||||||
<string name="pref_double_tap_anim_speed">Double tap animation speed</string>
|
<string name="pref_double_tap_anim_speed">Double tap animation speed</string>
|
||||||
<string name="pref_show_page_number">Show page number</string>
|
<string name="pref_show_page_number">Show page number</string>
|
||||||
<string name="pref_true_color">32-bit color</string>
|
<string name="pref_true_color">32-bit color</string>
|
||||||
<string name="pref_notch_display">Use space next to the notch</string>
|
|
||||||
<string name="pref_notch_display_summary">Works only for the landscape view for the notch to overlap the displayed page</string>
|
|
||||||
<string name="pref_crop_borders">Crop borders</string>
|
<string name="pref_crop_borders">Crop borders</string>
|
||||||
<string name="pref_custom_brightness">Use custom brightness</string>
|
<string name="pref_custom_brightness">Use custom brightness</string>
|
||||||
<string name="pref_custom_color_filter">Use custom color filter</string>
|
<string name="pref_custom_color_filter">Use custom color filter</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user