From e3a891688bb71bda52f26ffe697f469e347aaf3d Mon Sep 17 00:00:00 2001 From: Alexey Dubrov Date: Mon, 17 Feb 2020 12:11:00 +0300 Subject: [PATCH] Get brightness from settings if screenBrightness is set to auto --- .../java/org/schabi/newpipe/player/MainVideoPlayer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index ebb9e2423..3340f1107 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -910,7 +910,11 @@ public final class MainVideoPlayer extends AppCompatActivity volumeProgressBar.setProgress((int) (volumeProgressBar.getMax() * currentVolumeNormalized)); } - final float screenBrightness = getWindow().getAttributes().screenBrightness; + float screenBrightness = getWindow().getAttributes().screenBrightness; + if (screenBrightness < 0) + screenBrightness = Settings.System.getInt(getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, 0) / 255.0f; + brightnessProgressBar.setProgress((int) (brightnessProgressBar.getMax() * screenBrightness)); if (DEBUG) Log.d(TAG, "setInitialGestureValues: volumeProgressBar.getProgress() ["