aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-06-21 23:22:02 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-06-21 23:22:02 +0000
commit20620a67f740709608d128f5a811481290d7d017 (patch)
tree16a9bb44a1c2f2baa95ae5006d2a564a621c768a /app/src/main/java/ml
parent3d9dc47775ad35f3139c4f192a2007785c051295 (diff)
downloadinfinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar.gz
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar.bz2
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar.lz
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar.xz
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.tar.zst
infinity-for-reddit-20620a67f740709608d128f5a811481290d7d017.zip
Download gif in ViewVideoActivity when it's a gif post.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
index 6be51742..49927c8f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -210,6 +210,8 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
@Inject
SimpleCache mSimpleCache;
+ private Post post;
+
@OptIn(markerClass = UnstableApi.class)
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -390,7 +392,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
}
}
- Post post = intent.getParcelableExtra(EXTRA_POST);
+ post = intent.getParcelableExtra(EXTRA_POST);
if (post != null) {
binding.getTitleTextView().setText(post.getTitle());
videoFallbackDirectUrl = post.getVideoFallBackDirectUrl();
@@ -975,9 +977,17 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
Intent intent;
if (videoType != VIDEO_TYPE_NORMAL) {
intent = new Intent(this, DownloadMediaService.class);
- intent.putExtra(DownloadMediaService.EXTRA_URL, videoDownloadUrl);
- intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO);
- intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, videoFileName);
+ if (post.getPostType() == Post.GIF_TYPE) {
+ intent.putExtra(DownloadMediaService.EXTRA_URL, post.getVideoUrl());
+ intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_GIF);
+ intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, post.getSubredditName()
+ + "-" + post.getId() + ".gif");
+ } else {
+ intent.putExtra(DownloadMediaService.EXTRA_URL, videoDownloadUrl);
+ intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO);
+ intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, videoFileName);
+ }
+
intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(DownloadMediaService.EXTRA_IS_NSFW, isNSFW);
} else {