Skip to content

Commit

Permalink
- Restart video play activity with correct data on trigger from notif…
Browse files Browse the repository at this point in the history
…ication
  • Loading branch information
Stefan Schueller committed Dec 17, 2018
1 parent eeb2fcd commit 519fdb7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "net.schueller.peertube"
minSdkVersion 21
targetSdkVersion 28
versionCode 108
versionName "1.0.8"
versionCode 109
versionName "1.0.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ private void loadVideo()
{
// get video ID
Intent intent = getIntent();
String videoID = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
Log.v(TAG, "click: " + videoID);
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
Log.v(TAG, "click: " + videoUuid);

// get video details from api
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);

Call<Video> call = service.getVideoData(videoID);
Call<Video> call = service.getVideoData(videoUuid);

call.enqueue(new Callback<Video>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import static android.media.session.PlaybackState.ACTION_PAUSE;
import static android.media.session.PlaybackState.ACTION_PLAY;
import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID;

public class VideoPlayerService extends Service {

Expand Down Expand Up @@ -156,6 +157,7 @@ public String getCurrentContentTitle(Player player) {
@Override
public PendingIntent createCurrentContentIntent(Player player) {
Intent intent = new Intent(context, VideoPlayActivity.class);
intent.putExtra(EXTRA_VIDEOID, currentVideo.getUuid());
return PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
}
Expand All @@ -179,6 +181,9 @@ public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.Bitma

playerNotificationManager.setSmallIcon(R.drawable.ic_peertube_bw);

// don't show skip buttons in notification
playerNotificationManager.setUseNavigationActions(false);

playerNotificationManager.setNotificationListener(
new PlayerNotificationManager.NotificationListener() {
@Override
Expand Down

0 comments on commit 519fdb7

Please sign in to comment.