mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-24 11:45:49 +01:00
feat(youtube/swipe-controls): add option to save and restore brightness
This commit is contained in:
parent
4c77e7f3f7
commit
b5a71a843e
@ -168,6 +168,8 @@ public enum SettingsEnum {
|
||||
parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)),
|
||||
SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, true,
|
||||
parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)),
|
||||
SWIPE_SAVE_AND_RESTORE_BRIGHTNESS("revanced_swipe_save_and_restore_brightness", BOOLEAN, TRUE, true,
|
||||
parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)),
|
||||
|
||||
// Debugging
|
||||
DEBUG("revanced_debug", BOOLEAN, FALSE),
|
||||
|
@ -45,7 +45,7 @@ class SwipeControlsConfigurationProvider(
|
||||
*/
|
||||
val overwriteVolumeKeyControls: Boolean
|
||||
get() = isFullscreenVideo && enableVolumeControls
|
||||
//endregioin
|
||||
//endregion
|
||||
|
||||
//region gesture adjustments
|
||||
/**
|
||||
@ -94,5 +94,15 @@ class SwipeControlsConfigurationProvider(
|
||||
val overlayForegroundColor: Int
|
||||
get() = Color.WHITE
|
||||
|
||||
//endregion
|
||||
|
||||
//region behaviour
|
||||
|
||||
/**
|
||||
* should the brightness be saved and restored when exiting or entering fullscreen
|
||||
*/
|
||||
val shouldSaveAndRestoreBrightness: Boolean
|
||||
get() = SettingsEnum.SWIPE_SAVE_AND_RESTORE_BRIGHTNESS.boolean
|
||||
|
||||
//endregion
|
||||
}
|
@ -168,13 +168,14 @@ class SwipeControlsHostActivity : Activity() {
|
||||
* @param type the new player type
|
||||
*/
|
||||
private fun onPlayerTypeChanged(type: PlayerType) {
|
||||
when (type) {
|
||||
PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore()
|
||||
else -> {
|
||||
screen?.save()
|
||||
screen?.restoreDefaultBrightness()
|
||||
if (config.shouldSaveAndRestoreBrightness)
|
||||
when (type) {
|
||||
PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore()
|
||||
else -> {
|
||||
screen?.save()
|
||||
screen?.restoreDefaultBrightness()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user