implement bindControlButtons()

This commit is contained in:
Adrian Ulrich 2016-03-20 18:20:29 +01:00
parent 1a6774ca2f
commit 2c6bf316e1
4 changed files with 22 additions and 25 deletions

View File

@ -162,12 +162,6 @@ public class FullPlaybackActivity extends PlaybackActivity
mCoverView = coverView;
mSlidingView = findViewById(R.id.sliding_view);
View previousButton = findViewById(R.id.previous);
previousButton.setOnClickListener(this);
mPlayPauseButton = (ImageButton)findViewById(R.id.play_pause);
mPlayPauseButton.setOnClickListener(this);
View nextButton = findViewById(R.id.next);
nextButton.setOnClickListener(this);
TableLayout table = (TableLayout)findViewById(R.id.info_table);
if (table != null) {
@ -195,12 +189,7 @@ public class FullPlaybackActivity extends PlaybackActivity
mFormatView = (TextView)findViewById(R.id.format);
mReplayGainView = (TextView)findViewById(R.id.replaygain);
mShuffleButton = (ImageButton)findViewById(R.id.shuffle);
mShuffleButton.setOnClickListener(this);
registerForContextMenu(mShuffleButton);
mEndButton = (ImageButton)findViewById(R.id.end_action);
mEndButton.setOnClickListener(this);
registerForContextMenu(mEndButton);
bindControlButtons();
setControlsVisible(settings.getBoolean(PrefKeys.VISIBLE_CONTROLS, PrefDefaults.VISIBLE_CONTROLS));
setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, PrefDefaults.VISIBLE_EXTRA_INFO));

View File

@ -200,6 +200,7 @@ public class LibraryActivity
}
loadAlbumIntent(getIntent());
bindControlButtons();
}
@Override

View File

@ -46,19 +46,7 @@ public class MiniPlaybackActivity extends PlaybackActivity {
mCoverView.setOnClickListener(this);
mCoverView.setup(mLooper, this, CoverBitmap.STYLE_OVERLAPPING_BOX);
View previousButton = findViewById(R.id.previous);
previousButton.setOnClickListener(this);
mPlayPauseButton = (ImageButton)findViewById(R.id.play_pause);
mPlayPauseButton.setOnClickListener(this);
View nextButton = findViewById(R.id.next);
nextButton.setOnClickListener(this);
mShuffleButton = (ImageButton)findViewById(R.id.shuffle);
mShuffleButton.setOnClickListener(this);
registerForContextMenu(mShuffleButton);
mEndButton = (ImageButton)findViewById(R.id.end_action);
mEndButton.setOnClickListener(this);
registerForContextMenu(mEndButton);
bindControlButtons();
}
@Override

View File

@ -305,6 +305,25 @@ public abstract class PlaybackActivity extends Activity
return fs_start;
}
/**
* Sets up onClick listeners for our common control buttons bar
*/
protected void bindControlButtons() {
View previousButton = findViewById(R.id.previous);
previousButton.setOnClickListener(this);
mPlayPauseButton = (ImageButton)findViewById(R.id.play_pause);
mPlayPauseButton.setOnClickListener(this);
View nextButton = findViewById(R.id.next);
nextButton.setOnClickListener(this);
mShuffleButton = (ImageButton)findViewById(R.id.shuffle);
mShuffleButton.setOnClickListener(this);
registerForContextMenu(mShuffleButton);
mEndButton = (ImageButton)findViewById(R.id.end_action);
mEndButton.setOnClickListener(this);
registerForContextMenu(mEndButton);
}
/**
* Called by PlaybackService to update the current song.
*/