-
-
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
Mute button #3165
Mute button #3165
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.
There are a few issues here and there, but code looks good. Thank you!
app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java
Outdated
Show resolved
Hide resolved
Done! I think this functionality may require translation for other languages now ;) |
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.
Code looks good, just a question, thank you :-D
I also tested the apk and it works correctly
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.
Sorry, I forgot to bring further the discussion about themes ;-)
@@ -394,6 +400,11 @@ protected void setShuffleButton(final ImageButton shuffleButton, final boolean s | |||
shuffleButton.setImageAlpha(shuffleAlpha); | |||
} | |||
|
|||
protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) { | |||
muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), isMuted ? R.color.white : R.color.gray)); |
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.
What if the theme is white theme? The active button color should be black in that case. I'd suggest adding two attributes in attrs.xml
named something along the lines of button_active
and button_inactive
and giving them different color values in the themes.xml
file, so that they are themed.
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.
White theme does not affect background color for Main video player. Background is always black for this player. So if icon would turn black in WhiteTheme, then it would become invisible ;)
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.
Oh you are right, nevermind 🤦♂️
Then there should be different code for every player, at this point
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.
For MainVideoPlayer icon change happens in setMuteButton (place you've mentioned above).
For PopUp and Background, icon change happens for queue in ServicePlayerActivity in onMaybeMuteChanged. I did it similarly to other buttons, (e.g onPlayModeChanged also in ServicePlayerActivity)
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.
Ok, sorry for the misunderstading, this is ready :-D
The grey color of the icon breaks consistency with all the others. Is it not possible to have 2 white icons that switch to one another when toggled? One, a speaker with sound waves, and the other with no sound waves? |
Closes #2876.
Added "Mute button" for MainPlayer, BackgroundPlayer and PopupPlayer.
mute_button-debug.zip