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
|
@ -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
|
||||
|
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-night-hdpi/default_album_art.webp
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/drawable-night-hdpi/default_artist_art.webp
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-night-hdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-night-mdpi/default_album_art.webp
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable-night-mdpi/default_artist_art.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-night-mdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 932 B |
BIN
app/src/main/res/drawable-night-xhdpi/default_album_art.webp
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
app/src/main/res/drawable-night-xhdpi/default_artist_art.webp
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
app/src/main/res/drawable-night-xhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-night-xxhdpi/default_album_art.webp
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
app/src/main/res/drawable-night-xxhdpi/default_artist_art.webp
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
app/src/main/res/drawable-night-xxhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
app/src/main/res/drawable-night-xxxhdpi/default_album_art.webp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-night-xxxhdpi/default_artist_art.webp
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
app/src/main/res/drawable-night-xxxhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 10 KiB |