mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Removed UnsafeOptInUsageError annotation after media3 library update
This commit is contained in:
parent
ff8bf4f6bf
commit
490cce53e5
20 changed files with 14 additions and 53 deletions
|
|
@ -37,7 +37,6 @@ public class DownloaderManager {
|
|||
private final HashMap<Uri, Download> downloads;
|
||||
private final DownloadIndex downloadIndex;
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public DownloaderManager(Context context, DownloadManager downloadManager) {
|
||||
this.context = context.getApplicationContext();
|
||||
|
||||
|
|
@ -47,7 +46,6 @@ public class DownloaderManager {
|
|||
loadDownloads();
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private DownloadRequest buildDownloadRequest(MediaItem mediaItem) {
|
||||
return DownloadHelper.forMediaItem(context, mediaItem).getDownloadRequest(Util.getUtf8Bytes(checkNotNull(mediaItem.mediaId)));
|
||||
}
|
||||
|
|
@ -58,13 +56,11 @@ public class DownloaderManager {
|
|||
return download != null && download.state != Download.STATE_FAILED;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public boolean isDownloaded(MediaItem mediaItem) {
|
||||
@Nullable Download download = downloads.get(checkNotNull(mediaItem.localConfiguration).uri);
|
||||
return download != null && download.state != Download.STATE_FAILED;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public boolean areDownloaded(List<MediaItem> mediaItems) {
|
||||
for (MediaItem mediaItem : mediaItems) {
|
||||
@Nullable Download download = downloads.get(checkNotNull(mediaItem.localConfiguration).uri);
|
||||
|
|
@ -76,7 +72,6 @@ public class DownloaderManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public void download(MediaItem mediaItem, com.cappielloantonio.play.model.Download download) {
|
||||
DownloadService.sendAddDownload(context, DownloaderService.class, buildDownloadRequest(mediaItem), false);
|
||||
downloadDatabase(download);
|
||||
|
|
@ -88,7 +83,6 @@ public class DownloaderManager {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public void remove(MediaItem mediaItem, com.cappielloantonio.play.model.Download download) {
|
||||
DownloadService.sendRemoveDownload(context, DownloaderService.class, buildDownloadRequest(mediaItem).id, false);
|
||||
removeDatabase(download);
|
||||
|
|
@ -100,7 +94,6 @@ public class DownloaderManager {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void loadDownloads() {
|
||||
try (DownloadCursor loadedDownloads = downloadIndex.getDownloads()) {
|
||||
while (loadedDownloads.moveToNext()) {
|
||||
|
|
|
|||
|
|
@ -20,13 +20,11 @@ import com.cappielloantonio.play.util.DownloadUtil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public class DownloaderService extends androidx.media3.exoplayer.offline.DownloadService {
|
||||
|
||||
private static final int JOB_ID = 1;
|
||||
private static final int FOREGROUND_NOTIFICATION_ID = 1;
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public DownloaderService() {
|
||||
super(FOREGROUND_NOTIFICATION_ID, DEFAULT_FOREGROUND_NOTIFICATION_UPDATE_INTERVAL, DownloadUtil.DOWNLOAD_NOTIFICATION_CHANNEL_ID, R.string.exo_download_notification_channel_name, 0);
|
||||
}
|
||||
|
|
@ -64,7 +62,6 @@ public class DownloaderService extends androidx.media3.exoplayer.offline.Downloa
|
|||
nextNotificationId = firstNotificationId;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
@Override
|
||||
public void onDownloadChanged(@NonNull DownloadManager downloadManager, Download download, @Nullable Exception finalException) {
|
||||
Notification notification;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue