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

Commit 2d0735fe authored by John Reck's avatar John Reck
Browse files

Update ripple alphas

Bug: 63635160
Test: clicked, hovered, and focused stuff
Change-Id: Ic3ba65b467706969c904d7fe313bd3d659dcc4af
parent 03033385
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -77,9 +77,9 @@
    <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.54</item>

    <item name="highlight_alpha_material_light" format="float" type="dimen">0.12</item>
    <item name="highlight_alpha_material_dark" format="float" type="dimen">0.20</item>
    <item name="highlight_alpha_material_colored" format="float" type="dimen">0.26</item>
    <item name="highlight_alpha_material_light" format="float" type="dimen">0.16</item>
    <item name="highlight_alpha_material_dark" format="float" type="dimen">0.32</item>
    <item name="highlight_alpha_material_colored" format="float" type="dimen">0.48</item>

    <!-- Primary & accent colors -->
    <eat-comment />
+2 −7
Original line number Diff line number Diff line
@@ -16,17 +16,12 @@

package android.graphics.drawable;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.graphics.Canvas;
import android.graphics.CanvasProperty;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.FloatProperty;
import android.view.DisplayListCanvas;
import android.view.RenderNodeAnimator;
import android.view.animation.LinearInterpolator;

/**
@@ -78,8 +73,8 @@ class RippleBackground extends RippleComponent {

    private void onStateChanged(boolean animateChanged) {
        float newOpacity = 0.0f;
        if (mHovered) newOpacity += 1.0f;
        if (mFocused) newOpacity += 1.0f;
        if (mHovered) newOpacity += .25f;
        if (mFocused) newOpacity += .75f;
        if (mAnimator != null) {
            mAnimator.cancel();
            mAnimator = null;
+4 −8
Original line number Diff line number Diff line
@@ -264,8 +264,8 @@ public class RippleDrawable extends LayerDrawable {
        }

        setRippleActive(enabled && pressed);

        setBackgroundActive(hovered, focused);

        return changed;
    }

@@ -879,22 +879,18 @@ 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 = mState.mColor.getColorForState(getState(), Color.BLACK);
        final int halfAlpha = (Color.alpha(color) / 2) << 24;
        final Paint p = mRipplePaint;

        if (mMaskColorFilter != null) {
            // The ripple timing depends on the paint's alpha value, so we need
            // to push just the alpha channel into the paint and let the filter
            // handle the full-alpha color.
            final int fullAlphaColor = color | (0xFF << 24);
            mMaskColorFilter.setColor(fullAlphaColor);

            p.setColor(halfAlpha);
            mMaskColorFilter.setColor(color | 0xFF000000);
            p.setColor(color & 0xFF000000);
            p.setColorFilter(mMaskColorFilter);
            p.setShader(mMaskShader);
        } else {
            final int halfAlphaColor = (color & 0xFFFFFF) | halfAlpha;
            p.setColor(halfAlphaColor);
            p.setColor(color);
            p.setColorFilter(null);
            p.setShader(null);
        }