diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
index 2a5743550..b2dfdffc3 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
@@ -268,15 +268,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
}
private fun setColors(color: Int) {
- val textColor = if (PreferenceUtil.getInstance(this).adaptiveColor)
- color.ripAlpha()
- else
- ATHUtil.resolveColor(this, android.R.attr.textColorPrimary)
-
- songTitle.setTextColor(textColor)
- moreTitle.setTextColor(textColor)
- aboutAlbumTitle.setTextColor(textColor)
-
val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor)
color.ripAlpha()
else
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
index 2823c5904..72fb6ceaf 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
@@ -250,20 +250,10 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors.backgroundColor)
}
-
})
}
private fun setColors(color: Int) {
- val textColor = if (PreferenceUtil.getInstance(this).adaptiveColor)
- color.ripAlpha()
- else
- ATHUtil.resolveColor(this, android.R.attr.textColorPrimary)
-
- albumTitle.setTextColor(textColor)
- songTitle.setTextColor(textColor)
- biographyTitle.setTextColor(textColor)
-
val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor)
color.ripAlpha()
else
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt
index a38876cb1..0d2049c38 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt
@@ -45,8 +45,6 @@ import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchAct
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.fragment_classic_controls.*
import kotlinx.android.synthetic.main.fragment_classic_player.*
-import kotlinx.android.synthetic.main.status_bar.*
-
class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
MusicProgressViewUpdateHelper.Callback {
@@ -80,6 +78,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
override fun onStateChanged(bottomSheet: View, newState: Int) {
val activity = requireActivity() as AbsSlidingMusicPanelActivity
+ val isDark = ATHUtil.isWindowBackgroundDark(requireContext());
when (newState) {
BottomSheetBehavior.STATE_EXPANDED,
BottomSheetBehavior.STATE_DRAGGING -> {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
index bd7c11b43..0f0c3f876 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt
@@ -2,6 +2,7 @@ package code.name.monkey.retromusic.fragments.player.color
import android.animation.ValueAnimator
import android.os.Bundle
+import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -36,14 +37,16 @@ class ColorFragment : AbsPlayerFragment() {
playbackControlsFragment.setDark(color)
navigationColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
-
- ToolbarContentTintHelper.colorizeToolbar(
- playerToolbar,
- color.secondaryTextColor,
- requireActivity()
- )
colorGradientBackground?.setBackgroundColor(color.backgroundColor)
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor))
+ Handler().postDelayed(Runnable {
+ ToolbarContentTintHelper.colorizeToolbar(
+ playerToolbar,
+ color.secondaryTextColor,
+ requireActivity()
+ )
+ }, 100)
+
}
override fun onFavoriteToggled() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java b/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
index 726587442..af212005f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/color/MediaNotificationProcessor.java
@@ -31,6 +31,9 @@ import androidx.palette.graphics.Palette;
import java.util.List;
+import code.name.monkey.appthemehelper.util.ATHUtil;
+import code.name.monkey.appthemehelper.util.ColorUtil;
+
import static androidx.core.graphics.ColorUtils.RGBToXYZ;
/**
@@ -477,13 +480,13 @@ public class MediaNotificationProcessor {
}
public int getMightyColor() {
- if (isColorLight(backgroundColor)) {
- return primaryTextColor;
- } else if (isColorLight(primaryTextColor)) {
- return secondaryTextColor;
- } else {
- return backgroundColor;
+ if (ATHUtil.INSTANCE.isWindowBackgroundDark(context)) {
+ if (!ColorUtil.INSTANCE.isColorLight(primaryTextColor)) {
+ return NotificationColorUtil.ensureTextContrastOnBlack(primaryTextColor);
+ }
+ return NotificationColorUtil.ensureTextBackgroundColor(backgroundColor, primaryTextColor, secondaryTextColor);
}
+ return primaryTextColor;
}
public interface OnPaletteLoadedListener {
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/color/NotificationColorUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/color/NotificationColorUtil.java
index a663535d4..4d607f82b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/color/NotificationColorUtil.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/color/NotificationColorUtil.java
@@ -33,6 +33,7 @@ import androidx.annotation.ColorInt;
import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
import java.util.WeakHashMap;
@@ -348,28 +349,26 @@ public class NotificationColorUtil {
return ColorUtilsFromCompat.LABToColor(result[0], result[1], result[2]);
}
- // public static int resolvePrimaryColor(Context context, int backgroundColor) {
-// boolean useDark = shouldUseDark(backgroundColor);
-// if (useDark) {
-// return context.getColor(
-// com.android.internal.R.color.notification_primary_text_color_light);
-// } else {
-// return context.getColor(
-// com.android.internal.R.color.notification_primary_text_color_dark);
-// }
-// }
-//
-// public static int resolveSecondaryColor(Context context, int backgroundColor) {
-// boolean useDark = shouldUseDark(backgroundColor);
-// if (useDark) {
-// return context.getColor(
-// com.android.internal.R.color.notification_secondary_text_color_light);
-// } else {
-// return context.getColor(
-// com.android.internal.R.color.notification_secondary_text_color_dark);
-// }
-// }
-//
+ public static int resolvePrimaryColor(Context context, int backgroundColor) {
+ boolean useDark = shouldUseDark(backgroundColor);
+ if (useDark) {
+ return ContextCompat.getColor(context, android.R.color.primary_text_light);
+ } else {
+ return ContextCompat.getColor(context, android.R.color.primary_text_light);
+ }
+ }
+
+
+ public static int resolveSecondaryColor(Context context, int backgroundColor) {
+ boolean useDark = shouldUseDark(backgroundColor);
+ if (useDark) {
+ return ContextCompat.getColor(context,
+ android.R.color.secondary_text_light);
+ } else {
+ return ContextCompat.getColor(context, android.R.color.secondary_text_dark);
+ }
+ }
+
public static int resolveActionBarColor(Context context, int backgroundColor) {
if (backgroundColor == Notification.COLOR_DEFAULT) {
return Color.BLACK;
@@ -377,16 +376,16 @@ public class NotificationColorUtil {
return getShiftedColor(backgroundColor, 7);
}
-// /**
-// * Resolves {@param color} to an actual color if it is {@link Notification#COLOR_DEFAULT}
-// */
-// public static int resolveColor(Context context, int color) {
-// if (color == Notification.COLOR_DEFAULT) {
-// return context.getColor(com.android.internal.R.color.notification_icon_default_color);
-// }
-// return color;
-// }
-//
+ /**
+ * Resolves {@param color} to an actual color if it is {@link Notification#COLOR_DEFAULT}
+ */
+ public static int resolveColor(Context context, int color) {
+ if (color == Notification.COLOR_DEFAULT) {
+ return ContextCompat.getColor(context, android.R.color.background_dark);
+ }
+ return color;
+ }
+
//
// public static int resolveContrastColor(Context context, int notificationColor,
// int backgroundColor) {
@@ -449,24 +448,24 @@ public class NotificationColorUtil {
return ColorUtilsFromCompat.LABToColor(result[0], result[1], result[2]);
}
-// public static int resolveAmbientColor(Context context, int notificationColor) {
-// final int resolvedColor = resolveColor(context, notificationColor);
-//
-// int color = resolvedColor;
-// color = NotificationColorUtil.ensureTextContrastOnBlack(color);
-//
-// if (color != resolvedColor) {
-// if (DEBUG){
-// Log.w(TAG, String.format(
-// "Ambient contrast of notification for %s is %s (over black)"
-// + " by changing #%s to #%s",
-// context.getPackageName(),
-// NotificationColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
-// Integer.toHexString(resolvedColor), Integer.toHexString(color)));
-// }
-// }
-// return color;
-// }
+ public static int resolveAmbientColor(Context context, int notificationColor) {
+ final int resolvedColor = resolveColor(context, notificationColor);
+
+ int color = resolvedColor;
+ color = NotificationColorUtil.ensureTextContrastOnBlack(color);
+
+ if (color != resolvedColor) {
+ if (DEBUG) {
+ Log.w(TAG, String.format(
+ "Ambient contrast of notification for %s is %s (over black)"
+ + " by changing #%s to #%s",
+ context.getPackageName(),
+ NotificationColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
+ Integer.toHexString(resolvedColor), Integer.toHexString(color)));
+ }
+ }
+ return color;
+ }
private static boolean shouldUseDark(int backgroundColor) {
boolean useDark = backgroundColor == Notification.COLOR_DEFAULT;
diff --git a/app/src/main/res/layout/activity_album_content.xml b/app/src/main/res/layout/activity_album_content.xml
index 9985cf801..651479435 100644
--- a/app/src/main/res/layout/activity_album_content.xml
+++ b/app/src/main/res/layout/activity_album_content.xml
@@ -45,6 +45,7 @@
android:padding="16dp"
android:text="@string/songs"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -69,6 +70,7 @@
android:padding="16dp"
android:text="@string/songs"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
@@ -101,6 +103,7 @@
android:padding="12dp"
android:text="@string/songs"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout/activity_artist_content.xml b/app/src/main/res/layout/activity_artist_content.xml
index 4b6ef23d0..23ed6b5d2 100644
--- a/app/src/main/res/layout/activity_artist_content.xml
+++ b/app/src/main/res/layout/activity_artist_content.xml
@@ -42,6 +42,7 @@
android:padding="16dp"
android:text="@string/albums"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
@@ -69,6 +70,7 @@
android:padding="16dp"
android:text="@string/songs"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
@@ -92,6 +94,7 @@
android:padding="16dp"
android:text="@string/biography"
android:textAppearance="@style/TextViewHeadline6"
+ android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
android:visibility="gone"
app:layout_constrainedWidth="true"
diff --git a/app/src/main/res/layout/activity_lyrics.xml b/app/src/main/res/layout/activity_lyrics.xml
index f4669d9d5..42adb1f1a 100644
--- a/app/src/main/res/layout/activity_lyrics.xml
+++ b/app/src/main/res/layout/activity_lyrics.xml
@@ -18,15 +18,15 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
- app:layout_scrollFlags="scroll|enterAlways"
- app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
- app:subtitleTextAppearance="@style/TextViewSubtitle1"
+ app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
+ app:subtitleTextAppearance="@style/TextViewCaption"
app:titleMargin="0dp"
app:titleMarginStart="0dp"
- app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
+ app:titleTextAppearance="@style/TextViewSubtitle1"
tools:subtitle="@tools:sample/full_names"
tools:title="@tools:sample/full_names" />
diff --git a/app/src/main/res/layout/fragment_adaptive_player.xml b/app/src/main/res/layout/fragment_adaptive_player.xml
index 24cc6be43..6d3fb00bb 100644
--- a/app/src/main/res/layout/fragment_adaptive_player.xml
+++ b/app/src/main/res/layout/fragment_adaptive_player.xml
@@ -38,10 +38,12 @@
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
- app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
+ app:subtitleTextAppearance="@style/TextViewCaption"
app:titleMargin="0dp"
app:titleMarginStart="0dp"
- app:titleTextAppearance="@style/TextAppearance.AppCompat.Subhead" />
+ app:titleTextAppearance="@style/TextViewSubtitle1"
+ tools:subtitle="@tools:sample/full_names"
+ tools:title="@tools:sample/full_names" />
diff --git a/app/src/main/res/layout/fragment_album_full_cover.xml b/app/src/main/res/layout/fragment_album_full_cover.xml
index d1ca66a08..19fe46dfe 100644
--- a/app/src/main/res/layout/fragment_album_full_cover.xml
+++ b/app/src/main/res/layout/fragment_album_full_cover.xml
@@ -1,5 +1,5 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_classic_player.xml b/app/src/main/res/layout/fragment_classic_player.xml
index df98f55dd..09d2ddeae 100644
--- a/app/src/main/res/layout/fragment_classic_player.xml
+++ b/app/src/main/res/layout/fragment_classic_player.xml
@@ -11,7 +11,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
-
-
+
+
+
-
-
-
-
+ android:layout_height="@dimen/status_bar_padding" />
-