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/fragments/ViewImgurImageFragment.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java10
2 files changed, 4 insertions, 16 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
index a201210e..4ce6827b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
@@ -12,7 +12,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.os.PersistableBundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -43,7 +42,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.BuildConfig;
-import ml.docilealligator.infinityforreddit.post.ImgurMedia;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
@@ -51,6 +49,7 @@ import ml.docilealligator.infinityforreddit.activities.ViewImgurMediaActivity;
import ml.docilealligator.infinityforreddit.asynctasks.SaveBitmapImageToFile;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperBottomSheetFragment;
import ml.docilealligator.infinityforreddit.databinding.FragmentViewImgurImageBinding;
+import ml.docilealligator.infinityforreddit.post.ImgurMedia;
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
import ml.docilealligator.infinityforreddit.utils.Utils;
@@ -224,13 +223,8 @@ public class ViewImgurImageFragment extends Fragment {
private void download() {
isDownloading = false;
- PersistableBundle extras = new PersistableBundle();
- extras.putString(DownloadMediaService.EXTRA_URL, imgurMedia.getLink());
- extras.putInt(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE);
- extras.putString(DownloadMediaService.EXTRA_FILE_NAME, imgurMedia.getFileName());
-
//TODO: contentEstimatedBytes
- JobInfo jobInfo = DownloadMediaService.constructJobInfo(activity, 5000000, extras);
+ JobInfo jobInfo = DownloadMediaService.constructJobInfo(activity, 5000000, imgurMedia);
((JobScheduler) activity.getSystemService(Context.JOB_SCHEDULER_SERVICE)).schedule(jobInfo);
Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
index e3b5b8ac..0d0c7212 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -11,7 +11,6 @@ import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
-import android.os.PersistableBundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -49,12 +48,12 @@ import com.google.common.collect.ImmutableList;
import javax.inject.Inject;
import javax.inject.Named;
-import ml.docilealligator.infinityforreddit.post.ImgurMedia;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.activities.ViewImgurMediaActivity;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PlaybackSpeedBottomSheetFragment;
import ml.docilealligator.infinityforreddit.databinding.FragmentViewImgurVideoBinding;
+import ml.docilealligator.infinityforreddit.post.ImgurMedia;
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
import ml.docilealligator.infinityforreddit.utils.APIUtils;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
@@ -260,13 +259,8 @@ public class ViewImgurVideoFragment extends Fragment {
private void download() {
isDownloading = false;
- PersistableBundle extras = new PersistableBundle();
- extras.putString(DownloadMediaService.EXTRA_URL, imgurMedia.getLink());
- extras.putInt(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO);
- extras.putString(DownloadMediaService.EXTRA_FILE_NAME, imgurMedia.getFileName());
-
//TODO: contentEstimatedBytes
- JobInfo jobInfo = DownloadMediaService.constructJobInfo(activity, 5000000, extras);
+ JobInfo jobInfo = DownloadMediaService.constructJobInfo(activity, 5000000, imgurMedia);
((JobScheduler) activity.getSystemService(Context.JOB_SCHEDULER_SERVICE)).schedule(jobInfo);
Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show();