mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-03-31 22:25:39 +02:00
Let MediaScannerConnection to scan the downloaded Reddit videos after downloading to make the video shows up in WhatsApp.
This commit is contained in:
parent
580f9d2459
commit
4c762f4bd9
@ -13,6 +13,7 @@ import android.media.MediaCodec;
|
|||||||
import android.media.MediaExtractor;
|
import android.media.MediaExtractor;
|
||||||
import android.media.MediaFormat;
|
import android.media.MediaFormat;
|
||||||
import android.media.MediaMuxer;
|
import android.media.MediaMuxer;
|
||||||
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -225,6 +226,9 @@ public class DownloadRedditVideoService extends Service {
|
|||||||
}
|
}
|
||||||
EventBus.getDefault().post(new DownloadRedditVideoEvent(false));
|
EventBus.getDefault().post(new DownloadRedditVideoEvent(false));
|
||||||
} else {
|
} else {
|
||||||
|
MediaScannerConnection.scanFile(
|
||||||
|
this, new String[]{destinationFileUri.toString()}, null,
|
||||||
|
(path, uri) -> {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(android.content.Intent.ACTION_VIEW);
|
intent.setAction(android.content.Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(destinationFileUri, "video/*");
|
intent.setDataAndType(destinationFileUri, "video/*");
|
||||||
@ -232,6 +236,8 @@ public class DownloadRedditVideoService extends Service {
|
|||||||
updateNotification(R.string.downloading_reddit_video_finished, fileName, pendingIntent);
|
updateNotification(R.string.downloading_reddit_video_finished, fileName, pendingIntent);
|
||||||
EventBus.getDefault().post(new DownloadRedditVideoEvent(true));
|
EventBus.getDefault().post(new DownloadRedditVideoEvent(true));
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
stopForeground(false);
|
stopForeground(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user