Commit cfeac8cc authored by Adrien Maglo's avatar Adrien Maglo

Audio player: add a play pause button to the header

parent 266dbd42
......@@ -31,15 +31,30 @@
<ImageButton
android:id="@+id/adv_function"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_weight="0"
android:background="#00000000"
android:focusable="true"
android:padding="10dip"
android:scaleType="fitXY"
android:src="@drawable/dots_dark" />
<ImageButton
android:id="@+id/header_play_pause"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:background="#00000000"
android:contentDescription="@string/pause"
android:focusable="true"
android:scaleType="fitXY"
android:src="@drawable/ic_pause" />
<View
android:layout_width="10dp"
android:layout_height="match_parent" />
</LinearLayout>
<ViewSwitcher
......
......@@ -63,6 +63,7 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
private TextView mTime;
private TextView mLength;
private ImageButton mPlayPause;
private ImageButton mHeaderPlayPause;
private ImageButton mStop;
private ImageButton mNext;
private ImageButton mPrevious;
......@@ -100,6 +101,7 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
mTime = (TextView) v.findViewById(R.id.time);
mLength = (TextView) v.findViewById(R.id.length);
mPlayPause = (ImageButton) v.findViewById(R.id.play_pause);
mHeaderPlayPause = (ImageButton) v.findViewById(R.id.header_play_pause);
mStop = (ImageButton) v.findViewById(R.id.stop);
mNext = (ImageButton) v.findViewById(R.id.next);
mPrevious = (ImageButton) v.findViewById(R.id.previous);
......@@ -128,6 +130,12 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
onPlayPauseClick(v);
}
});
mHeaderPlayPause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onPlayPauseClick(v);
}
});
mStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -237,9 +245,13 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
if (mAudioController.isPlaying()) {
mPlayPause.setImageResource(R.drawable.ic_pause);
mPlayPause.setContentDescription(getString(R.string.pause));
mHeaderPlayPause.setImageResource(R.drawable.ic_pause);
mHeaderPlayPause.setContentDescription(getString(R.string.pause));
} else {
mPlayPause.setImageResource(R.drawable.ic_play);
mPlayPause.setContentDescription(getString(R.string.play));
mHeaderPlayPause.setImageResource(R.drawable.ic_play);
mHeaderPlayPause.setContentDescription(getString(R.string.play));
}
if (mAudioController.isShuffling()) {
mShuffle.setImageResource(R.drawable.ic_shuffle_glow);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment