Added placeholders for images
This commit is contained in:
parent
8604856a64
commit
a25c80a9bc
1 changed files with 13 additions and 10 deletions
|
@ -34,11 +34,11 @@ import java.io.File
|
||||||
@GlideExtension
|
@GlideExtension
|
||||||
object RetroGlideExtension {
|
object RetroGlideExtension {
|
||||||
|
|
||||||
private const val DEFAULT_ERROR_ARTIST_IMAGE =
|
private const val DEFAULT_ARTIST_IMAGE =
|
||||||
R.drawable.default_artist_art
|
R.drawable.default_artist_art
|
||||||
private const val DEFAULT_ERROR_SONG_IMAGE: Int = R.drawable.default_audio_art
|
private const val DEFAULT_SONG_IMAGE: Int = R.drawable.default_audio_art
|
||||||
private const val DEFAULT_ERROR_ALBUM_IMAGE = R.drawable.default_album_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 const val DEFAULT_IMAGE_BANNER = R.drawable.material_design_default
|
||||||
|
|
||||||
private val DEFAULT_DISK_CACHE_STRATEGY_ARTIST = DiskCacheStrategy.RESOURCE
|
private val DEFAULT_DISK_CACHE_STRATEGY_ARTIST = DiskCacheStrategy.RESOURCE
|
||||||
private val DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE
|
private val DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE
|
||||||
|
@ -96,8 +96,9 @@ object RetroGlideExtension {
|
||||||
return baseRequestOptions
|
return baseRequestOptions
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY_ARTIST)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY_ARTIST)
|
||||||
.priority(Priority.LOW)
|
.priority(Priority.LOW)
|
||||||
.error(DEFAULT_ERROR_ARTIST_IMAGE)
|
.error(DEFAULT_ARTIST_IMAGE)
|
||||||
.override(SIZE_ORIGINAL, SIZE_ORIGINAL)
|
.override(SIZE_ORIGINAL, SIZE_ORIGINAL)
|
||||||
|
.placeholder(DEFAULT_ARTIST_IMAGE)
|
||||||
.signature(createSignature(artist))
|
.signature(createSignature(artist))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +109,8 @@ object RetroGlideExtension {
|
||||||
song: Song
|
song: Song
|
||||||
): BaseRequestOptions<*> {
|
): BaseRequestOptions<*> {
|
||||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_SONG_IMAGE)
|
.error(DEFAULT_SONG_IMAGE)
|
||||||
|
.placeholder(DEFAULT_SONG_IMAGE)
|
||||||
.signature(createSignature(song))
|
.signature(createSignature(song))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +121,8 @@ object RetroGlideExtension {
|
||||||
song: Song
|
song: Song
|
||||||
): BaseRequestOptions<*> {
|
): BaseRequestOptions<*> {
|
||||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_ALBUM_IMAGE)
|
.error(DEFAULT_ALBUM_IMAGE)
|
||||||
|
.placeholder(DEFAULT_ALBUM_IMAGE)
|
||||||
.signature(createSignature(song))
|
.signature(createSignature(song))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +144,8 @@ object RetroGlideExtension {
|
||||||
file: File
|
file: File
|
||||||
): BaseRequestOptions<*> {
|
): BaseRequestOptions<*> {
|
||||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.placeholder(DEFAULT_ERROR_IMAGE_BANNER)
|
.placeholder(DEFAULT_IMAGE_BANNER)
|
||||||
.error(DEFAULT_ERROR_IMAGE_BANNER)
|
.error(DEFAULT_IMAGE_BANNER)
|
||||||
.signature(createSignature(file))
|
.signature(createSignature(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +155,7 @@ object RetroGlideExtension {
|
||||||
baseRequestOptions: BaseRequestOptions<*>
|
baseRequestOptions: BaseRequestOptions<*>
|
||||||
): BaseRequestOptions<*> {
|
): BaseRequestOptions<*> {
|
||||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_ALBUM_IMAGE)
|
.error(DEFAULT_ALBUM_IMAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createSignature(song: Song): Key {
|
private fun createSignature(song: Song): Key {
|
||||||
|
|
Loading…
Reference in a new issue