ADD week 5
This commit is contained in:
		| @@ -0,0 +1,33 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class AbsoluteCornerSize implements CornerSize { | ||||
|     private final float size; | ||||
|  | ||||
|     public float getCornerSize() { | ||||
|         return this.size; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerSize | ||||
|     public float getCornerSize(RectF rectF) { | ||||
|         return this.size; | ||||
|     } | ||||
|  | ||||
|     public AbsoluteCornerSize(float f) { | ||||
|         this.size = f; | ||||
|     } | ||||
|  | ||||
|     public boolean equals(Object obj) { | ||||
|         if (this == obj) { | ||||
|             return true; | ||||
|         } | ||||
|         return (obj instanceof AbsoluteCornerSize) && this.size == ((AbsoluteCornerSize) obj).size; | ||||
|     } | ||||
|  | ||||
|     public int hashCode() { | ||||
|         return Arrays.hashCode(new Object[]{Float.valueOf(this.size)}); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,39 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class AdjustedCornerSize implements CornerSize { | ||||
|     private final float adjustment; | ||||
|     private final CornerSize other; | ||||
|  | ||||
|     public AdjustedCornerSize(float f, CornerSize cornerSize) { | ||||
|         while (cornerSize instanceof AdjustedCornerSize) { | ||||
|             cornerSize = ((AdjustedCornerSize) cornerSize).other; | ||||
|             f += ((AdjustedCornerSize) cornerSize).adjustment; | ||||
|         } | ||||
|         this.other = cornerSize; | ||||
|         this.adjustment = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerSize | ||||
|     public float getCornerSize(RectF rectF) { | ||||
|         return Math.max(0.0f, this.other.getCornerSize(rectF) + this.adjustment); | ||||
|     } | ||||
|  | ||||
|     public boolean equals(Object obj) { | ||||
|         if (this == obj) { | ||||
|             return true; | ||||
|         } | ||||
|         if (!(obj instanceof AdjustedCornerSize)) { | ||||
|             return false; | ||||
|         } | ||||
|         AdjustedCornerSize adjustedCornerSize = (AdjustedCornerSize) obj; | ||||
|         return this.other.equals(adjustedCornerSize.other) && this.adjustment == adjustedCornerSize.adjustment; | ||||
|     } | ||||
|  | ||||
|     public int hashCode() { | ||||
|         return Arrays.hashCode(new Object[]{this.other, Float.valueOf(this.adjustment)}); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,37 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class ClampedCornerSize implements CornerSize { | ||||
|     private final float target; | ||||
|  | ||||
|     public static ClampedCornerSize createFromCornerSize(AbsoluteCornerSize absoluteCornerSize) { | ||||
|         return new ClampedCornerSize(absoluteCornerSize.getCornerSize()); | ||||
|     } | ||||
|  | ||||
|     private static float getMaxCornerSize(RectF rectF) { | ||||
|         return Math.min(rectF.width() / 2.0f, rectF.height() / 2.0f); | ||||
|     } | ||||
|  | ||||
|     public ClampedCornerSize(float f) { | ||||
|         this.target = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerSize | ||||
|     public float getCornerSize(RectF rectF) { | ||||
|         return Math.min(this.target, getMaxCornerSize(rectF)); | ||||
|     } | ||||
|  | ||||
|     public boolean equals(Object obj) { | ||||
|         if (this == obj) { | ||||
|             return true; | ||||
|         } | ||||
|         return (obj instanceof ClampedCornerSize) && this.target == ((ClampedCornerSize) obj).target; | ||||
|     } | ||||
|  | ||||
|     public int hashCode() { | ||||
|         return Arrays.hashCode(new Object[]{Float.valueOf(this.target)}); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
|  | ||||
| @Retention(RetentionPolicy.SOURCE) | ||||
| /* loaded from: classes.dex */ | ||||
| public @interface CornerFamily { | ||||
|     public static final int CUT = 1; | ||||
|     public static final int ROUNDED = 0; | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public interface CornerSize { | ||||
|     float getCornerSize(RectF rectF); | ||||
| } | ||||
| @@ -0,0 +1,18 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class CornerTreatment { | ||||
|     @Deprecated | ||||
|     public void getCornerPath(float f, float f2, ShapePath shapePath) { | ||||
|     } | ||||
|  | ||||
|     public void getCornerPath(ShapePath shapePath, float f, float f2, float f3) { | ||||
|         getCornerPath(f, f2, shapePath); | ||||
|     } | ||||
|  | ||||
|     public void getCornerPath(ShapePath shapePath, float f, float f2, RectF rectF, CornerSize cornerSize) { | ||||
|         getCornerPath(shapePath, f, f2, cornerSize.getCornerSize(rectF)); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class CutCornerTreatment extends CornerTreatment { | ||||
|     float size; | ||||
|  | ||||
|     public CutCornerTreatment() { | ||||
|         this.size = -1.0f; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public CutCornerTreatment(float f) { | ||||
|         this.size = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerTreatment | ||||
|     public void getCornerPath(ShapePath shapePath, float f, float f2, float f3) { | ||||
|         shapePath.reset(0.0f, f3 * f2, 180.0f, 180.0f - f); | ||||
|         double d = f3; | ||||
|         double d2 = f2; | ||||
|         shapePath.lineTo((float) (Math.sin(Math.toRadians(f)) * d * d2), (float) (Math.sin(Math.toRadians(90.0f - f)) * d * d2)); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,17 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class EdgeTreatment { | ||||
|     boolean forceIntersection() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void getEdgePath(float f, float f2, ShapePath shapePath) { | ||||
|         getEdgePath(f, f / 2.0f, f2, shapePath); | ||||
|     } | ||||
|  | ||||
|     public void getEdgePath(float f, float f2, float f3, ShapePath shapePath) { | ||||
|         shapePath.lineTo(f, 0.0f); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,69 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.view.View; | ||||
| import android.view.ViewTreeObserver; | ||||
| import android.widget.ScrollView; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class InterpolateOnScrollPositionChangeHelper { | ||||
|     private ScrollView containingScrollView; | ||||
|     private MaterialShapeDrawable materialShapeDrawable; | ||||
|     private View shapedView; | ||||
|     private final int[] scrollLocation = new int[2]; | ||||
|     private final int[] containerLocation = new int[2]; | ||||
|     private final ViewTreeObserver.OnScrollChangedListener scrollChangedListener = new ViewTreeObserver.OnScrollChangedListener() { // from class: com.google.android.material.shape.InterpolateOnScrollPositionChangeHelper.1 | ||||
|         @Override // android.view.ViewTreeObserver.OnScrollChangedListener | ||||
|         public void onScrollChanged() { | ||||
|             InterpolateOnScrollPositionChangeHelper.this.updateInterpolationForScreenPosition(); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     public void setContainingScrollView(ScrollView scrollView) { | ||||
|         this.containingScrollView = scrollView; | ||||
|     } | ||||
|  | ||||
|     public void setMaterialShapeDrawable(MaterialShapeDrawable materialShapeDrawable) { | ||||
|         this.materialShapeDrawable = materialShapeDrawable; | ||||
|     } | ||||
|  | ||||
|     public InterpolateOnScrollPositionChangeHelper(View view, MaterialShapeDrawable materialShapeDrawable, ScrollView scrollView) { | ||||
|         this.shapedView = view; | ||||
|         this.materialShapeDrawable = materialShapeDrawable; | ||||
|         this.containingScrollView = scrollView; | ||||
|     } | ||||
|  | ||||
|     public void startListeningForScrollChanges(ViewTreeObserver viewTreeObserver) { | ||||
|         viewTreeObserver.addOnScrollChangedListener(this.scrollChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void stopListeningForScrollChanges(ViewTreeObserver viewTreeObserver) { | ||||
|         viewTreeObserver.removeOnScrollChangedListener(this.scrollChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void updateInterpolationForScreenPosition() { | ||||
|         ScrollView scrollView = this.containingScrollView; | ||||
|         if (scrollView == null) { | ||||
|             return; | ||||
|         } | ||||
|         if (scrollView.getChildCount() == 0) { | ||||
|             throw new IllegalStateException("Scroll bar must contain a child to calculate interpolation."); | ||||
|         } | ||||
|         this.containingScrollView.getLocationInWindow(this.scrollLocation); | ||||
|         this.containingScrollView.getChildAt(0).getLocationInWindow(this.containerLocation); | ||||
|         int top = (this.shapedView.getTop() - this.scrollLocation[1]) + this.containerLocation[1]; | ||||
|         int height = this.shapedView.getHeight(); | ||||
|         int height2 = this.containingScrollView.getHeight(); | ||||
|         if (top < 0) { | ||||
|             this.materialShapeDrawable.setInterpolation(Math.max(0.0f, Math.min(1.0f, (top / height) + 1.0f))); | ||||
|             this.shapedView.invalidate(); | ||||
|             return; | ||||
|         } | ||||
|         if (top + height > height2) { | ||||
|             this.materialShapeDrawable.setInterpolation(Math.max(0.0f, Math.min(1.0f, 1.0f - ((r0 - height2) / height)))); | ||||
|             this.shapedView.invalidate(); | ||||
|         } else if (this.materialShapeDrawable.getInterpolation() != 1.0f) { | ||||
|             this.materialShapeDrawable.setInterpolation(1.0f); | ||||
|             this.shapedView.invalidate(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,24 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class MarkerEdgeTreatment extends EdgeTreatment { | ||||
|     private final float radius; | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     boolean forceIntersection() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public MarkerEdgeTreatment(float f) { | ||||
|         this.radius = f - 0.001f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     public void getEdgePath(float f, float f2, float f3, ShapePath shapePath) { | ||||
|         float sqrt = (float) ((this.radius * Math.sqrt(2.0d)) / 2.0d); | ||||
|         float sqrt2 = (float) Math.sqrt(Math.pow(this.radius, 2.0d) - Math.pow(sqrt, 2.0d)); | ||||
|         shapePath.reset(f2 - sqrt, ((float) (-((this.radius * Math.sqrt(2.0d)) - this.radius))) + sqrt2); | ||||
|         shapePath.lineTo(f2, (float) (-((this.radius * Math.sqrt(2.0d)) - this.radius))); | ||||
|         shapePath.lineTo(f2 + sqrt, ((float) (-((this.radius * Math.sqrt(2.0d)) - this.radius))) + sqrt2); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,926 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Bitmap; | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.ColorFilter; | ||||
| import android.graphics.Matrix; | ||||
| import android.graphics.Outline; | ||||
| import android.graphics.Paint; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.PorterDuff; | ||||
| import android.graphics.PorterDuffColorFilter; | ||||
| import android.graphics.PorterDuffXfermode; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.Region; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Build; | ||||
| import android.os.Looper; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Log; | ||||
| import androidx.core.graphics.drawable.TintAwareDrawable; | ||||
| import androidx.core.util.ObjectsCompat; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.color.MaterialColors; | ||||
| import com.google.android.material.drawable.DrawableUtils; | ||||
| import com.google.android.material.elevation.ElevationOverlayProvider; | ||||
| import com.google.android.material.shadow.ShadowRenderer; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.shape.ShapeAppearancePathProvider; | ||||
| import com.google.android.material.shape.ShapePath; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
| import java.util.BitSet; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class MaterialShapeDrawable extends Drawable implements TintAwareDrawable, Shapeable { | ||||
|     public static final int SHADOW_COMPAT_MODE_ALWAYS = 2; | ||||
|     public static final int SHADOW_COMPAT_MODE_DEFAULT = 0; | ||||
|     public static final int SHADOW_COMPAT_MODE_NEVER = 1; | ||||
|     private static final float SHADOW_OFFSET_MULTIPLIER = 0.25f; | ||||
|     private static final float SHADOW_RADIUS_MULTIPLIER = 0.75f; | ||||
|     private static final String TAG = "MaterialShapeDrawable"; | ||||
|     private static final Paint clearPaint; | ||||
|     private final BitSet containsIncompatibleShadowOp; | ||||
|     private final ShapePath.ShadowCompatOperation[] cornerShadowOperation; | ||||
|     private MaterialShapeDrawableState drawableState; | ||||
|     private final ShapePath.ShadowCompatOperation[] edgeShadowOperation; | ||||
|     private final Paint fillPaint; | ||||
|     private final RectF insetRectF; | ||||
|     private final Matrix matrix; | ||||
|     private final Path path; | ||||
|     private final RectF pathBounds; | ||||
|     private boolean pathDirty; | ||||
|     private final Path pathInsetByStroke; | ||||
|     private final ShapeAppearancePathProvider pathProvider; | ||||
|     private final ShapeAppearancePathProvider.PathListener pathShadowListener; | ||||
|     private final RectF rectF; | ||||
|     private int resolvedTintColor; | ||||
|     private final Region scratchRegion; | ||||
|     private boolean shadowBitmapDrawingEnable; | ||||
|     private final ShadowRenderer shadowRenderer; | ||||
|     private final Paint strokePaint; | ||||
|     private ShapeAppearanceModel strokeShapeAppearance; | ||||
|     private PorterDuffColorFilter strokeTintFilter; | ||||
|     private PorterDuffColorFilter tintFilter; | ||||
|     private final Region transparentRegion; | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface CompatibilityShadowMode { | ||||
|     } | ||||
|  | ||||
|     private static int modulateAlpha(int i, int i2) { | ||||
|         return (i * (i2 + (i2 >>> 7))) >>> 8; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Drawable.ConstantState getConstantState() { | ||||
|         return this.drawableState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getOpacity() { | ||||
|         return -3; | ||||
|     } | ||||
|  | ||||
|     public int getResolvedTintColor() { | ||||
|         return this.resolvedTintColor; | ||||
|     } | ||||
|  | ||||
|     public void setShadowBitmapDrawingEnable(boolean z) { | ||||
|         this.shadowBitmapDrawingEnable = z; | ||||
|     } | ||||
|  | ||||
|     static { | ||||
|         Paint paint = new Paint(1); | ||||
|         clearPaint = paint; | ||||
|         paint.setColor(-1); | ||||
|         paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); | ||||
|     } | ||||
|  | ||||
|     public static MaterialShapeDrawable createWithElevationOverlay(Context context) { | ||||
|         return createWithElevationOverlay(context, 0.0f); | ||||
|     } | ||||
|  | ||||
|     public static MaterialShapeDrawable createWithElevationOverlay(Context context, float f) { | ||||
|         return createWithElevationOverlay(context, f, null); | ||||
|     } | ||||
|  | ||||
|     public static MaterialShapeDrawable createWithElevationOverlay(Context context, float f, ColorStateList colorStateList) { | ||||
|         if (colorStateList == null) { | ||||
|             colorStateList = ColorStateList.valueOf(MaterialColors.getColor(context, R.attr.colorSurface, TAG)); | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(); | ||||
|         materialShapeDrawable.initializeElevationOverlay(context); | ||||
|         materialShapeDrawable.setFillColor(colorStateList); | ||||
|         materialShapeDrawable.setElevation(f); | ||||
|         return materialShapeDrawable; | ||||
|     } | ||||
|  | ||||
|     public MaterialShapeDrawable() { | ||||
|         this(new ShapeAppearanceModel()); | ||||
|     } | ||||
|  | ||||
|     public MaterialShapeDrawable(Context context, AttributeSet attributeSet, int i, int i2) { | ||||
|         this(ShapeAppearanceModel.builder(context, attributeSet, i, i2).build()); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public MaterialShapeDrawable(ShapePathModel shapePathModel) { | ||||
|         this((ShapeAppearanceModel) shapePathModel); | ||||
|     } | ||||
|  | ||||
|     public MaterialShapeDrawable(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this(new MaterialShapeDrawableState(shapeAppearanceModel, null)); | ||||
|     } | ||||
|  | ||||
|     protected MaterialShapeDrawable(MaterialShapeDrawableState materialShapeDrawableState) { | ||||
|         ShapeAppearancePathProvider shapeAppearancePathProvider; | ||||
|         this.cornerShadowOperation = new ShapePath.ShadowCompatOperation[4]; | ||||
|         this.edgeShadowOperation = new ShapePath.ShadowCompatOperation[4]; | ||||
|         this.containsIncompatibleShadowOp = new BitSet(8); | ||||
|         this.matrix = new Matrix(); | ||||
|         this.path = new Path(); | ||||
|         this.pathInsetByStroke = new Path(); | ||||
|         this.rectF = new RectF(); | ||||
|         this.insetRectF = new RectF(); | ||||
|         this.transparentRegion = new Region(); | ||||
|         this.scratchRegion = new Region(); | ||||
|         Paint paint = new Paint(1); | ||||
|         this.fillPaint = paint; | ||||
|         Paint paint2 = new Paint(1); | ||||
|         this.strokePaint = paint2; | ||||
|         this.shadowRenderer = new ShadowRenderer(); | ||||
|         if (Looper.getMainLooper().getThread() == Thread.currentThread()) { | ||||
|             shapeAppearancePathProvider = ShapeAppearancePathProvider.getInstance(); | ||||
|         } else { | ||||
|             shapeAppearancePathProvider = new ShapeAppearancePathProvider(); | ||||
|         } | ||||
|         this.pathProvider = shapeAppearancePathProvider; | ||||
|         this.pathBounds = new RectF(); | ||||
|         this.shadowBitmapDrawingEnable = true; | ||||
|         this.drawableState = materialShapeDrawableState; | ||||
|         paint2.setStyle(Paint.Style.STROKE); | ||||
|         paint.setStyle(Paint.Style.FILL); | ||||
|         updateTintFilter(); | ||||
|         updateColorsForState(getState()); | ||||
|         this.pathShadowListener = new ShapeAppearancePathProvider.PathListener() { // from class: com.google.android.material.shape.MaterialShapeDrawable.1 | ||||
|             @Override // com.google.android.material.shape.ShapeAppearancePathProvider.PathListener | ||||
|             public void onCornerPathCreated(ShapePath shapePath, Matrix matrix, int i) { | ||||
|                 MaterialShapeDrawable.this.containsIncompatibleShadowOp.set(i, shapePath.containsIncompatibleShadowOp()); | ||||
|                 MaterialShapeDrawable.this.cornerShadowOperation[i] = shapePath.createShadowCompatOperation(matrix); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.shape.ShapeAppearancePathProvider.PathListener | ||||
|             public void onEdgePathCreated(ShapePath shapePath, Matrix matrix, int i) { | ||||
|                 MaterialShapeDrawable.this.containsIncompatibleShadowOp.set(i + 4, shapePath.containsIncompatibleShadowOp()); | ||||
|                 MaterialShapeDrawable.this.edgeShadowOperation[i] = shapePath.createShadowCompatOperation(matrix); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Drawable mutate() { | ||||
|         this.drawableState = new MaterialShapeDrawableState(this.drawableState); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.drawableState.shapeAppearanceModel = shapeAppearanceModel; | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public ShapeAppearanceModel getShapeAppearanceModel() { | ||||
|         return this.drawableState.shapeAppearanceModel; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setShapedViewModel(ShapePathModel shapePathModel) { | ||||
|         setShapeAppearanceModel(shapePathModel); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public ShapePathModel getShapedViewModel() { | ||||
|         ShapeAppearanceModel shapeAppearanceModel = getShapeAppearanceModel(); | ||||
|         if (shapeAppearanceModel instanceof ShapePathModel) { | ||||
|             return (ShapePathModel) shapeAppearanceModel; | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     public void setFillColor(ColorStateList colorStateList) { | ||||
|         if (this.drawableState.fillColor != colorStateList) { | ||||
|             this.drawableState.fillColor = colorStateList; | ||||
|             onStateChange(getState()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getFillColor() { | ||||
|         return this.drawableState.fillColor; | ||||
|     } | ||||
|  | ||||
|     public void setStrokeColor(ColorStateList colorStateList) { | ||||
|         if (this.drawableState.strokeColor != colorStateList) { | ||||
|             this.drawableState.strokeColor = colorStateList; | ||||
|             onStateChange(getState()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getStrokeColor() { | ||||
|         return this.drawableState.strokeColor; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable | ||||
|     public void setTintMode(PorterDuff.Mode mode) { | ||||
|         if (this.drawableState.tintMode != mode) { | ||||
|             this.drawableState.tintMode = mode; | ||||
|             updateTintFilter(); | ||||
|             invalidateSelfIgnoreShape(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable | ||||
|     public void setTintList(ColorStateList colorStateList) { | ||||
|         this.drawableState.tintList = colorStateList; | ||||
|         updateTintFilter(); | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getTintList() { | ||||
|         return this.drawableState.tintList; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getStrokeTintList() { | ||||
|         return this.drawableState.strokeTintList; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable | ||||
|     public void setTint(int i) { | ||||
|         setTintList(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeTint(ColorStateList colorStateList) { | ||||
|         this.drawableState.strokeTintList = colorStateList; | ||||
|         updateTintFilter(); | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeTint(int i) { | ||||
|         setStrokeTint(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     public void setStroke(float f, int i) { | ||||
|         setStrokeWidth(f); | ||||
|         setStrokeColor(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     public void setStroke(float f, ColorStateList colorStateList) { | ||||
|         setStrokeWidth(f); | ||||
|         setStrokeColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public float getStrokeWidth() { | ||||
|         return this.drawableState.strokeWidth; | ||||
|     } | ||||
|  | ||||
|     public void setStrokeWidth(float f) { | ||||
|         this.drawableState.strokeWidth = f; | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getAlpha() { | ||||
|         return this.drawableState.alpha; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setAlpha(int i) { | ||||
|         if (this.drawableState.alpha != i) { | ||||
|             this.drawableState.alpha = i; | ||||
|             invalidateSelfIgnoreShape(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setColorFilter(ColorFilter colorFilter) { | ||||
|         this.drawableState.colorFilter = colorFilter; | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Region getTransparentRegion() { | ||||
|         this.transparentRegion.set(getBounds()); | ||||
|         calculatePath(getBoundsAsRectF(), this.path); | ||||
|         this.scratchRegion.setPath(this.path, this.transparentRegion); | ||||
|         this.transparentRegion.op(this.scratchRegion, Region.Op.DIFFERENCE); | ||||
|         return this.transparentRegion; | ||||
|     } | ||||
|  | ||||
|     protected RectF getBoundsAsRectF() { | ||||
|         this.rectF.set(getBounds()); | ||||
|         return this.rectF; | ||||
|     } | ||||
|  | ||||
|     public void setCornerSize(float f) { | ||||
|         setShapeAppearanceModel(this.drawableState.shapeAppearanceModel.withCornerSize(f)); | ||||
|     } | ||||
|  | ||||
|     public void setCornerSize(CornerSize cornerSize) { | ||||
|         setShapeAppearanceModel(this.drawableState.shapeAppearanceModel.withCornerSize(cornerSize)); | ||||
|     } | ||||
|  | ||||
|     public boolean isPointInTransparentRegion(int i, int i2) { | ||||
|         return getTransparentRegion().contains(i, i2); | ||||
|     } | ||||
|  | ||||
|     public int getShadowCompatibilityMode() { | ||||
|         return this.drawableState.shadowCompatMode; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean getPadding(Rect rect) { | ||||
|         if (this.drawableState.padding != null) { | ||||
|             rect.set(this.drawableState.padding); | ||||
|             return true; | ||||
|         } | ||||
|         return super.getPadding(rect); | ||||
|     } | ||||
|  | ||||
|     public void setPadding(int i, int i2, int i3, int i4) { | ||||
|         if (this.drawableState.padding == null) { | ||||
|             this.drawableState.padding = new Rect(); | ||||
|         } | ||||
|         this.drawableState.padding.set(i, i2, i3, i4); | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     public void setShadowCompatibilityMode(int i) { | ||||
|         if (this.drawableState.shadowCompatMode != i) { | ||||
|             this.drawableState.shadowCompatMode = i; | ||||
|             invalidateSelfIgnoreShape(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public boolean isShadowEnabled() { | ||||
|         return this.drawableState.shadowCompatMode == 0 || this.drawableState.shadowCompatMode == 2; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setShadowEnabled(boolean z) { | ||||
|         setShadowCompatibilityMode(!z ? 1 : 0); | ||||
|     } | ||||
|  | ||||
|     public boolean isElevationOverlayEnabled() { | ||||
|         return this.drawableState.elevationOverlayProvider != null && this.drawableState.elevationOverlayProvider.isThemeElevationOverlayEnabled(); | ||||
|     } | ||||
|  | ||||
|     public boolean isElevationOverlayInitialized() { | ||||
|         return this.drawableState.elevationOverlayProvider != null; | ||||
|     } | ||||
|  | ||||
|     public void initializeElevationOverlay(Context context) { | ||||
|         this.drawableState.elevationOverlayProvider = new ElevationOverlayProvider(context); | ||||
|         updateZ(); | ||||
|     } | ||||
|  | ||||
|     protected int compositeElevationOverlayIfNeeded(int i) { | ||||
|         return this.drawableState.elevationOverlayProvider != null ? this.drawableState.elevationOverlayProvider.compositeOverlayIfNeeded(i, getZ() + getParentAbsoluteElevation()) : i; | ||||
|     } | ||||
|  | ||||
|     public float getInterpolation() { | ||||
|         return this.drawableState.interpolation; | ||||
|     } | ||||
|  | ||||
|     public void setInterpolation(float f) { | ||||
|         if (this.drawableState.interpolation != f) { | ||||
|             this.drawableState.interpolation = f; | ||||
|             this.pathDirty = true; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getParentAbsoluteElevation() { | ||||
|         return this.drawableState.parentAbsoluteElevation; | ||||
|     } | ||||
|  | ||||
|     public void setParentAbsoluteElevation(float f) { | ||||
|         if (this.drawableState.parentAbsoluteElevation != f) { | ||||
|             this.drawableState.parentAbsoluteElevation = f; | ||||
|             updateZ(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getElevation() { | ||||
|         return this.drawableState.elevation; | ||||
|     } | ||||
|  | ||||
|     public void setElevation(float f) { | ||||
|         if (this.drawableState.elevation != f) { | ||||
|             this.drawableState.elevation = f; | ||||
|             updateZ(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getTranslationZ() { | ||||
|         return this.drawableState.translationZ; | ||||
|     } | ||||
|  | ||||
|     public void setTranslationZ(float f) { | ||||
|         if (this.drawableState.translationZ != f) { | ||||
|             this.drawableState.translationZ = f; | ||||
|             updateZ(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getZ() { | ||||
|         return getElevation() + getTranslationZ(); | ||||
|     } | ||||
|  | ||||
|     public void setZ(float f) { | ||||
|         setTranslationZ(f - getElevation()); | ||||
|     } | ||||
|  | ||||
|     private void updateZ() { | ||||
|         float z = getZ(); | ||||
|         this.drawableState.shadowCompatRadius = (int) Math.ceil(0.75f * z); | ||||
|         this.drawableState.shadowCompatOffset = (int) Math.ceil(z * SHADOW_OFFSET_MULTIPLIER); | ||||
|         updateTintFilter(); | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public int getShadowElevation() { | ||||
|         return (int) getElevation(); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setShadowElevation(int i) { | ||||
|         setElevation(i); | ||||
|     } | ||||
|  | ||||
|     public int getShadowVerticalOffset() { | ||||
|         return this.drawableState.shadowCompatOffset; | ||||
|     } | ||||
|  | ||||
|     public void setEdgeIntersectionCheckEnable(boolean z) { | ||||
|         this.pathProvider.setEdgeIntersectionCheckEnable(z); | ||||
|     } | ||||
|  | ||||
|     public void setShadowVerticalOffset(int i) { | ||||
|         if (this.drawableState.shadowCompatOffset != i) { | ||||
|             this.drawableState.shadowCompatOffset = i; | ||||
|             invalidateSelfIgnoreShape(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getShadowCompatRotation() { | ||||
|         return this.drawableState.shadowCompatRotation; | ||||
|     } | ||||
|  | ||||
|     public void setShadowCompatRotation(int i) { | ||||
|         if (this.drawableState.shadowCompatRotation != i) { | ||||
|             this.drawableState.shadowCompatRotation = i; | ||||
|             invalidateSelfIgnoreShape(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getShadowRadius() { | ||||
|         return this.drawableState.shadowCompatRadius; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setShadowRadius(int i) { | ||||
|         this.drawableState.shadowCompatRadius = i; | ||||
|     } | ||||
|  | ||||
|     public boolean requiresCompatShadow() { | ||||
|         return (isRoundRect() || this.path.isConvex() || Build.VERSION.SDK_INT >= 29) ? false : true; | ||||
|     } | ||||
|  | ||||
|     public float getScale() { | ||||
|         return this.drawableState.scale; | ||||
|     } | ||||
|  | ||||
|     public void setScale(float f) { | ||||
|         if (this.drawableState.scale != f) { | ||||
|             this.drawableState.scale = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void invalidateSelf() { | ||||
|         this.pathDirty = true; | ||||
|         super.invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     private void invalidateSelfIgnoreShape() { | ||||
|         super.invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     public void setUseTintColorForShadow(boolean z) { | ||||
|         if (this.drawableState.useTintColorForShadow != z) { | ||||
|             this.drawableState.useTintColorForShadow = z; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setShadowColor(int i) { | ||||
|         this.shadowRenderer.setShadowColor(i); | ||||
|         this.drawableState.useTintColorForShadow = false; | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     public Paint.Style getPaintStyle() { | ||||
|         return this.drawableState.paintStyle; | ||||
|     } | ||||
|  | ||||
|     public void setPaintStyle(Paint.Style style) { | ||||
|         this.drawableState.paintStyle = style; | ||||
|         invalidateSelfIgnoreShape(); | ||||
|     } | ||||
|  | ||||
|     private boolean hasCompatShadow() { | ||||
|         return this.drawableState.shadowCompatMode != 1 && this.drawableState.shadowCompatRadius > 0 && (this.drawableState.shadowCompatMode == 2 || requiresCompatShadow()); | ||||
|     } | ||||
|  | ||||
|     private boolean hasFill() { | ||||
|         return this.drawableState.paintStyle == Paint.Style.FILL_AND_STROKE || this.drawableState.paintStyle == Paint.Style.FILL; | ||||
|     } | ||||
|  | ||||
|     private boolean hasStroke() { | ||||
|         return (this.drawableState.paintStyle == Paint.Style.FILL_AND_STROKE || this.drawableState.paintStyle == Paint.Style.STROKE) && this.strokePaint.getStrokeWidth() > 0.0f; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     protected void onBoundsChange(Rect rect) { | ||||
|         this.pathDirty = true; | ||||
|         super.onBoundsChange(rect); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void draw(Canvas canvas) { | ||||
|         this.fillPaint.setColorFilter(this.tintFilter); | ||||
|         int alpha = this.fillPaint.getAlpha(); | ||||
|         this.fillPaint.setAlpha(modulateAlpha(alpha, this.drawableState.alpha)); | ||||
|         this.strokePaint.setColorFilter(this.strokeTintFilter); | ||||
|         this.strokePaint.setStrokeWidth(this.drawableState.strokeWidth); | ||||
|         int alpha2 = this.strokePaint.getAlpha(); | ||||
|         this.strokePaint.setAlpha(modulateAlpha(alpha2, this.drawableState.alpha)); | ||||
|         if (this.pathDirty) { | ||||
|             calculateStrokePath(); | ||||
|             calculatePath(getBoundsAsRectF(), this.path); | ||||
|             this.pathDirty = false; | ||||
|         } | ||||
|         maybeDrawCompatShadow(canvas); | ||||
|         if (hasFill()) { | ||||
|             drawFillShape(canvas); | ||||
|         } | ||||
|         if (hasStroke()) { | ||||
|             drawStrokeShape(canvas); | ||||
|         } | ||||
|         this.fillPaint.setAlpha(alpha); | ||||
|         this.strokePaint.setAlpha(alpha2); | ||||
|     } | ||||
|  | ||||
|     private void maybeDrawCompatShadow(Canvas canvas) { | ||||
|         if (hasCompatShadow()) { | ||||
|             canvas.save(); | ||||
|             prepareCanvasForShadow(canvas); | ||||
|             if (!this.shadowBitmapDrawingEnable) { | ||||
|                 drawCompatShadow(canvas); | ||||
|                 canvas.restore(); | ||||
|                 return; | ||||
|             } | ||||
|             int width = (int) (this.pathBounds.width() - getBounds().width()); | ||||
|             int height = (int) (this.pathBounds.height() - getBounds().height()); | ||||
|             if (width < 0 || height < 0) { | ||||
|                 throw new IllegalStateException("Invalid shadow bounds. Check that the treatments result in a valid path."); | ||||
|             } | ||||
|             Bitmap createBitmap = Bitmap.createBitmap(((int) this.pathBounds.width()) + (this.drawableState.shadowCompatRadius * 2) + width, ((int) this.pathBounds.height()) + (this.drawableState.shadowCompatRadius * 2) + height, Bitmap.Config.ARGB_8888); | ||||
|             Canvas canvas2 = new Canvas(createBitmap); | ||||
|             float f = (getBounds().left - this.drawableState.shadowCompatRadius) - width; | ||||
|             float f2 = (getBounds().top - this.drawableState.shadowCompatRadius) - height; | ||||
|             canvas2.translate(-f, -f2); | ||||
|             drawCompatShadow(canvas2); | ||||
|             canvas.drawBitmap(createBitmap, f, f2, (Paint) null); | ||||
|             createBitmap.recycle(); | ||||
|             canvas.restore(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected void drawShape(Canvas canvas, Paint paint, Path path, RectF rectF) { | ||||
|         drawShape(canvas, paint, path, this.drawableState.shapeAppearanceModel, rectF); | ||||
|     } | ||||
|  | ||||
|     private void drawShape(Canvas canvas, Paint paint, Path path, ShapeAppearanceModel shapeAppearanceModel, RectF rectF) { | ||||
|         if (shapeAppearanceModel.isRoundRect(rectF)) { | ||||
|             float cornerSize = shapeAppearanceModel.getTopRightCornerSize().getCornerSize(rectF) * this.drawableState.interpolation; | ||||
|             canvas.drawRoundRect(rectF, cornerSize, cornerSize, paint); | ||||
|         } else { | ||||
|             canvas.drawPath(path, paint); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void drawFillShape(Canvas canvas) { | ||||
|         drawShape(canvas, this.fillPaint, this.path, this.drawableState.shapeAppearanceModel, getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     protected void drawStrokeShape(Canvas canvas) { | ||||
|         drawShape(canvas, this.strokePaint, this.pathInsetByStroke, this.strokeShapeAppearance, getBoundsInsetByStroke()); | ||||
|     } | ||||
|  | ||||
|     private void prepareCanvasForShadow(Canvas canvas) { | ||||
|         canvas.translate(getShadowOffsetX(), getShadowOffsetY()); | ||||
|     } | ||||
|  | ||||
|     private void drawCompatShadow(Canvas canvas) { | ||||
|         if (this.containsIncompatibleShadowOp.cardinality() > 0) { | ||||
|             Log.w(TAG, "Compatibility shadow requested but can't be drawn for all operations in this shape."); | ||||
|         } | ||||
|         if (this.drawableState.shadowCompatOffset != 0) { | ||||
|             canvas.drawPath(this.path, this.shadowRenderer.getShadowPaint()); | ||||
|         } | ||||
|         for (int i = 0; i < 4; i++) { | ||||
|             this.cornerShadowOperation[i].draw(this.shadowRenderer, this.drawableState.shadowCompatRadius, canvas); | ||||
|             this.edgeShadowOperation[i].draw(this.shadowRenderer, this.drawableState.shadowCompatRadius, canvas); | ||||
|         } | ||||
|         if (this.shadowBitmapDrawingEnable) { | ||||
|             int shadowOffsetX = getShadowOffsetX(); | ||||
|             int shadowOffsetY = getShadowOffsetY(); | ||||
|             canvas.translate(-shadowOffsetX, -shadowOffsetY); | ||||
|             canvas.drawPath(this.path, clearPaint); | ||||
|             canvas.translate(shadowOffsetX, shadowOffsetY); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getShadowOffsetX() { | ||||
|         return (int) (this.drawableState.shadowCompatOffset * Math.sin(Math.toRadians(this.drawableState.shadowCompatRotation))); | ||||
|     } | ||||
|  | ||||
|     public int getShadowOffsetY() { | ||||
|         return (int) (this.drawableState.shadowCompatOffset * Math.cos(Math.toRadians(this.drawableState.shadowCompatRotation))); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void getPathForSize(int i, int i2, Path path) { | ||||
|         calculatePathForSize(new RectF(0.0f, 0.0f, i, i2), path); | ||||
|     } | ||||
|  | ||||
|     protected final void calculatePathForSize(RectF rectF, Path path) { | ||||
|         this.pathProvider.calculatePath(this.drawableState.shapeAppearanceModel, this.drawableState.interpolation, rectF, this.pathShadowListener, path); | ||||
|     } | ||||
|  | ||||
|     private void calculateStrokePath() { | ||||
|         final float f = -getStrokeInsetLength(); | ||||
|         ShapeAppearanceModel withTransformedCornerSizes = getShapeAppearanceModel().withTransformedCornerSizes(new ShapeAppearanceModel.CornerSizeUnaryOperator() { // from class: com.google.android.material.shape.MaterialShapeDrawable.2 | ||||
|             @Override // com.google.android.material.shape.ShapeAppearanceModel.CornerSizeUnaryOperator | ||||
|             public CornerSize apply(CornerSize cornerSize) { | ||||
|                 return cornerSize instanceof RelativeCornerSize ? cornerSize : new AdjustedCornerSize(f, cornerSize); | ||||
|             } | ||||
|         }); | ||||
|         this.strokeShapeAppearance = withTransformedCornerSizes; | ||||
|         this.pathProvider.calculatePath(withTransformedCornerSizes, this.drawableState.interpolation, getBoundsInsetByStroke(), this.pathInsetByStroke); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void getOutline(Outline outline) { | ||||
|         if (this.drawableState.shadowCompatMode == 2) { | ||||
|             return; | ||||
|         } | ||||
|         if (isRoundRect()) { | ||||
|             outline.setRoundRect(getBounds(), getTopLeftCornerResolvedSize() * this.drawableState.interpolation); | ||||
|         } else { | ||||
|             calculatePath(getBoundsAsRectF(), this.path); | ||||
|             DrawableUtils.setOutlineToPath(outline, this.path); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void calculatePath(RectF rectF, Path path) { | ||||
|         calculatePathForSize(rectF, path); | ||||
|         if (this.drawableState.scale != 1.0f) { | ||||
|             this.matrix.reset(); | ||||
|             this.matrix.setScale(this.drawableState.scale, this.drawableState.scale, rectF.width() / 2.0f, rectF.height() / 2.0f); | ||||
|             path.transform(this.matrix); | ||||
|         } | ||||
|         path.computeBounds(this.pathBounds, true); | ||||
|     } | ||||
|  | ||||
|     private boolean updateTintFilter() { | ||||
|         PorterDuffColorFilter porterDuffColorFilter = this.tintFilter; | ||||
|         PorterDuffColorFilter porterDuffColorFilter2 = this.strokeTintFilter; | ||||
|         this.tintFilter = calculateTintFilter(this.drawableState.tintList, this.drawableState.tintMode, this.fillPaint, true); | ||||
|         this.strokeTintFilter = calculateTintFilter(this.drawableState.strokeTintList, this.drawableState.tintMode, this.strokePaint, false); | ||||
|         if (this.drawableState.useTintColorForShadow) { | ||||
|             this.shadowRenderer.setShadowColor(this.drawableState.tintList.getColorForState(getState(), 0)); | ||||
|         } | ||||
|         return (ObjectsCompat.equals(porterDuffColorFilter, this.tintFilter) && ObjectsCompat.equals(porterDuffColorFilter2, this.strokeTintFilter)) ? false : true; | ||||
|     } | ||||
|  | ||||
|     private PorterDuffColorFilter calculateTintFilter(ColorStateList colorStateList, PorterDuff.Mode mode, Paint paint, boolean z) { | ||||
|         if (colorStateList == null || mode == null) { | ||||
|             return calculatePaintColorTintFilter(paint, z); | ||||
|         } | ||||
|         return calculateTintColorTintFilter(colorStateList, mode, z); | ||||
|     } | ||||
|  | ||||
|     private PorterDuffColorFilter calculatePaintColorTintFilter(Paint paint, boolean z) { | ||||
|         if (!z) { | ||||
|             return null; | ||||
|         } | ||||
|         int color = paint.getColor(); | ||||
|         int compositeElevationOverlayIfNeeded = compositeElevationOverlayIfNeeded(color); | ||||
|         this.resolvedTintColor = compositeElevationOverlayIfNeeded; | ||||
|         if (compositeElevationOverlayIfNeeded != color) { | ||||
|             return new PorterDuffColorFilter(compositeElevationOverlayIfNeeded, PorterDuff.Mode.SRC_IN); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private PorterDuffColorFilter calculateTintColorTintFilter(ColorStateList colorStateList, PorterDuff.Mode mode, boolean z) { | ||||
|         int colorForState = colorStateList.getColorForState(getState(), 0); | ||||
|         if (z) { | ||||
|             colorForState = compositeElevationOverlayIfNeeded(colorForState); | ||||
|         } | ||||
|         this.resolvedTintColor = colorForState; | ||||
|         return new PorterDuffColorFilter(colorForState, mode); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean isStateful() { | ||||
|         return super.isStateful() || (this.drawableState.tintList != null && this.drawableState.tintList.isStateful()) || ((this.drawableState.strokeTintList != null && this.drawableState.strokeTintList.isStateful()) || ((this.drawableState.strokeColor != null && this.drawableState.strokeColor.isStateful()) || (this.drawableState.fillColor != null && this.drawableState.fillColor.isStateful()))); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable, com.google.android.material.internal.TextDrawableHelper.TextDrawableDelegate | ||||
|     protected boolean onStateChange(int[] iArr) { | ||||
|         boolean z = updateColorsForState(iArr) || updateTintFilter(); | ||||
|         if (z) { | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|         return z; | ||||
|     } | ||||
|  | ||||
|     private boolean updateColorsForState(int[] iArr) { | ||||
|         boolean z; | ||||
|         int color; | ||||
|         int colorForState; | ||||
|         int color2; | ||||
|         int colorForState2; | ||||
|         if (this.drawableState.fillColor == null || color2 == (colorForState2 = this.drawableState.fillColor.getColorForState(iArr, (color2 = this.fillPaint.getColor())))) { | ||||
|             z = false; | ||||
|         } else { | ||||
|             this.fillPaint.setColor(colorForState2); | ||||
|             z = true; | ||||
|         } | ||||
|         if (this.drawableState.strokeColor == null || color == (colorForState = this.drawableState.strokeColor.getColorForState(iArr, (color = this.strokePaint.getColor())))) { | ||||
|             return z; | ||||
|         } | ||||
|         this.strokePaint.setColor(colorForState); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private float getStrokeInsetLength() { | ||||
|         if (hasStroke()) { | ||||
|             return this.strokePaint.getStrokeWidth() / 2.0f; | ||||
|         } | ||||
|         return 0.0f; | ||||
|     } | ||||
|  | ||||
|     private RectF getBoundsInsetByStroke() { | ||||
|         this.insetRectF.set(getBoundsAsRectF()); | ||||
|         float strokeInsetLength = getStrokeInsetLength(); | ||||
|         this.insetRectF.inset(strokeInsetLength, strokeInsetLength); | ||||
|         return this.insetRectF; | ||||
|     } | ||||
|  | ||||
|     public float getTopLeftCornerResolvedSize() { | ||||
|         return this.drawableState.shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     public float getTopRightCornerResolvedSize() { | ||||
|         return this.drawableState.shapeAppearanceModel.getTopRightCornerSize().getCornerSize(getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     public float getBottomLeftCornerResolvedSize() { | ||||
|         return this.drawableState.shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     public float getBottomRightCornerResolvedSize() { | ||||
|         return this.drawableState.shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     public boolean isRoundRect() { | ||||
|         return this.drawableState.shapeAppearanceModel.isRoundRect(getBoundsAsRectF()); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: protected */ | ||||
|     public static class MaterialShapeDrawableState extends Drawable.ConstantState { | ||||
|         int alpha; | ||||
|         ColorFilter colorFilter; | ||||
|         float elevation; | ||||
|         ElevationOverlayProvider elevationOverlayProvider; | ||||
|         ColorStateList fillColor; | ||||
|         float interpolation; | ||||
|         Rect padding; | ||||
|         Paint.Style paintStyle; | ||||
|         float parentAbsoluteElevation; | ||||
|         float scale; | ||||
|         int shadowCompatMode; | ||||
|         int shadowCompatOffset; | ||||
|         int shadowCompatRadius; | ||||
|         int shadowCompatRotation; | ||||
|         ShapeAppearanceModel shapeAppearanceModel; | ||||
|         ColorStateList strokeColor; | ||||
|         ColorStateList strokeTintList; | ||||
|         float strokeWidth; | ||||
|         ColorStateList tintList; | ||||
|         PorterDuff.Mode tintMode; | ||||
|         float translationZ; | ||||
|         boolean useTintColorForShadow; | ||||
|  | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public int getChangingConfigurations() { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         public MaterialShapeDrawableState(ShapeAppearanceModel shapeAppearanceModel, ElevationOverlayProvider elevationOverlayProvider) { | ||||
|             this.fillColor = null; | ||||
|             this.strokeColor = null; | ||||
|             this.strokeTintList = null; | ||||
|             this.tintList = null; | ||||
|             this.tintMode = PorterDuff.Mode.SRC_IN; | ||||
|             this.padding = null; | ||||
|             this.scale = 1.0f; | ||||
|             this.interpolation = 1.0f; | ||||
|             this.alpha = 255; | ||||
|             this.parentAbsoluteElevation = 0.0f; | ||||
|             this.elevation = 0.0f; | ||||
|             this.translationZ = 0.0f; | ||||
|             this.shadowCompatMode = 0; | ||||
|             this.shadowCompatRadius = 0; | ||||
|             this.shadowCompatOffset = 0; | ||||
|             this.shadowCompatRotation = 0; | ||||
|             this.useTintColorForShadow = false; | ||||
|             this.paintStyle = Paint.Style.FILL_AND_STROKE; | ||||
|             this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|             this.elevationOverlayProvider = elevationOverlayProvider; | ||||
|         } | ||||
|  | ||||
|         public MaterialShapeDrawableState(MaterialShapeDrawableState materialShapeDrawableState) { | ||||
|             this.fillColor = null; | ||||
|             this.strokeColor = null; | ||||
|             this.strokeTintList = null; | ||||
|             this.tintList = null; | ||||
|             this.tintMode = PorterDuff.Mode.SRC_IN; | ||||
|             this.padding = null; | ||||
|             this.scale = 1.0f; | ||||
|             this.interpolation = 1.0f; | ||||
|             this.alpha = 255; | ||||
|             this.parentAbsoluteElevation = 0.0f; | ||||
|             this.elevation = 0.0f; | ||||
|             this.translationZ = 0.0f; | ||||
|             this.shadowCompatMode = 0; | ||||
|             this.shadowCompatRadius = 0; | ||||
|             this.shadowCompatOffset = 0; | ||||
|             this.shadowCompatRotation = 0; | ||||
|             this.useTintColorForShadow = false; | ||||
|             this.paintStyle = Paint.Style.FILL_AND_STROKE; | ||||
|             this.shapeAppearanceModel = materialShapeDrawableState.shapeAppearanceModel; | ||||
|             this.elevationOverlayProvider = materialShapeDrawableState.elevationOverlayProvider; | ||||
|             this.strokeWidth = materialShapeDrawableState.strokeWidth; | ||||
|             this.colorFilter = materialShapeDrawableState.colorFilter; | ||||
|             this.fillColor = materialShapeDrawableState.fillColor; | ||||
|             this.strokeColor = materialShapeDrawableState.strokeColor; | ||||
|             this.tintMode = materialShapeDrawableState.tintMode; | ||||
|             this.tintList = materialShapeDrawableState.tintList; | ||||
|             this.alpha = materialShapeDrawableState.alpha; | ||||
|             this.scale = materialShapeDrawableState.scale; | ||||
|             this.shadowCompatOffset = materialShapeDrawableState.shadowCompatOffset; | ||||
|             this.shadowCompatMode = materialShapeDrawableState.shadowCompatMode; | ||||
|             this.useTintColorForShadow = materialShapeDrawableState.useTintColorForShadow; | ||||
|             this.interpolation = materialShapeDrawableState.interpolation; | ||||
|             this.parentAbsoluteElevation = materialShapeDrawableState.parentAbsoluteElevation; | ||||
|             this.elevation = materialShapeDrawableState.elevation; | ||||
|             this.translationZ = materialShapeDrawableState.translationZ; | ||||
|             this.shadowCompatRadius = materialShapeDrawableState.shadowCompatRadius; | ||||
|             this.shadowCompatRotation = materialShapeDrawableState.shadowCompatRotation; | ||||
|             this.strokeTintList = materialShapeDrawableState.strokeTintList; | ||||
|             this.paintStyle = materialShapeDrawableState.paintStyle; | ||||
|             if (materialShapeDrawableState.padding != null) { | ||||
|                 this.padding = new Rect(materialShapeDrawableState.padding); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable() { | ||||
|             MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(this); | ||||
|             materialShapeDrawable.pathDirty = true; | ||||
|             return materialShapeDrawable; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,49 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.view.View; | ||||
| import com.google.android.material.internal.ViewUtils; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class MaterialShapeUtils { | ||||
|     private MaterialShapeUtils() { | ||||
|     } | ||||
|  | ||||
|     static CornerTreatment createCornerTreatment(int i) { | ||||
|         if (i == 0) { | ||||
|             return new RoundedCornerTreatment(); | ||||
|         } | ||||
|         if (i == 1) { | ||||
|             return new CutCornerTreatment(); | ||||
|         } | ||||
|         return createDefaultCornerTreatment(); | ||||
|     } | ||||
|  | ||||
|     static CornerTreatment createDefaultCornerTreatment() { | ||||
|         return new RoundedCornerTreatment(); | ||||
|     } | ||||
|  | ||||
|     static EdgeTreatment createDefaultEdgeTreatment() { | ||||
|         return new EdgeTreatment(); | ||||
|     } | ||||
|  | ||||
|     public static void setElevation(View view, float f) { | ||||
|         Drawable background = view.getBackground(); | ||||
|         if (background instanceof MaterialShapeDrawable) { | ||||
|             ((MaterialShapeDrawable) background).setElevation(f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void setParentAbsoluteElevation(View view) { | ||||
|         Drawable background = view.getBackground(); | ||||
|         if (background instanceof MaterialShapeDrawable) { | ||||
|             setParentAbsoluteElevation(view, (MaterialShapeDrawable) background); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void setParentAbsoluteElevation(View view, MaterialShapeDrawable materialShapeDrawable) { | ||||
|         if (materialShapeDrawable.isElevationOverlayEnabled()) { | ||||
|             materialShapeDrawable.setParentAbsoluteElevation(ViewUtils.getParentAbsoluteElevation(view)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class OffsetEdgeTreatment extends EdgeTreatment { | ||||
|     private final float offset; | ||||
|     private final EdgeTreatment other; | ||||
|  | ||||
|     public OffsetEdgeTreatment(EdgeTreatment edgeTreatment, float f) { | ||||
|         this.other = edgeTreatment; | ||||
|         this.offset = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     public void getEdgePath(float f, float f2, float f3, ShapePath shapePath) { | ||||
|         this.other.getEdgePath(f, f2 - this.offset, f3, shapePath); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     boolean forceIntersection() { | ||||
|         return this.other.forceIntersection(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,44 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.RectF; | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class RelativeCornerSize implements CornerSize { | ||||
|     private final float percent; | ||||
|  | ||||
|     public float getRelativePercent() { | ||||
|         return this.percent; | ||||
|     } | ||||
|  | ||||
|     public static RelativeCornerSize createFromCornerSize(RectF rectF, CornerSize cornerSize) { | ||||
|         if (cornerSize instanceof RelativeCornerSize) { | ||||
|             return (RelativeCornerSize) cornerSize; | ||||
|         } | ||||
|         return new RelativeCornerSize(cornerSize.getCornerSize(rectF) / getMaxCornerSize(rectF)); | ||||
|     } | ||||
|  | ||||
|     private static float getMaxCornerSize(RectF rectF) { | ||||
|         return Math.min(rectF.width(), rectF.height()); | ||||
|     } | ||||
|  | ||||
|     public RelativeCornerSize(float f) { | ||||
|         this.percent = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerSize | ||||
|     public float getCornerSize(RectF rectF) { | ||||
|         return this.percent * getMaxCornerSize(rectF); | ||||
|     } | ||||
|  | ||||
|     public boolean equals(Object obj) { | ||||
|         if (this == obj) { | ||||
|             return true; | ||||
|         } | ||||
|         return (obj instanceof RelativeCornerSize) && this.percent == ((RelativeCornerSize) obj).percent; | ||||
|     } | ||||
|  | ||||
|     public int hashCode() { | ||||
|         return Arrays.hashCode(new Object[]{Float.valueOf(this.percent)}); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class RoundedCornerTreatment extends CornerTreatment { | ||||
|     float radius; | ||||
|  | ||||
|     public RoundedCornerTreatment() { | ||||
|         this.radius = -1.0f; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public RoundedCornerTreatment(float f) { | ||||
|         this.radius = f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.CornerTreatment | ||||
|     public void getCornerPath(ShapePath shapePath, float f, float f2, float f3) { | ||||
|         shapePath.reset(0.0f, f3 * f2, 180.0f, 180.0f - f); | ||||
|         float f4 = f3 * 2.0f * f2; | ||||
|         shapePath.addArc(0.0f, 0.0f, f4, f4, 180.0f, f); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,410 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.RectF; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.TypedValue; | ||||
| import android.view.ContextThemeWrapper; | ||||
| import com.google.android.material.R; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class ShapeAppearanceModel { | ||||
|     public static final CornerSize PILL = new RelativeCornerSize(0.5f); | ||||
|     EdgeTreatment bottomEdge; | ||||
|     CornerTreatment bottomLeftCorner; | ||||
|     CornerSize bottomLeftCornerSize; | ||||
|     CornerTreatment bottomRightCorner; | ||||
|     CornerSize bottomRightCornerSize; | ||||
|     EdgeTreatment leftEdge; | ||||
|     EdgeTreatment rightEdge; | ||||
|     EdgeTreatment topEdge; | ||||
|     CornerTreatment topLeftCorner; | ||||
|     CornerSize topLeftCornerSize; | ||||
|     CornerTreatment topRightCorner; | ||||
|     CornerSize topRightCornerSize; | ||||
|  | ||||
|     public interface CornerSizeUnaryOperator { | ||||
|         CornerSize apply(CornerSize cornerSize); | ||||
|     } | ||||
|  | ||||
|     public EdgeTreatment getBottomEdge() { | ||||
|         return this.bottomEdge; | ||||
|     } | ||||
|  | ||||
|     public CornerTreatment getBottomLeftCorner() { | ||||
|         return this.bottomLeftCorner; | ||||
|     } | ||||
|  | ||||
|     public CornerSize getBottomLeftCornerSize() { | ||||
|         return this.bottomLeftCornerSize; | ||||
|     } | ||||
|  | ||||
|     public CornerTreatment getBottomRightCorner() { | ||||
|         return this.bottomRightCorner; | ||||
|     } | ||||
|  | ||||
|     public CornerSize getBottomRightCornerSize() { | ||||
|         return this.bottomRightCornerSize; | ||||
|     } | ||||
|  | ||||
|     public EdgeTreatment getLeftEdge() { | ||||
|         return this.leftEdge; | ||||
|     } | ||||
|  | ||||
|     public EdgeTreatment getRightEdge() { | ||||
|         return this.rightEdge; | ||||
|     } | ||||
|  | ||||
|     public EdgeTreatment getTopEdge() { | ||||
|         return this.topEdge; | ||||
|     } | ||||
|  | ||||
|     public CornerTreatment getTopLeftCorner() { | ||||
|         return this.topLeftCorner; | ||||
|     } | ||||
|  | ||||
|     public CornerSize getTopLeftCornerSize() { | ||||
|         return this.topLeftCornerSize; | ||||
|     } | ||||
|  | ||||
|     public CornerTreatment getTopRightCorner() { | ||||
|         return this.topRightCorner; | ||||
|     } | ||||
|  | ||||
|     public CornerSize getTopRightCornerSize() { | ||||
|         return this.topRightCornerSize; | ||||
|     } | ||||
|  | ||||
|     public static final class Builder { | ||||
|         private EdgeTreatment bottomEdge; | ||||
|         private CornerTreatment bottomLeftCorner; | ||||
|         private CornerSize bottomLeftCornerSize; | ||||
|         private CornerTreatment bottomRightCorner; | ||||
|         private CornerSize bottomRightCornerSize; | ||||
|         private EdgeTreatment leftEdge; | ||||
|         private EdgeTreatment rightEdge; | ||||
|         private EdgeTreatment topEdge; | ||||
|         private CornerTreatment topLeftCorner; | ||||
|         private CornerSize topLeftCornerSize; | ||||
|         private CornerTreatment topRightCorner; | ||||
|         private CornerSize topRightCornerSize; | ||||
|  | ||||
|         public Builder setBottomEdge(EdgeTreatment edgeTreatment) { | ||||
|             this.bottomEdge = edgeTreatment; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomLeftCornerSize(CornerSize cornerSize) { | ||||
|             this.bottomLeftCornerSize = cornerSize; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomRightCornerSize(CornerSize cornerSize) { | ||||
|             this.bottomRightCornerSize = cornerSize; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setLeftEdge(EdgeTreatment edgeTreatment) { | ||||
|             this.leftEdge = edgeTreatment; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setRightEdge(EdgeTreatment edgeTreatment) { | ||||
|             this.rightEdge = edgeTreatment; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopEdge(EdgeTreatment edgeTreatment) { | ||||
|             this.topEdge = edgeTreatment; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopLeftCornerSize(CornerSize cornerSize) { | ||||
|             this.topLeftCornerSize = cornerSize; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopRightCornerSize(CornerSize cornerSize) { | ||||
|             this.topRightCornerSize = cornerSize; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder() { | ||||
|             this.topLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.topRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.bottomRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.bottomLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.topLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.topRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.bottomRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.bottomLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.topEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.rightEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.bottomEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.leftEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|         } | ||||
|  | ||||
|         public Builder(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|             this.topLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.topRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.bottomRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.bottomLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|             this.topLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.topRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.bottomRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.bottomLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|             this.topEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.rightEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.bottomEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.leftEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|             this.topLeftCorner = shapeAppearanceModel.topLeftCorner; | ||||
|             this.topRightCorner = shapeAppearanceModel.topRightCorner; | ||||
|             this.bottomRightCorner = shapeAppearanceModel.bottomRightCorner; | ||||
|             this.bottomLeftCorner = shapeAppearanceModel.bottomLeftCorner; | ||||
|             this.topLeftCornerSize = shapeAppearanceModel.topLeftCornerSize; | ||||
|             this.topRightCornerSize = shapeAppearanceModel.topRightCornerSize; | ||||
|             this.bottomRightCornerSize = shapeAppearanceModel.bottomRightCornerSize; | ||||
|             this.bottomLeftCornerSize = shapeAppearanceModel.bottomLeftCornerSize; | ||||
|             this.topEdge = shapeAppearanceModel.topEdge; | ||||
|             this.rightEdge = shapeAppearanceModel.rightEdge; | ||||
|             this.bottomEdge = shapeAppearanceModel.bottomEdge; | ||||
|             this.leftEdge = shapeAppearanceModel.leftEdge; | ||||
|         } | ||||
|  | ||||
|         public Builder setAllCorners(int i, float f) { | ||||
|             return setAllCorners(MaterialShapeUtils.createCornerTreatment(i)).setAllCornerSizes(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setAllCorners(CornerTreatment cornerTreatment) { | ||||
|             return setTopLeftCorner(cornerTreatment).setTopRightCorner(cornerTreatment).setBottomRightCorner(cornerTreatment).setBottomLeftCorner(cornerTreatment); | ||||
|         } | ||||
|  | ||||
|         public Builder setAllCornerSizes(CornerSize cornerSize) { | ||||
|             return setTopLeftCornerSize(cornerSize).setTopRightCornerSize(cornerSize).setBottomRightCornerSize(cornerSize).setBottomLeftCornerSize(cornerSize); | ||||
|         } | ||||
|  | ||||
|         public Builder setAllCornerSizes(float f) { | ||||
|             return setTopLeftCornerSize(f).setTopRightCornerSize(f).setBottomRightCornerSize(f).setBottomLeftCornerSize(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setTopLeftCornerSize(float f) { | ||||
|             this.topLeftCornerSize = new AbsoluteCornerSize(f); | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopRightCornerSize(float f) { | ||||
|             this.topRightCornerSize = new AbsoluteCornerSize(f); | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomRightCornerSize(float f) { | ||||
|             this.bottomRightCornerSize = new AbsoluteCornerSize(f); | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomLeftCornerSize(float f) { | ||||
|             this.bottomLeftCornerSize = new AbsoluteCornerSize(f); | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopLeftCorner(int i, float f) { | ||||
|             return setTopLeftCorner(MaterialShapeUtils.createCornerTreatment(i)).setTopLeftCornerSize(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setTopLeftCorner(int i, CornerSize cornerSize) { | ||||
|             return setTopLeftCorner(MaterialShapeUtils.createCornerTreatment(i)).setTopLeftCornerSize(cornerSize); | ||||
|         } | ||||
|  | ||||
|         public Builder setTopLeftCorner(CornerTreatment cornerTreatment) { | ||||
|             this.topLeftCorner = cornerTreatment; | ||||
|             float compatCornerTreatmentSize = compatCornerTreatmentSize(cornerTreatment); | ||||
|             if (compatCornerTreatmentSize != -1.0f) { | ||||
|                 setTopLeftCornerSize(compatCornerTreatmentSize); | ||||
|             } | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setTopRightCorner(int i, float f) { | ||||
|             return setTopRightCorner(MaterialShapeUtils.createCornerTreatment(i)).setTopRightCornerSize(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setTopRightCorner(int i, CornerSize cornerSize) { | ||||
|             return setTopRightCorner(MaterialShapeUtils.createCornerTreatment(i)).setTopRightCornerSize(cornerSize); | ||||
|         } | ||||
|  | ||||
|         public Builder setTopRightCorner(CornerTreatment cornerTreatment) { | ||||
|             this.topRightCorner = cornerTreatment; | ||||
|             float compatCornerTreatmentSize = compatCornerTreatmentSize(cornerTreatment); | ||||
|             if (compatCornerTreatmentSize != -1.0f) { | ||||
|                 setTopRightCornerSize(compatCornerTreatmentSize); | ||||
|             } | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomRightCorner(int i, float f) { | ||||
|             return setBottomRightCorner(MaterialShapeUtils.createCornerTreatment(i)).setBottomRightCornerSize(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomRightCorner(int i, CornerSize cornerSize) { | ||||
|             return setBottomRightCorner(MaterialShapeUtils.createCornerTreatment(i)).setBottomRightCornerSize(cornerSize); | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomRightCorner(CornerTreatment cornerTreatment) { | ||||
|             this.bottomRightCorner = cornerTreatment; | ||||
|             float compatCornerTreatmentSize = compatCornerTreatmentSize(cornerTreatment); | ||||
|             if (compatCornerTreatmentSize != -1.0f) { | ||||
|                 setBottomRightCornerSize(compatCornerTreatmentSize); | ||||
|             } | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomLeftCorner(int i, float f) { | ||||
|             return setBottomLeftCorner(MaterialShapeUtils.createCornerTreatment(i)).setBottomLeftCornerSize(f); | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomLeftCorner(int i, CornerSize cornerSize) { | ||||
|             return setBottomLeftCorner(MaterialShapeUtils.createCornerTreatment(i)).setBottomLeftCornerSize(cornerSize); | ||||
|         } | ||||
|  | ||||
|         public Builder setBottomLeftCorner(CornerTreatment cornerTreatment) { | ||||
|             this.bottomLeftCorner = cornerTreatment; | ||||
|             float compatCornerTreatmentSize = compatCornerTreatmentSize(cornerTreatment); | ||||
|             if (compatCornerTreatmentSize != -1.0f) { | ||||
|                 setBottomLeftCornerSize(compatCornerTreatmentSize); | ||||
|             } | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public Builder setAllEdges(EdgeTreatment edgeTreatment) { | ||||
|             return setLeftEdge(edgeTreatment).setTopEdge(edgeTreatment).setRightEdge(edgeTreatment).setBottomEdge(edgeTreatment); | ||||
|         } | ||||
|  | ||||
|         private static float compatCornerTreatmentSize(CornerTreatment cornerTreatment) { | ||||
|             if (cornerTreatment instanceof RoundedCornerTreatment) { | ||||
|                 return ((RoundedCornerTreatment) cornerTreatment).radius; | ||||
|             } | ||||
|             if (cornerTreatment instanceof CutCornerTreatment) { | ||||
|                 return ((CutCornerTreatment) cornerTreatment).size; | ||||
|             } | ||||
|             return -1.0f; | ||||
|         } | ||||
|  | ||||
|         public ShapeAppearanceModel build() { | ||||
|             return new ShapeAppearanceModel(this); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static Builder builder() { | ||||
|         return new Builder(); | ||||
|     } | ||||
|  | ||||
|     public static Builder builder(Context context, AttributeSet attributeSet, int i, int i2) { | ||||
|         return builder(context, attributeSet, i, i2, 0); | ||||
|     } | ||||
|  | ||||
|     public static Builder builder(Context context, AttributeSet attributeSet, int i, int i2, int i3) { | ||||
|         return builder(context, attributeSet, i, i2, new AbsoluteCornerSize(i3)); | ||||
|     } | ||||
|  | ||||
|     public static Builder builder(Context context, AttributeSet attributeSet, int i, int i2, CornerSize cornerSize) { | ||||
|         TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.MaterialShape, i, i2); | ||||
|         int resourceId = obtainStyledAttributes.getResourceId(R.styleable.MaterialShape_shapeAppearance, 0); | ||||
|         int resourceId2 = obtainStyledAttributes.getResourceId(R.styleable.MaterialShape_shapeAppearanceOverlay, 0); | ||||
|         obtainStyledAttributes.recycle(); | ||||
|         return builder(context, resourceId, resourceId2, cornerSize); | ||||
|     } | ||||
|  | ||||
|     public static Builder builder(Context context, int i, int i2) { | ||||
|         return builder(context, i, i2, 0); | ||||
|     } | ||||
|  | ||||
|     private static Builder builder(Context context, int i, int i2, int i3) { | ||||
|         return builder(context, i, i2, new AbsoluteCornerSize(i3)); | ||||
|     } | ||||
|  | ||||
|     private static Builder builder(Context context, int i, int i2, CornerSize cornerSize) { | ||||
|         ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, i); | ||||
|         if (i2 != 0) { | ||||
|             contextThemeWrapper = new ContextThemeWrapper(contextThemeWrapper, i2); | ||||
|         } | ||||
|         TypedArray obtainStyledAttributes = contextThemeWrapper.obtainStyledAttributes(R.styleable.ShapeAppearance); | ||||
|         try { | ||||
|             int i3 = obtainStyledAttributes.getInt(R.styleable.ShapeAppearance_cornerFamily, 0); | ||||
|             int i4 = obtainStyledAttributes.getInt(R.styleable.ShapeAppearance_cornerFamilyTopLeft, i3); | ||||
|             int i5 = obtainStyledAttributes.getInt(R.styleable.ShapeAppearance_cornerFamilyTopRight, i3); | ||||
|             int i6 = obtainStyledAttributes.getInt(R.styleable.ShapeAppearance_cornerFamilyBottomRight, i3); | ||||
|             int i7 = obtainStyledAttributes.getInt(R.styleable.ShapeAppearance_cornerFamilyBottomLeft, i3); | ||||
|             CornerSize cornerSize2 = getCornerSize(obtainStyledAttributes, R.styleable.ShapeAppearance_cornerSize, cornerSize); | ||||
|             CornerSize cornerSize3 = getCornerSize(obtainStyledAttributes, R.styleable.ShapeAppearance_cornerSizeTopLeft, cornerSize2); | ||||
|             CornerSize cornerSize4 = getCornerSize(obtainStyledAttributes, R.styleable.ShapeAppearance_cornerSizeTopRight, cornerSize2); | ||||
|             CornerSize cornerSize5 = getCornerSize(obtainStyledAttributes, R.styleable.ShapeAppearance_cornerSizeBottomRight, cornerSize2); | ||||
|             return new Builder().setTopLeftCorner(i4, cornerSize3).setTopRightCorner(i5, cornerSize4).setBottomRightCorner(i6, cornerSize5).setBottomLeftCorner(i7, getCornerSize(obtainStyledAttributes, R.styleable.ShapeAppearance_cornerSizeBottomLeft, cornerSize2)); | ||||
|         } finally { | ||||
|             obtainStyledAttributes.recycle(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static CornerSize getCornerSize(TypedArray typedArray, int i, CornerSize cornerSize) { | ||||
|         TypedValue peekValue = typedArray.peekValue(i); | ||||
|         if (peekValue == null) { | ||||
|             return cornerSize; | ||||
|         } | ||||
|         if (peekValue.type == 5) { | ||||
|             return new AbsoluteCornerSize(TypedValue.complexToDimensionPixelSize(peekValue.data, typedArray.getResources().getDisplayMetrics())); | ||||
|         } | ||||
|         return peekValue.type == 6 ? new RelativeCornerSize(peekValue.getFraction(1.0f, 1.0f)) : cornerSize; | ||||
|     } | ||||
|  | ||||
|     private ShapeAppearanceModel(Builder builder) { | ||||
|         this.topLeftCorner = builder.topLeftCorner; | ||||
|         this.topRightCorner = builder.topRightCorner; | ||||
|         this.bottomRightCorner = builder.bottomRightCorner; | ||||
|         this.bottomLeftCorner = builder.bottomLeftCorner; | ||||
|         this.topLeftCornerSize = builder.topLeftCornerSize; | ||||
|         this.topRightCornerSize = builder.topRightCornerSize; | ||||
|         this.bottomRightCornerSize = builder.bottomRightCornerSize; | ||||
|         this.bottomLeftCornerSize = builder.bottomLeftCornerSize; | ||||
|         this.topEdge = builder.topEdge; | ||||
|         this.rightEdge = builder.rightEdge; | ||||
|         this.bottomEdge = builder.bottomEdge; | ||||
|         this.leftEdge = builder.leftEdge; | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel() { | ||||
|         this.topLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|         this.topRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|         this.bottomRightCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|         this.bottomLeftCorner = MaterialShapeUtils.createDefaultCornerTreatment(); | ||||
|         this.topLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|         this.topRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|         this.bottomRightCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|         this.bottomLeftCornerSize = new AbsoluteCornerSize(0.0f); | ||||
|         this.topEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|         this.rightEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|         this.bottomEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|         this.leftEdge = MaterialShapeUtils.createDefaultEdgeTreatment(); | ||||
|     } | ||||
|  | ||||
|     public Builder toBuilder() { | ||||
|         return new Builder(this); | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel withCornerSize(float f) { | ||||
|         return toBuilder().setAllCornerSizes(f).build(); | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel withCornerSize(CornerSize cornerSize) { | ||||
|         return toBuilder().setAllCornerSizes(cornerSize).build(); | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel withTransformedCornerSizes(CornerSizeUnaryOperator cornerSizeUnaryOperator) { | ||||
|         return toBuilder().setTopLeftCornerSize(cornerSizeUnaryOperator.apply(getTopLeftCornerSize())).setTopRightCornerSize(cornerSizeUnaryOperator.apply(getTopRightCornerSize())).setBottomLeftCornerSize(cornerSizeUnaryOperator.apply(getBottomLeftCornerSize())).setBottomRightCornerSize(cornerSizeUnaryOperator.apply(getBottomRightCornerSize())).build(); | ||||
|     } | ||||
|  | ||||
|     public boolean isRoundRect(RectF rectF) { | ||||
|         boolean z = this.leftEdge.getClass().equals(EdgeTreatment.class) && this.rightEdge.getClass().equals(EdgeTreatment.class) && this.topEdge.getClass().equals(EdgeTreatment.class) && this.bottomEdge.getClass().equals(EdgeTreatment.class); | ||||
|         float cornerSize = this.topLeftCornerSize.getCornerSize(rectF); | ||||
|         return z && ((this.topRightCornerSize.getCornerSize(rectF) > cornerSize ? 1 : (this.topRightCornerSize.getCornerSize(rectF) == cornerSize ? 0 : -1)) == 0 && (this.bottomLeftCornerSize.getCornerSize(rectF) > cornerSize ? 1 : (this.bottomLeftCornerSize.getCornerSize(rectF) == cornerSize ? 0 : -1)) == 0 && (this.bottomRightCornerSize.getCornerSize(rectF) > cornerSize ? 1 : (this.bottomRightCornerSize.getCornerSize(rectF) == cornerSize ? 0 : -1)) == 0) && ((this.topRightCorner instanceof RoundedCornerTreatment) && (this.topLeftCorner instanceof RoundedCornerTreatment) && (this.bottomRightCorner instanceof RoundedCornerTreatment) && (this.bottomLeftCorner instanceof RoundedCornerTreatment)); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,249 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.Matrix; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.PointF; | ||||
| import android.graphics.RectF; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class ShapeAppearancePathProvider { | ||||
|     private final ShapePath[] cornerPaths = new ShapePath[4]; | ||||
|     private final Matrix[] cornerTransforms = new Matrix[4]; | ||||
|     private final Matrix[] edgeTransforms = new Matrix[4]; | ||||
|     private final PointF pointF = new PointF(); | ||||
|     private final Path overlappedEdgePath = new Path(); | ||||
|     private final Path boundsPath = new Path(); | ||||
|     private final ShapePath shapePath = new ShapePath(); | ||||
|     private final float[] scratch = new float[2]; | ||||
|     private final float[] scratch2 = new float[2]; | ||||
|     private final Path edgePath = new Path(); | ||||
|     private final Path cornerPath = new Path(); | ||||
|     private boolean edgeIntersectionCheckEnabled = true; | ||||
|  | ||||
|     public interface PathListener { | ||||
|         void onCornerPathCreated(ShapePath shapePath, Matrix matrix, int i); | ||||
|  | ||||
|         void onEdgePathCreated(ShapePath shapePath, Matrix matrix, int i); | ||||
|     } | ||||
|  | ||||
|     void setEdgeIntersectionCheckEnable(boolean z) { | ||||
|         this.edgeIntersectionCheckEnabled = z; | ||||
|     } | ||||
|  | ||||
|     private static class Lazy { | ||||
|         static final ShapeAppearancePathProvider INSTANCE = new ShapeAppearancePathProvider(); | ||||
|  | ||||
|         private Lazy() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearancePathProvider() { | ||||
|         for (int i = 0; i < 4; i++) { | ||||
|             this.cornerPaths[i] = new ShapePath(); | ||||
|             this.cornerTransforms[i] = new Matrix(); | ||||
|             this.edgeTransforms[i] = new Matrix(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static ShapeAppearancePathProvider getInstance() { | ||||
|         return Lazy.INSTANCE; | ||||
|     } | ||||
|  | ||||
|     public void calculatePath(ShapeAppearanceModel shapeAppearanceModel, float f, RectF rectF, Path path) { | ||||
|         calculatePath(shapeAppearanceModel, f, rectF, null, path); | ||||
|     } | ||||
|  | ||||
|     public void calculatePath(ShapeAppearanceModel shapeAppearanceModel, float f, RectF rectF, PathListener pathListener, Path path) { | ||||
|         path.rewind(); | ||||
|         this.overlappedEdgePath.rewind(); | ||||
|         this.boundsPath.rewind(); | ||||
|         this.boundsPath.addRect(rectF, Path.Direction.CW); | ||||
|         ShapeAppearancePathSpec shapeAppearancePathSpec = new ShapeAppearancePathSpec(shapeAppearanceModel, f, rectF, pathListener, path); | ||||
|         for (int i = 0; i < 4; i++) { | ||||
|             setCornerPathAndTransform(shapeAppearancePathSpec, i); | ||||
|             setEdgePathAndTransform(i); | ||||
|         } | ||||
|         for (int i2 = 0; i2 < 4; i2++) { | ||||
|             appendCornerPath(shapeAppearancePathSpec, i2); | ||||
|             appendEdgePath(shapeAppearancePathSpec, i2); | ||||
|         } | ||||
|         path.close(); | ||||
|         this.overlappedEdgePath.close(); | ||||
|         if (this.overlappedEdgePath.isEmpty()) { | ||||
|             return; | ||||
|         } | ||||
|         path.op(this.overlappedEdgePath, Path.Op.UNION); | ||||
|     } | ||||
|  | ||||
|     private void setCornerPathAndTransform(ShapeAppearancePathSpec shapeAppearancePathSpec, int i) { | ||||
|         getCornerTreatmentForIndex(i, shapeAppearancePathSpec.shapeAppearanceModel).getCornerPath(this.cornerPaths[i], 90.0f, shapeAppearancePathSpec.interpolation, shapeAppearancePathSpec.bounds, getCornerSizeForIndex(i, shapeAppearancePathSpec.shapeAppearanceModel)); | ||||
|         float angleOfEdge = angleOfEdge(i); | ||||
|         this.cornerTransforms[i].reset(); | ||||
|         getCoordinatesOfCorner(i, shapeAppearancePathSpec.bounds, this.pointF); | ||||
|         this.cornerTransforms[i].setTranslate(this.pointF.x, this.pointF.y); | ||||
|         this.cornerTransforms[i].preRotate(angleOfEdge); | ||||
|     } | ||||
|  | ||||
|     private void setEdgePathAndTransform(int i) { | ||||
|         this.scratch[0] = this.cornerPaths[i].getEndX(); | ||||
|         this.scratch[1] = this.cornerPaths[i].getEndY(); | ||||
|         this.cornerTransforms[i].mapPoints(this.scratch); | ||||
|         float angleOfEdge = angleOfEdge(i); | ||||
|         this.edgeTransforms[i].reset(); | ||||
|         Matrix matrix = this.edgeTransforms[i]; | ||||
|         float[] fArr = this.scratch; | ||||
|         matrix.setTranslate(fArr[0], fArr[1]); | ||||
|         this.edgeTransforms[i].preRotate(angleOfEdge); | ||||
|     } | ||||
|  | ||||
|     private void appendCornerPath(ShapeAppearancePathSpec shapeAppearancePathSpec, int i) { | ||||
|         this.scratch[0] = this.cornerPaths[i].getStartX(); | ||||
|         this.scratch[1] = this.cornerPaths[i].getStartY(); | ||||
|         this.cornerTransforms[i].mapPoints(this.scratch); | ||||
|         if (i == 0) { | ||||
|             Path path = shapeAppearancePathSpec.path; | ||||
|             float[] fArr = this.scratch; | ||||
|             path.moveTo(fArr[0], fArr[1]); | ||||
|         } else { | ||||
|             Path path2 = shapeAppearancePathSpec.path; | ||||
|             float[] fArr2 = this.scratch; | ||||
|             path2.lineTo(fArr2[0], fArr2[1]); | ||||
|         } | ||||
|         this.cornerPaths[i].applyToPath(this.cornerTransforms[i], shapeAppearancePathSpec.path); | ||||
|         if (shapeAppearancePathSpec.pathListener != null) { | ||||
|             shapeAppearancePathSpec.pathListener.onCornerPathCreated(this.cornerPaths[i], this.cornerTransforms[i], i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void appendEdgePath(ShapeAppearancePathSpec shapeAppearancePathSpec, int i) { | ||||
|         int i2 = (i + 1) % 4; | ||||
|         this.scratch[0] = this.cornerPaths[i].getEndX(); | ||||
|         this.scratch[1] = this.cornerPaths[i].getEndY(); | ||||
|         this.cornerTransforms[i].mapPoints(this.scratch); | ||||
|         this.scratch2[0] = this.cornerPaths[i2].getStartX(); | ||||
|         this.scratch2[1] = this.cornerPaths[i2].getStartY(); | ||||
|         this.cornerTransforms[i2].mapPoints(this.scratch2); | ||||
|         float f = this.scratch[0]; | ||||
|         float[] fArr = this.scratch2; | ||||
|         float max = Math.max(((float) Math.hypot(f - fArr[0], r1[1] - fArr[1])) - 0.001f, 0.0f); | ||||
|         float edgeCenterForIndex = getEdgeCenterForIndex(shapeAppearancePathSpec.bounds, i); | ||||
|         this.shapePath.reset(0.0f, 0.0f); | ||||
|         EdgeTreatment edgeTreatmentForIndex = getEdgeTreatmentForIndex(i, shapeAppearancePathSpec.shapeAppearanceModel); | ||||
|         edgeTreatmentForIndex.getEdgePath(max, edgeCenterForIndex, shapeAppearancePathSpec.interpolation, this.shapePath); | ||||
|         this.edgePath.reset(); | ||||
|         this.shapePath.applyToPath(this.edgeTransforms[i], this.edgePath); | ||||
|         if (this.edgeIntersectionCheckEnabled && (edgeTreatmentForIndex.forceIntersection() || pathOverlapsCorner(this.edgePath, i) || pathOverlapsCorner(this.edgePath, i2))) { | ||||
|             Path path = this.edgePath; | ||||
|             path.op(path, this.boundsPath, Path.Op.DIFFERENCE); | ||||
|             this.scratch[0] = this.shapePath.getStartX(); | ||||
|             this.scratch[1] = this.shapePath.getStartY(); | ||||
|             this.edgeTransforms[i].mapPoints(this.scratch); | ||||
|             Path path2 = this.overlappedEdgePath; | ||||
|             float[] fArr2 = this.scratch; | ||||
|             path2.moveTo(fArr2[0], fArr2[1]); | ||||
|             this.shapePath.applyToPath(this.edgeTransforms[i], this.overlappedEdgePath); | ||||
|         } else { | ||||
|             this.shapePath.applyToPath(this.edgeTransforms[i], shapeAppearancePathSpec.path); | ||||
|         } | ||||
|         if (shapeAppearancePathSpec.pathListener != null) { | ||||
|             shapeAppearancePathSpec.pathListener.onEdgePathCreated(this.shapePath, this.edgeTransforms[i], i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean pathOverlapsCorner(Path path, int i) { | ||||
|         this.cornerPath.reset(); | ||||
|         this.cornerPaths[i].applyToPath(this.cornerTransforms[i], this.cornerPath); | ||||
|         RectF rectF = new RectF(); | ||||
|         path.computeBounds(rectF, true); | ||||
|         this.cornerPath.computeBounds(rectF, true); | ||||
|         path.op(this.cornerPath, Path.Op.INTERSECT); | ||||
|         path.computeBounds(rectF, true); | ||||
|         if (rectF.isEmpty()) { | ||||
|             return rectF.width() > 1.0f && rectF.height() > 1.0f; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private float getEdgeCenterForIndex(RectF rectF, int i) { | ||||
|         this.scratch[0] = this.cornerPaths[i].endX; | ||||
|         this.scratch[1] = this.cornerPaths[i].endY; | ||||
|         this.cornerTransforms[i].mapPoints(this.scratch); | ||||
|         if (i == 1 || i == 3) { | ||||
|             return Math.abs(rectF.centerX() - this.scratch[0]); | ||||
|         } | ||||
|         return Math.abs(rectF.centerY() - this.scratch[1]); | ||||
|     } | ||||
|  | ||||
|     private CornerTreatment getCornerTreatmentForIndex(int i, ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         if (i == 1) { | ||||
|             return shapeAppearanceModel.getBottomRightCorner(); | ||||
|         } | ||||
|         if (i == 2) { | ||||
|             return shapeAppearanceModel.getBottomLeftCorner(); | ||||
|         } | ||||
|         if (i == 3) { | ||||
|             return shapeAppearanceModel.getTopLeftCorner(); | ||||
|         } | ||||
|         return shapeAppearanceModel.getTopRightCorner(); | ||||
|     } | ||||
|  | ||||
|     private CornerSize getCornerSizeForIndex(int i, ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         if (i == 1) { | ||||
|             return shapeAppearanceModel.getBottomRightCornerSize(); | ||||
|         } | ||||
|         if (i == 2) { | ||||
|             return shapeAppearanceModel.getBottomLeftCornerSize(); | ||||
|         } | ||||
|         if (i == 3) { | ||||
|             return shapeAppearanceModel.getTopLeftCornerSize(); | ||||
|         } | ||||
|         return shapeAppearanceModel.getTopRightCornerSize(); | ||||
|     } | ||||
|  | ||||
|     private EdgeTreatment getEdgeTreatmentForIndex(int i, ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         if (i == 1) { | ||||
|             return shapeAppearanceModel.getBottomEdge(); | ||||
|         } | ||||
|         if (i == 2) { | ||||
|             return shapeAppearanceModel.getLeftEdge(); | ||||
|         } | ||||
|         if (i == 3) { | ||||
|             return shapeAppearanceModel.getTopEdge(); | ||||
|         } | ||||
|         return shapeAppearanceModel.getRightEdge(); | ||||
|     } | ||||
|  | ||||
|     private void getCoordinatesOfCorner(int i, RectF rectF, PointF pointF) { | ||||
|         if (i == 1) { | ||||
|             pointF.set(rectF.right, rectF.bottom); | ||||
|             return; | ||||
|         } | ||||
|         if (i == 2) { | ||||
|             pointF.set(rectF.left, rectF.bottom); | ||||
|         } else if (i == 3) { | ||||
|             pointF.set(rectF.left, rectF.top); | ||||
|         } else { | ||||
|             pointF.set(rectF.right, rectF.top); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private float angleOfEdge(int i) { | ||||
|         return ((i + 1) % 4) * 90; | ||||
|     } | ||||
|  | ||||
|     static final class ShapeAppearancePathSpec { | ||||
|         public final RectF bounds; | ||||
|         public final float interpolation; | ||||
|         public final Path path; | ||||
|         public final PathListener pathListener; | ||||
|         public final ShapeAppearanceModel shapeAppearanceModel; | ||||
|  | ||||
|         ShapeAppearancePathSpec(ShapeAppearanceModel shapeAppearanceModel, float f, RectF rectF, PathListener pathListener, Path path) { | ||||
|             this.pathListener = pathListener; | ||||
|             this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|             this.interpolation = f; | ||||
|             this.bounds = rectF; | ||||
|             this.path = path; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,596 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.Matrix; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.RectF; | ||||
| import com.google.android.material.shadow.ShadowRenderer; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class ShapePath { | ||||
|     protected static final float ANGLE_LEFT = 180.0f; | ||||
|     private static final float ANGLE_UP = 270.0f; | ||||
|     private boolean containsIncompatibleShadowOp; | ||||
|  | ||||
|     @Deprecated | ||||
|     public float currentShadowAngle; | ||||
|  | ||||
|     @Deprecated | ||||
|     public float endShadowAngle; | ||||
|  | ||||
|     @Deprecated | ||||
|     public float endX; | ||||
|  | ||||
|     @Deprecated | ||||
|     public float endY; | ||||
|     private final List<PathOperation> operations = new ArrayList(); | ||||
|     private final List<ShadowCompatOperation> shadowCompatOperations = new ArrayList(); | ||||
|  | ||||
|     @Deprecated | ||||
|     public float startX; | ||||
|  | ||||
|     @Deprecated | ||||
|     public float startY; | ||||
|  | ||||
|     public static abstract class PathOperation { | ||||
|         protected final Matrix matrix = new Matrix(); | ||||
|  | ||||
|         public abstract void applyToPath(Matrix matrix, Path path); | ||||
|     } | ||||
|  | ||||
|     private float getCurrentShadowAngle() { | ||||
|         return this.currentShadowAngle; | ||||
|     } | ||||
|  | ||||
|     private float getEndShadowAngle() { | ||||
|         return this.endShadowAngle; | ||||
|     } | ||||
|  | ||||
|     private void setCurrentShadowAngle(float f) { | ||||
|         this.currentShadowAngle = f; | ||||
|     } | ||||
|  | ||||
|     private void setEndShadowAngle(float f) { | ||||
|         this.endShadowAngle = f; | ||||
|     } | ||||
|  | ||||
|     private void setEndX(float f) { | ||||
|         this.endX = f; | ||||
|     } | ||||
|  | ||||
|     private void setEndY(float f) { | ||||
|         this.endY = f; | ||||
|     } | ||||
|  | ||||
|     private void setStartX(float f) { | ||||
|         this.startX = f; | ||||
|     } | ||||
|  | ||||
|     private void setStartY(float f) { | ||||
|         this.startY = f; | ||||
|     } | ||||
|  | ||||
|     boolean containsIncompatibleShadowOp() { | ||||
|         return this.containsIncompatibleShadowOp; | ||||
|     } | ||||
|  | ||||
|     float getEndX() { | ||||
|         return this.endX; | ||||
|     } | ||||
|  | ||||
|     float getEndY() { | ||||
|         return this.endY; | ||||
|     } | ||||
|  | ||||
|     float getStartX() { | ||||
|         return this.startX; | ||||
|     } | ||||
|  | ||||
|     float getStartY() { | ||||
|         return this.startY; | ||||
|     } | ||||
|  | ||||
|     public ShapePath() { | ||||
|         reset(0.0f, 0.0f); | ||||
|     } | ||||
|  | ||||
|     public ShapePath(float f, float f2) { | ||||
|         reset(f, f2); | ||||
|     } | ||||
|  | ||||
|     public void reset(float f, float f2) { | ||||
|         reset(f, f2, ANGLE_UP, 0.0f); | ||||
|     } | ||||
|  | ||||
|     public void reset(float f, float f2, float f3, float f4) { | ||||
|         setStartX(f); | ||||
|         setStartY(f2); | ||||
|         setEndX(f); | ||||
|         setEndY(f2); | ||||
|         setCurrentShadowAngle(f3); | ||||
|         setEndShadowAngle((f3 + f4) % 360.0f); | ||||
|         this.operations.clear(); | ||||
|         this.shadowCompatOperations.clear(); | ||||
|         this.containsIncompatibleShadowOp = false; | ||||
|     } | ||||
|  | ||||
|     public void lineTo(float f, float f2) { | ||||
|         PathLineOperation pathLineOperation = new PathLineOperation(); | ||||
|         pathLineOperation.x = f; | ||||
|         pathLineOperation.y = f2; | ||||
|         this.operations.add(pathLineOperation); | ||||
|         LineShadowOperation lineShadowOperation = new LineShadowOperation(pathLineOperation, getEndX(), getEndY()); | ||||
|         addShadowCompatOperation(lineShadowOperation, lineShadowOperation.getAngle() + ANGLE_UP, lineShadowOperation.getAngle() + ANGLE_UP); | ||||
|         setEndX(f); | ||||
|         setEndY(f2); | ||||
|     } | ||||
|  | ||||
|     public void lineTo(float f, float f2, float f3, float f4) { | ||||
|         if ((Math.abs(f - getEndX()) < 0.001f && Math.abs(f2 - getEndY()) < 0.001f) || (Math.abs(f - f3) < 0.001f && Math.abs(f2 - f4) < 0.001f)) { | ||||
|             lineTo(f3, f4); | ||||
|             return; | ||||
|         } | ||||
|         PathLineOperation pathLineOperation = new PathLineOperation(); | ||||
|         pathLineOperation.x = f; | ||||
|         pathLineOperation.y = f2; | ||||
|         this.operations.add(pathLineOperation); | ||||
|         PathLineOperation pathLineOperation2 = new PathLineOperation(); | ||||
|         pathLineOperation2.x = f3; | ||||
|         pathLineOperation2.y = f4; | ||||
|         this.operations.add(pathLineOperation2); | ||||
|         InnerCornerShadowOperation innerCornerShadowOperation = new InnerCornerShadowOperation(pathLineOperation, pathLineOperation2, getEndX(), getEndY()); | ||||
|         if (innerCornerShadowOperation.getSweepAngle() > 0.0f) { | ||||
|             lineTo(f, f2); | ||||
|             lineTo(f3, f4); | ||||
|         } else { | ||||
|             addShadowCompatOperation(innerCornerShadowOperation, innerCornerShadowOperation.getStartAngle() + ANGLE_UP, innerCornerShadowOperation.getEndAngle() + ANGLE_UP); | ||||
|             setEndX(f3); | ||||
|             setEndY(f4); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void quadToPoint(float f, float f2, float f3, float f4) { | ||||
|         PathQuadOperation pathQuadOperation = new PathQuadOperation(); | ||||
|         pathQuadOperation.setControlX(f); | ||||
|         pathQuadOperation.setControlY(f2); | ||||
|         pathQuadOperation.setEndX(f3); | ||||
|         pathQuadOperation.setEndY(f4); | ||||
|         this.operations.add(pathQuadOperation); | ||||
|         this.containsIncompatibleShadowOp = true; | ||||
|         setEndX(f3); | ||||
|         setEndY(f4); | ||||
|     } | ||||
|  | ||||
|     public void cubicToPoint(float f, float f2, float f3, float f4, float f5, float f6) { | ||||
|         this.operations.add(new PathCubicOperation(f, f2, f3, f4, f5, f6)); | ||||
|         this.containsIncompatibleShadowOp = true; | ||||
|         setEndX(f5); | ||||
|         setEndY(f6); | ||||
|     } | ||||
|  | ||||
|     public void addArc(float f, float f2, float f3, float f4, float f5, float f6) { | ||||
|         PathArcOperation pathArcOperation = new PathArcOperation(f, f2, f3, f4); | ||||
|         pathArcOperation.setStartAngle(f5); | ||||
|         pathArcOperation.setSweepAngle(f6); | ||||
|         this.operations.add(pathArcOperation); | ||||
|         ArcShadowOperation arcShadowOperation = new ArcShadowOperation(pathArcOperation); | ||||
|         float f7 = f5 + f6; | ||||
|         boolean z = f6 < 0.0f; | ||||
|         if (z) { | ||||
|             f5 = (f5 + ANGLE_LEFT) % 360.0f; | ||||
|         } | ||||
|         addShadowCompatOperation(arcShadowOperation, f5, z ? (ANGLE_LEFT + f7) % 360.0f : f7); | ||||
|         double d = f7; | ||||
|         setEndX(((f + f3) * 0.5f) + (((f3 - f) / 2.0f) * ((float) Math.cos(Math.toRadians(d))))); | ||||
|         setEndY(((f2 + f4) * 0.5f) + (((f4 - f2) / 2.0f) * ((float) Math.sin(Math.toRadians(d))))); | ||||
|     } | ||||
|  | ||||
|     public void applyToPath(Matrix matrix, Path path) { | ||||
|         int size = this.operations.size(); | ||||
|         for (int i = 0; i < size; i++) { | ||||
|             this.operations.get(i).applyToPath(matrix, path); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ShadowCompatOperation createShadowCompatOperation(Matrix matrix) { | ||||
|         addConnectingShadowIfNecessary(getEndShadowAngle()); | ||||
|         final Matrix matrix2 = new Matrix(matrix); | ||||
|         final ArrayList arrayList = new ArrayList(this.shadowCompatOperations); | ||||
|         return new ShadowCompatOperation() { // from class: com.google.android.material.shape.ShapePath.1 | ||||
|             @Override // com.google.android.material.shape.ShapePath.ShadowCompatOperation | ||||
|             public void draw(Matrix matrix3, ShadowRenderer shadowRenderer, int i, Canvas canvas) { | ||||
|                 Iterator it = arrayList.iterator(); | ||||
|                 while (it.hasNext()) { | ||||
|                     ((ShadowCompatOperation) it.next()).draw(matrix2, shadowRenderer, i, canvas); | ||||
|                 } | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     private void addShadowCompatOperation(ShadowCompatOperation shadowCompatOperation, float f, float f2) { | ||||
|         addConnectingShadowIfNecessary(f); | ||||
|         this.shadowCompatOperations.add(shadowCompatOperation); | ||||
|         setCurrentShadowAngle(f2); | ||||
|     } | ||||
|  | ||||
|     private void addConnectingShadowIfNecessary(float f) { | ||||
|         if (getCurrentShadowAngle() == f) { | ||||
|             return; | ||||
|         } | ||||
|         float currentShadowAngle = ((f - getCurrentShadowAngle()) + 360.0f) % 360.0f; | ||||
|         if (currentShadowAngle > ANGLE_LEFT) { | ||||
|             return; | ||||
|         } | ||||
|         PathArcOperation pathArcOperation = new PathArcOperation(getEndX(), getEndY(), getEndX(), getEndY()); | ||||
|         pathArcOperation.setStartAngle(getCurrentShadowAngle()); | ||||
|         pathArcOperation.setSweepAngle(currentShadowAngle); | ||||
|         this.shadowCompatOperations.add(new ArcShadowOperation(pathArcOperation)); | ||||
|         setCurrentShadowAngle(f); | ||||
|     } | ||||
|  | ||||
|     static abstract class ShadowCompatOperation { | ||||
|         static final Matrix IDENTITY_MATRIX = new Matrix(); | ||||
|         final Matrix renderMatrix = new Matrix(); | ||||
|  | ||||
|         public abstract void draw(Matrix matrix, ShadowRenderer shadowRenderer, int i, Canvas canvas); | ||||
|  | ||||
|         ShadowCompatOperation() { | ||||
|         } | ||||
|  | ||||
|         public final void draw(ShadowRenderer shadowRenderer, int i, Canvas canvas) { | ||||
|             draw(IDENTITY_MATRIX, shadowRenderer, i, canvas); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class LineShadowOperation extends ShadowCompatOperation { | ||||
|         private final PathLineOperation operation; | ||||
|         private final float startX; | ||||
|         private final float startY; | ||||
|  | ||||
|         public LineShadowOperation(PathLineOperation pathLineOperation, float f, float f2) { | ||||
|             this.operation = pathLineOperation; | ||||
|             this.startX = f; | ||||
|             this.startY = f2; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.ShadowCompatOperation | ||||
|         public void draw(Matrix matrix, ShadowRenderer shadowRenderer, int i, Canvas canvas) { | ||||
|             RectF rectF = new RectF(0.0f, 0.0f, (float) Math.hypot(this.operation.y - this.startY, this.operation.x - this.startX), 0.0f); | ||||
|             this.renderMatrix.set(matrix); | ||||
|             this.renderMatrix.preTranslate(this.startX, this.startY); | ||||
|             this.renderMatrix.preRotate(getAngle()); | ||||
|             shadowRenderer.drawEdgeShadow(canvas, this.renderMatrix, rectF, i); | ||||
|         } | ||||
|  | ||||
|         float getAngle() { | ||||
|             return (float) Math.toDegrees(Math.atan((this.operation.y - this.startY) / (this.operation.x - this.startX))); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class InnerCornerShadowOperation extends ShadowCompatOperation { | ||||
|         private final PathLineOperation operation1; | ||||
|         private final PathLineOperation operation2; | ||||
|         private final float startX; | ||||
|         private final float startY; | ||||
|  | ||||
|         public InnerCornerShadowOperation(PathLineOperation pathLineOperation, PathLineOperation pathLineOperation2, float f, float f2) { | ||||
|             this.operation1 = pathLineOperation; | ||||
|             this.operation2 = pathLineOperation2; | ||||
|             this.startX = f; | ||||
|             this.startY = f2; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.ShadowCompatOperation | ||||
|         public void draw(Matrix matrix, ShadowRenderer shadowRenderer, int i, Canvas canvas) { | ||||
|             ShadowRenderer shadowRenderer2; | ||||
|             float sweepAngle = getSweepAngle(); | ||||
|             if (sweepAngle > 0.0f) { | ||||
|                 return; | ||||
|             } | ||||
|             double hypot = Math.hypot(this.operation1.x - this.startX, this.operation1.y - this.startY); | ||||
|             double hypot2 = Math.hypot(this.operation2.x - this.operation1.x, this.operation2.y - this.operation1.y); | ||||
|             float min = (float) Math.min(i, Math.min(hypot, hypot2)); | ||||
|             double d = min; | ||||
|             double tan = Math.tan(Math.toRadians((-sweepAngle) / 2.0f)) * d; | ||||
|             if (hypot > tan) { | ||||
|                 RectF rectF = new RectF(0.0f, 0.0f, (float) (hypot - tan), 0.0f); | ||||
|                 this.renderMatrix.set(matrix); | ||||
|                 this.renderMatrix.preTranslate(this.startX, this.startY); | ||||
|                 this.renderMatrix.preRotate(getStartAngle()); | ||||
|                 shadowRenderer2 = shadowRenderer; | ||||
|                 shadowRenderer2.drawEdgeShadow(canvas, this.renderMatrix, rectF, i); | ||||
|             } else { | ||||
|                 shadowRenderer2 = shadowRenderer; | ||||
|             } | ||||
|             float f = 2.0f * min; | ||||
|             RectF rectF2 = new RectF(0.0f, 0.0f, f, f); | ||||
|             this.renderMatrix.set(matrix); | ||||
|             this.renderMatrix.preTranslate(this.operation1.x, this.operation1.y); | ||||
|             this.renderMatrix.preRotate(getStartAngle()); | ||||
|             this.renderMatrix.preTranslate((float) ((-tan) - d), (-2.0f) * min); | ||||
|             shadowRenderer.drawInnerCornerShadow(canvas, this.renderMatrix, rectF2, (int) min, 450.0f, sweepAngle, new float[]{(float) (d + tan), f}); | ||||
|             if (hypot2 > tan) { | ||||
|                 RectF rectF3 = new RectF(0.0f, 0.0f, (float) (hypot2 - tan), 0.0f); | ||||
|                 this.renderMatrix.set(matrix); | ||||
|                 this.renderMatrix.preTranslate(this.operation1.x, this.operation1.y); | ||||
|                 this.renderMatrix.preRotate(getEndAngle()); | ||||
|                 this.renderMatrix.preTranslate((float) tan, 0.0f); | ||||
|                 shadowRenderer2.drawEdgeShadow(canvas, this.renderMatrix, rectF3, i); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         float getStartAngle() { | ||||
|             return (float) Math.toDegrees(Math.atan((this.operation1.y - this.startY) / (this.operation1.x - this.startX))); | ||||
|         } | ||||
|  | ||||
|         float getEndAngle() { | ||||
|             return (float) Math.toDegrees(Math.atan((this.operation2.y - this.operation1.y) / (this.operation2.x - this.operation1.x))); | ||||
|         } | ||||
|  | ||||
|         float getSweepAngle() { | ||||
|             float endAngle = ((getEndAngle() - getStartAngle()) + 360.0f) % 360.0f; | ||||
|             return endAngle <= ShapePath.ANGLE_LEFT ? endAngle : endAngle - 360.0f; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class ArcShadowOperation extends ShadowCompatOperation { | ||||
|         private final PathArcOperation operation; | ||||
|  | ||||
|         public ArcShadowOperation(PathArcOperation pathArcOperation) { | ||||
|             this.operation = pathArcOperation; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.ShadowCompatOperation | ||||
|         public void draw(Matrix matrix, ShadowRenderer shadowRenderer, int i, Canvas canvas) { | ||||
|             shadowRenderer.drawCornerShadow(canvas, matrix, new RectF(this.operation.getLeft(), this.operation.getTop(), this.operation.getRight(), this.operation.getBottom()), i, this.operation.getStartAngle(), this.operation.getSweepAngle()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static class PathLineOperation extends PathOperation { | ||||
|         private float x; | ||||
|         private float y; | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.PathOperation | ||||
|         public void applyToPath(Matrix matrix, Path path) { | ||||
|             Matrix matrix2 = this.matrix; | ||||
|             matrix.invert(matrix2); | ||||
|             path.transform(matrix2); | ||||
|             path.lineTo(this.x, this.y); | ||||
|             path.transform(matrix); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static class PathQuadOperation extends PathOperation { | ||||
|  | ||||
|         @Deprecated | ||||
|         public float controlX; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float controlY; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float endX; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float endY; | ||||
|  | ||||
|         private float getControlX() { | ||||
|             return this.controlX; | ||||
|         } | ||||
|  | ||||
|         private float getControlY() { | ||||
|             return this.controlY; | ||||
|         } | ||||
|  | ||||
|         private float getEndX() { | ||||
|             return this.endX; | ||||
|         } | ||||
|  | ||||
|         private float getEndY() { | ||||
|             return this.endY; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setControlX(float f) { | ||||
|             this.controlX = f; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setControlY(float f) { | ||||
|             this.controlY = f; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setEndX(float f) { | ||||
|             this.endX = f; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setEndY(float f) { | ||||
|             this.endY = f; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.PathOperation | ||||
|         public void applyToPath(Matrix matrix, Path path) { | ||||
|             Matrix matrix2 = this.matrix; | ||||
|             matrix.invert(matrix2); | ||||
|             path.transform(matrix2); | ||||
|             path.quadTo(getControlX(), getControlY(), getEndX(), getEndY()); | ||||
|             path.transform(matrix); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static class PathArcOperation extends PathOperation { | ||||
|         private static final RectF rectF = new RectF(); | ||||
|  | ||||
|         @Deprecated | ||||
|         public float bottom; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float left; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float right; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float startAngle; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float sweepAngle; | ||||
|  | ||||
|         @Deprecated | ||||
|         public float top; | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getBottom() { | ||||
|             return this.bottom; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getLeft() { | ||||
|             return this.left; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getRight() { | ||||
|             return this.right; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getStartAngle() { | ||||
|             return this.startAngle; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getSweepAngle() { | ||||
|             return this.sweepAngle; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public float getTop() { | ||||
|             return this.top; | ||||
|         } | ||||
|  | ||||
|         private void setBottom(float f) { | ||||
|             this.bottom = f; | ||||
|         } | ||||
|  | ||||
|         private void setLeft(float f) { | ||||
|             this.left = f; | ||||
|         } | ||||
|  | ||||
|         private void setRight(float f) { | ||||
|             this.right = f; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setStartAngle(float f) { | ||||
|             this.startAngle = f; | ||||
|         } | ||||
|  | ||||
|         /* JADX INFO: Access modifiers changed from: private */ | ||||
|         public void setSweepAngle(float f) { | ||||
|             this.sweepAngle = f; | ||||
|         } | ||||
|  | ||||
|         private void setTop(float f) { | ||||
|             this.top = f; | ||||
|         } | ||||
|  | ||||
|         public PathArcOperation(float f, float f2, float f3, float f4) { | ||||
|             setLeft(f); | ||||
|             setTop(f2); | ||||
|             setRight(f3); | ||||
|             setBottom(f4); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.PathOperation | ||||
|         public void applyToPath(Matrix matrix, Path path) { | ||||
|             Matrix matrix2 = this.matrix; | ||||
|             matrix.invert(matrix2); | ||||
|             path.transform(matrix2); | ||||
|             RectF rectF2 = rectF; | ||||
|             rectF2.set(getLeft(), getTop(), getRight(), getBottom()); | ||||
|             path.arcTo(rectF2, getStartAngle(), getSweepAngle(), false); | ||||
|             path.transform(matrix); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static class PathCubicOperation extends PathOperation { | ||||
|         private float controlX1; | ||||
|         private float controlX2; | ||||
|         private float controlY1; | ||||
|         private float controlY2; | ||||
|         private float endX; | ||||
|         private float endY; | ||||
|  | ||||
|         private float getControlX1() { | ||||
|             return this.controlX1; | ||||
|         } | ||||
|  | ||||
|         private float getControlX2() { | ||||
|             return this.controlX2; | ||||
|         } | ||||
|  | ||||
|         private float getControlY1() { | ||||
|             return this.controlY1; | ||||
|         } | ||||
|  | ||||
|         private float getControlY2() { | ||||
|             return this.controlY1; | ||||
|         } | ||||
|  | ||||
|         private float getEndX() { | ||||
|             return this.endX; | ||||
|         } | ||||
|  | ||||
|         private float getEndY() { | ||||
|             return this.endY; | ||||
|         } | ||||
|  | ||||
|         private void setControlX1(float f) { | ||||
|             this.controlX1 = f; | ||||
|         } | ||||
|  | ||||
|         private void setControlX2(float f) { | ||||
|             this.controlX2 = f; | ||||
|         } | ||||
|  | ||||
|         private void setControlY1(float f) { | ||||
|             this.controlY1 = f; | ||||
|         } | ||||
|  | ||||
|         private void setControlY2(float f) { | ||||
|             this.controlY2 = f; | ||||
|         } | ||||
|  | ||||
|         private void setEndX(float f) { | ||||
|             this.endX = f; | ||||
|         } | ||||
|  | ||||
|         private void setEndY(float f) { | ||||
|             this.endY = f; | ||||
|         } | ||||
|  | ||||
|         public PathCubicOperation(float f, float f2, float f3, float f4, float f5, float f6) { | ||||
|             setControlX1(f); | ||||
|             setControlY1(f2); | ||||
|             setControlX2(f3); | ||||
|             setControlY2(f4); | ||||
|             setEndX(f5); | ||||
|             setEndY(f6); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shape.ShapePath.PathOperation | ||||
|         public void applyToPath(Matrix matrix, Path path) { | ||||
|             Matrix matrix2 = this.matrix; | ||||
|             matrix.invert(matrix2); | ||||
|             path.transform(matrix2); | ||||
|             path.cubicTo(this.controlX1, this.controlY1, this.controlX2, this.controlY2, this.endX, this.endY); | ||||
|             path.transform(matrix); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,77 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| @Deprecated | ||||
| /* loaded from: classes.dex */ | ||||
| public class ShapePathModel extends ShapeAppearanceModel { | ||||
|     @Deprecated | ||||
|     public void setAllCorners(CornerTreatment cornerTreatment) { | ||||
|         this.topLeftCorner = cornerTreatment; | ||||
|         this.topRightCorner = cornerTreatment; | ||||
|         this.bottomRightCorner = cornerTreatment; | ||||
|         this.bottomLeftCorner = cornerTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setAllEdges(EdgeTreatment edgeTreatment) { | ||||
|         this.leftEdge = edgeTreatment; | ||||
|         this.topEdge = edgeTreatment; | ||||
|         this.rightEdge = edgeTreatment; | ||||
|         this.bottomEdge = edgeTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setCornerTreatments(CornerTreatment cornerTreatment, CornerTreatment cornerTreatment2, CornerTreatment cornerTreatment3, CornerTreatment cornerTreatment4) { | ||||
|         this.topLeftCorner = cornerTreatment; | ||||
|         this.topRightCorner = cornerTreatment2; | ||||
|         this.bottomRightCorner = cornerTreatment3; | ||||
|         this.bottomLeftCorner = cornerTreatment4; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setEdgeTreatments(EdgeTreatment edgeTreatment, EdgeTreatment edgeTreatment2, EdgeTreatment edgeTreatment3, EdgeTreatment edgeTreatment4) { | ||||
|         this.leftEdge = edgeTreatment; | ||||
|         this.topEdge = edgeTreatment2; | ||||
|         this.rightEdge = edgeTreatment3; | ||||
|         this.bottomEdge = edgeTreatment4; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setTopLeftCorner(CornerTreatment cornerTreatment) { | ||||
|         this.topLeftCorner = cornerTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setTopRightCorner(CornerTreatment cornerTreatment) { | ||||
|         this.topRightCorner = cornerTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setBottomRightCorner(CornerTreatment cornerTreatment) { | ||||
|         this.bottomRightCorner = cornerTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setBottomLeftCorner(CornerTreatment cornerTreatment) { | ||||
|         this.bottomLeftCorner = cornerTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setTopEdge(EdgeTreatment edgeTreatment) { | ||||
|         this.topEdge = edgeTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setRightEdge(EdgeTreatment edgeTreatment) { | ||||
|         this.rightEdge = edgeTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setBottomEdge(EdgeTreatment edgeTreatment) { | ||||
|         this.bottomEdge = edgeTreatment; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public void setLeftEdge(EdgeTreatment edgeTreatment) { | ||||
|         this.leftEdge = edgeTreatment; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public interface Shapeable { | ||||
|     ShapeAppearanceModel getShapeAppearanceModel(); | ||||
|  | ||||
|     void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel); | ||||
| } | ||||
| @@ -0,0 +1,81 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.RectF; | ||||
| import android.os.Build; | ||||
| import android.view.View; | ||||
| import com.google.android.material.canvas.CanvasCompat; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class ShapeableDelegate { | ||||
|     ShapeAppearanceModel shapeAppearanceModel; | ||||
|     boolean forceCompatClippingEnabled = false; | ||||
|     boolean offsetZeroCornerEdgeBoundsEnabled = false; | ||||
|     RectF maskBounds = new RectF(); | ||||
|     final Path shapePath = new Path(); | ||||
|  | ||||
|     abstract void invalidateClippingMethod(View view); | ||||
|  | ||||
|     public boolean isForceCompatClippingEnabled() { | ||||
|         return this.forceCompatClippingEnabled; | ||||
|     } | ||||
|  | ||||
|     abstract boolean shouldUseCompatClipping(); | ||||
|  | ||||
|     public static ShapeableDelegate create(View view) { | ||||
|         if (Build.VERSION.SDK_INT >= 33) { | ||||
|             return new ShapeableDelegateV33(view); | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT >= 22) { | ||||
|             return new ShapeableDelegateV22(view); | ||||
|         } | ||||
|         return new ShapeableDelegateV14(); | ||||
|     } | ||||
|  | ||||
|     public void setForceCompatClippingEnabled(View view, boolean z) { | ||||
|         if (z != this.forceCompatClippingEnabled) { | ||||
|             this.forceCompatClippingEnabled = z; | ||||
|             invalidateClippingMethod(view); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setOffsetZeroCornerEdgeBoundsEnabled(View view, boolean z) { | ||||
|         this.offsetZeroCornerEdgeBoundsEnabled = z; | ||||
|         invalidateClippingMethod(view); | ||||
|     } | ||||
|  | ||||
|     public void onShapeAppearanceChanged(View view, ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|         updateShapePath(); | ||||
|         invalidateClippingMethod(view); | ||||
|     } | ||||
|  | ||||
|     public void onMaskChanged(View view, RectF rectF) { | ||||
|         this.maskBounds = rectF; | ||||
|         updateShapePath(); | ||||
|         invalidateClippingMethod(view); | ||||
|     } | ||||
|  | ||||
|     private void updateShapePath() { | ||||
|         if (!isMaskBoundsValid() || this.shapeAppearanceModel == null) { | ||||
|             return; | ||||
|         } | ||||
|         ShapeAppearancePathProvider.getInstance().calculatePath(this.shapeAppearanceModel, 1.0f, this.maskBounds, this.shapePath); | ||||
|     } | ||||
|  | ||||
|     private boolean isMaskBoundsValid() { | ||||
|         return this.maskBounds.left <= this.maskBounds.right && this.maskBounds.top <= this.maskBounds.bottom; | ||||
|     } | ||||
|  | ||||
|     public void maybeClip(Canvas canvas, CanvasCompat.CanvasOperation canvasOperation) { | ||||
|         if (shouldUseCompatClipping() && !this.shapePath.isEmpty()) { | ||||
|             canvas.save(); | ||||
|             canvas.clipPath(this.shapePath); | ||||
|             canvasOperation.run(canvas); | ||||
|             canvas.restore(); | ||||
|             return; | ||||
|         } | ||||
|         canvasOperation.run(canvas); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.view.View; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class ShapeableDelegateV14 extends ShapeableDelegate { | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     boolean shouldUseCompatClipping() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     ShapeableDelegateV14() { | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     void invalidateClippingMethod(View view) { | ||||
|         if (this.shapeAppearanceModel == null || this.maskBounds.isEmpty() || !shouldUseCompatClipping()) { | ||||
|             return; | ||||
|         } | ||||
|         view.invalidate(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,96 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.Outline; | ||||
| import android.view.View; | ||||
| import android.view.ViewOutlineProvider; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class ShapeableDelegateV22 extends ShapeableDelegate { | ||||
|     private boolean canUseViewOutline = false; | ||||
|     private float cornerRadius = 0.0f; | ||||
|  | ||||
|     float getCornerRadius() { | ||||
|         return this.cornerRadius; | ||||
|     } | ||||
|  | ||||
|     ShapeableDelegateV22(View view) { | ||||
|         initMaskOutlineProvider(view); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     boolean shouldUseCompatClipping() { | ||||
|         return !this.canUseViewOutline || this.forceCompatClippingEnabled; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     void invalidateClippingMethod(View view) { | ||||
|         this.cornerRadius = getDefaultCornerRadius(); | ||||
|         this.canUseViewOutline = isShapeRoundRect() || offsetZeroCornerEdgeBoundsIfPossible(); | ||||
|         view.setClipToOutline(!shouldUseCompatClipping()); | ||||
|         if (shouldUseCompatClipping()) { | ||||
|             view.invalidate(); | ||||
|         } else { | ||||
|             view.invalidateOutline(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private float getDefaultCornerRadius() { | ||||
|         if (this.shapeAppearanceModel == null || this.maskBounds == null) { | ||||
|             return 0.0f; | ||||
|         } | ||||
|         return this.shapeAppearanceModel.topRightCornerSize.getCornerSize(this.maskBounds); | ||||
|     } | ||||
|  | ||||
|     private boolean isShapeRoundRect() { | ||||
|         if (this.maskBounds.isEmpty() || this.shapeAppearanceModel == null) { | ||||
|             return false; | ||||
|         } | ||||
|         return this.shapeAppearanceModel.isRoundRect(this.maskBounds); | ||||
|     } | ||||
|  | ||||
|     private boolean offsetZeroCornerEdgeBoundsIfPossible() { | ||||
|         if (!this.maskBounds.isEmpty() && this.shapeAppearanceModel != null && this.offsetZeroCornerEdgeBoundsEnabled && !this.shapeAppearanceModel.isRoundRect(this.maskBounds) && shapeUsesAllRoundedCornerTreatments(this.shapeAppearanceModel)) { | ||||
|             float cornerSize = this.shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(this.maskBounds); | ||||
|             float cornerSize2 = this.shapeAppearanceModel.getTopRightCornerSize().getCornerSize(this.maskBounds); | ||||
|             float cornerSize3 = this.shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(this.maskBounds); | ||||
|             float cornerSize4 = this.shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(this.maskBounds); | ||||
|             if (cornerSize == 0.0f && cornerSize3 == 0.0f && cornerSize2 == cornerSize4) { | ||||
|                 this.maskBounds.set(this.maskBounds.left - cornerSize2, this.maskBounds.top, this.maskBounds.right, this.maskBounds.bottom); | ||||
|                 this.cornerRadius = cornerSize2; | ||||
|                 return true; | ||||
|             } | ||||
|             if (cornerSize == 0.0f && cornerSize2 == 0.0f && cornerSize3 == cornerSize4) { | ||||
|                 this.maskBounds.set(this.maskBounds.left, this.maskBounds.top - cornerSize3, this.maskBounds.right, this.maskBounds.bottom); | ||||
|                 this.cornerRadius = cornerSize3; | ||||
|                 return true; | ||||
|             } | ||||
|             if (cornerSize2 == 0.0f && cornerSize4 == 0.0f && cornerSize == cornerSize3) { | ||||
|                 this.maskBounds.set(this.maskBounds.left, this.maskBounds.top, this.maskBounds.right + cornerSize, this.maskBounds.bottom); | ||||
|                 this.cornerRadius = cornerSize; | ||||
|                 return true; | ||||
|             } | ||||
|             if (cornerSize3 == 0.0f && cornerSize4 == 0.0f && cornerSize == cornerSize2) { | ||||
|                 this.maskBounds.set(this.maskBounds.left, this.maskBounds.top, this.maskBounds.right, this.maskBounds.bottom + cornerSize); | ||||
|                 this.cornerRadius = cornerSize; | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     private static boolean shapeUsesAllRoundedCornerTreatments(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         return (shapeAppearanceModel.getTopLeftCorner() instanceof RoundedCornerTreatment) && (shapeAppearanceModel.getTopRightCorner() instanceof RoundedCornerTreatment) && (shapeAppearanceModel.getBottomLeftCorner() instanceof RoundedCornerTreatment) && (shapeAppearanceModel.getBottomRightCorner() instanceof RoundedCornerTreatment); | ||||
|     } | ||||
|  | ||||
|     private void initMaskOutlineProvider(View view) { | ||||
|         view.setOutlineProvider(new ViewOutlineProvider() { // from class: com.google.android.material.shape.ShapeableDelegateV22.1 | ||||
|             @Override // android.view.ViewOutlineProvider | ||||
|             public void getOutline(View view2, Outline outline) { | ||||
|                 if (ShapeableDelegateV22.this.shapeAppearanceModel == null || ShapeableDelegateV22.this.maskBounds.isEmpty()) { | ||||
|                     return; | ||||
|                 } | ||||
|                 outline.setRoundRect((int) ShapeableDelegateV22.this.maskBounds.left, (int) ShapeableDelegateV22.this.maskBounds.top, (int) ShapeableDelegateV22.this.maskBounds.right, (int) ShapeableDelegateV22.this.maskBounds.bottom, ShapeableDelegateV22.this.cornerRadius); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,39 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| import android.graphics.Outline; | ||||
| import android.view.View; | ||||
| import android.view.ViewOutlineProvider; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class ShapeableDelegateV33 extends ShapeableDelegate { | ||||
|     ShapeableDelegateV33(View view) { | ||||
|         initMaskOutlineProvider(view); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     boolean shouldUseCompatClipping() { | ||||
|         return this.forceCompatClippingEnabled; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.ShapeableDelegate | ||||
|     void invalidateClippingMethod(View view) { | ||||
|         view.setClipToOutline(!shouldUseCompatClipping()); | ||||
|         if (shouldUseCompatClipping()) { | ||||
|             view.invalidate(); | ||||
|         } else { | ||||
|             view.invalidateOutline(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void initMaskOutlineProvider(View view) { | ||||
|         view.setOutlineProvider(new ViewOutlineProvider() { // from class: com.google.android.material.shape.ShapeableDelegateV33.1 | ||||
|             @Override // android.view.ViewOutlineProvider | ||||
|             public void getOutline(View view2, Outline outline) { | ||||
|                 if (ShapeableDelegateV33.this.shapePath.isEmpty()) { | ||||
|                     return; | ||||
|                 } | ||||
|                 outline.setPath(ShapeableDelegateV33.this.shapePath); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,26 @@ | ||||
| package com.google.android.material.shape; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class TriangleEdgeTreatment extends EdgeTreatment { | ||||
|     private final boolean inside; | ||||
|     private final float size; | ||||
|  | ||||
|     public TriangleEdgeTreatment(float f, boolean z) { | ||||
|         this.size = f; | ||||
|         this.inside = z; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     public void getEdgePath(float f, float f2, float f3, ShapePath shapePath) { | ||||
|         if (this.inside) { | ||||
|             shapePath.lineTo(f2 - (this.size * f3), 0.0f); | ||||
|             float f4 = this.size; | ||||
|             shapePath.lineTo(f2, f4 * f3, (f4 * f3) + f2, 0.0f); | ||||
|             shapePath.lineTo(f, 0.0f); | ||||
|             return; | ||||
|         } | ||||
|         float f5 = this.size; | ||||
|         shapePath.lineTo(f2 - (f5 * f3), 0.0f, f2, (-f5) * f3); | ||||
|         shapePath.lineTo(f2 + (this.size * f3), 0.0f, f, 0.0f); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user