diff --git a/app/src/main/java/code/name/monkey/retromusic/App.kt b/app/src/main/java/code/name/monkey/retromusic/App.kt
index a141fa069..35479e7ec 100644
--- a/app/src/main/java/code/name/monkey/retromusic/App.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/App.kt
@@ -43,7 +43,7 @@ class App : MultiDexApplication() {
// default theme
if (!ThemeStore.isConfigured(this, 3)) {
ThemeStore.editTheme(this)
- .accentColorRes(R.color.md_green_A200)
+ .accentColorRes(R.color.md_deep_purple_A200)
.coloredNavigationBar(true)
.commit()
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/RippleUtils.java b/app/src/main/java/code/name/monkey/retromusic/util/RippleUtils.java
new file mode 100644
index 000000000..6a61c5dba
--- /dev/null
+++ b/app/src/main/java/code/name/monkey/retromusic/util/RippleUtils.java
@@ -0,0 +1,146 @@
+package code.name.monkey.retromusic.util;
+
+import android.annotation.TargetApi;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.os.Build;
+import android.util.StateSet;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
+import androidx.core.graphics.ColorUtils;
+
+public class RippleUtils {
+ public static final boolean USE_FRAMEWORK_RIPPLE = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+ private static final int[] PRESSED_STATE_SET = {
+ android.R.attr.state_pressed,
+ };
+ private static final int[] HOVERED_FOCUSED_STATE_SET = {
+ android.R.attr.state_hovered, android.R.attr.state_focused,
+ };
+ private static final int[] FOCUSED_STATE_SET = {
+ android.R.attr.state_focused,
+ };
+ private static final int[] HOVERED_STATE_SET = {
+ android.R.attr.state_hovered,
+ };
+
+ private static final int[] SELECTED_PRESSED_STATE_SET = {
+ android.R.attr.state_selected, android.R.attr.state_pressed,
+ };
+ private static final int[] SELECTED_HOVERED_FOCUSED_STATE_SET = {
+ android.R.attr.state_selected, android.R.attr.state_hovered, android.R.attr.state_focused,
+ };
+ private static final int[] SELECTED_FOCUSED_STATE_SET = {
+ android.R.attr.state_selected, android.R.attr.state_focused,
+ };
+ private static final int[] SELECTED_HOVERED_STATE_SET = {
+ android.R.attr.state_selected, android.R.attr.state_hovered,
+ };
+ private static final int[] SELECTED_STATE_SET = {
+ android.R.attr.state_selected,
+ };
+
+ private static final int[] ENABLED_PRESSED_STATE_SET = {
+ android.R.attr.state_enabled, android.R.attr.state_pressed
+ };
+
+ public static ColorStateList convertToRippleDrawableColor(@Nullable ColorStateList rippleColor) {
+ if (USE_FRAMEWORK_RIPPLE) {
+ int size = 2;
+
+ final int[][] states = new int[size][];
+ final int[] colors = new int[size];
+ int i = 0;
+
+ // Ideally we would define a different composite color for each state, but that causes the
+ // ripple animation to abort prematurely.
+ // So we only allow two base states: selected, and non-selected. For each base state, we only
+ // base the ripple composite on its pressed state.
+
+ // Selected base state.
+ states[i] = SELECTED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, SELECTED_PRESSED_STATE_SET);
+ i++;
+
+ // Non-selected base state.
+ states[i] = StateSet.NOTHING;
+ colors[i] = getColorForState(rippleColor, PRESSED_STATE_SET);
+ i++;
+
+ return new ColorStateList(states, colors);
+ } else {
+ int size = 10;
+
+ final int[][] states = new int[size][];
+ final int[] colors = new int[size];
+ int i = 0;
+
+ states[i] = SELECTED_PRESSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, SELECTED_PRESSED_STATE_SET);
+ i++;
+
+ states[i] = SELECTED_HOVERED_FOCUSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, SELECTED_HOVERED_FOCUSED_STATE_SET);
+ i++;
+
+ states[i] = SELECTED_FOCUSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, SELECTED_FOCUSED_STATE_SET);
+ i++;
+
+ states[i] = SELECTED_HOVERED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, SELECTED_HOVERED_STATE_SET);
+ i++;
+
+ // Checked state.
+ states[i] = SELECTED_STATE_SET;
+ colors[i] = Color.TRANSPARENT;
+ i++;
+
+ states[i] = PRESSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, PRESSED_STATE_SET);
+ i++;
+
+ states[i] = HOVERED_FOCUSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, HOVERED_FOCUSED_STATE_SET);
+ i++;
+
+ states[i] = FOCUSED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, FOCUSED_STATE_SET);
+ i++;
+
+ states[i] = HOVERED_STATE_SET;
+ colors[i] = getColorForState(rippleColor, HOVERED_STATE_SET);
+ i++;
+
+ // Default state.
+ states[i] = StateSet.NOTHING;
+ colors[i] = Color.TRANSPARENT;
+ i++;
+
+ return new ColorStateList(states, colors);
+ }
+ }
+
+ @ColorInt
+ private static int getColorForState(@Nullable ColorStateList rippleColor, int[] state) {
+ int color;
+ if (rippleColor != null) {
+ color = rippleColor.getColorForState(state, rippleColor.getDefaultColor());
+ } else {
+ color = Color.TRANSPARENT;
+ }
+ return USE_FRAMEWORK_RIPPLE ? doubleAlpha(color) : color;
+ }
+
+ /**
+ * On API 21+, the framework composites a ripple color onto the display at about 50% opacity.
+ * Since we are providing precise ripple colors, cancel that out by doubling the opacity here.
+ */
+ @ColorInt
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private static int doubleAlpha(@ColorInt int color) {
+ int alpha = Math.min(2 * Color.alpha(color), 255);
+ return ColorUtils.setAlphaComponent(color, alpha);
+ }
+}
diff --git a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
index 1d4701c94..6df828631 100644
--- a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
@@ -15,13 +15,17 @@
package code.name.monkey.retromusic.views
import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.drawable.RippleDrawable
import android.util.AttributeSet
+import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.NavigationViewUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil
+import code.name.monkey.retromusic.util.RippleUtils
import com.google.android.material.bottomnavigation.BottomNavigationView
class BottomNavigationBarTinted @JvmOverloads constructor(
@@ -38,7 +42,11 @@ class BottomNavigationBarTinted @JvmOverloads constructor(
val accentColor = ThemeStore.accentColor(context)
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
-
+ itemBackground = RippleDrawable(RippleUtils.convertToRippleDrawableColor(ColorStateList.valueOf(ThemeStore.accentColor(context).addAlpha())), ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background), null)
setOnApplyWindowInsetsListener(null)
}
-}
\ No newline at end of file
+}
+
+private fun Int.addAlpha(): Int {
+ return ColorUtil.withAlpha(this, 0.12f)
+}
diff --git a/app/src/main/res/drawable-xxhdpi/bottom_navigation_item_background_ripple.xml b/app/src/main/res/drawable-xxhdpi/bottom_navigation_item_background_ripple.xml
new file mode 100644
index 000000000..8aff4a1e4
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/bottom_navigation_item_background_ripple.xml
@@ -0,0 +1,11 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bottom_navigation_item_background.xml b/app/src/main/res/drawable/bottom_navigation_item_background.xml
new file mode 100644
index 000000000..3ee82f453
--- /dev/null
+++ b/app/src/main/res/drawable/bottom_navigation_item_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_artist_selected_white_24dp.xml b/app/src/main/res/drawable/ic_artist_selected_white_24dp.xml
index ca9417a72..4e865f47c 100644
--- a/app/src/main/res/drawable/ic_artist_selected_white_24dp.xml
+++ b/app/src/main/res/drawable/ic_artist_selected_white_24dp.xml
@@ -7,8 +7,5 @@
-
+ android:pathData="M11,14C12,14 13.05,14.16 14.2,14.44C13.39,15.31 13,16.33 13,17.5C13,18.39 13.25,19.23 13.78,20H3V18C3,16.81 3.91,15.85 5.74,15.12C7.57,14.38 9.33,14 11,14M11,12C9.92,12 9,11.61 8.18,10.83C7.38,10.05 7,9.11 7,8C7,6.92 7.38,6 8.18,5.18C9,4.38 9.92,4 11,4C12.11,4 13.05,4.38 13.83,5.18C14.61,6 15,6.92 15,8C15,9.11 14.61,10.05 13.83,10.83C13.05,11.61 12.11,12 11,12M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z" />
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_artist_white_24dp.xml b/app/src/main/res/drawable/ic_artist_white_24dp.xml
index ba9618349..ce926c92e 100644
--- a/app/src/main/res/drawable/ic_artist_white_24dp.xml
+++ b/app/src/main/res/drawable/ic_artist_white_24dp.xml
@@ -6,8 +6,5 @@
android:viewportHeight="24">
-
+ android:pathData="M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4M11,6A2,2 0 0,0 9,8A2,2 0 0,0 11,10A2,2 0 0,0 13,8A2,2 0 0,0 11,6M11,13C12.1,13 13.66,13.23 15.11,13.69C14.5,14.07 14,14.6 13.61,15.23C12.79,15.03 11.89,14.9 11,14.9C8.03,14.9 4.9,16.36 4.9,17V18.1H13.04C13.13,18.8 13.38,19.44 13.76,20H3V17C3,14.34 8.33,13 11,13M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z" />
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_audiotrack_black_24dp.xml b/app/src/main/res/drawable/ic_audiotrack_black_24dp.xml
index 7575cd187..0cbc058db 100644
--- a/app/src/main/res/drawable/ic_audiotrack_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_audiotrack_black_24dp.xml
@@ -6,5 +6,5 @@
android:viewportHeight="24">
+ android:pathData="M12 3l0.01 10.55c-0.59-0.34-1.27-0.55-2-0.55C7.79 13 6 14.79 6 17s1.79 4 4.01 4S14 19.21 14 17V7h4V3h-6zm-1.99 16c-1.1 0-2-0.9-2-2s0.9-2 2-2 2 0.9 2 2-0.9 2-2 2z" />
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_audiotrack_selected_black_24dp.xml b/app/src/main/res/drawable/ic_audiotrack_selected_black_24dp.xml
index 9ae3e2b33..57206a2da 100644
--- a/app/src/main/res/drawable/ic_audiotrack_selected_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_audiotrack_selected_black_24dp.xml
@@ -7,5 +7,5 @@
+ android:pathData="M12 3v10.55c-0.59-0.34-1.27-0.55-2-0.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z" />
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_music_note_off_white_24dp.xml b/app/src/main/res/drawable/ic_music_note_off_white_24dp.xml
index 7c7bf9bc9..5643cb819 100644
--- a/app/src/main/res/drawable/ic_music_note_off_white_24dp.xml
+++ b/app/src/main/res/drawable/ic_music_note_off_white_24dp.xml
@@ -20,5 +20,5 @@
android:viewportHeight="24">
+ android:pathData="M14 7H18V3H12V7.61L14 9.61M12 10.44L4.41 2.86L3 4.27L12 13.27V13.55A3.94 3.94 0 0 0 8.67 13.23A4 4 0 0 0 10.65 20.95A4.1 4.1 0 0 0 14 16.85V15.27L19.73 21L21.14 19.59M10 19A2 2 0 1 1 12 17A2 2 0 0 1 10 19Z" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/sliding_music_panel_layout.xml b/app/src/main/res/layout/sliding_music_panel_layout.xml
index 9eae11dcf..b052fc37a 100644
--- a/app/src/main/res/layout/sliding_music_panel_layout.xml
+++ b/app/src/main/res/layout/sliding_music_panel_layout.xml
@@ -53,6 +53,7 @@
android:background="?colorSecondary"
android:elevation="0dp"
android:visibility="gone"
+ app:itemBackground="@drawable/bottom_navigation_item_background"
app:itemIconTint="@drawable/bottom_navigation_item_colors"
app:itemTextAppearanceActive="@style/BottomSheetItemTextAppearanceActive"
app:itemTextAppearanceInactive="@style/BottomSheetItemTextAppearanceInactive"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 63db75f74..712b55857 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -3,7 +3,7 @@
Team, social links
Accent color
- The theme accent color, defaults to teal
+ The theme accent color, defaults to purple
About
Add to favorites