Changed the code accordingly
+ Removed some unused code
This commit is contained in:
parent
25a43b57b2
commit
8b209df253
35 changed files with 153 additions and 413 deletions
|
|
@ -39,8 +39,8 @@ final class CacheFactory implements DataSource.Factory {
|
|||
.createDataSource();
|
||||
|
||||
final FileDataSource fileSource = new FileDataSource();
|
||||
final CacheDataSink dataSink
|
||||
= new CacheDataSink(cache, PlayerHelper.getPreferredFileSize());
|
||||
final CacheDataSink dataSink =
|
||||
new CacheDataSink(cache, PlayerHelper.getPreferredFileSize());
|
||||
return new CacheDataSource(cache, dataSource, fileSource, dataSink, CACHE_FLAGS, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,8 +208,8 @@ public class PlayerDataSource {
|
|||
Log.w(TAG, "instantiateCacheIfNeeded: could not create cache dir");
|
||||
}
|
||||
|
||||
final LeastRecentlyUsedCacheEvictor evictor
|
||||
= new LeastRecentlyUsedCacheEvictor(PlayerHelper.getPreferredCacheSize());
|
||||
final LeastRecentlyUsedCacheEvictor evictor =
|
||||
new LeastRecentlyUsedCacheEvictor(PlayerHelper.getPreferredCacheSize());
|
||||
cache = new SimpleCache(cacheDir, evictor, new StandaloneDatabaseProvider(context));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
public final class PlayerHelper {
|
||||
private static final StringBuilder STRING_BUILDER = new StringBuilder();
|
||||
private static final Formatter STRING_FORMATTER
|
||||
= new Formatter(STRING_BUILDER, Locale.getDefault());
|
||||
private static final Formatter STRING_FORMATTER =
|
||||
new Formatter(STRING_BUILDER, Locale.getDefault());
|
||||
private static final NumberFormat SPEED_FORMATTER = new DecimalFormat("0.##x");
|
||||
private static final NumberFormat PITCH_FORMATTER = new DecimalFormat("##%");
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ public class PlayerMediaSession implements MediaSessionCallback {
|
|||
return null;
|
||||
}
|
||||
|
||||
final MediaDescriptionCompat.Builder descriptionBuilder
|
||||
= new MediaDescriptionCompat.Builder()
|
||||
final MediaDescriptionCompat.Builder descBuilder = new MediaDescriptionCompat.Builder()
|
||||
.setMediaId(String.valueOf(index))
|
||||
.setTitle(item.getTitle())
|
||||
.setSubtitle(item.getUploader());
|
||||
|
|
@ -76,14 +75,14 @@ public class PlayerMediaSession implements MediaSessionCallback {
|
|||
additionalMetadata.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, index + 1);
|
||||
additionalMetadata
|
||||
.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, player.getPlayQueue().size());
|
||||
descriptionBuilder.setExtras(additionalMetadata);
|
||||
descBuilder.setExtras(additionalMetadata);
|
||||
|
||||
final Uri thumbnailUri = Uri.parse(item.getThumbnailUrl());
|
||||
if (thumbnailUri != null) {
|
||||
descriptionBuilder.setIconUri(thumbnailUri);
|
||||
descBuilder.setIconUri(thumbnailUri);
|
||||
}
|
||||
|
||||
return descriptionBuilder.build();
|
||||
return descBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue