aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java1
3 files changed, 10 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
index 11e0d56d..00f9e848 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
@@ -69,6 +69,7 @@ public class ViewVideoActivity extends AppCompatActivity {
public static final String EXTRA_SUBREDDIT = "ES";
public static final String EXTRA_ID = "EI";
public static final String EXTRA_POST_TITLE = "EPT";
+ public static final String EXTRA_PROGRESS_SECONDS = "EPS";
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
private static final String IS_MUTE_STATE = "IMS";
@BindView(R.id.relative_layout_view_video_activity)
@@ -93,6 +94,7 @@ public class ViewVideoActivity extends AppCompatActivity {
private float totalLengthY = 0.0f;
private float touchY = -1.0f;
private String postTitle;
+ private long resumePosition = -1;
@Inject
@Named("default")
@@ -134,6 +136,9 @@ public class ViewVideoActivity extends AppCompatActivity {
videoDownloadUrl = intent.getStringExtra(EXTRA_VIDEO_DOWNLOAD_URL);
videoFileName = intent.getStringExtra(EXTRA_SUBREDDIT) + "-" + intent.getStringExtra(EXTRA_ID) + ".mp4";
postTitle = intent.getStringExtra(EXTRA_POST_TITLE);
+ if (savedInstanceState == null) {
+ resumePosition = intent.getLongExtra(EXTRA_PROGRESS_SECONDS, -1);
+ }
if (postTitle != null) {
setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle)));
@@ -320,6 +325,9 @@ public class ViewVideoActivity extends AppCompatActivity {
player.prepare(new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri));
player.setRepeatMode(Player.REPEAT_MODE_ALL);
+ if (resumePosition > 0) {
+ player.seekTo(resumePosition);
+ }
player.setPlayWhenReady(true);
wasPlaying = true;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index f2a12781..64ab34ff 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -2057,6 +2057,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, mPost.getSubredditName());
intent.putExtra(ViewVideoActivity.EXTRA_ID, mPost.getId());
intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, mPost.getTitle());
+ intent.putExtra(ViewVideoActivity.EXTRA_PROGRESS_SECONDS, helper.getLatestPlaybackInfo().getResumePosition());
mActivity.startActivity(intent);
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 2d89858a..19df7a8c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -1922,6 +1922,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, post.getSubredditName());
intent.putExtra(ViewVideoActivity.EXTRA_ID, post.getId());
intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, post.getTitle());
+ intent.putExtra(ViewVideoActivity.EXTRA_PROGRESS_SECONDS, helper.getLatestPlaybackInfo().getResumePosition());
mActivity.startActivity(intent);
}
});