diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index 1b7b91ee..e1d53fa2 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -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), diff --git a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt index ebb1fe59..69ad7417 100644 --- a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt +++ b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt @@ -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 } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt index 4213102e..7a756b08 100644 --- a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt +++ b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt @@ -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() + } } - } } /**