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

Commit 3e024c0e authored by Mehdi Alizadeh's avatar Mehdi Alizadeh
Browse files

Fixes the incorrect hover icon color in drop bar when dark theme

Bug: 78641863
Test: Manual test with dark and light wallpapers
Change-Id: Ic3fb68f5c5f746482a7f23b11284e30ac3e10168
parent 3aa3eb51
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);
    }
}