feat(youtube/swipe-controls): add option to save and restore brightness

This commit is contained in:
oSumAtrIX 2023-05-31 23:46:26 +02:00
parent 4c77e7f3f7
commit b5a71a843e
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 20 additions and 7 deletions

View File

@ -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),

View File

@ -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
}

View File

@ -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()
}
}
}
}
/**