mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +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;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
// BOTTOM SHEET/NAVIGATION
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initBottomSheet() {
|
||||
bottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.player_bottom_sheet));
|
||||
bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback);
|
||||
|
|
@ -205,7 +204,6 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initService() {
|
||||
MediaManager.check(getMediaBrowserListenableFuture(), this);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.cappielloantonio.play.ui.activity.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
|
@ -19,6 +18,7 @@ import com.cappielloantonio.play.service.DownloaderManager;
|
|||
import com.cappielloantonio.play.service.DownloaderService;
|
||||
import com.cappielloantonio.play.service.MediaService;
|
||||
import com.cappielloantonio.play.util.DownloadUtil;
|
||||
import com.cappielloantonio.play.util.UIUtil;
|
||||
import com.google.android.gms.cast.framework.CastContext;
|
||||
import com.google.android.material.elevation.SurfaceColors;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
|
@ -83,7 +83,6 @@ public class BaseActivity extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(this, new SessionToken(this, new ComponentName(this, MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
@ -96,7 +95,6 @@ public class BaseActivity extends AppCompatActivity {
|
|||
return mediaBrowserListenableFuture;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeDownloader() {
|
||||
downloaderManager = DownloadUtil.getDownloadTracker(this);
|
||||
|
||||
|
|
@ -108,7 +106,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void initializeCastContext() {
|
||||
CastContext.getSharedInstance(this);
|
||||
if (UIUtil.isCastApiAvailable(this)) CastContext.getSharedInstance(this);
|
||||
}
|
||||
|
||||
private void setNavigationBarColor() {
|
||||
|
|
|
|||
|
|
@ -195,7 +195,6 @@ public class AlbumPageFragment extends Fragment {
|
|||
albumPageViewModel.getAlbumSongLiveList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> songHorizontalAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@ public class ArtistPageFragment extends Fragment {
|
|||
similarArtistSnapHelper.attachToRecyclerView(bind.similarArtistsRecyclerView);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,6 @@ public class DownloadFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
bind.playerBodyLayout.playerBodyBottomSheetViewPager.setAdapter(new PlayerControllerVerticalPager(this));
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
@ -97,7 +96,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
MediaController.releaseFuture(mediaBrowserListenableFuture);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void bindMediaController() {
|
||||
mediaBrowserListenableFuture.addListener(() -> {
|
||||
try {
|
||||
|
|
@ -110,7 +108,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
}, MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMediaControllerListener(MediaBrowser mediaBrowser) {
|
||||
defineProgressBarHandler(mediaBrowser);
|
||||
setMediaControllerUI(mediaBrowser);
|
||||
|
|
@ -145,7 +142,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMetadata(MediaMetadata mediaMetadata) {
|
||||
if (mediaMetadata.extras != null)
|
||||
playerBottomSheetViewModel.setLiveMedia(getViewLifecycleOwner(), mediaMetadata.extras.getString("mediaType"), mediaMetadata.extras.getString("id"));
|
||||
|
|
@ -162,7 +158,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
.into(bind.playerHeaderLayout.playerHeaderMediaCoverImage);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMediaControllerUI(MediaBrowser mediaBrowser) {
|
||||
if (mediaBrowser.getMediaMetadata().extras != null) {
|
||||
switch (mediaBrowser.getMediaMetadata().extras.getString("mediaType", Media.MEDIA_TYPE_MUSIC)) {
|
||||
|
|
@ -194,7 +189,6 @@ public class PlayerBottomSheetFragment extends Fragment {
|
|||
runProgressBarHandler(isPlaying);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setHeaderMediaController() {
|
||||
bind.playerHeaderLayout.playerHeaderButton.setOnClickListener(view -> bind.getRoot().findViewById(R.id.exo_play_pause).performClick());
|
||||
bind.playerHeaderLayout.playerHeaderNextMediaButton.setOnClickListener(view -> bind.getRoot().findViewById(R.id.exo_next).performClick());
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
bind = null;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void init() {
|
||||
playerMediaCoverViewPager = bind.getRoot().findViewById(R.id.player_media_cover_view_pager);
|
||||
buttonFavorite = bind.getRoot().findViewById(R.id.button_favorite);
|
||||
|
|
@ -109,7 +108,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
playerMediaTranscodedBitrate = bind.getRoot().findViewById(R.id.player_media_transcoded_bitrate);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
@ -118,7 +116,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
MediaBrowser.releaseFuture(mediaBrowserListenableFuture);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void bindMediaController() {
|
||||
mediaBrowserListenableFuture.addListener(() -> {
|
||||
try {
|
||||
|
|
@ -133,7 +130,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
}, MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMediaControllerListener(MediaBrowser mediaBrowser) {
|
||||
setMediaControllerUI(mediaBrowser);
|
||||
setMetadata(mediaBrowser.getMediaMetadata());
|
||||
|
|
@ -149,7 +145,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMetadata(MediaMetadata mediaMetadata) {
|
||||
playerMediaTitleLabel.setText(MusicUtil.getReadableString(String.valueOf(mediaMetadata.title)));
|
||||
playerArtistNameLabel.setText(MusicUtil.getReadableString(String.valueOf(mediaMetadata.artist)));
|
||||
|
|
@ -193,7 +188,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMediaControllerUI(MediaBrowser mediaBrowser) {
|
||||
initPlaybackSpeedButton(mediaBrowser);
|
||||
|
||||
|
|
@ -280,7 +274,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initPlaybackSpeedButton(MediaBrowser mediaBrowser) {
|
||||
playbackSpeedButton.setOnClickListener(view -> {
|
||||
float currentSpeed = PreferenceUtil.getInstance(requireContext()).getPlaybackSpeed();
|
||||
|
|
@ -325,7 +318,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
playerMediaCoverViewPager.setCurrentItem(1, true);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setPlaybackParameters(MediaBrowser mediaBrowser) {
|
||||
Button playbackSpeedButton = bind.getRoot().findViewById(R.id.player_playback_speed_button);
|
||||
float currentSpeed = PreferenceUtil.getInstance(requireContext()).getPlaybackSpeed();
|
||||
|
|
@ -338,7 +330,6 @@ public class PlayerControllerFragment extends Fragment {
|
|||
skipSilenceToggleButton.setChecked(skipSilence);
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void resetPlaybackParameters(MediaBrowser mediaBrowser) {
|
||||
mediaBrowser.setPlaybackParameters(new PlaybackParameters(Media.MEDIA_PLAYBACK_SPEED_100));
|
||||
// TODO Resettare lo skip del silenzio
|
||||
|
|
|
|||
|
|
@ -139,7 +139,6 @@ public class PlayerCoverFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
@ -160,7 +159,6 @@ public class PlayerCoverFragment extends Fragment {
|
|||
}, MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setMediaBrowserListener(MediaBrowser mediaBrowser) {
|
||||
setCover(mediaBrowser.getMediaMetadata());
|
||||
|
||||
|
|
@ -173,7 +171,6 @@ public class PlayerCoverFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void setCover(MediaMetadata mediaMetadata) {
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), mediaMetadata.extras != null ? mediaMetadata.extras.getString("coverArtId") : null, CustomGlideRequest.SONG_PIC, null)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public class PlayerQueueFragment extends Fragment {
|
|||
bind = null;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,6 @@ public class PlaylistPageFragment extends Fragment {
|
|||
playlistPageViewModel.getPlaylistSongLiveList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> songHorizontalAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,6 @@ public class SearchFragment extends Fragment {
|
|||
bind.persistentSearchView.expand();
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ public class SongListPageFragment extends Fragment {
|
|||
songListPageViewModel.getSongList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> songHorizontalAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
dismiss();
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
|||
dismiss();
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ public class PodcastBottomSheetDialog extends BottomSheetDialogFragment implemen
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private void initializeMediaBrowser() {
|
||||
mediaBrowserListenableFuture = new MediaBrowser.Builder(requireContext(), new SessionToken(requireContext(), new ComponentName(requireContext(), MediaService.class))).buildAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public final class DownloadUtil {
|
|||
private static DownloaderManager downloaderManager;
|
||||
private static DownloadNotificationHelper downloadNotificationHelper;
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public static synchronized HttpDataSource.Factory getHttpDataSourceFactory() {
|
||||
if (httpDataSourceFactory == null) {
|
||||
CookieManager cookieManager = new CookieManager();
|
||||
|
|
@ -52,7 +51,6 @@ public final class DownloadUtil {
|
|||
return httpDataSourceFactory;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public static synchronized DataSource.Factory getDataSourceFactory(Context context) {
|
||||
if (dataSourceFactory == null) {
|
||||
context = context.getApplicationContext();
|
||||
|
|
@ -63,7 +61,6 @@ public final class DownloadUtil {
|
|||
return dataSourceFactory;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public static synchronized DownloadNotificationHelper getDownloadNotificationHelper(Context context) {
|
||||
if (downloadNotificationHelper == null) {
|
||||
downloadNotificationHelper = new DownloadNotificationHelper(context, DOWNLOAD_NOTIFICATION_CHANNEL_ID);
|
||||
|
|
@ -82,7 +79,6 @@ public final class DownloadUtil {
|
|||
return downloaderManager;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private static synchronized Cache getDownloadCache(Context context) {
|
||||
if (downloadCache == null) {
|
||||
File downloadContentDirectory = new File(getDownloadDirectory(context), DOWNLOAD_CONTENT_DIRECTORY);
|
||||
|
|
@ -92,7 +88,6 @@ public final class DownloadUtil {
|
|||
return downloadCache;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private static synchronized void ensureDownloadManagerInitialized(Context context) {
|
||||
if (downloadManager == null) {
|
||||
downloadManager =
|
||||
|
|
@ -107,7 +102,6 @@ public final class DownloadUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private static synchronized DatabaseProvider getDatabaseProvider(Context context) {
|
||||
if (databaseProvider == null) {
|
||||
databaseProvider = new StandaloneDatabaseProvider(context);
|
||||
|
|
@ -127,7 +121,6 @@ public final class DownloadUtil {
|
|||
return downloadDirectory;
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
private static CacheDataSource.Factory buildReadOnlyCacheDataSource(DataSource.Factory upstreamFactory, Cache cache) {
|
||||
return new CacheDataSource.Factory()
|
||||
.setCache(cache)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ public class MusicUtil {
|
|||
return Uri.parse(uri.toString());
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
public static Uri getDownloadUri(String id) {
|
||||
Map<String, String> params = App.getSubsonicClientInstance(App.getInstance(), false).getParams();
|
||||
|
||||
|
|
@ -124,6 +123,18 @@ public class MusicUtil {
|
|||
return "";
|
||||
}
|
||||
|
||||
public static String getReadableLyrics(String string) {
|
||||
if (string != null) {
|
||||
return string
|
||||
.replaceAll(""", "\"")
|
||||
.replaceAll("'", "'")
|
||||
.replaceAll("&", "'")
|
||||
.replaceAll("
", "\n");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String normalizedArtistName(String string) {
|
||||
if (string != null) {
|
||||
if (string.toLowerCase().contains(" feat.")) return Pattern.compile(" feat.", Pattern.CASE_INSENSITIVE).split(string)[0].trim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue