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

Commit 2f34d56e authored by Jay Aliomer's avatar Jay Aliomer Committed by Android (Google) Code Review
Browse files

Merge "Remove alpha clamping from ripple drawable" into tm-qpr-dev

parents fad6eccb 7b084440
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
@@ -23,7 +23,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;
@@ -983,9 +982,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);
@@ -1008,13 +1007,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);
@@ -1229,7 +1221,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) {