mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-10 23:27:54 +02:00
comments and rename vars
This commit is contained in:
parent
c3a9e6b84f
commit
46ef6c74d5
|
@ -243,9 +243,9 @@ 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 BooleanSetting SWIPE_ENABLE_LOWEST_VALUE_AUTO_BRIGHTNESS = new BooleanSetting("revanced_swipe_enable_lowest_value_auto_brightness", TRUE, true, parent(SWIPE_BRIGHTNESS));
|
||||
public static final FloatSetting SWIPE_BRIGHTNESS_VALUE = new FloatSetting("revanced_swipe_brightness_value", 0.5f);
|
||||
public static final BooleanSetting SWIPE_BRIGHTNESS_AUTO_STATE = new BooleanSetting("revanced_swipe_brightness_auto_state", TRUE);
|
||||
public static final BooleanSetting SWIPE_ENABLE_LOWEST_VALUE_AUTO_BRIGHTNESS = new BooleanSetting("revanced_swipe_enable_lowest_value_auto_brightness", TRUE, true, parent(SWIPE_BRIGHTNESS));
|
||||
public static final BooleanSetting SWIPE_AUTO_BRIGHTNESS_STATE = new BooleanSetting("revanced_swipe_auto_brightness_state", TRUE);
|
||||
// Debugging
|
||||
/**
|
||||
* When enabled, share the debug logs with care.
|
||||
|
|
|
@ -113,16 +113,16 @@ class SwipeControlsConfigurationProvider(
|
|||
/**
|
||||
* variable that stores the brightness gesture value
|
||||
*/
|
||||
var brightnessValue: Float
|
||||
var screenBrightnessValue: Float
|
||||
get() = Settings.SWIPE_BRIGHTNESS_VALUE.get()
|
||||
set(value) = Settings.SWIPE_BRIGHTNESS_VALUE.save(value)
|
||||
|
||||
/**
|
||||
* variable that stores the auto-brightness state, which used in restore brightness function
|
||||
* it needed for that the brightness is not saved if auto-brightness is enabled
|
||||
* it needed for that the brightness is not restored if auto-brightness is enabled
|
||||
*/
|
||||
var isEnableAutoBrightness: Boolean
|
||||
get() = Settings.SWIPE_BRIGHTNESS_AUTO_STATE.get()
|
||||
set(value) = Settings.SWIPE_BRIGHTNESS_AUTO_STATE.save(value)
|
||||
var isEnabledAutoBrightness: Boolean
|
||||
get() = Settings.SWIPE_AUTO_BRIGHTNESS_STATE.get()
|
||||
set(value) = Settings.SWIPE_AUTO_BRIGHTNESS_STATE.save(value)
|
||||
//endregion
|
||||
}
|
|
@ -41,15 +41,15 @@ class ScreenBrightnessController(
|
|||
* save the current screen brightness into settings, to be brought back using [restore]
|
||||
*/
|
||||
fun save() {
|
||||
config.brightnessValue = rawScreenBrightness
|
||||
config.screenBrightnessValue = rawScreenBrightness
|
||||
}
|
||||
|
||||
/**
|
||||
* restore the screen brightness from settings saved using [save]
|
||||
*/
|
||||
fun restore() {
|
||||
if (!config.isEnableAutoBrightness)
|
||||
rawScreenBrightness = config.brightnessValue
|
||||
if (!config.isEnabledAutoBrightness)
|
||||
rawScreenBrightness = config.screenBrightnessValue
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,13 +123,13 @@ class SwipeControlsOverlayLayout(
|
|||
}
|
||||
|
||||
override fun onBrightnessChanged(brightness: Double) {
|
||||
config.isEnableAutoBrightness = false
|
||||
config.isEnabledAutoBrightness = false
|
||||
if (config.shouldEnableLowestValueAutoBrightness) {
|
||||
if (brightness > 0) {
|
||||
showFeedbackView("${round(brightness).toInt()}%", manualBrightnessIcon)
|
||||
} else {
|
||||
showFeedbackView(str("revanced_swipe_enable_lowest_value_auto_brightness_overlay_text"), autoBrightnessIcon)
|
||||
config.isEnableAutoBrightness = true
|
||||
config.isEnabledAutoBrightness = true
|
||||
}
|
||||
} else {
|
||||
if (brightness >= 0) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user