Fix buttons color
This commit is contained in:
parent
a96e682e2b
commit
933bf70068
13 changed files with 47 additions and 90 deletions
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import java.util.*
|
||||
|
||||
|
@ -37,7 +37,7 @@ open class PlaylistSongAdapter(activity: AppCompatActivity,
|
|||
|
||||
if (holder.itemViewType == OFFSET_ITEM) {
|
||||
|
||||
val buttonColor = RetroUtil.toolbarColor(activity)
|
||||
val buttonColor = RetroColorUtil.toolbarColor(activity)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(buttonColor))
|
||||
val viewHolder = holder as ViewHolder
|
||||
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
package code.name.monkey.retromusic.adapter.song
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.View
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import java.util.*
|
||||
|
||||
|
@ -28,51 +25,19 @@ class ShuffleButtonSongAdapter(activity: AppCompatActivity,
|
|||
|
||||
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
||||
if (holder.itemViewType == OFFSET_ITEM) {
|
||||
val accentColor = ThemeStore.accentColor(activity.applicationContext)
|
||||
val buttonColor = RetroUtil.toolbarColor(activity)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(buttonColor))
|
||||
val viewHolder = holder as ViewHolder
|
||||
|
||||
viewHolder.playAction?.let {
|
||||
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
|
||||
it.setTextColor(textColor)
|
||||
it.iconTint = ColorStateList.valueOf(textColor)
|
||||
MaterialUtil.setTint(it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openQueue(dataSet, 0, true)
|
||||
}
|
||||
}
|
||||
viewHolder.shuffleAction?.let {
|
||||
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
|
||||
it.setTextColor(textColor)
|
||||
it.iconTint = ColorStateList.valueOf(textColor)
|
||||
MaterialUtil.setTint(button = it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (holder.title != null) {
|
||||
holder.title!!.text = activity.resources.getString(R.string.action_shuffle_all)
|
||||
holder.title!!.setTextColor(accentColor)
|
||||
}
|
||||
if (holder.text != null) {
|
||||
holder.text!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.menu != null) {
|
||||
holder.menu!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.image != null) {
|
||||
val padding = activity.resources.getDimensionPixelSize(R.dimen.default_item_margin) / 2
|
||||
holder.image!!.setPadding(padding, padding, padding, padding)
|
||||
holder.image!!.setColorFilter(accentColor)
|
||||
holder.image!!.setImageResource(R.drawable.ic_shuffle_white_24dp)
|
||||
}
|
||||
if (holder.separator != null) {
|
||||
holder.separator!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.shortSeparator != null) {
|
||||
holder.shortSeparator!!.visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
super.onBindViewHolder(holder, position - 1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue