Made feature persistent, removed option from settings
This commit is contained in:
parent
bcec01c48b
commit
3b7be37268
5 changed files with 4 additions and 26 deletions
|
@ -72,8 +72,6 @@ class PreferencesHelper(val context: Context) {
|
|||
|
||||
fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true)
|
||||
|
||||
fun notchDefaultCutoutMode() = rxPrefs.getBoolean(Keys.isDefaultNotchMode, false)
|
||||
|
||||
fun keepScreenOn() = rxPrefs.getBoolean(Keys.keepScreenOn, true)
|
||||
|
||||
fun customBrightness() = rxPrefs.getBoolean(Keys.customBrightness, false)
|
||||
|
|
|
@ -686,9 +686,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||
subscriptions += preferences.colorFilterMode().asObservable()
|
||||
.subscribe { setColorFilter(preferences.colorFilter().getOrDefault()) }
|
||||
|
||||
subscriptions += preferences.notchDefaultCutoutMode().asObservable()
|
||||
.subscribe { setNotchCutoutMode(preferences.notchDefaultCutoutMode().getOrDefault()) }
|
||||
|
||||
this.setNotchCutoutMode()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -803,12 +801,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||
|
||||
|
||||
/**
|
||||
* Sets notch cutout mode to "DEFAULT" mode if true and "NEVER" mode if false.
|
||||
* In "NEVER" mode the space next to the notch won't be used and filled with a black background.
|
||||
* Sets notch cutout mode to "NEVER", if mobile is in a landscape view
|
||||
*/
|
||||
private fun setNotchCutoutMode(isDefault: Boolean) {
|
||||
private fun setNotchCutoutMode() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
if (!isDefault) {
|
||||
|
||||
val currentOrientation = resources.configuration.orientation
|
||||
|
||||
if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
|
@ -817,7 +814,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||
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 {
|
||||
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_show_page_number">Pokazuj numer strony</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_custom_brightness">Niestandardowa jasność</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_show_page_number">Show page number</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_custom_brightness">Use custom brightness</string>
|
||||
<string name="pref_custom_color_filter">Use custom color filter</string>
|
||||
|
|
Reference in a new issue