mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Hide reader cutout setting if no cutout detected
This commit is contained in:
		| @@ -85,10 +85,14 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia | ||||
|         background_color.bindToPreference(preferences.readerTheme()) | ||||
|         show_page_number.bindToPreference(preferences.showPageNumber()) | ||||
|         fullscreen.bindToPreference(preferences.fullscreen()) | ||||
|         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | ||||
|  | ||||
|         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()) | ||||
|         long_tap.bindToPreference(preferences.readWithLongTap()) | ||||
|         always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition()) | ||||
|   | ||||
| @@ -77,13 +77,17 @@ class SettingsReaderController : SettingsController() { | ||||
|                 titleRes = R.string.pref_fullscreen | ||||
|                 defaultValue = true | ||||
|             } | ||||
|             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | ||||
|  | ||||
|             val hasDisplayCutout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && | ||||
|                 activity?.window?.decorView?.rootWindowInsets?.displayCutout != null | ||||
|             if (hasDisplayCutout) { | ||||
|                 switchPreference { | ||||
|                     key = Keys.cutoutShort | ||||
|                     titleRes = R.string.pref_cutout_short | ||||
|                     defaultValue = true | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             switchPreference { | ||||
|                 key = Keys.keepScreenOn | ||||
|                 titleRes = R.string.pref_keep_screen_on | ||||
|   | ||||
		Reference in New Issue
	
	Block a user