Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e0b98fa authored by android-build-team Robot's avatar android-build-team Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixes the incorrect hover icon color in drop bar when dark theme" into ub-launcher3-edmonton

parents 59d6f26c 3e024c0e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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());
+19 −0
Original line number Diff line number Diff line
@@ -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);
    }
}