Loading src/com/android/launcher3/ButtonDropTarget.java +4 −2 Original line number Diff line number Diff line Loading @@ -192,8 +192,10 @@ public abstract class ButtonDropTarget extends TextView mCurrentFilter = new ColorMatrix(); } Themes.setColorScaleOnMatrix(getTextColor(), mSrcFilter); Themes.setColorScaleOnMatrix(targetColor, mDstFilter); int defaultTextColor = mOriginalTextColor.getDefaultColor(); Themes.setColorChangeOnMatrix(defaultTextColor, getTextColor(), mSrcFilter); Themes.setColorChangeOnMatrix(defaultTextColor, targetColor, mDstFilter); ValueAnimator anim1 = ValueAnimator.ofObject( new FloatArrayEvaluator(mCurrentFilter.getArray()), mSrcFilter.getArray(), mDstFilter.getArray()); Loading src/com/android/launcher3/util/Themes.java +19 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,23 @@ public class Themes { target.setScale(Color.red(color) / 255f, Color.green(color) / 255f, Color.blue(color) / 255f, Color.alpha(color) / 255f); } /** * Changes a color matrix such that, when applied to srcColor, it produces dstColor. * * Note that values on the last column of target ColorMatrix can be negative, and may result in * negative values when applied on a color. Such negative values will be automatically shifted * up to 0 by the framework. * * @param srcColor The color to start from * @param dstColor The color to create by applying target on srcColor * @param target The ColorMatrix to transform the color */ public static void setColorChangeOnMatrix(int srcColor, int dstColor, ColorMatrix target) { target.reset(); target.getArray()[4] = Color.red(dstColor) - Color.red(srcColor); target.getArray()[9] = Color.green(dstColor) - Color.green(srcColor); target.getArray()[14] = Color.blue(dstColor) - Color.blue(srcColor); target.getArray()[19] = Color.alpha(dstColor) - Color.alpha(srcColor); } } Loading
src/com/android/launcher3/ButtonDropTarget.java +4 −2 Original line number Diff line number Diff line Loading @@ -192,8 +192,10 @@ public abstract class ButtonDropTarget extends TextView mCurrentFilter = new ColorMatrix(); } Themes.setColorScaleOnMatrix(getTextColor(), mSrcFilter); Themes.setColorScaleOnMatrix(targetColor, mDstFilter); int defaultTextColor = mOriginalTextColor.getDefaultColor(); Themes.setColorChangeOnMatrix(defaultTextColor, getTextColor(), mSrcFilter); Themes.setColorChangeOnMatrix(defaultTextColor, targetColor, mDstFilter); ValueAnimator anim1 = ValueAnimator.ofObject( new FloatArrayEvaluator(mCurrentFilter.getArray()), mSrcFilter.getArray(), mDstFilter.getArray()); Loading
src/com/android/launcher3/util/Themes.java +19 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,23 @@ public class Themes { target.setScale(Color.red(color) / 255f, Color.green(color) / 255f, Color.blue(color) / 255f, Color.alpha(color) / 255f); } /** * Changes a color matrix such that, when applied to srcColor, it produces dstColor. * * Note that values on the last column of target ColorMatrix can be negative, and may result in * negative values when applied on a color. Such negative values will be automatically shifted * up to 0 by the framework. * * @param srcColor The color to start from * @param dstColor The color to create by applying target on srcColor * @param target The ColorMatrix to transform the color */ public static void setColorChangeOnMatrix(int srcColor, int dstColor, ColorMatrix target) { target.reset(); target.getArray()[4] = Color.red(dstColor) - Color.red(srcColor); target.getArray()[9] = Color.green(dstColor) - Color.green(srcColor); target.getArray()[14] = Color.blue(dstColor) - Color.blue(srcColor); target.getArray()[19] = Color.alpha(dstColor) - Color.alpha(srcColor); } }