mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-25 04:05:50 +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)),
|
parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)),
|
||||||
SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, true,
|
SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, true,
|
||||||
parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)),
|
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
|
// Debugging
|
||||||
DEBUG("revanced_debug", BOOLEAN, FALSE),
|
DEBUG("revanced_debug", BOOLEAN, FALSE),
|
||||||
|
@ -45,7 +45,7 @@ class SwipeControlsConfigurationProvider(
|
|||||||
*/
|
*/
|
||||||
val overwriteVolumeKeyControls: Boolean
|
val overwriteVolumeKeyControls: Boolean
|
||||||
get() = isFullscreenVideo && enableVolumeControls
|
get() = isFullscreenVideo && enableVolumeControls
|
||||||
//endregioin
|
//endregion
|
||||||
|
|
||||||
//region gesture adjustments
|
//region gesture adjustments
|
||||||
/**
|
/**
|
||||||
@ -94,5 +94,15 @@ class SwipeControlsConfigurationProvider(
|
|||||||
val overlayForegroundColor: Int
|
val overlayForegroundColor: Int
|
||||||
get() = Color.WHITE
|
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
|
//endregion
|
||||||
}
|
}
|
@ -168,13 +168,14 @@ class SwipeControlsHostActivity : Activity() {
|
|||||||
* @param type the new player type
|
* @param type the new player type
|
||||||
*/
|
*/
|
||||||
private fun onPlayerTypeChanged(type: PlayerType) {
|
private fun onPlayerTypeChanged(type: PlayerType) {
|
||||||
when (type) {
|
if (config.shouldSaveAndRestoreBrightness)
|
||||||
PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore()
|
when (type) {
|
||||||
else -> {
|
PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore()
|
||||||
screen?.save()
|
else -> {
|
||||||
screen?.restoreDefaultBrightness()
|
screen?.save()
|
||||||
|
screen?.restoreDefaultBrightness()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user