comments and rename vars

This commit is contained in:
MarcaDian 2024-04-07 15:33:11 +03:00
parent c3a9e6b84f
commit 46ef6c74d5
No known key found for this signature in database
GPG Key ID: 904EF10755E7C016
4 changed files with 12 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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