Improved the color picking with the "Colored Playback Controls"
This commit is contained in:
parent
62c85aeeb5
commit
b5cb4e87ce
2 changed files with 63 additions and 31 deletions
|
|
@ -25,6 +25,15 @@
|
||||||
|
|
||||||
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
|
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
|
||||||
|
|
||||||
|
<h3>Version 0.9.43 beta4</h3>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li><b>NEW:</b> Improved the color picking with the "Colored Playback Controls". Leave some
|
||||||
|
feedback at the <a href="https://plus.google.com/u/0/communities/106227738496107108513">Google+
|
||||||
|
Community</a>.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<h3>Version 0.9.43 beta3</h3>
|
<h3>Version 0.9.43 beta3</h3>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
SeekBar progressSlider;
|
SeekBar progressSlider;
|
||||||
|
|
||||||
private int lastFooterColor;
|
private int lastFooterColor;
|
||||||
private int lastPlaybackControllsColor;
|
private int lastPlaybackControlsColor;
|
||||||
private int lastTitleTextColor;
|
private int lastTitleTextColor;
|
||||||
private int lastCaptionTextColor;
|
private int lastCaptionTextColor;
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpPlayPauseButtonTint() {
|
private void setUpPlayPauseButtonTint() {
|
||||||
int fabColor = colorPlaybackControls && slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED ? lastPlaybackControllsColor : getThemeColorAccent();
|
int fabColor = colorPlaybackControls && slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED ? lastPlaybackControlsColor : getThemeColorAccent();
|
||||||
setPlayPauseButtonTint(fabColor);
|
setPlayPauseButtonTint(fabColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,7 +402,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
|
|
||||||
miniPlayer.setAlpha(1 - slideOffset);
|
miniPlayer.setAlpha(1 - slideOffset);
|
||||||
|
|
||||||
int newColor = colorPlaybackControls ? (int) argbEvaluator.evaluate(slideOffset, getThemeColorAccent(), lastPlaybackControllsColor) : getThemeColorAccent();
|
int newColor = colorPlaybackControls ? (int) argbEvaluator.evaluate(slideOffset, getThemeColorAccent(), lastPlaybackControlsColor) : getThemeColorAccent();
|
||||||
setPlayPauseButtonTint(newColor);
|
setPlayPauseButtonTint(newColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -593,24 +593,57 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpProgressSliderTint() {
|
private void setUpProgressSliderTint() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
int thumbColor;
|
||||||
if (alternativeProgressSlider) {
|
int progressColor;
|
||||||
ColorStateList thumbTintList = colorPlaybackControls ? ColorStateList.valueOf(lastPlaybackControllsColor) : ThemeSingleton.get().positiveColor;
|
if (alternativeProgressSlider) {
|
||||||
progressSlider.setThumbTintList(thumbTintList);
|
if (colorPlaybackControls) {
|
||||||
|
thumbColor = lastPlaybackControlsColor;
|
||||||
} else {
|
} else {
|
||||||
final ColorStateList seekBarTint = colorPlaybackControls ? ColorStateList.valueOf(lastPlaybackControllsColor) : ColorStateList.valueOf(getThemeColorAccent());
|
thumbColor = ThemeSingleton.get().positiveColor.getDefaultColor();
|
||||||
progressSlider.setThumbTintList(seekBarTint);
|
|
||||||
progressSlider.setProgressTintList(seekBarTint);
|
|
||||||
}
|
}
|
||||||
|
progressColor = Color.TRANSPARENT;
|
||||||
} else {
|
} else {
|
||||||
if (alternativeProgressSlider) {
|
if (colorPlaybackControls) {
|
||||||
int color = colorPlaybackControls ? lastPlaybackControllsColor : ThemeSingleton.get().positiveColor.getDefaultColor();
|
if (ColorUtil.useDarkTextColorOnBackground(lastPlaybackControlsColor)) {
|
||||||
progressSlider.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
thumbColor = shiftColorDown(lastPlaybackControlsColor);
|
||||||
|
} else {
|
||||||
|
thumbColor = shiftColorUp(lastPlaybackControlsColor);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int color = colorPlaybackControls ? lastPlaybackControllsColor : getThemeColorAccent();
|
thumbColor = getThemeColorAccent();
|
||||||
progressSlider.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
|
||||||
progressSlider.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
|
||||||
}
|
}
|
||||||
|
progressColor = thumbColor;
|
||||||
|
}
|
||||||
|
setSeekBarTint(progressSlider, thumbColor, progressColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// note that this is not exactly the same as in ColorUtil
|
||||||
|
@SuppressWarnings("ResourceType")
|
||||||
|
private static int shiftColorUp(@ColorInt int color) {
|
||||||
|
int alpha = Color.alpha(color);
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
Color.colorToHSV(color, hsv);
|
||||||
|
hsv[2] *= 1.2f; // value component
|
||||||
|
return (alpha << 24) + (0x00ffffff & Color.HSVToColor(hsv));
|
||||||
|
}
|
||||||
|
|
||||||
|
// note that this is not exactly the same as in ColorUtil
|
||||||
|
@SuppressWarnings("ResourceType")
|
||||||
|
private static int shiftColorDown(@ColorInt int color) {
|
||||||
|
int alpha = Color.alpha(color);
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
Color.colorToHSV(color, hsv);
|
||||||
|
hsv[2] *= 0.8f; // value component
|
||||||
|
return (alpha << 24) + (0x00ffffff & Color.HSVToColor(hsv));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setSeekBarTint(SeekBar seekBar, @ColorInt int thumbColor, @ColorInt int progressColor) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
seekBar.setThumbTintList(ColorStateList.valueOf(thumbColor));
|
||||||
|
seekBar.setProgressTintList(ColorStateList.valueOf(progressColor));
|
||||||
|
} else {
|
||||||
|
seekBar.getThumb().setColorFilter(thumbColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
seekBar.getProgressDrawable().setColorFilter(progressColor, PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -662,7 +695,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
private void updateShuffleState() {
|
private void updateShuffleState() {
|
||||||
switch (MusicPlayerRemote.getShuffleMode()) {
|
switch (MusicPlayerRemote.getShuffleMode()) {
|
||||||
case MusicService.SHUFFLE_MODE_SHUFFLE:
|
case MusicService.SHUFFLE_MODE_SHUFFLE:
|
||||||
int activatedColor = colorPlaybackControls ? lastPlaybackControllsColor : ThemeSingleton.get().positiveColor.getDefaultColor();
|
int activatedColor = colorPlaybackControls ? lastPlaybackControlsColor : ThemeSingleton.get().positiveColor.getDefaultColor();
|
||||||
shuffleButton.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_shuffle_white_36dp,
|
shuffleButton.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_shuffle_white_36dp,
|
||||||
activatedColor));
|
activatedColor));
|
||||||
break;
|
break;
|
||||||
|
|
@ -685,7 +718,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRepeatState() {
|
private void updateRepeatState() {
|
||||||
int activatedColor = colorPlaybackControls ? lastPlaybackControllsColor : ThemeSingleton.get().positiveColor.getDefaultColor();
|
int activatedColor = colorPlaybackControls ? lastPlaybackControlsColor : ThemeSingleton.get().positiveColor.getDefaultColor();
|
||||||
switch (MusicPlayerRemote.getRepeatMode()) {
|
switch (MusicPlayerRemote.getRepeatMode()) {
|
||||||
case MusicService.REPEAT_MODE_ALL:
|
case MusicService.REPEAT_MODE_ALL:
|
||||||
repeatButton.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_repeat_white_36dp,
|
repeatButton.setImageDrawable(Util.getTintedDrawable(this, R.drawable.ic_repeat_white_36dp,
|
||||||
|
|
@ -895,10 +928,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
colorTransitionAnimator.addListener(new SimpleAnimatorListener() {
|
colorTransitionAnimator.addListener(new SimpleAnimatorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
if (newColor == ColorUtil.resolveColor(AbsSlidingMusicPanelActivity.this, R.attr.default_bar_color)) {
|
if (newColor == ColorUtil.resolveColor(AbsSlidingMusicPanelActivity.this, R.attr.default_bar_color) && ThemeSingleton.get().darkTheme) {
|
||||||
lastPlaybackControllsColor = Color.WHITE;
|
lastPlaybackControlsColor = Color.WHITE;
|
||||||
} else {
|
} else {
|
||||||
lastPlaybackControllsColor = shiftColorDown(newColor);
|
lastPlaybackControlsColor = newColor;
|
||||||
}
|
}
|
||||||
updateRepeatState();
|
updateRepeatState();
|
||||||
updateShuffleState();
|
updateShuffleState();
|
||||||
|
|
@ -914,16 +947,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
lastCaptionTextColor = captionTextColor;
|
lastCaptionTextColor = captionTextColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// note that this is not exactly the same as in ColorUtil
|
|
||||||
@SuppressWarnings("ResourceType")
|
|
||||||
private static int shiftColorDown(@ColorInt int color) {
|
|
||||||
int alpha = Color.alpha(color);
|
|
||||||
float[] hsv = new float[3];
|
|
||||||
Color.colorToHSV(color, hsv);
|
|
||||||
hsv[2] *= 0.5f; // value component
|
|
||||||
return (alpha << 24) + (0x00ffffff & Color.HSVToColor(hsv));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startUpdatingProgressViews() {
|
private void startUpdatingProgressViews() {
|
||||||
queueNextRefresh(1);
|
queueNextRefresh(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue