mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Optimize CIECLhEvaluator and ThemeManager.setActiveColor
This commit is contained in:
@@ -18,7 +18,13 @@ public class CIELChEvaluator implements TypeEvaluator<Integer> {
|
||||
private final ColorCIELCh mStartColor;
|
||||
private final ColorCIELCh mEndColor;
|
||||
|
||||
private final int mStartInt;
|
||||
private final int mEndInt;
|
||||
|
||||
public CIELChEvaluator(int startColor, int endColor) {
|
||||
mStartInt = startColor;
|
||||
mEndInt = endColor;
|
||||
|
||||
mStartColor = convertRgbToCIELCH(startColor);
|
||||
mEndColor = convertRgbToCIELCH(endColor);
|
||||
}
|
||||
@@ -29,6 +35,9 @@ public class CIELChEvaluator implements TypeEvaluator<Integer> {
|
||||
|
||||
@Override
|
||||
public Integer evaluate(float fraction, Integer ignored, Integer ignored2) {
|
||||
if (mStartInt == mEndInt) {
|
||||
return mStartInt;
|
||||
}
|
||||
|
||||
// CIELCH to CIELAB
|
||||
double L = mStartColor.L * (1 - fraction) + mEndColor.L * fraction;
|
||||
|
||||
@@ -621,8 +621,10 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
public static void setActiveColor(int color) {
|
||||
mActiveColor = color;
|
||||
LiveViewManager.refreshViews(QKPreference.THEME);
|
||||
if (mActiveColor != color) {
|
||||
mActiveColor = color;
|
||||
LiveViewManager.refreshViews(QKPreference.THEME);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isColorDarkEnough(int color) {
|
||||
|
||||
Reference in New Issue
Block a user