Workaround loading of light mode resources and Revert "Remove and replace light mode default song, album, artist images with dark mode ones"
This reverts commit 337d7301
This commit is contained in:
parent
806b3beaa7
commit
aa4c20bd8c
32 changed files with 14 additions and 7 deletions
|
@ -3,6 +3,7 @@ package code.name.monkey.retromusic.extensions
|
|||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
fun Context.showToast(@StringRes stringRes: Int, duration: Int = Toast.LENGTH_SHORT) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package code.name.monkey.retromusic.glide
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.retromusic.App.Companion.getContext
|
||||
import code.name.monkey.retromusic.Constants.USER_BANNER
|
||||
|
@ -107,8 +109,8 @@ object RetroGlideExtension {
|
|||
return baseRequestOptions
|
||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY_ARTIST)
|
||||
.priority(Priority.LOW)
|
||||
.error(DEFAULT_ARTIST_IMAGE)
|
||||
.placeholder(DEFAULT_ARTIST_IMAGE)
|
||||
.error(getDrawable(DEFAULT_ARTIST_IMAGE))
|
||||
.placeholder(getDrawable(DEFAULT_ARTIST_IMAGE))
|
||||
.override(SIZE_ORIGINAL, SIZE_ORIGINAL)
|
||||
.signature(createSignature(artist))
|
||||
}
|
||||
|
@ -120,8 +122,8 @@ object RetroGlideExtension {
|
|||
song: Song
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_SONG_IMAGE)
|
||||
.placeholder(DEFAULT_SONG_IMAGE)
|
||||
.error(getDrawable(DEFAULT_SONG_IMAGE))
|
||||
.placeholder(getDrawable(DEFAULT_SONG_IMAGE))
|
||||
.signature(createSignature(song))
|
||||
}
|
||||
|
||||
|
@ -142,8 +144,8 @@ object RetroGlideExtension {
|
|||
song: Song
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ALBUM_IMAGE)
|
||||
.placeholder(DEFAULT_ALBUM_IMAGE)
|
||||
.error(ContextCompat.getDrawable(getContext(), DEFAULT_ALBUM_IMAGE))
|
||||
.placeholder(ContextCompat.getDrawable(getContext(), DEFAULT_ALBUM_IMAGE))
|
||||
.signature(createSignature(song))
|
||||
}
|
||||
|
||||
|
@ -177,7 +179,7 @@ object RetroGlideExtension {
|
|||
baseRequestOptions: BaseRequestOptions<*>
|
||||
): BaseRequestOptions<*> {
|
||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ALBUM_IMAGE)
|
||||
.error(getDrawable(DEFAULT_ALBUM_IMAGE))
|
||||
}
|
||||
|
||||
private fun createSignature(song: Song): Key {
|
||||
|
@ -214,6 +216,10 @@ object RetroGlideExtension {
|
|||
fun <TranscodeType> getDefaultTransition(): GenericTransitionOptions<TranscodeType> {
|
||||
return GenericTransitionOptions<TranscodeType>().transition(DEFAULT_ANIMATION)
|
||||
}
|
||||
|
||||
fun getDrawable(@DrawableRes id: Int): Drawable? {
|
||||
return ContextCompat.getDrawable(getContext(), id)
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/bumptech/glide/issues/527#issuecomment-148840717
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue