mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 19:27:25 +01:00
Revert hiding cutout setting from reader sheet
This commit is contained in:
parent
8f26c4bd07
commit
74af40a352
@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader
|
package eu.kanade.tachiyomi.ui.reader
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
@ -85,14 +84,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
|||||||
background_color.bindToPreference(preferences.readerTheme())
|
background_color.bindToPreference(preferences.readerTheme())
|
||||||
show_page_number.bindToPreference(preferences.showPageNumber())
|
show_page_number.bindToPreference(preferences.showPageNumber())
|
||||||
fullscreen.bindToPreference(preferences.fullscreen())
|
fullscreen.bindToPreference(preferences.fullscreen())
|
||||||
|
cutout_short.bindToPreference(preferences.cutoutShort())
|
||||||
val hasDisplayCutout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
|
||||||
activity.window?.decorView?.rootWindowInsets?.displayCutout != null
|
|
||||||
if (hasDisplayCutout) {
|
|
||||||
cutout_short.visible()
|
|
||||||
cutout_short.bindToPreference(preferences.cutoutShort())
|
|
||||||
}
|
|
||||||
|
|
||||||
keepscreen.bindToPreference(preferences.keepScreenOn())
|
keepscreen.bindToPreference(preferences.keepScreenOn())
|
||||||
long_tap.bindToPreference(preferences.readWithLongTap())
|
long_tap.bindToPreference(preferences.readWithLongTap())
|
||||||
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
||||||
|
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.util.preference.intListPreference
|
|||||||
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||||
import eu.kanade.tachiyomi.util.preference.switchPreference
|
import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||||
|
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||||
|
|
||||||
class SettingsReaderController : SettingsController() {
|
class SettingsReaderController : SettingsController() {
|
||||||
|
|
||||||
@ -86,9 +87,7 @@ class SettingsReaderController : SettingsController() {
|
|||||||
defaultValue = true
|
defaultValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val hasDisplayCutout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
if (activity?.hasDisplayCutout() == true) {
|
||||||
activity?.window?.decorView?.rootWindowInsets?.displayCutout != null
|
|
||||||
if (hasDisplayCutout) {
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.cutoutShort
|
key = Keys.cutoutShort
|
||||||
titleRes = R.string.pref_cutout_short
|
titleRes = R.string.pref_cutout_short
|
||||||
|
@ -4,6 +4,7 @@ import android.app.Activity
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
||||||
|
|
||||||
@ -21,3 +22,13 @@ fun Activity.copyToClipboard(label: String, content: String) {
|
|||||||
|
|
||||||
toast(getString(R.string.copied_to_clipboard, content.truncateCenter(50)))
|
toast(getString(R.string.copied_to_clipboard, content.truncateCenter(50)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether if the device has a display cutout (i.e. notch, camera cutout, etc.).
|
||||||
|
*
|
||||||
|
* Only works in Android 9+.
|
||||||
|
*/
|
||||||
|
fun Activity.hasDisplayCutout(): Boolean {
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
||||||
|
window.decorView.rootWindowInsets?.displayCutout != null
|
||||||
|
}
|
||||||
|
@ -132,7 +132,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/pref_cutout_short"
|
android:text="@string/pref_cutout_short"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/fullscreen" />
|
app:layout_constraintTop_toBottomOf="@id/fullscreen" />
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
Loading…
Reference in New Issue
Block a user