Added color change animation on cab creation
This commit is contained in:
parent
d8c21ba7bb
commit
6cc0985ab6
8 changed files with 58 additions and 13 deletions
|
@ -0,0 +1,19 @@
|
|||
package code.name.monkey.retromusic.util
|
||||
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.animation.ValueAnimator
|
||||
|
||||
class ColorAnimUtil {
|
||||
companion object {
|
||||
fun createColorAnimator(
|
||||
fromColor: Int,
|
||||
toColor: Int,
|
||||
mDuration: Long = 300
|
||||
): ValueAnimator {
|
||||
return ValueAnimator.ofInt(fromColor, toColor).apply {
|
||||
setEvaluator(ArgbEvaluator())
|
||||
duration = mDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -205,6 +205,17 @@ public class RetroColorUtil {
|
|||
return color;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int shiftBackgroundColor(@ColorInt int backgroundColor) {
|
||||
int color = backgroundColor;
|
||||
if (ColorUtil.INSTANCE.isColorLight(color)) {
|
||||
color = ColorUtil.INSTANCE.shiftColor(color, 0.5F);
|
||||
} else {
|
||||
color = ColorUtil.INSTANCE.shiftColor(color, 1.5F);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
private static class SwatchComparator implements Comparator<Palette.Swatch> {
|
||||
|
||||
private static SwatchComparator sInstance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue