mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-02 11:26:18 +02:00
some fix
set -1f as default (auto-brightness) need to override -1f in fun restore(), because in some cases the brightness is not restored after force closing app
This commit is contained in:
parent
2a1916bf6e
commit
765ec07b0d
|
@ -244,7 +244,7 @@ public class Settings extends BaseSettings {
|
|||
public static final LongSetting SWIPE_OVERLAY_TIMEOUT = new LongSetting("revanced_swipe_overlay_timeout", 500L, true,
|
||||
parentsAny(SWIPE_BRIGHTNESS, SWIPE_VOLUME));
|
||||
public static final BooleanSetting SWIPE_SAVE_AND_RESTORE_BRIGHTNESS = new BooleanSetting("revanced_swipe_save_and_restore_brightness", TRUE, true, parent(SWIPE_BRIGHTNESS));
|
||||
public static final FloatSetting SWIPE_BRIGHTNESS_VALUE = new FloatSetting("revanced_swipe_brightness_value", 0.5f);
|
||||
public static final FloatSetting SWIPE_BRIGHTNESS_VALUE = new FloatSetting("revanced_swipe_brightness_value", -1f);
|
||||
public static final BooleanSetting SWIPE_ENABLE_LOWEST_VALUE_AUTO_BRIGHTNESS = new BooleanSetting("revanced_swipe_enable_lowest_value_auto_brightness", TRUE, true, parent(SWIPE_BRIGHTNESS));
|
||||
// Debugging
|
||||
/**
|
||||
|
|
|
@ -176,7 +176,6 @@ class SwipeControlsHostActivity : Activity() {
|
|||
when (type) {
|
||||
PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore()
|
||||
else -> {
|
||||
screen?.restore()
|
||||
screen?.save()
|
||||
screen?.restoreDefaultBrightness()
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package app.revanced.integrations.youtube.swipecontrols.controller
|
|||
|
||||
import android.app.Activity
|
||||
import android.view.WindowManager
|
||||
import app.revanced.integrations.shared.Utils
|
||||
import app.revanced.integrations.youtube.swipecontrols.SwipeControlsConfigurationProvider
|
||||
import app.revanced.integrations.youtube.swipecontrols.misc.clamp
|
||||
|
||||
|
@ -37,9 +38,6 @@ class ScreenBrightnessController(
|
|||
val isDefaultBrightness
|
||||
get() = (rawScreenBrightness == WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE)
|
||||
|
||||
/**
|
||||
* save the current screen brightness into settings, to be brought back using [restore]
|
||||
*/
|
||||
fun save() {
|
||||
if (config.savedScreenBrightnessValue == -1f) {
|
||||
config.savedScreenBrightnessValue = rawScreenBrightness
|
||||
|
@ -50,12 +48,12 @@ class ScreenBrightnessController(
|
|||
* restore the screen brightness from settings saved using [save]
|
||||
*/
|
||||
fun restore() {
|
||||
// after force close app, 'savedScreenBrightnessValue' resets to default from settings ('0.5f').
|
||||
// so default value in settings should not be '-1f'
|
||||
// `-1f` means auto-brightness activated
|
||||
if (config.savedScreenBrightnessValue != -1f) {
|
||||
rawScreenBrightness = config.savedScreenBrightnessValue
|
||||
config.savedScreenBrightnessValue = -1f
|
||||
} else {
|
||||
// here need to override -1f, because in some cases the brightness is not restored after force closing app
|
||||
config.savedScreenBrightnessValue = -1f
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user