[Glide] Added placeholder images for song, album & artist
parent
652a79f14e
commit
e02e99ed02
|
@ -33,10 +33,10 @@ import java.io.File
|
|||
@GlideExtension
|
||||
object RetroGlideExtension {
|
||||
|
||||
private const val DEFAULT_ERROR_ARTIST_IMAGE =
|
||||
private const val DEFAULT_ARTIST_IMAGE =
|
||||
R.drawable.default_artist_art
|
||||
private const val DEFAULT_ERROR_SONG_IMAGE: Int = R.drawable.default_audio_art
|
||||
private const val DEFAULT_ERROR_ALBUM_IMAGE = R.drawable.default_album_art
|
||||
private const val DEFAULT_SONG_IMAGE: Int = R.drawable.default_audio_art
|
||||
private const val DEFAULT_ALBUM_IMAGE = R.drawable.default_album_art
|
||||
private const val DEFAULT_ERROR_IMAGE_BANNER = R.drawable.material_design_default
|
||||
|
||||
private val DEFAULT_DISK_CACHE_STRATEGY_ARTIST = DiskCacheStrategy.RESOURCE
|
||||
|
@ -99,7 +99,8 @@ object RetroGlideExtension {
|
|||
return baseRequestOptions
|
||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY_ARTIST)
|
||||
.priority(Priority.LOW)
|
||||
.error(DEFAULT_ERROR_ARTIST_IMAGE)
|
||||
.error(DEFAULT_ARTIST_IMAGE)
|
||||
.placeholder(DEFAULT_ARTIST_IMAGE)
|
||||
.signature(createSignature(artist))
|
||||
}
|
||||
|
||||
|
@ -110,7 +111,8 @@ object RetroGlideExtension {
|
|||
song: Song
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ERROR_SONG_IMAGE)
|
||||
.error(DEFAULT_SONG_IMAGE)
|
||||
.placeholder(DEFAULT_SONG_IMAGE)
|
||||
.signature(createSignature(song))
|
||||
}
|
||||
|
||||
|
@ -121,7 +123,8 @@ object RetroGlideExtension {
|
|||
song: Song
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ERROR_ALBUM_IMAGE)
|
||||
.error(DEFAULT_ALBUM_IMAGE)
|
||||
.placeholder(DEFAULT_ALBUM_IMAGE)
|
||||
.signature(createSignature(song))
|
||||
}
|
||||
|
||||
|
@ -154,7 +157,7 @@ object RetroGlideExtension {
|
|||
baseRequestOptions: BaseRequestOptions<*>
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ERROR_ALBUM_IMAGE)
|
||||
.error(DEFAULT_ALBUM_IMAGE)
|
||||
}
|
||||
|
||||
private fun createSignature(song: Song): Key {
|
||||
|
|
|
@ -33,8 +33,7 @@ abstract class RetroMusicColoredTarget(view: ImageView) : BitmapPaletteTarget(vi
|
|||
|
||||
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||
super.onLoadFailed(errorDrawable)
|
||||
val colors = MediaNotificationProcessor(App.getContext(), errorDrawable)
|
||||
onColorReady(colors)
|
||||
onColorReady(MediaNotificationProcessor.errorColor(App.getContext()))
|
||||
}
|
||||
|
||||
override fun onResourceReady(
|
||||
|
|
|
@ -473,4 +473,12 @@ public class MediaNotificationProcessor {
|
|||
public interface OnPaletteLoadedListener {
|
||||
void onPaletteLoaded(MediaNotificationProcessor mediaNotificationProcessor);
|
||||
}
|
||||
|
||||
public static MediaNotificationProcessor errorColor(Context context) {
|
||||
MediaNotificationProcessor errorColors = new MediaNotificationProcessor(context);
|
||||
errorColors.backgroundColor = 0x15724528;
|
||||
errorColors.primaryTextColor = 0x6974059;
|
||||
errorColors.secondaryTextColor = 0x8684677;
|
||||
return errorColors;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue