mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Revert hiding cutout setting from reader sheet
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| package eu.kanade.tachiyomi.ui.reader | ||||
|  | ||||
| import android.os.Build | ||||
| import android.os.Bundle | ||||
| import android.widget.CompoundButton | ||||
| import android.widget.Spinner | ||||
| @@ -85,14 +84,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia | ||||
|         background_color.bindToPreference(preferences.readerTheme()) | ||||
|         show_page_number.bindToPreference(preferences.showPageNumber()) | ||||
|         fullscreen.bindToPreference(preferences.fullscreen()) | ||||
|  | ||||
|         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()) | ||||
|         } | ||||
|  | ||||
|         cutout_short.bindToPreference(preferences.cutoutShort()) | ||||
|         keepscreen.bindToPreference(preferences.keepScreenOn()) | ||||
|         long_tap.bindToPreference(preferences.readWithLongTap()) | ||||
|         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.switchPreference | ||||
| import eu.kanade.tachiyomi.util.preference.titleRes | ||||
| import eu.kanade.tachiyomi.util.system.hasDisplayCutout | ||||
|  | ||||
| class SettingsReaderController : SettingsController() { | ||||
|  | ||||
| @@ -86,9 +87,7 @@ class SettingsReaderController : SettingsController() { | ||||
|                 defaultValue = true | ||||
|             } | ||||
|  | ||||
|             val hasDisplayCutout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && | ||||
|                 activity?.window?.decorView?.rootWindowInsets?.displayCutout != null | ||||
|             if (hasDisplayCutout) { | ||||
|             if (activity?.hasDisplayCutout() == true) { | ||||
|                 switchPreference { | ||||
|                     key = Keys.cutoutShort | ||||
|                     titleRes = R.string.pref_cutout_short | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import android.app.Activity | ||||
| import android.content.ClipData | ||||
| import android.content.ClipboardManager | ||||
| import android.content.Context | ||||
| import android.os.Build | ||||
| import eu.kanade.tachiyomi.R | ||||
| 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))) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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:text="@string/pref_cutout_short" | ||||
|         android:textColor="?android:attr/textColorSecondary" | ||||
|         android:visibility="gone" | ||||
|         app:layout_constraintTop_toBottomOf="@id/fullscreen" /> | ||||
|  | ||||
|     <com.google.android.material.switchmaterial.SwitchMaterial | ||||
|   | ||||
		Reference in New Issue
	
	Block a user