Fix colors

This commit is contained in:
Hemanth S 2020-05-11 15:57:12 +05:30
parent 336f67fd48
commit adf2d57703
8 changed files with 33 additions and 29 deletions

View file

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.app.ActivityOptions import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MenuItem import android.view.MenuItem
@ -84,10 +85,13 @@ open class SongAdapter(
loadAlbumCover(song, holder) loadAlbumCover(song, holder)
} }
private fun setColors(color: Int, holder: ViewHolder) { private fun setColors(color: MediaNotificationProcessor, holder: ViewHolder) {
if (holder.paletteColorContainer != null) { if (holder.paletteColorContainer != null) {
holder.paletteColorContainer?.setBackgroundColor(color) holder.title?.setTextColor(color.primaryTextColor)
holder.text?.setTextColor(color.secondaryTextColor)
holder.paletteColorContainer?.setBackgroundColor(color.backgroundColor)
} }
holder.mask?.backgroundTintList = ColorStateList.valueOf(color.primaryTextColor)
} }
protected open fun loadAlbumCover(song: Song, holder: ViewHolder) { protected open fun loadAlbumCover(song: Song, holder: ViewHolder) {
@ -100,11 +104,11 @@ open class SongAdapter(
.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)
} }
override fun onColorReady(colors: MediaNotificationProcessor) { override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors.backgroundColor, holder) setColors(colors, holder)
} }
}) })
} }

View file

@ -32,9 +32,9 @@ class ColorFragment : AbsPlayerFragment() {
get() = navigationColor get() = navigationColor
override fun onColorChanged(color: MediaNotificationProcessor) { override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.secondaryTextColor
playbackControlsFragment.setDark(color) playbackControlsFragment.setDark(color)
navigationColor = color.backgroundColor navigationColor = color.backgroundColor
lastColor = color.secondaryTextColor
callbacks?.onPaletteColorChanged() callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar( ToolbarContentTintHelper.colorizeToolbar(

View file

@ -98,8 +98,8 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
fun setDark(colors: MediaNotificationProcessor) { fun setDark(colors: MediaNotificationProcessor) {
setDark(colors.secondaryTextColor) setDark(colors.secondaryTextColor)
TintHelper.setTintAuto(playPauseButton, colors.backgroundColor, false)
TintHelper.setTintAuto(playPauseButton, colors.primaryTextColor, true) TintHelper.setTintAuto(playPauseButton, colors.primaryTextColor, true)
TintHelper.setTintAuto(playPauseButton, colors.backgroundColor, false)
title.setTextColor(colors.primaryTextColor) title.setTextColor(colors.primaryTextColor)
text.setTextColor(colors.secondaryTextColor) text.setTextColor(colors.secondaryTextColor)

View file

@ -29,9 +29,6 @@ abstract class RetroMusicColoredTarget(view: ImageView) : BitmapPaletteTarget(vi
protected val defaultFooterColor: Int protected val defaultFooterColor: Int
get() = ATHUtil.resolveColor(getView().context, R.attr.colorControlNormal) get() = ATHUtil.resolveColor(getView().context, R.attr.colorControlNormal)
protected val albumArtistFooterColor: Int
get() = ATHUtil.resolveColor(getView().context, R.attr.colorControlNormal)
abstract fun onColorReady(colors: MediaNotificationProcessor) abstract fun onColorReady(colors: MediaNotificationProcessor)
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {

View file

@ -1,22 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:layout_gravity="center">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/player_album_art_frame" android:id="@+id/player_album_art_frame"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="16dp" android:layout_margin="16dp"
app:cardCornerRadius="8dp"> app:cardCornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent"
<code.name.monkey.retromusic.views.WidthFitSquareLayout app:layout_constraintDimensionRatio="1:1"
android:layout_width="match_parent" app:layout_constraintEnd_toEndOf="parent"
android:layout_height="wrap_content"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/player_image" android:id="@+id/player_image"
@ -25,6 +24,6 @@
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:ignore="ContentDescription,UnusedAttribute" tools:ignore="ContentDescription,UnusedAttribute"
tools:srcCompat="@tools:sample/backgrounds/scenic[8]" /> tools:srcCompat="@tools:sample/backgrounds/scenic[8]" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -16,6 +16,7 @@
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image" android:id="@+id/image"
app:srcCompat="@drawable/default_album_art"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"

View file

@ -14,6 +14,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
app:retroCornerSize="46dp" app:retroCornerSize="46dp"
app:srcCompat="@drawable/default_artist_art"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView

View file

@ -16,8 +16,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="128dp" android:layout_width="128dp"
android:layout_height="128dp" android:layout_height="128dp"
app:cardCornerRadius="16dp"
app:cardUseCompatPadding="true"> android:layout_margin="4dp"
app:cardCornerRadius="16dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/paletteColorContainer" android:id="@+id/paletteColorContainer"
@ -35,6 +36,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:retroCornerSize="21dp" app:retroCornerSize="21dp"
app:srcCompat="@drawable/default_album_art"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView