Fix color in Album and Artist list
This commit is contained in:
parent
2d3ad54ab5
commit
2f42ce1638
4 changed files with 17 additions and 37 deletions
|
@ -8,8 +8,6 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
||||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||||
|
@ -83,23 +81,13 @@ open class AlbumAdapter(
|
||||||
loadAlbumCover(album, holder)
|
loadAlbumCover(album, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setColors(color: Int, holder: ViewHolder) {
|
protected open fun setColors(color: MediaNotificationProcessor, holder: ViewHolder) {
|
||||||
if (holder.paletteColorContainer != null) {
|
if (holder.paletteColorContainer != null) {
|
||||||
holder.title?.setTextColor(
|
holder.title?.setTextColor(color.primaryTextColor)
|
||||||
MaterialValueHelper.getPrimaryTextColor(
|
holder.text?.setTextColor(color.secondaryTextColor)
|
||||||
activity,
|
holder.paletteColorContainer?.setBackgroundColor(color.backgroundColor)
|
||||||
ColorUtil.isColorLight(color)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
holder.text?.setTextColor(
|
|
||||||
MaterialValueHelper.getSecondaryTextColor(
|
|
||||||
activity,
|
|
||||||
ColorUtil.isColorLight(color)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
holder.paletteColorContainer?.setBackgroundColor(color)
|
|
||||||
}
|
}
|
||||||
holder.mask?.backgroundTintList = ColorStateList.valueOf(color)
|
holder.mask?.backgroundTintList = ColorStateList.valueOf(color.primaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun loadAlbumCover(album: Album, holder: ViewHolder) {
|
protected open fun loadAlbumCover(album: Album, holder: ViewHolder) {
|
||||||
|
@ -118,7 +106,7 @@ open class AlbumAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColors(colors.backgroundColor, holder)
|
setColors(colors, holder)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class HorizontalAlbumAdapter(
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setColors(color: Int, holder: ViewHolder) {
|
fun setColors(color: Int, holder: ViewHolder) {
|
||||||
holder.title?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorPrimary))
|
holder.title?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorPrimary))
|
||||||
holder.text?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorSecondary))
|
holder.text?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorSecondary))
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class HorizontalAlbumAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColors(colors.backgroundColor,holder)
|
setColors(colors, holder)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
||||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||||
|
@ -67,19 +65,13 @@ class ArtistAdapter(
|
||||||
loadArtistImage(artist, holder)
|
loadArtistImage(artist, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setColors(color: Int, holder: ViewHolder) {
|
fun setColors(processor: MediaNotificationProcessor, holder: ViewHolder) {
|
||||||
if (holder.paletteColorContainer != null) {
|
if (holder.paletteColorContainer != null) {
|
||||||
holder.paletteColorContainer?.setBackgroundColor(color)
|
holder.paletteColorContainer?.setBackgroundColor(processor.backgroundColor)
|
||||||
holder.title?.setTextColor(
|
holder.title?.setTextColor(processor.primaryTextColor)
|
||||||
MaterialValueHelper.getPrimaryTextColor(
|
|
||||||
activity, ColorUtil.isColorLight(
|
|
||||||
color
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
holder.imageContainerCard?.setCardBackgroundColor(color)
|
holder.imageContainerCard?.setCardBackgroundColor(processor.backgroundColor)
|
||||||
holder.mask?.backgroundTintList = ColorStateList.valueOf(color)
|
holder.mask?.backgroundTintList = ColorStateList.valueOf(processor.backgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadArtistImage(artist: Artist, holder: ViewHolder) {
|
private fun loadArtistImage(artist: Artist, holder: ViewHolder) {
|
||||||
|
@ -92,11 +84,11 @@ class ArtistAdapter(
|
||||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
super.onLoadCleared(placeholder)
|
super.onLoadCleared(placeholder)
|
||||||
setColors(defaultFooterColor, holder)
|
//setColors(defaultFooterColor, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColors(colors.backgroundColor,holder)
|
setColors(colors, holder)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class PlaylistsUtil {
|
||||||
}
|
}
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Toast.makeText(context, "Don't have permission for adding to playlist", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Unable to add music to playlist due to Android 10 limitations", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
|
@ -140,7 +140,7 @@ public class PlaylistsUtil {
|
||||||
}
|
}
|
||||||
} catch (SecurityException ignored) {
|
} catch (SecurityException ignored) {
|
||||||
ignored.printStackTrace();
|
ignored.printStackTrace();
|
||||||
Toast.makeText(context, "Don't have permission for adding to playlist", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Unable to add music to playlist due to Android 10 limitations", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue