Fixed some colors
This commit is contained in:
parent
3cbd938f26
commit
0019a5a8af
2 changed files with 31 additions and 3 deletions
|
|
@ -58,6 +58,7 @@ public class PlaybackControlsFragment extends Fragment implements MusicServiceEv
|
||||||
|
|
||||||
private AbsMusicServiceActivity activity;
|
private AbsMusicServiceActivity activity;
|
||||||
private int lastPlaybackControlsColor;
|
private int lastPlaybackControlsColor;
|
||||||
|
private int lastDisabledPlaybackControlsColor;
|
||||||
|
|
||||||
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
|
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
|
||||||
|
|
||||||
|
|
@ -147,7 +148,14 @@ public class PlaybackControlsFragment extends Fragment implements MusicServiceEv
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int color) {
|
public void setColor(int color) {
|
||||||
lastPlaybackControlsColor = ColorUtil.getOpaqueColor(ColorUtil.getSecondaryTextColorForBackground(getContext(), color));
|
if (ColorUtil.useDarkTextColorOnBackground(color)) {
|
||||||
|
lastPlaybackControlsColor = ColorUtil.getSecondaryTextColor(getActivity(), true);
|
||||||
|
lastDisabledPlaybackControlsColor = ColorUtil.getSecondaryDisabledTextColor(getActivity(), true);
|
||||||
|
} else {
|
||||||
|
lastPlaybackControlsColor = ColorUtil.getPrimaryTextColor(getActivity(), false);
|
||||||
|
lastDisabledPlaybackControlsColor = ColorUtil.getPrimaryDisabledTextColor(getActivity(), false);
|
||||||
|
}
|
||||||
|
|
||||||
updateRepeatState();
|
updateRepeatState();
|
||||||
updateShuffleState();
|
updateShuffleState();
|
||||||
updatePrevNextColor();
|
updatePrevNextColor();
|
||||||
|
|
@ -235,7 +243,7 @@ public class PlaybackControlsFragment extends Fragment implements MusicServiceEv
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
shuffleButton.setImageDrawable(Util.getTintedDrawable(activity, R.drawable.ic_shuffle_white_36dp,
|
shuffleButton.setImageDrawable(Util.getTintedDrawable(activity, R.drawable.ic_shuffle_white_36dp,
|
||||||
ColorUtil.getColorWithAlpha(0.5f, lastPlaybackControlsColor)));
|
lastDisabledPlaybackControlsColor));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -262,7 +270,7 @@ public class PlaybackControlsFragment extends Fragment implements MusicServiceEv
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
repeatButton.setImageDrawable(Util.getTintedDrawable(activity, R.drawable.ic_repeat_white_36dp,
|
repeatButton.setImageDrawable(Util.getTintedDrawable(activity, R.drawable.ic_repeat_white_36dp,
|
||||||
ColorUtil.getColorWithAlpha(0.5f, lastPlaybackControlsColor)));
|
lastDisabledPlaybackControlsColor));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,16 @@ public class ColorUtil {
|
||||||
return dark ? ContextCompat.getColor(context, R.color.secondary_text_default_material_light) : ContextCompat.getColor(context, R.color.secondary_text_default_material_dark);
|
return dark ? ContextCompat.getColor(context, R.color.secondary_text_default_material_light) : ContextCompat.getColor(context, R.color.secondary_text_default_material_dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getPrimaryDisabledTextColor(final Context context, boolean dark) {
|
||||||
|
return dark ? ContextCompat.getColor(context, R.color.primary_text_disabled_material_light) : ContextCompat.getColor(context, R.color.primary_text_disabled_material_dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getSecondaryDisabledTextColor(final Context context, boolean dark) {
|
||||||
|
return dark ? ContextCompat.getColor(context, R.color.secondary_text_disabled_material_light) : ContextCompat.getColor(context, R.color.secondary_text_disabled_material_dark);
|
||||||
|
}
|
||||||
|
|
||||||
public static float getLuminance(@ColorInt int color) {
|
public static float getLuminance(@ColorInt int color) {
|
||||||
return (Color.red(color) * 0.299f + Color.green(color) * 0.587f + Color.blue(color) * 0.114f);
|
return (Color.red(color) * 0.299f + Color.green(color) * 0.587f + Color.blue(color) * 0.114f);
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +132,16 @@ public class ColorUtil {
|
||||||
return getSecondaryTextColor(context, useDarkTextColorOnBackground(backgroundColor));
|
return getSecondaryTextColor(context, useDarkTextColorOnBackground(backgroundColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getPrimaryDisabledTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||||
|
return getPrimaryDisabledTextColor(context, useDarkTextColorOnBackground(backgroundColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getSecondaryDisabledTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||||
|
return getSecondaryDisabledTextColor(context, useDarkTextColorOnBackground(backgroundColor));
|
||||||
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
|
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
|
||||||
while (ColorUtil.useDarkTextColorOnBackground(backgroundColor)) {
|
while (ColorUtil.useDarkTextColorOnBackground(backgroundColor)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue