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:
Prathamesh More 2022-05-02 09:48:10 +05:30
parent 806b3beaa7
commit aa4c20bd8c
32 changed files with 14 additions and 7 deletions

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.extensions
import android.content.Context import android.content.Context
import android.content.res.Configuration import android.content.res.Configuration
import android.widget.Toast import android.widget.Toast
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
fun Context.showToast(@StringRes stringRes: Int, duration: Int = Toast.LENGTH_SHORT) { fun Context.showToast(@StringRes stringRes: Int, duration: Int = Toast.LENGTH_SHORT) {

View file

@ -2,6 +2,8 @@ package code.name.monkey.retromusic.glide
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable 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.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.App.Companion.getContext import code.name.monkey.retromusic.App.Companion.getContext
import code.name.monkey.retromusic.Constants.USER_BANNER import code.name.monkey.retromusic.Constants.USER_BANNER
@ -107,8 +109,8 @@ 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_ARTIST_IMAGE) .error(getDrawable(DEFAULT_ARTIST_IMAGE))
.placeholder(DEFAULT_ARTIST_IMAGE) .placeholder(getDrawable(DEFAULT_ARTIST_IMAGE))
.override(SIZE_ORIGINAL, SIZE_ORIGINAL) .override(SIZE_ORIGINAL, SIZE_ORIGINAL)
.signature(createSignature(artist)) .signature(createSignature(artist))
} }
@ -120,8 +122,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_SONG_IMAGE) .error(getDrawable(DEFAULT_SONG_IMAGE))
.placeholder(DEFAULT_SONG_IMAGE) .placeholder(getDrawable(DEFAULT_SONG_IMAGE))
.signature(createSignature(song)) .signature(createSignature(song))
} }
@ -142,8 +144,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_ALBUM_IMAGE) .error(ContextCompat.getDrawable(getContext(), DEFAULT_ALBUM_IMAGE))
.placeholder(DEFAULT_ALBUM_IMAGE) .placeholder(ContextCompat.getDrawable(getContext(), DEFAULT_ALBUM_IMAGE))
.signature(createSignature(song)) .signature(createSignature(song))
} }
@ -177,7 +179,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_ALBUM_IMAGE) .error(getDrawable(DEFAULT_ALBUM_IMAGE))
} }
private fun createSignature(song: Song): Key { private fun createSignature(song: Song): Key {
@ -214,6 +216,10 @@ object RetroGlideExtension {
fun <TranscodeType> getDefaultTransition(): GenericTransitionOptions<TranscodeType> { fun <TranscodeType> getDefaultTransition(): GenericTransitionOptions<TranscodeType> {
return GenericTransitionOptions<TranscodeType>().transition(DEFAULT_ANIMATION) 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 // https://github.com/bumptech/glide/issues/527#issuecomment-148840717

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After