aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java9
3 files changed, 10 insertions, 15 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
index 42c6b706..6204934f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
@@ -862,7 +862,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((PostDetailVideoAutoplayViewHolder) holder).setVolume(mMuteAutoplayingVideos || (mPost.isNSFW() && mMuteNSFWVideo) ? 0f : 1f);
if (mPost.isGfycat() || mPost.isRedgifs() && !mPost.isLoadGfyOrRedgifsVideoSuccess()) {
- ((PostDetailVideoAutoplayViewHolder) holder).mTypeTextView.setText("GFYCAT");
((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrRedgifsVideoLinks = new FetchGfycatOrRedgifsVideoLinks(new FetchGfycatOrRedgifsVideoLinks.FetchGfycatOrRedgifsVideoLinksListener() {
@Override
public void success(String webm, String mp4) {
@@ -881,7 +880,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
.fetchGfycatOrRedgifsVideoLinksInRecyclerViewAdapter(mGfycatRetrofit, mRedgifsRetrofit,
mPost.getGfycatId(), mPost.isGfycat(), mAutomaticallyTryRedgifs);
} else {
- ((PostDetailVideoAutoplayViewHolder) holder).mTypeTextView.setText("VIDEO");
((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl()));
}
} else if (holder instanceof PostDetailVideoAndGifPreviewHolder) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
index 2f2eef38..bd650cbe 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
@@ -178,8 +178,7 @@ public class DownloadMediaService extends Service {
NotificationManager.IMPORTANCE_LOW
);
- NotificationManagerCompat manager = NotificationManagerCompat.from(this);
- manager.createNotificationChannel(serviceChannel);
+ notificationManager.createNotificationChannel(serviceChannel);
}
switch (mediaType) {
@@ -275,7 +274,7 @@ public class DownloadMediaService extends Service {
new SaveImageOrGifAndCopyToExternalStorageAsyncTask(response.body(), mediaType,
isDefaultDestination, fileName[0], destinationFileUriString, getContentResolver(),
- (destinationFileUri, errorCode) -> downloadFinished(destinationFileUri, errorCode)).execute();
+ (destinationFileUri, errorCode) -> downloadFinished(destinationFileUri, errorCode)).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@@ -289,8 +288,7 @@ public class DownloadMediaService extends Service {
}
private Notification createNotification(String fileName) {
- builder.setContentTitle(fileName).setContentText(getString(R.string.downloading))
- .setProgress(100, 0, false);
+ builder.setContentTitle(fileName).setContentText(getString(R.string.downloading)).setProgress(100, 0, false);
return builder.setSmallIcon(R.drawable.ic_notification)
.setColor(mCustomThemeWrapper.getColorPrimaryLightTheme())
.build();
@@ -424,9 +422,9 @@ public class DownloadMediaService extends Service {
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, destinationFileName);
contentValues.put(MediaStore.MediaColumns.MIME_TYPE, mediaType == EXTRA_MEDIA_TYPE_VIDEO ? "video/*" : "image/*");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, destinationFileUriString);
- contentValues.put(MediaStore.Images.Media.IS_PENDING, 1);
+ contentValues.put(mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.IS_PENDING : MediaStore.Images.Media.IS_PENDING, 1);
- final Uri contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
+ final Uri contentUri = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.EXTERNAL_CONTENT_URI : MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
Uri uri = contentResolver.insert(contentUri, contentValues);
if (uri == null) {
@@ -446,7 +444,7 @@ public class DownloadMediaService extends Service {
stream.write(buf, 0, len);
}
contentValues.clear();
- contentValues.put(MediaStore.Images.Media.IS_PENDING, 0);
+ contentValues.put(mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.IS_PENDING : MediaStore.Images.Media.IS_PENDING, 0);
contentResolver.update(uri, contentValues, null, null);
destinationFileUriString = uri.toString();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
index c68be79b..5b744a9d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
@@ -138,8 +138,7 @@ public class DownloadRedditVideoService extends Service {
NotificationManager.IMPORTANCE_LOW
);
- NotificationManagerCompat manager = NotificationManagerCompat.from(this);
- manager.createNotificationChannel(serviceChannel);
+ notificationManager.createNotificationChannel(serviceChannel);
}
startForeground(
@@ -246,7 +245,7 @@ public class DownloadRedditVideoService extends Service {
public void updateProgressNotification(int stringResId) {
updateNotification(stringResId, -1, null);
}
- }).execute();
+ }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
String videoFilePath = directoryPath + fileNameWithoutExtension[0] + "-cache.mp4";
new SaveTempMuxAndCopyAsyncTask(videoResponse.body(),
@@ -264,7 +263,7 @@ public class DownloadRedditVideoService extends Service {
public void updateProgressNotification(int stringResId) {
updateNotification(stringResId, -1, null);
}
- }).execute();
+ }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@@ -286,7 +285,7 @@ public class DownloadRedditVideoService extends Service {
public void updateProgressNotification(int stringResId) {
updateNotification(stringResId, -1, null);
}
- }).execute();
+ }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
} else {