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

Commit c0a06acf authored by Jay Aliomer's avatar Jay Aliomer Committed by Automerger Merge Worker
Browse files

Merge "Remove alpha clamping from ripple drawable" into tm-qpr-dev am: 2f34d56e am: e80c0892

parents f4454b71 e80c0892
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -72,8 +72,8 @@
    <item name="secondary_content_alpha_material_dark" format="float" type="dimen">.7</item>
    <item name="secondary_content_alpha_material_light" format="float" type="dimen">0.60</item>

    <item name="highlight_alpha_material_light" format="float" type="dimen">0.10</item>
    <item name="highlight_alpha_material_dark" format="float" type="dimen">0.10</item>
    <item name="highlight_alpha_material_light" format="float" type="dimen">0.5</item>
    <item name="highlight_alpha_material_dark" format="float" type="dimen">0.5</item>
    <item name="highlight_alpha_material_colored" format="float" type="dimen">0.10</item>

    <!-- Primary & accent colors -->
+3 −11
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.animation.ValueAnimator;
import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -993,9 +992,9 @@ public class RippleDrawable extends LayerDrawable {
        RippleShader shader = new RippleShader();
        // Grab the color for the current state and cut the alpha channel in
        // half so that the ripple and background together yield full alpha.
        final int color = clampAlpha(mMaskColorFilter == null
        final int color = mMaskColorFilter == null
                ? mState.mColor.getColorForState(getState(), Color.BLACK)
                : mMaskColorFilter.getColor());
                : mMaskColorFilter.getColor();
        final int effectColor = mState.mEffectColor.getColorForState(getState(), Color.MAGENTA);
        final float noisePhase = AnimationUtils.currentAnimationTimeMillis();
        shader.setColor(color, effectColor);
@@ -1018,13 +1017,6 @@ public class RippleDrawable extends LayerDrawable {
        return properties;
    }

    private int clampAlpha(@ColorInt int color) {
        if (Color.alpha(color) < 128) {
            return  (color & 0x00FFFFFF) | 0x80000000;
        }
        return color;
    }

    @Override
    public void invalidateSelf() {
        invalidateSelf(true);
@@ -1239,7 +1231,7 @@ public class RippleDrawable extends LayerDrawable {

        // Grab the color for the current state and cut the alpha channel in
        // half so that the ripple and background together yield full alpha.
        final int color = clampAlpha(mState.mColor.getColorForState(getState(), Color.BLACK));
        final int color = mState.mColor.getColorForState(getState(), Color.BLACK);
        final Paint p = mRipplePaint;

        if (mMaskColorFilter != null) {