mute/unmute text change in action bar
This commit is contained in:
parent
1ae8a72ba6
commit
83c7c4a68e
2 changed files with 8 additions and 1 deletions
|
@ -459,7 +459,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
if (view.getId() == repeatButton.getId()) {
|
if (view.getId() == repeatButton.getId()) {
|
||||||
player.onRepeatClicked();
|
player.onRepeatClicked();
|
||||||
|
|
||||||
} else if (view.getId() == backwardButton.getId()) {
|
} else if (view.getId() == backwardButton.getId()) {
|
||||||
player.onPlayPrevious();
|
player.onPlayPrevious();
|
||||||
|
|
||||||
} else if (view.getId() == playPauseButton.getId()) {
|
} else if (view.getId() == playPauseButton.getId()) {
|
||||||
|
@ -694,6 +694,12 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
private void onMaybeMuteChanged() {
|
private void onMaybeMuteChanged() {
|
||||||
if (menu != null && player != null) {
|
if (menu != null && player != null) {
|
||||||
MenuItem item = menu.findItem(R.id.action_mute);
|
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});
|
TypedArray a = getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{R.attr.volume_off});
|
||||||
int attributeResourceId = a.getResourceId(0, 0);
|
int attributeResourceId = a.getResourceId(0, 0);
|
||||||
Drawable drawableMuted = getResources().getDrawable(attributeResourceId);
|
Drawable drawableMuted = getResources().getDrawable(attributeResourceId);
|
||||||
|
|
|
@ -449,6 +449,7 @@
|
||||||
<string name="playlist_name_input">Name</string>
|
<string name="playlist_name_input">Name</string>
|
||||||
<string name="append_playlist">Add To Playlist</string>
|
<string name="append_playlist">Add To Playlist</string>
|
||||||
<string name="mute">Mute</string>
|
<string name="mute">Mute</string>
|
||||||
|
<string name="unmute">Unmute</string>
|
||||||
<string name="set_as_playlist_thumbnail">Set as Playlist Thumbnail</string>
|
<string name="set_as_playlist_thumbnail">Set as Playlist Thumbnail</string>
|
||||||
<string name="bookmark_playlist">Bookmark Playlist</string>
|
<string name="bookmark_playlist">Bookmark Playlist</string>
|
||||||
<string name="unbookmark_playlist">Remove Bookmark</string>
|
<string name="unbookmark_playlist">Remove Bookmark</string>
|
||||||
|
|
Loading…
Reference in a new issue