diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java
index 5b4f246d0..8ec525e77 100644
--- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java
@@ -54,6 +54,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
private static final String TAG = BackgroundPlayer.class.toString();
private static final String ACTION_STOP = TAG + ".STOP";
private static final String ACTION_PLAYPAUSE = TAG + ".PLAYPAUSE";
+ private static final String ACTION_REWIND = TAG + ".REWIND";
// Extra intent arguments
public static final String TITLE = "title";
@@ -179,6 +180,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
filter.setPriority(Integer.MAX_VALUE);
filter.addAction(ACTION_PLAYPAUSE);
filter.addAction(ACTION_STOP);
+ filter.addAction(ACTION_REWIND);
registerReceiver(broadcastReceiver, filter);
note = buildNotification();
@@ -228,6 +230,10 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
noteMgr.notify(noteID, note);
}
}
+ else if(action.equals(ACTION_REWIND)) {
+ mediaPlayer.seekTo(0);
+// noteMgr.notify(noteID, note);
+ }
else if(action.equals(ACTION_STOP)) {
//this auto-releases CPU lock
mediaPlayer.stop();
@@ -275,6 +281,8 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
new Intent(ACTION_PLAYPAUSE), PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent stopPI = PendingIntent.getBroadcast(owner, noteID,
new Intent(ACTION_STOP), PendingIntent.FLAG_UPDATE_CURRENT);
+ PendingIntent rewindPI = PendingIntent.getBroadcast(owner, noteID,
+ new Intent(ACTION_REWIND), PendingIntent.FLAG_UPDATE_CURRENT);
/*
NotificationCompat.Action pauseButton = new NotificationCompat.Action.Builder
(R.drawable.ic_pause_white_24dp, "Pause", playPI).build();
@@ -311,6 +319,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
view.setTextViewText(R.id.notificationArtist, channelName);
view.setOnClickPendingIntent(R.id.notificationStop, stopPI);
view.setOnClickPendingIntent(R.id.notificationPlayPause, playPI);
+ view.setOnClickPendingIntent(R.id.notificationRewind, rewindPI);
view.setOnClickPendingIntent(R.id.notificationContent, openDetailView);
//possibly found the expandedView problem,
@@ -322,6 +331,7 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
expandedView.setTextViewText(R.id.notificationArtist, channelName);
expandedView.setOnClickPendingIntent(R.id.notificationStop, stopPI);
expandedView.setOnClickPendingIntent(R.id.notificationPlayPause, playPI);
+ expandedView.setOnClickPendingIntent(R.id.notificationRewind, rewindPI);
expandedView.setOnClickPendingIntent(R.id.notificationContent, openDetailView);
diff --git a/app/src/main/res/drawable-hdpi/ic_action_av_fast_rewind.png b/app/src/main/res/drawable-hdpi/ic_action_av_fast_rewind.png
new file mode 100644
index 000000000..8d49992eb
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_av_fast_rewind.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_av_fast_rewind.png b/app/src/main/res/drawable-mdpi/ic_action_av_fast_rewind.png
new file mode 100644
index 000000000..e280bd470
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_av_fast_rewind.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_av_fast_rewind.png b/app/src/main/res/drawable-xhdpi/ic_action_av_fast_rewind.png
new file mode 100644
index 000000000..1e804aafc
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_av_fast_rewind.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_av_fast_rewind.png b/app/src/main/res/drawable-xxhdpi/ic_action_av_fast_rewind.png
new file mode 100644
index 000000000..a04b8433a
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_av_fast_rewind.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_av_fast_rewind.png b/app/src/main/res/drawable-xxxhdpi/ic_action_av_fast_rewind.png
new file mode 100644
index 000000000..5a9fa3de0
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_action_av_fast_rewind.png differ
diff --git a/app/src/main/res/layout/player_notification.xml b/app/src/main/res/layout/player_notification.xml
index 64311e5c6..43ac993ca 100644
--- a/app/src/main/res/layout/player_notification.xml
+++ b/app/src/main/res/layout/player_notification.xml
@@ -47,6 +47,16 @@
android:text="artist" />
+
+
+
+
+
\ No newline at end of file