Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions app/src/main/java/com/noti/restore/overlay/OverlayPanelManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,6 @@ object OverlayPanelManager {
Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS)
} catch (_: Exception) { 128 }

// Ensure manual brightness mode
try {
Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL)
} catch (_: Exception) {}

val trackH = (6 * dp).toInt()
val thumbSize = (24 * dp).toInt()

Expand Down Expand Up @@ -1154,6 +1148,10 @@ object OverlayPanelManager {
val frac = ((event.x - thumbSize / 2) / (v.width - thumbSize)).coerceIn(0f, 1f)
val brightness = (frac * 255).toInt().coerceIn(1, 255)
try {
// Force manual mode here, on an actual drag, not just from opening this
// sub-panel — matches stock Android's own slider-drag behavior.
Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL)
Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, brightness)
} catch (_: Exception) {}
updateSliderVisual(brightness, v.width)
Expand Down Expand Up @@ -1508,10 +1506,9 @@ object OverlayPanelManager {
val currentBrightness = try {
Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS)
} catch (_: Exception) { 128 }
try {
Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL)
} catch (_: Exception) {}
// Manual mode is forced from applyBrightness() below, on an actual slider drag or
// sun-icon tap — not here, just from building this section's view. Merely viewing the
// Quick Settings tab shouldn't disable Adaptive Brightness on its own.

// Percentage label on right (declare early so sun icon click can update it)
val valueText = TextView(context).apply {
Expand Down