Fixed chip color
parent
5f81f48b7f
commit
2f6ca4b124
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.adapter
|
package code.name.monkey.retromusic.adapter
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -9,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
|
import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
|
||||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||||
|
@ -17,7 +19,6 @@ import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
|
||||||
import code.name.monkey.retromusic.model.*
|
import code.name.monkey.retromusic.model.*
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import kotlinx.android.synthetic.main.item_option_menu.view.*
|
|
||||||
|
|
||||||
|
|
||||||
class HomeAdapter(private val activity: AppCompatActivity, private var homes: List<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
class HomeAdapter(private val activity: AppCompatActivity, private var homes: List<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
|
@ -138,5 +139,9 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
||||||
private open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
private open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
||||||
val chip: Chip = itemView.findViewById(R.id.chipHead)
|
val chip: Chip = itemView.findViewById(R.id.chipHead)
|
||||||
|
|
||||||
|
init {
|
||||||
|
chip.apply { chipBackgroundColor = ColorStateList.valueOf(ThemeStore.primaryColor(context)) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -147,8 +147,6 @@ public final class PreferenceUtil {
|
||||||
return R.style.Theme_RetroMusic_Light;
|
return R.style.Theme_RetroMusic_Light;
|
||||||
case "color":
|
case "color":
|
||||||
return R.style.Theme_RetroMusic_Color;
|
return R.style.Theme_RetroMusic_Color;
|
||||||
case "acolor":
|
|
||||||
return R.style.Theme_RetroMusic_Black;
|
|
||||||
case "black":
|
case "black":
|
||||||
return R.style.Theme_RetroMusic_Black;
|
return R.style.Theme_RetroMusic_Black;
|
||||||
case "daynight":
|
case "daynight":
|
||||||
|
|
|
@ -37,7 +37,7 @@ import code.name.monkey.retromusic.R;
|
||||||
public class RetroColorUtil {
|
public class RetroColorUtil {
|
||||||
public static int toolbarColor(@NonNull Context context) {
|
public static int toolbarColor(@NonNull Context context) {
|
||||||
int color = ThemeStore.Companion.primaryColor(context);
|
int color = ThemeStore.Companion.primaryColor(context);
|
||||||
if (ATHUtil.INSTANCE.isWindowBackgroundDark(context)) {
|
if (ATHUtil.INSTANCE.isWindowBackgroundDark(context) && PreferenceUtil.getInstance().getGeneralTheme() != R.style.Theme_RetroMusic_Color) {
|
||||||
return ATHUtil.INSTANCE.resolveColor(context, R.attr.cardBackgroundColor);
|
return ATHUtil.INSTANCE.resolveColor(context, R.attr.cardBackgroundColor);
|
||||||
} else {
|
} else {
|
||||||
return color;
|
return color;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Hemanth Savarala.
|
||||||
|
*
|
||||||
|
* Licensed under the GNU General Public License v3
|
||||||
|
*
|
||||||
|
* This is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package code.name.monkey.retromusic.views
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
|
import com.google.android.material.chip.Chip
|
||||||
|
|
||||||
|
class RetroChip @JvmOverloads constructor(
|
||||||
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
|
||||||
|
Chip(context, attrs, defStyleAttr) {
|
||||||
|
init {
|
||||||
|
chipBackgroundColor = ColorStateList.valueOf(ThemeStore.primaryColor(context))
|
||||||
|
val iconColor = ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||||
|
val dividerColor = ATHUtil.resolveColor(context, R.attr.dividerColor)
|
||||||
|
chipIcon?.setTintList(ColorStateList.valueOf(iconColor))
|
||||||
|
setTextColor(iconColor)
|
||||||
|
chipStrokeColor = ColorStateList.valueOf(dividerColor)
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,14 +7,13 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="12dp">
|
android:paddingBottom="12dp">
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<code.name.monkey.retromusic.views.RetroChip
|
||||||
android:id="@+id/chipHead"
|
android:id="@+id/chipHead"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:fontFamily="@font/circular"
|
android:fontFamily="@font/circular"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
app:chipBackgroundColor="?colorPrimary"
|
|
||||||
app:chipIconTint="?iconColor"
|
app:chipIconTint="?iconColor"
|
||||||
app:chipStrokeColor="?dividerColor"
|
app:chipStrokeColor="?dividerColor"
|
||||||
app:chipStrokeWidth="1dp"
|
app:chipStrokeWidth="1dp"
|
||||||
|
|
|
@ -8,14 +8,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<code.name.monkey.retromusic.views.RetroChip
|
||||||
android:id="@+id/chipHead"
|
android:id="@+id/chipHead"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="12dp"
|
||||||
android:fontFamily="@font/circular"
|
android:fontFamily="@font/circular"
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
app:chipBackgroundColor="?colorPrimary"
|
|
||||||
app:chipIconTint="?iconColor"
|
app:chipIconTint="?iconColor"
|
||||||
app:chipStrokeColor="?dividerColor"
|
app:chipStrokeColor="?dividerColor"
|
||||||
app:chipStrokeWidth="1dp"
|
app:chipStrokeWidth="1dp"
|
||||||
|
|
Loading…
Reference in New Issue