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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21022185

Change-Id: I4e8d8e04abb2d75d6e5b43576aa03ad81368b6ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jay Aliomer
2023-01-19 22:45:59 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 13 deletions

View File

@@ -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 -->

View File

@@ -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) {