Removed colors

Removed text color from Album and Artist details
This commit is contained in:
Hemanth S 2020-05-12 22:13:00 +05:30
parent 2e22c74fef
commit 54e6a8fb81
12 changed files with 98 additions and 109 deletions

View file

@ -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

View file

@ -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

View file

@ -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 -> {

View file

@ -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() {

View file

@ -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 {

View file

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