-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix initial brightness value #3102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that getWindow().getAttributes().screenBrightness
is in range [0.0, 1.0]
? The reference says:
A value of less than 0, the default, means to use the preferred screen brightness. 0 to 1 adjusts the brightness from dark to full bright.
According to this Stack Overflow question:
settings.screenBrightness will return -1 if it has not been previously overwritten in code. This is correct behaviour as setting screenBrightness to -1 will set the brightness to the current system brightness level.
Current brightness can be retrieved by getWindow().getAttributes().screenBrightness. If however this current brightness is < 0 this means that application uses the current settings for brightness (which can be loaded by the means provided in current answer)
So we should check for getWindow().getAttributes().screenBrightness
first, and if it is negative use this, instead:
float curBrightnessValue=android.provider.Settings.System.getInt(
getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good now, thanks!
Could you provide a test apk? |
Here is the test apk |
@Stypox If you have time, can you please create a RC and create a PR + Issue? I'd like to release a new version as soon as possible, but the time I can spend on NewPipe is quite limited the next two weeks. |
@TobiGr: I'd wait until yt_new is finished. Tomorrow I probably have another 4 hours and them I'm hopefully much more productive. |
@TobiGr I don't have the keys to sign a release RC, so I'm just going to build a Debug RC apk, is that ok? @wb9688 Ok, even though it could have some problems at the beginning since it is not thoroughly tested. But we will test using RCs, so that's ok. Thank you :-) |
@Stypox For the RC, I use my debug key, too. I'd wait for mauricio's review of #3098. If he does not answer until Friday, I assume it is good to merge and will be included in the 0.18.4. Regarding the new YouTube version: we should release it asap, but not in 0.18.4. We still have 11 days and can release 0.18.5 as soon as the extractor is stable. |
I will create the PR&issue later today or tomorrow (I have to study ;-) ) |
Fixes Brightness resets on first gesture brightness change after playback activity open #3084