Added new theme for Material You & a toggle

This commit is contained in:
Prathamesh More 2021-09-26 15:59:32 +05:30
parent 289557898e
commit f23b102e41
34 changed files with 243 additions and 123 deletions

View file

@ -35,23 +35,26 @@ class BottomNavigationBarTinted @JvmOverloads constructor(
init {
labelVisibilityMode = PreferenceUtil.tabTitleMode
val iconColor = ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
val accentColor = ThemeStore.accentColor(context)
NavigationViewUtil.setItemIconColors(
this,
ColorUtil.withAlpha(iconColor, 0.5f),
accentColor
)
NavigationViewUtil.setItemTextColors(
this,
ColorUtil.withAlpha(iconColor, 0.5f),
accentColor
)
itemRippleColor = ColorStateList.valueOf(accentColor.addAlpha())
background = ColorDrawable(ATHUtil.resolveColor(context, R.attr.colorSurface))
if (!PreferenceUtil.materialYou) {
val iconColor = ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
val accentColor = ThemeStore.accentColor(context)
NavigationViewUtil.setItemIconColors(
this,
ColorUtil.withAlpha(iconColor, 0.5f),
accentColor
)
NavigationViewUtil.setItemTextColors(
this,
ColorUtil.withAlpha(iconColor, 0.5f),
accentColor
)
itemRippleColor = ColorStateList.valueOf(accentColor.addAlpha(0.08F))
background = ColorDrawable(ATHUtil.resolveColor(context, R.attr.colorSurface))
itemActiveIndicatorColor = ColorStateList.valueOf(accentColor.addAlpha(0.12F))
}
}
}
fun Int.addAlpha(): Int {
return ColorUtil.withAlpha(this, 0.12f)
fun Int.addAlpha(alpha: Float): Int {
return ColorUtil.withAlpha(this, alpha)
}

View file

@ -32,7 +32,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R;
public class PopupBackground extends Drawable {
@ -47,10 +46,10 @@ public class PopupBackground extends Drawable {
@NonNull private final Matrix mTempMatrix = new Matrix();
public PopupBackground(@NonNull Context context) {
public PopupBackground(@NonNull Context context, int color) {
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(ThemeStore.Companion.accentColor(context));
mPaint.setColor(color);
mPaint.setStyle(Paint.Style.FILL);
Resources resources = context.getResources();
mPaddingStart = resources.getDimensionPixelOffset(R.dimen.afs_md2_popup_padding_start);