add previous button to small notification

This commit is contained in:
Adrian Ulrich 2017-08-22 21:34:26 +02:00
parent 35668a5c3f
commit fa65bc393b
3 changed files with 26 additions and 2 deletions

View File

@ -53,6 +53,17 @@ THE SOFTWARE.
android:singleLine="true"
android:ellipsize="marquee" />
</LinearLayout>
<ImageButton
android:id="@+id/previous"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_height="42dp"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/widget_previous"
android:contentDescription="@string/previous_song" />
<ImageButton
android:id="@+id/play_pause"
android:paddingTop="5dp"

View File

@ -53,6 +53,17 @@ THE SOFTWARE.
android:singleLine="true"
android:ellipsize="marquee" />
</LinearLayout>
<ImageButton
android:id="@+id/previous"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/widget_previous"
android:contentDescription="@string/previous_song" />
<ImageButton
android:id="@+id/play_pause"
android:paddingTop="5dip"
@ -62,7 +73,7 @@ THE SOFTWARE.
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/play"
android:src="@drawable/widget_play"
android:contentDescription="@string/play_pause" />
<ImageButton
android:id="@+id/next"
@ -73,7 +84,7 @@ THE SOFTWARE.
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/next"
android:src="@drawable/widget_next"
android:contentDescription="@string/next_song" />
<ImageButton
android:id="@+id/close"

View File

@ -2074,6 +2074,7 @@ public final class PlaybackService extends Service
Intent previous = new Intent(PlaybackService.ACTION_PREVIOUS_SONG);
previous.setComponent(service);
views.setOnClickPendingIntent(R.id.previous, PendingIntent.getService(this, 0, previous, 0));
expanded.setOnClickPendingIntent(R.id.previous, PendingIntent.getService(this, 0, previous, 0));
Intent playPause = new Intent(PlaybackService.ACTION_TOGGLE_PLAYBACK_NOTIFICATION);
@ -2118,6 +2119,7 @@ public final class PlaybackService extends Service
viewsPublic.setImageViewResource(R.id.cover, R.drawable.icon);
viewsPublic.setImageViewResource(R.id.play_pause, playButton);
viewsPublic.setOnClickPendingIntent(R.id.previous, PendingIntent.getService(this, 0, previous, 0));
viewsPublic.setOnClickPendingIntent(R.id.play_pause, PendingIntent.getService(this, 0, playPause, 0));
viewsPublic.setOnClickPendingIntent(R.id.next, PendingIntent.getService(this, 0, next, 0));
viewsPublic.setOnClickPendingIntent(R.id.close, PendingIntent.getService(this, 0, close, 0));