Added destauration accent color
This commit is contained in:
parent
694e78e92e
commit
576201bfd5
5 changed files with 20 additions and 20 deletions
|
@ -45,13 +45,8 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
view.setOnTouchListener(FlingPlayBackController(requireContext()))
|
||||
//view.setOnClickListener(v -> NavigationUtil.gotoNowPlayingActivity(getContext()));
|
||||
setUpMiniPlayer()
|
||||
|
||||
miniPlayerImage.setOnClickListener {
|
||||
//toggleFavorite(MusicPlayerRemote.currentSong)
|
||||
}
|
||||
|
||||
if (RetroUtil.isTablet()) {
|
||||
actionNext.visibility = View.VISIBLE
|
||||
actionPrevious.visibility = View.VISIBLE
|
||||
|
|
|
@ -34,6 +34,14 @@ import code.name.monkey.appthemehelper.util.ColorUtil;
|
|||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class RetroColorUtil {
|
||||
public static int desaturateColor(int color, float ratio) {
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color, hsv);
|
||||
|
||||
hsv[1] = ( hsv[1] / 1 * ratio ) + ( 0.2f * (1.0f - ratio) );
|
||||
|
||||
return Color.HSVToColor(hsv);
|
||||
}
|
||||
public static int toolbarColor(@NonNull Context context) {
|
||||
return ATHUtil.INSTANCE.resolveColor(context, R.attr.colorSurface);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import androidx.appcompat.widget.AppCompatImageView
|
|||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||
|
||||
|
||||
class ColorIconsImageView : AppCompatImageView {
|
||||
|
@ -49,7 +50,7 @@ class ColorIconsImageView : AppCompatImageView {
|
|||
private fun setIconBackgroundColor(color: Int) {
|
||||
setBackgroundResource(R.drawable.color_circle_gradient)
|
||||
if (ATHUtil.isWindowBackgroundDark(context)) {
|
||||
val desaturatedColor = desaturateColor(color, 0.4f)
|
||||
val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f)
|
||||
backgroundTintList = ColorStateList.valueOf(desaturatedColor)
|
||||
imageTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorPrimary))
|
||||
} else {
|
||||
|
@ -60,12 +61,5 @@ class ColorIconsImageView : AppCompatImageView {
|
|||
invalidate()
|
||||
}
|
||||
|
||||
private fun desaturateColor(color: Int, ratio: Float): Int {
|
||||
val hsv = FloatArray(3)
|
||||
Color.colorToHSV(color, hsv)
|
||||
|
||||
hsv[1] = hsv[1] / 1 * ratio + 0.2f * (1.0f - ratio)
|
||||
|
||||
return Color.HSVToColor(hsv)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue