Added color change animation on cab creation

This commit is contained in:
Prathamesh More 2021-09-11 16:52:47 +05:30
parent d8c21ba7bb
commit 6cc0985ab6
8 changed files with 58 additions and 13 deletions

View file

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

View file

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