mute/unmute text change in action bar

This commit is contained in:
karol 2020-03-04 18:53:17 +01:00
parent 1ae8a72ba6
commit 83c7c4a68e
2 changed files with 8 additions and 1 deletions

View File

@ -459,7 +459,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
if (view.getId() == repeatButton.getId()) {
player.onRepeatClicked();
} else if (view.getId() == backwardButton.getId()) {
} else if (view.getId() == backwardButton.getId()) {
player.onPlayPrevious();
} else if (view.getId() == playPauseButton.getId()) {
@ -694,6 +694,12 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private void onMaybeMuteChanged() {
if (menu != null && player != null) {
MenuItem item = menu.findItem(R.id.action_mute);
//Change the mute-button item in ActionBar
//1) Text change:
item.setTitle(player.isMuted() ? R.string.unmute : R.string.mute);
//2) Icon change accordingly to current App Theme
TypedArray a = getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{R.attr.volume_off});
int attributeResourceId = a.getResourceId(0, 0);
Drawable drawableMuted = getResources().getDrawable(attributeResourceId);

View File

@ -449,6 +449,7 @@
<string name="playlist_name_input">Name</string>
<string name="append_playlist">Add To Playlist</string>
<string name="mute">Mute</string>
<string name="unmute">Unmute</string>
<string name="set_as_playlist_thumbnail">Set as Playlist Thumbnail</string>
<string name="bookmark_playlist">Bookmark Playlist</string>
<string name="unbookmark_playlist">Remove Bookmark</string>