Add speed button to top bar

This commit is contained in:
TheLastGimbus 2020-06-14 15:16:04 +02:00
parent 36b4134838
commit 72af51fe9d
2 changed files with 15 additions and 1 deletions

View File

@ -164,6 +164,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
case R.id.action_append_playlist: case R.id.action_append_playlist:
appendAllToPlaylist(); appendAllToPlaylist();
return true; return true;
case R.id.action_playback_speed:
openPlaybackParameterDialog();
return true;
case R.id.action_mute: case R.id.action_mute:
player.onMuteUnmuteButtonClicked(); player.onMuteUnmuteButtonClicked();
return true; return true;
@ -688,7 +691,10 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { private void onPlaybackParameterChanged(final PlaybackParameters parameters) {
if (parameters != null) { if (parameters != null) {
Log.d("Dupa", "12"); if (menu != null && player != null) {
MenuItem item = menu.findItem(R.id.action_playback_speed);
item.setTitle(formatSpeed(parameters.speed));
}
} }
} }

View File

@ -10,6 +10,14 @@
android:visible="true" android:visible="true"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_playback_speed"
android:title="1x"
android:tooltipText="@string/playback_speed_control"
android:visible="true"
app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_mute" android:id="@+id/action_mute"
android:icon="?attr/volume_off" android:icon="?attr/volume_off"