Skip to content
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

Merged
merged 5 commits into from
Feb 19, 2020
Merged

Fix initial brightness value #3102

merged 5 commits into from
Feb 19, 2020

Conversation

vhsw
Copy link
Contributor

@vhsw vhsw commented Feb 16, 2020

Copy link
Member

@Stypox Stypox left a 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;

@TobiGr TobiGr added bug Issue is related to a bug player Issues related to any player (main, popup and background) labels Feb 16, 2020
@vhsw vhsw requested a review from Stypox February 18, 2020 06:41
Copy link
Member

@Stypox Stypox left a 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!

@Stypox
Copy link
Member

Stypox commented Feb 18, 2020

Could you provide a test apk?

@vhsw
Copy link
Contributor Author

vhsw commented Feb 19, 2020

Here is the test apk

app-debug.zip

@Stypox
Copy link
Member

Stypox commented Feb 19, 2020

I tested the app and it works as expected. Thank you @vhsw ! :-D
@TobiGr I am merging this even though it is not in the milestone since it is a simple change

@Stypox Stypox merged commit 12c7284 into TeamNewPipe:dev Feb 19, 2020
@TobiGr TobiGr added this to the 0.18.4 milestone Feb 19, 2020
@TobiGr
Copy link
Contributor

TobiGr commented Feb 19, 2020

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

@wb9688
Copy link
Contributor

wb9688 commented Feb 19, 2020

@TobiGr: I'd wait until yt_new is finished. Tomorrow I probably have another 4 hours and them I'm hopefully much more productive.

@Stypox
Copy link
Member

Stypox commented Feb 19, 2020

@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?
I assume the way to build RCs is exactly the same as the way to build normal debug apks, isnt't?
The PR has to be created between the dev and the master branch, hasn't it?
Also, would #3098 be postponed to 0.18.5?

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

@TobiGr
Copy link
Contributor

TobiGr commented Feb 19, 2020

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

@Stypox
Copy link
Member

Stypox commented Feb 19, 2020

I will create the PR&issue later today or tomorrow (I have to study ;-) )

This was referenced Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brightness resets on first gesture brightness change after playback activity open
4 participants