Add listeners in activity

This commit is contained in:
TheLastGimbus 2020-04-14 22:06:32 +02:00
parent 3175199787
commit 63afacc067

View file

@ -84,7 +84,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private ImageButton repeatButton; private ImageButton repeatButton;
private ImageButton backwardButton; private ImageButton backwardButton;
private ImageButton fastRewindButton;
private ImageButton playPauseButton; private ImageButton playPauseButton;
private ImageButton fastForwardButton;
private ImageButton forwardButton; private ImageButton forwardButton;
private ImageButton shuffleButton; private ImageButton shuffleButton;
private ProgressBar progressBar; private ProgressBar progressBar;
@ -310,7 +312,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private void buildControls() { private void buildControls() {
repeatButton = rootView.findViewById(R.id.control_repeat); repeatButton = rootView.findViewById(R.id.control_repeat);
backwardButton = rootView.findViewById(R.id.control_backward); backwardButton = rootView.findViewById(R.id.control_backward);
fastRewindButton = rootView.findViewById(R.id.control_fast_rewind);
playPauseButton = rootView.findViewById(R.id.control_play_pause); playPauseButton = rootView.findViewById(R.id.control_play_pause);
fastForwardButton = rootView.findViewById(R.id.control_fast_forward);
forwardButton = rootView.findViewById(R.id.control_forward); forwardButton = rootView.findViewById(R.id.control_forward);
shuffleButton = rootView.findViewById(R.id.control_shuffle); shuffleButton = rootView.findViewById(R.id.control_shuffle);
playbackSpeedButton = rootView.findViewById(R.id.control_playback_speed); playbackSpeedButton = rootView.findViewById(R.id.control_playback_speed);
@ -319,7 +323,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
repeatButton.setOnClickListener(this); repeatButton.setOnClickListener(this);
backwardButton.setOnClickListener(this); backwardButton.setOnClickListener(this);
fastRewindButton.setOnClickListener(this);
playPauseButton.setOnClickListener(this); playPauseButton.setOnClickListener(this);
fastForwardButton.setOnClickListener(this);
forwardButton.setOnClickListener(this); forwardButton.setOnClickListener(this);
shuffleButton.setOnClickListener(this); shuffleButton.setOnClickListener(this);
playbackSpeedButton.setOnClickListener(this); playbackSpeedButton.setOnClickListener(this);
@ -473,8 +479,12 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
player.onRepeatClicked(); player.onRepeatClicked();
} else if (view.getId() == backwardButton.getId()) { } else if (view.getId() == backwardButton.getId()) {
player.onPlayPrevious(); player.onPlayPrevious();
} else if (view.getId() == fastRewindButton.getId()) {
player.onFastRewind();
} else if (view.getId() == playPauseButton.getId()) { } else if (view.getId() == playPauseButton.getId()) {
player.onPlayPause(); player.onPlayPause();
} else if (view.getId() == fastForwardButton.getId()) {
player.onFastForward();
} else if (view.getId() == forwardButton.getId()) { } else if (view.getId() == forwardButton.getId()) {
player.onPlayNext(); player.onPlayNext();
} else if (view.getId() == shuffleButton.getId()) { } else if (view.getId() == shuffleButton.getId()) {