Fix home shortcuts color

This commit is contained in:
h4h13 2019-10-09 20:04:01 +05:30
parent 3f50a118f7
commit 87e4f78a1f
5 changed files with 13 additions and 13 deletions

View file

@ -60,7 +60,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
if (sections.isEmpty()) {
showEmptyView()
shortcuts.visibility = View.GONE
} else {
emptyContainer.hide()
}

View file

@ -19,6 +19,7 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
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
@ -45,8 +46,13 @@ class ColorIconsImageView : AppCompatImageView {
private fun setIconBackgroundColor(color: Int) {
setBackgroundResource(R.drawable.color_circle_gradient)
if (ATHUtil.isWindowBackgroundDark(context)) {
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.72f))
imageTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorPrimary))
} else {
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))
}
requestLayout()
invalidate()
}

View file

@ -17,7 +17,7 @@
app:civ_border="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
tools:srcCompat="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView
@ -199,7 +199,6 @@
<androidx.constraintlayout.widget.Group
android:id="@+id/shortcuts"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="history,lastAdded,topPlayed,actionShuffle" />

View file

@ -25,10 +25,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp">
android:padding="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
@ -52,6 +49,7 @@
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp"

View file

@ -25,10 +25,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp">
android:padding="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
@ -52,6 +49,7 @@
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp"