Added new theme for Material You & a toggle

main
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

@ -20,6 +20,7 @@ import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.Constants.PRO_VERSION_PRODUCT_ID
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
import code.name.monkey.retromusic.util.PreferenceUtil
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
import com.google.android.material.color.DynamicColors
@ -46,7 +47,9 @@ class App : Application() {
.commit()
}
DynamicColors.applyToActivitiesIfAvailable(this)
if (PreferenceUtil.materialYou) {
DynamicColors.applyToActivitiesIfAvailable(this)
}
if (VersionUtils.hasNougatMR())
DynamicShortcutManager(this).initDynamicShortcuts()

View File

@ -148,3 +148,4 @@ const val SHOW_LYRICS = "show_lyrics"
const val REMEMBER_LAST_TAB = "remember_last_tab"
const val LAST_USED_TAB = "last_used_tab"
const val WHITELIST_MUSIC = "whitelist_music"
const val MATERIAL_YOU = "material_you"

View File

@ -33,6 +33,7 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.databinding.ActivityAlbumTagEditorBinding
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.setTint
import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.model.ArtworkInfo
@ -62,8 +63,6 @@ class AlbumTagEditorActivity : AbsTagEditorActivity<ActivityAlbumTagEditorBindin
}
override fun loadImageFromFile(selectedFile: Uri?) {
GlideApp.with(this@AlbumTagEditorActivity).asBitmapPalette().load(selectedFile)
.diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true)
.into(object : ImageViewTarget<BitmapPaletteWrapper>(binding.editorImage) {
@ -119,10 +118,10 @@ class AlbumTagEditorActivity : AbsTagEditorActivity<ActivityAlbumTagEditorBindin
private fun setUpViews() {
fillViewsWithFileTags()
MaterialUtil.setTint(binding.yearContainer, false)
MaterialUtil.setTint(binding.genreContainer, false)
MaterialUtil.setTint(binding.albumTitleContainer, false)
MaterialUtil.setTint(binding.albumArtistContainer, false)
binding.yearContainer.setTint(false)
binding.genreContainer.setTint(false)
binding.albumTitleContainer.setTint(false)
binding.albumArtistContainer.setTint(false)
binding.albumText.appHandleColor().addTextChangedListener(this)
binding.albumArtistText.appHandleColor().addTextChangedListener(this)

View File

@ -22,10 +22,10 @@ import android.text.TextWatcher
import android.view.LayoutInflater
import android.widget.ImageView
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.databinding.ActivitySongTagEditorBinding
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.setTint
import code.name.monkey.retromusic.repository.SongRepository
import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject
@ -50,15 +50,15 @@ class SongTagEditorActivity : AbsTagEditorActivity<ActivitySongTagEditorBinding>
@SuppressLint("ClickableViewAccessibility")
private fun setUpViews() {
fillViewsWithFileTags()
MaterialUtil.setTint(binding.songTextContainer, false)
MaterialUtil.setTint(binding.composerContainer, false)
MaterialUtil.setTint(binding.albumTextContainer, false)
MaterialUtil.setTint(binding.artistContainer, false)
MaterialUtil.setTint(binding.albumArtistContainer, false)
MaterialUtil.setTint(binding.yearContainer, false)
MaterialUtil.setTint(binding.genreContainer, false)
MaterialUtil.setTint(binding.trackNumberContainer, false)
MaterialUtil.setTint(binding.lyricsContainer, false)
binding.songTextContainer.setTint(false)
binding.composerContainer.setTint(false)
binding.albumTextContainer.setTint(false)
binding.artistContainer.setTint(false)
binding.albumArtistContainer.setTint(false)
binding.yearContainer.setTint(false)
binding.genreContainer.setTint(false)
binding.trackNumberContainer.setTint(false)
binding.lyricsContainer.setTint(false)
binding.songText.appHandleColor().addTextChangedListener(this)
binding.albumText.appHandleColor().addTextChangedListener(this)

View File

@ -21,6 +21,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.fragment.app.findFragment
import androidx.navigation.findNavController
@ -30,6 +31,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
@ -190,7 +192,11 @@ class HomeAdapter(
)
fun bindView(home: Home) {
val color = ThemeStore.accentColor(activity)
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
ContextCompat.getColor(App.getContext(), R.color.m3_accent_color)
} else {
ThemeStore.accentColor(activity)
}
itemView.findViewById<TextView>(R.id.message).apply {
setTextColor(color)
setOnClickListener {

View File

@ -16,10 +16,9 @@ package code.name.monkey.retromusic.adapter.song
import android.view.View
import androidx.fragment.app.FragmentActivity
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.applyOutlineColor
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.accentOutlineColor
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song
@ -45,19 +44,18 @@ class ShuffleButtonSongAdapter(
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
if (holder.itemViewType == OFFSET_ITEM) {
val color = ThemeStore.accentColor(activity)
val viewHolder = holder as ViewHolder
viewHolder.playAction?.let {
it.setOnClickListener {
MusicPlayerRemote.openQueue(dataSet, 0, true)
}
it.applyOutlineColor(color)
it.accentOutlineColor()
}
viewHolder.shuffleAction?.let {
it.setOnClickListener {
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
}
it.applyColor(color)
it.accentColor()
}
} else {
super.onBindViewHolder(holder, position - 1)

View File

@ -37,6 +37,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil.materialYou
import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import com.google.android.material.floatingactionbutton.FloatingActionButton
@ -84,23 +85,32 @@ fun Fragment.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
fun Dialog.resolveColor(@AttrRes attr: Int, fallBackColor: Int = 0) =
ATHUtil.resolveColor(context, attr, fallBackColor)
// Don't apply accent colors if Material You is enabled
// Material Components will take care of applying material you colors
fun CheckBox.addAccentColor() {
if (materialYou) return
buttonTintList = ColorStateList.valueOf(ThemeStore.accentColor(context))
}
fun SeekBar.addAccentColor() {
if (materialYou) return
val colorState = ColorStateList.valueOf(ThemeStore.accentColor(context))
progressTintList = colorState
thumbTintList = colorState
}
fun Button.accentTextColor() = setTextColor(ThemeStore.accentColor(App.getContext()))
fun Button.accentTextColor() {
if (materialYou) return
setTextColor(ThemeStore.accentColor(App.getContext()))
}
fun MaterialButton.accentBackgroundColor() {
if (materialYou) return
backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(App.getContext()))
}
fun MaterialButton.accentOutlineColor() {
if (materialYou) return
val color = ThemeStore.accentColor(context)
val colorStateList = ColorStateList.valueOf(color)
iconTint = colorStateList
@ -116,6 +126,7 @@ fun SeekBar.applyColor(@ColorInt color: Int) {
}
fun ExtendedFloatingActionButton.accentColor() {
if (materialYou) return
val color = ThemeStore.accentColor(context)
val textColor = MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color))
val colorStateList = ColorStateList.valueOf(color)
@ -126,6 +137,7 @@ fun ExtendedFloatingActionButton.accentColor() {
}
fun FloatingActionButton.accentColor() {
if (materialYou) return
val color = ThemeStore.accentColor(context)
val textColor = MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color))
backgroundTintList = ColorStateList.valueOf(color)
@ -145,15 +157,21 @@ fun MaterialButton.applyColor(color: Int) {
iconTint = textColorColorStateList
}
fun MaterialButton.accentColor() = applyColor(ThemeStore.accentColor(context))
fun MaterialButton.accentColor() {
if (materialYou) return
applyColor(ThemeStore.accentColor(context))
}
fun MaterialButton.applyOutlineColor(color: Int) {
val textColorColorStateList = ColorStateList.valueOf(color)
setTextColor(textColorColorStateList)
iconTint = textColorColorStateList
val colorStateList = ColorStateList.valueOf(color)
iconTint = colorStateList
strokeColor = colorStateList
setTextColor(colorStateList)
rippleColor = colorStateList
}
fun TextInputLayout.accentColor() {
if (materialYou) return
val accentColor = ThemeStore.accentColor(context)
val colorState = ColorStateList.valueOf(accentColor)
boxStrokeColor = accentColor
@ -162,6 +180,7 @@ fun TextInputLayout.accentColor() {
}
fun CircularProgressIndicator.accentColor() {
if (materialYou) return
val color = ThemeStore.accentColor(context)
setIndicatorColor(color)
trackColor = ColorUtil.withAlpha(color, 0.2f)
@ -174,6 +193,21 @@ fun CircularProgressIndicator.applyColor(color: Int) {
fun AppCompatImageView.accentColor(): Int = ThemeStore.accentColor(context)
fun TextInputLayout.setTint(background: Boolean = true) {
if (materialYou) return
val accentColor = ThemeStore.accentColor(context)
val colorState = ColorStateList.valueOf(accentColor)
if (background) {
backgroundTintList = colorState
defaultHintTextColor = colorState
} else {
boxStrokeColor = accentColor
defaultHintTextColor = colorState
isHintAnimationEnabled = true
}
}
@CheckResult
fun Drawable.tint(@ColorInt color: Int): Drawable {
val tintedDrawable = DrawableCompat.wrap(this).mutate()

View File

@ -27,6 +27,7 @@ import androidx.core.animation.doOnEnd
import androidx.core.animation.doOnStart
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.util.PreferenceUtil
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.imageview.ShapeableImageView
import com.google.android.material.shape.ShapeAppearanceModel
@ -51,6 +52,7 @@ fun View.hidden() {
fun View.showOrHide(show: Boolean) = if (show) show() else hide()
fun EditText.appHandleColor(): EditText {
if (PreferenceUtil.materialYou) return this
TintHelper.colorHandles(this, ThemeStore.accentColor(context))
return this
}

View File

@ -20,6 +20,7 @@ import android.view.MenuInflater
import android.view.MenuItem
import android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.core.view.doOnPreDraw
@ -29,6 +30,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.adapter.HomeAdapter
import code.name.monkey.retromusic.databinding.FragmentBannerHomeBinding
@ -139,7 +141,11 @@ class HomeFragment :
MaterialSharedAxis(MaterialSharedAxis.Z, false)
findNavController().navigate(R.id.searchFragment, null, navOptions)
}
val color = ThemeStore.accentColor(requireContext())
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
ContextCompat.getColor(App.getContext(), R.color.m3_accent_color)
} else {
ThemeStore.accentColor(requireContext())
}
val hexColor = String.format("#%06X", 0xFFFFFF and color)
val appName = HtmlCompat.fromHtml(
"Retro <span style='color:$hexColor';>Music</span>",

View File

@ -111,6 +111,12 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
true
}
}
val materialYou: ATESwitchPreference? = findPreference(MATERIAL_YOU)
materialYou?.setOnPreferenceChangeListener { _, _ ->
restartActivity()
true
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

View File

@ -1,8 +1,10 @@
package code.name.monkey.retromusic.glide
import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.App.Companion.getContext
import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.Constants.USER_PROFILE
@ -17,6 +19,7 @@ import code.name.monkey.retromusic.util.CustomArtistImageUtil.Companion.getFile
import code.name.monkey.retromusic.util.CustomArtistImageUtil.Companion.getInstance
import code.name.monkey.retromusic.util.MusicUtil.getMediaStoreAlbumCoverUri
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.PreferenceUtil.materialYou
import com.bumptech.glide.GenericTransitionOptions
import com.bumptech.glide.Priority
import com.bumptech.glide.RequestBuilder
@ -185,7 +188,11 @@ object RetroGlideExtension {
return TintHelper.createTintedDrawable(
getContext(),
R.drawable.ic_account,
accentColor(getContext())
if (materialYou && VersionUtils.hasS()) {
ContextCompat.getColor(getContext(), R.color.m3_accent_color)
} else {
accentColor(getContext())
}
)
}

View File

@ -613,4 +613,7 @@ object PreferenceUtil {
val crossFadeDuration
get() = sharedPreferences
.getInt(CROSS_FADE_DURATION, 0)
val materialYou
get() = sharedPreferences.getBoolean(MATERIAL_YOU, false)
}

View File

@ -18,6 +18,7 @@ import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.views.PopupBackground
import me.zhanghai.android.fastscroll.FastScroller
import me.zhanghai.android.fastscroll.FastScrollerBuilder
@ -27,13 +28,17 @@ import me.zhanghai.android.fastscroll.R
object ThemedFastScroller {
fun create(view: ViewGroup): FastScroller {
val context = view.context
val color = accentColor(context)
val color = if (PreferenceUtil.materialYou && VersionUtils.hasS()) {
context.getColor(code.name.monkey.retromusic.R.color.m3_accent_color)
} else {
accentColor(context)
}
val textColor = getPrimaryTextColor(context, isColorLight(color))
val fastScrollerBuilder = FastScrollerBuilder(view)
fastScrollerBuilder.useMd2Style()
fastScrollerBuilder.setPopupStyle { popupText ->
PopupStyles.MD2.accept(popupText)
popupText.background = PopupBackground(context)
popupText.background = PopupBackground(context, color)
popupText.setTextColor(textColor)
}

View File

@ -5,6 +5,7 @@ import androidx.annotation.StyleRes
import androidx.appcompat.app.AppCompatDelegate
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.generalThemeValue
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.theme.ThemeMode.*
object ThemeManager {
@ -12,11 +13,16 @@ object ThemeManager {
@StyleRes
fun getThemeResValue(
context: Context
): Int = when (context.generalThemeValue) {
LIGHT -> R.style.Theme_RetroMusic_Light
DARK -> R.style.Theme_RetroMusic_Base
BLACK -> R.style.Theme_RetroMusic_Black
AUTO -> R.style.Theme_RetroMusic_FollowSystem
): Int =
if (PreferenceUtil.materialYou) {
R.style.Theme_RetroMusic_MD3
} else {
when (context.generalThemeValue) {
LIGHT -> R.style.Theme_RetroMusic_Light
DARK -> R.style.Theme_RetroMusic_Base
BLACK -> R.style.Theme_RetroMusic_Black
AUTO -> R.style.Theme_RetroMusic_FollowSystem
}
}
fun getNightMode(

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);

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2020 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.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape>
<corners android:radius="8dp" />
<solid android:color="@color/md_green_500" />
</shape>
</item>
<item>
<selector>
<item android:state_activated="true">
<shape>
<corners android:radius="8dp" />
<solid android:color="@android:color/system_neutral1_300" />
</shape>
</item>
</selector>
</item>
</ripple>

View File

@ -13,6 +13,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:paddingVertical="10dp"
android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
@ -26,12 +27,12 @@
android:id="@+id/shuffleAction"
style="@style/Widget.Material3.Button.Icon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
android:paddingVertical="10dp"
android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -13,6 +13,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:paddingVertical="10dp"
android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
@ -27,13 +28,12 @@
android:id="@+id/shuffleAction"
style="@style/Widget.Material3.Button.Icon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
android:paddingVertical="10dp"
android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
app:icon="@drawable/ic_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -18,16 +18,16 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="16dp"
android:paddingVertical="10dp">
android:paddingHorizontal="16dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/playAction"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:paddingVertical="10dp"
android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
@ -38,12 +38,12 @@
android:id="@+id/shuffleAction"
style="@style/Widget.Material3.Button.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="4dp"
android:layout_weight="1"
android:paddingVertical="10dp"
android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_shuffle" />
</LinearLayout>

View File

@ -55,17 +55,12 @@
<code.name.monkey.retromusic.views.BottomNavigationBarTinted
android:id="@+id/bottomNavigationView"
style="@style/Widget.Material3.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_nav_height"
android:layout_gravity="bottom"
android:background="?attr/colorSurface"
android:elevation="0dp"
app:itemHorizontalTranslationEnabled="false"
app:itemIconTint="@drawable/bottom_navigation_item_colors"
app:itemTextAppearanceActive="@style/BottomSheetItemTextAppearance"
app:itemTextAppearanceInactive="@style/BottomSheetItemTextAppearance"
app:itemTextColor="@drawable/bottom_navigation_item_colors"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_navigation_main"
tools:layout_height="56dp" />
tools:layout_height="wrap_content" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -14,7 +14,7 @@
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.RetroMusic.Base.MD3.DayNight">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="windowActionBarOverlay">true</item>
@ -27,9 +27,11 @@
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base" parent="Theme.RetroMusic.Base.MD3.Dark">
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/darkColorPrimary</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -47,9 +49,11 @@
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="android:windowBackground">@color/window_color_dark</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base.Light" parent="Theme.RetroMusic.Base.MD3.Light">
<style name="Theme.RetroMusic.Base.Light" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="roundSelector">@drawable/round_selector</item>
@ -64,5 +68,7 @@
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColorLight</item>
<item name="elevationOverlayColor">@color/elevationOverlayLight</item>
</style>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="md3_available">true</bool>
</resources>

View File

@ -0,0 +1,9 @@
<resources>
<style name="Theme.RetroMusic.MD3" parent="@style/Theme.Material3.DayNight.NoActionBar" >
<item name="rectSelector">@drawable/rect_selector</item>
</style>
<style name="BottomSheetStyle" parent="Widget.MaterialComponents.BottomSheet">
<item name="android:maxWidth">@empty</item>
</style>
</resources>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.RetroMusic.Base.MD3.Light" parent="Theme.Material3.Light.NoActionBar" />
<style name="Theme.RetroMusic.Base.MD3.DayNight" parent="Theme.Material3.DayNight.NoActionBar" />
<style name="Theme.RetroMusic.Base.MD3.Dark" parent="Theme.Material3.DayNight.NoActionBar" />
<style name="Theme.RetroMusic.Base.MD3.Black" parent="Theme.Material3.DayNight.NoActionBar" />
</resources>

View File

@ -35,5 +35,4 @@
<color name="bottomSheetColorBlack">#000000</color>
<color name="bottomSheetColor">#FFFFFF</color>
</resources>

View File

@ -34,8 +34,8 @@
<dimen name="now_playing_top_margin">12dp</dimen>
<dimen name="icon_notification_dimen">32dp</dimen>
<dimen name="mini_player_height_expanded">112dp</dimen>
<dimen name="mini_cast_player_height_expanded">120dp</dimen>
<dimen name="mini_player_height_expanded">136dp</dimen>
<dimen name="mini_cast_player_height_expanded">144dp</dimen>
<dimen name="toolbar_margin_horizontal">8dp</dimen>
<dimen name="toolbar_height">48dp</dimen>
<dimen name="item_song_height">52dp</dimen>
@ -53,5 +53,5 @@
<dimen name="indicator_radius">10dp</dimen>
<dimen name="lyrics_dialog_radius">20dp</dimen>
<dimen name="cast_mini_player_height">64dp</dimen>
<dimen name="bottom_nav_height">56dp</dimen>
<dimen name="bottom_nav_height">80dp</dimen>
</resources>

View File

@ -21,4 +21,8 @@
<string name="app_shortcut_top_tracks_long" translatable="false">@string/my_top_tracks</string>
<string name="empty_text_emoji" translatable="false">&#128561;</string>
<!-- Material You -->
<string name="pref_title_md3">Material You</string>
<bool name="md3_available">false</bool>
</resources>

View File

@ -23,6 +23,16 @@
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
</style>
<style name="Theme.RetroMusic.MD3" parent="@style/Theme.Material3.DayNight.NoActionBar">
<item name="roundSelector">@drawable/round_selector</item>
<item name="rectSelector">@drawable/rect_selector</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.DayNight</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="popupWindowStyle">@style/MaterialPopupMenuStyle</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
</style>
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />
<style name="Theme.RetroMusic.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.RetroMusic.Base.MD3.DayNight">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="windowActionBarOverlay">true</item>
@ -15,9 +15,11 @@
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="popupWindowStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base" parent="Theme.RetroMusic.Base.MD3.Dark">
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/darkColorSurface</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -34,9 +36,11 @@
<item name="android:windowBackground">@color/window_color_dark</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base.Black" parent="Theme.RetroMusic.Base.MD3.Black">
<style name="Theme.RetroMusic.Base.Black" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/blackColorSurface</item>
<item name="roundSelector">@drawable/round_selector</item>
<item name="rectSelector">@drawable/rect_selector</item>
@ -51,9 +55,11 @@
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/bottomSheetColorBlack</item>
<item name="elevationOverlayColor">@color/elevationOverlayBlack</item>
</style>
<style name="Theme.RetroMusic.Base.Light" parent="Theme.RetroMusic.Base.MD3.Light">
<style name="Theme.RetroMusic.Base.Light" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="roundSelector">@drawable/round_selector</item>
@ -68,32 +74,10 @@
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
</style>
<!-- Base Themes -->
<style name="Theme.RetroMusic.Base.MD3" parent="Theme.RetroMusic.Base" />
<style name="Theme.RetroMusic.Base.MD3.Light" parent="Theme.Material3.Light.NoActionBar">
<item name="bottomSheetTint">@color/bottomSheetColorLight</item>
<item name="elevationOverlayColor">@color/elevationOverlayLight</item>
</style>
<style name="Theme.RetroMusic.Base.MD3.DayNight" parent="Theme.Material3.DayNight.NoActionBar">
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base.MD3.Dark" parent="Theme.Material3.DayNight.NoActionBar">
<item name="bottomSheetTint">@color/bottomSheetColor</item>
<item name="elevationOverlayColor">@color/elevationOverlay</item>
</style>
<style name="Theme.RetroMusic.Base.MD3.Black" parent="Theme.Material3.DayNight.NoActionBar">
<item name="bottomSheetTint">@color/bottomSheetColorBlack</item>
<item name="elevationOverlayColor">@color/elevationOverlayBlack</item>
</style>
<style name="MusicProgressSliderParent">
<item name="android:progressDrawable">@android:color/transparent</item>
<item name="android:layout_width">match_parent</item>

View File

@ -17,10 +17,19 @@
app:icon="@drawable/ic_color_lens" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:dependency="material_you"
android:key="black_theme"
android:layout="@layout/list_item_view_switch_no_title"
android:title="@string/black_theme_name" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:disableDependentsState="true"
android:key="material_you"
android:layout="@layout/list_item_view_switch_no_title"
android:title="@string/pref_title_md3"
app:isPreferenceVisible="@bool/md3_available" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
@ -29,6 +38,7 @@
android:title="@string/colors">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
android:dependency="material_you"
android:key="accent_color"
android:layout="@layout/list_item_color_view"
android:persistent="false"
@ -38,6 +48,7 @@
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:dependency="material_you"
android:key="desaturated_color"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_desaturated_color"
@ -52,6 +63,7 @@
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:dependency="material_you"
android:key="should_color_app_shortcuts"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_colored_app_shortcuts"

View File

@ -9,7 +9,6 @@ import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.util.ATHUtil.isWindowBackgroundDark
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.VersionUtils
/**
@ -205,9 +204,6 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
@CheckResult
@ColorInt
fun accentColor(context: Context): Int {
if (VersionUtils.hasS()) {
return ContextCompat.getColor(context, R.color.m3_accent_color)
}
val desaturatedColor = prefs(context).getBoolean("desaturated_color", false)
val color = prefs(context).getInt(
ThemeStorePrefKeys.KEY_ACCENT_COLOR,