ADD week 5
This commit is contained in:
		| @@ -0,0 +1,441 @@ | ||||
| package com.google.android.material.card; | ||||
|  | ||||
| import android.R; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Build; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Log; | ||||
| import android.view.accessibility.AccessibilityEvent; | ||||
| import android.view.accessibility.AccessibilityNodeInfo; | ||||
| import android.widget.Checkable; | ||||
| import androidx.appcompat.content.res.AppCompatResources; | ||||
| import androidx.cardview.widget.CardView; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.shape.Shapeable; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class MaterialCardView extends CardView implements Checkable, Shapeable { | ||||
|     private static final String ACCESSIBILITY_CLASS_NAME = "androidx.cardview.widget.CardView"; | ||||
|     public static final int CHECKED_ICON_GRAVITY_BOTTOM_END = 8388693; | ||||
|     public static final int CHECKED_ICON_GRAVITY_BOTTOM_START = 8388691; | ||||
|     public static final int CHECKED_ICON_GRAVITY_TOP_END = 8388661; | ||||
|     public static final int CHECKED_ICON_GRAVITY_TOP_START = 8388659; | ||||
|     private static final String LOG_TAG = "MaterialCardView"; | ||||
|     private final MaterialCardViewHelper cardViewHelper; | ||||
|     private boolean checked; | ||||
|     private boolean dragged; | ||||
|     private boolean isParentCardViewDoneInitializing; | ||||
|     private OnCheckedChangeListener onCheckedChangeListener; | ||||
|     private static final int[] CHECKABLE_STATE_SET = {R.attr.state_checkable}; | ||||
|     private static final int[] CHECKED_STATE_SET = {R.attr.state_checked}; | ||||
|     private static final int[] DRAGGED_STATE_SET = {com.google.android.material.R.attr.state_dragged}; | ||||
|     private static final int DEF_STYLE_RES = com.google.android.material.R.style.Widget_MaterialComponents_CardView; | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface CheckedIconGravity { | ||||
|     } | ||||
|  | ||||
|     public interface OnCheckedChangeListener { | ||||
|         void onCheckedChanged(MaterialCardView materialCardView, boolean z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.Checkable | ||||
|     public boolean isChecked() { | ||||
|         return this.checked; | ||||
|     } | ||||
|  | ||||
|     public boolean isDragged() { | ||||
|         return this.dragged; | ||||
|     } | ||||
|  | ||||
|     public void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) { | ||||
|         this.onCheckedChangeListener = onCheckedChangeListener; | ||||
|     } | ||||
|  | ||||
|     public MaterialCardView(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public MaterialCardView(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, com.google.android.material.R.attr.materialCardViewStyle); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Illegal instructions before constructor call */ | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     public MaterialCardView(android.content.Context r8, android.util.AttributeSet r9, int r10) { | ||||
|         /* | ||||
|             r7 = this; | ||||
|             int r6 = com.google.android.material.card.MaterialCardView.DEF_STYLE_RES | ||||
|             android.content.Context r8 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r8, r9, r10, r6) | ||||
|             r7.<init>(r8, r9, r10) | ||||
|             r8 = 0 | ||||
|             r7.checked = r8 | ||||
|             r7.dragged = r8 | ||||
|             r0 = 1 | ||||
|             r7.isParentCardViewDoneInitializing = r0 | ||||
|             android.content.Context r0 = r7.getContext() | ||||
|             int[] r2 = com.google.android.material.R.styleable.MaterialCardView | ||||
|             int[] r5 = new int[r8] | ||||
|             r1 = r9 | ||||
|             r3 = r10 | ||||
|             r4 = r6 | ||||
|             android.content.res.TypedArray r8 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r0, r1, r2, r3, r4, r5) | ||||
|             com.google.android.material.card.MaterialCardViewHelper r0 = new com.google.android.material.card.MaterialCardViewHelper | ||||
|             r0.<init>(r7, r9, r10, r6) | ||||
|             r7.cardViewHelper = r0 | ||||
|             android.content.res.ColorStateList r9 = super.getCardBackgroundColor() | ||||
|             r0.setCardBackgroundColor(r9) | ||||
|             int r9 = super.getContentPaddingLeft() | ||||
|             int r10 = super.getContentPaddingTop() | ||||
|             int r1 = super.getContentPaddingRight() | ||||
|             int r2 = super.getContentPaddingBottom() | ||||
|             r0.setUserContentPadding(r9, r10, r1, r2) | ||||
|             r0.loadFromAttributes(r8) | ||||
|             r8.recycle() | ||||
|             return | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.card.MaterialCardView.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { | ||||
|         super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); | ||||
|         accessibilityNodeInfo.setClassName(ACCESSIBILITY_CLASS_NAME); | ||||
|         accessibilityNodeInfo.setCheckable(isCheckable()); | ||||
|         accessibilityNodeInfo.setClickable(isClickable()); | ||||
|         accessibilityNodeInfo.setChecked(isChecked()); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) { | ||||
|         super.onInitializeAccessibilityEvent(accessibilityEvent); | ||||
|         accessibilityEvent.setClassName(ACCESSIBILITY_CLASS_NAME); | ||||
|         accessibilityEvent.setChecked(isChecked()); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView, android.widget.FrameLayout, android.view.View | ||||
|     protected void onMeasure(int i, int i2) { | ||||
|         super.onMeasure(i, i2); | ||||
|         this.cardViewHelper.recalculateCheckedIconPosition(getMeasuredWidth(), getMeasuredHeight()); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeColor(int i) { | ||||
|         setStrokeColor(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeColor(ColorStateList colorStateList) { | ||||
|         this.cardViewHelper.setStrokeColor(colorStateList); | ||||
|         invalidate(); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public int getStrokeColor() { | ||||
|         return this.cardViewHelper.getStrokeColor(); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getStrokeColorStateList() { | ||||
|         return this.cardViewHelper.getStrokeColorStateList(); | ||||
|     } | ||||
|  | ||||
|     public void setStrokeWidth(int i) { | ||||
|         this.cardViewHelper.setStrokeWidth(i); | ||||
|         invalidate(); | ||||
|     } | ||||
|  | ||||
|     public int getStrokeWidth() { | ||||
|         return this.cardViewHelper.getStrokeWidth(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setRadius(float f) { | ||||
|         super.setRadius(f); | ||||
|         this.cardViewHelper.setCornerRadius(f); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public float getRadius() { | ||||
|         return this.cardViewHelper.getCornerRadius(); | ||||
|     } | ||||
|  | ||||
|     float getCardViewRadius() { | ||||
|         return super.getRadius(); | ||||
|     } | ||||
|  | ||||
|     public void setProgress(float f) { | ||||
|         this.cardViewHelper.setProgress(f); | ||||
|     } | ||||
|  | ||||
|     public float getProgress() { | ||||
|         return this.cardViewHelper.getProgress(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setContentPadding(int i, int i2, int i3, int i4) { | ||||
|         this.cardViewHelper.setUserContentPadding(i, i2, i3, i4); | ||||
|     } | ||||
|  | ||||
|     void setAncestorContentPadding(int i, int i2, int i3, int i4) { | ||||
|         super.setContentPadding(i, i2, i3, i4); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public int getContentPaddingLeft() { | ||||
|         return this.cardViewHelper.getUserContentPadding().left; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public int getContentPaddingTop() { | ||||
|         return this.cardViewHelper.getUserContentPadding().top; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public int getContentPaddingRight() { | ||||
|         return this.cardViewHelper.getUserContentPadding().right; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public int getContentPaddingBottom() { | ||||
|         return this.cardViewHelper.getUserContentPadding().bottom; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setCardBackgroundColor(int i) { | ||||
|         this.cardViewHelper.setCardBackgroundColor(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setCardBackgroundColor(ColorStateList colorStateList) { | ||||
|         this.cardViewHelper.setCardBackgroundColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public ColorStateList getCardBackgroundColor() { | ||||
|         return this.cardViewHelper.getCardBackgroundColor(); | ||||
|     } | ||||
|  | ||||
|     public void setCardForegroundColor(ColorStateList colorStateList) { | ||||
|         this.cardViewHelper.setCardForegroundColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getCardForegroundColor() { | ||||
|         return this.cardViewHelper.getCardForegroundColor(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setClickable(boolean z) { | ||||
|         super.setClickable(z); | ||||
|         MaterialCardViewHelper materialCardViewHelper = this.cardViewHelper; | ||||
|         if (materialCardViewHelper != null) { | ||||
|             materialCardViewHelper.updateClickable(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         this.cardViewHelper.updateClickable(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this, this.cardViewHelper.getBackground()); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setCardElevation(float f) { | ||||
|         super.setCardElevation(f); | ||||
|         this.cardViewHelper.updateElevation(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setMaxCardElevation(float f) { | ||||
|         super.setMaxCardElevation(f); | ||||
|         this.cardViewHelper.updateInsets(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setUseCompatPadding(boolean z) { | ||||
|         super.setUseCompatPadding(z); | ||||
|         this.cardViewHelper.updateInsets(); | ||||
|         this.cardViewHelper.updateContentPadding(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.cardview.widget.CardView | ||||
|     public void setPreventCornerOverlap(boolean z) { | ||||
|         super.setPreventCornerOverlap(z); | ||||
|         this.cardViewHelper.updateInsets(); | ||||
|         this.cardViewHelper.updateContentPadding(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackground(Drawable drawable) { | ||||
|         setBackgroundDrawable(drawable); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundDrawable(Drawable drawable) { | ||||
|         if (this.isParentCardViewDoneInitializing) { | ||||
|             if (!this.cardViewHelper.isBackgroundOverwritten()) { | ||||
|                 Log.i(LOG_TAG, "Setting a custom background is not supported."); | ||||
|                 this.cardViewHelper.setBackgroundOverwritten(true); | ||||
|             } | ||||
|             super.setBackgroundDrawable(drawable); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setBackgroundInternal(Drawable drawable) { | ||||
|         super.setBackgroundDrawable(drawable); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.Checkable | ||||
|     public void setChecked(boolean z) { | ||||
|         if (this.checked != z) { | ||||
|             toggle(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setDragged(boolean z) { | ||||
|         if (this.dragged != z) { | ||||
|             this.dragged = z; | ||||
|             refreshDrawableState(); | ||||
|             forceRippleRedrawIfNeeded(); | ||||
|             invalidate(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public boolean isCheckable() { | ||||
|         MaterialCardViewHelper materialCardViewHelper = this.cardViewHelper; | ||||
|         return materialCardViewHelper != null && materialCardViewHelper.isCheckable(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckable(boolean z) { | ||||
|         this.cardViewHelper.setCheckable(z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.Checkable | ||||
|     public void toggle() { | ||||
|         if (isCheckable() && isEnabled()) { | ||||
|             this.checked = !this.checked; | ||||
|             refreshDrawableState(); | ||||
|             forceRippleRedrawIfNeeded(); | ||||
|             this.cardViewHelper.setChecked(this.checked, true); | ||||
|             OnCheckedChangeListener onCheckedChangeListener = this.onCheckedChangeListener; | ||||
|             if (onCheckedChangeListener != null) { | ||||
|                 onCheckedChangeListener.onCheckedChanged(this, this.checked); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     protected int[] onCreateDrawableState(int i) { | ||||
|         int[] onCreateDrawableState = super.onCreateDrawableState(i + 3); | ||||
|         if (isCheckable()) { | ||||
|             mergeDrawableStates(onCreateDrawableState, CHECKABLE_STATE_SET); | ||||
|         } | ||||
|         if (isChecked()) { | ||||
|             mergeDrawableStates(onCreateDrawableState, CHECKED_STATE_SET); | ||||
|         } | ||||
|         if (isDragged()) { | ||||
|             mergeDrawableStates(onCreateDrawableState, DRAGGED_STATE_SET); | ||||
|         } | ||||
|         return onCreateDrawableState; | ||||
|     } | ||||
|  | ||||
|     public void setRippleColor(ColorStateList colorStateList) { | ||||
|         this.cardViewHelper.setRippleColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public void setRippleColorResource(int i) { | ||||
|         this.cardViewHelper.setRippleColor(AppCompatResources.getColorStateList(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getRippleColor() { | ||||
|         return this.cardViewHelper.getRippleColor(); | ||||
|     } | ||||
|  | ||||
|     public Drawable getCheckedIcon() { | ||||
|         return this.cardViewHelper.getCheckedIcon(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconResource(int i) { | ||||
|         this.cardViewHelper.setCheckedIcon(AppCompatResources.getDrawable(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIcon(Drawable drawable) { | ||||
|         this.cardViewHelper.setCheckedIcon(drawable); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getCheckedIconTint() { | ||||
|         return this.cardViewHelper.getCheckedIconTint(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconTint(ColorStateList colorStateList) { | ||||
|         this.cardViewHelper.setCheckedIconTint(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public int getCheckedIconSize() { | ||||
|         return this.cardViewHelper.getCheckedIconSize(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconSize(int i) { | ||||
|         this.cardViewHelper.setCheckedIconSize(i); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconSizeResource(int i) { | ||||
|         if (i != 0) { | ||||
|             this.cardViewHelper.setCheckedIconSize(getResources().getDimensionPixelSize(i)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getCheckedIconMargin() { | ||||
|         return this.cardViewHelper.getCheckedIconMargin(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconMargin(int i) { | ||||
|         this.cardViewHelper.setCheckedIconMargin(i); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconMarginResource(int i) { | ||||
|         if (i != -1) { | ||||
|             this.cardViewHelper.setCheckedIconMargin(getResources().getDimensionPixelSize(i)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private RectF getBoundsAsRectF() { | ||||
|         RectF rectF = new RectF(); | ||||
|         rectF.set(this.cardViewHelper.getBackground().getBounds()); | ||||
|         return rectF; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         setClipToOutline(shapeAppearanceModel.isRoundRect(getBoundsAsRectF())); | ||||
|         this.cardViewHelper.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public ShapeAppearanceModel getShapeAppearanceModel() { | ||||
|         return this.cardViewHelper.getShapeAppearanceModel(); | ||||
|     } | ||||
|  | ||||
|     private void forceRippleRedrawIfNeeded() { | ||||
|         if (Build.VERSION.SDK_INT > 26) { | ||||
|             this.cardViewHelper.forceRippleRedraw(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getCheckedIconGravity() { | ||||
|         return this.cardViewHelper.getCheckedIconGravity(); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedIconGravity(int i) { | ||||
|         if (this.cardViewHelper.getCheckedIconGravity() != i) { | ||||
|             this.cardViewHelper.setCheckedIconGravity(i); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,569 @@ | ||||
| package com.google.android.material.card; | ||||
|  | ||||
| import android.animation.TimeInterpolator; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.drawable.ColorDrawable; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.InsetDrawable; | ||||
| import android.graphics.drawable.LayerDrawable; | ||||
| import android.graphics.drawable.RippleDrawable; | ||||
| import android.graphics.drawable.StateListDrawable; | ||||
| import android.os.Build; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.View; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.GravityCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.color.MaterialColors; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import com.google.android.material.resources.MaterialResources; | ||||
| import com.google.android.material.ripple.RippleUtils; | ||||
| import com.google.android.material.shape.CornerTreatment; | ||||
| import com.google.android.material.shape.CutCornerTreatment; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.RoundedCornerTreatment; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class MaterialCardViewHelper { | ||||
|     private static final float CARD_VIEW_SHADOW_MULTIPLIER = 1.5f; | ||||
|     private static final int CHECKED_ICON_LAYER_INDEX = 2; | ||||
|     private static final Drawable CHECKED_ICON_NONE; | ||||
|     private static final double COS_45 = Math.cos(Math.toRadians(45.0d)); | ||||
|     public static final int DEFAULT_FADE_ANIM_DURATION = 300; | ||||
|     private static final int DEFAULT_STROKE_VALUE = -1; | ||||
|     private final MaterialShapeDrawable bgDrawable; | ||||
|     private boolean checkable; | ||||
|     private Drawable checkedIcon; | ||||
|     private int checkedIconGravity; | ||||
|     private int checkedIconMargin; | ||||
|     private int checkedIconSize; | ||||
|     private ColorStateList checkedIconTint; | ||||
|     private LayerDrawable clickableForegroundDrawable; | ||||
|     private MaterialShapeDrawable compatRippleDrawable; | ||||
|     private Drawable fgDrawable; | ||||
|     private final MaterialShapeDrawable foregroundContentDrawable; | ||||
|     private MaterialShapeDrawable foregroundShapeDrawable; | ||||
|     private ValueAnimator iconAnimator; | ||||
|     private final TimeInterpolator iconFadeAnimInterpolator; | ||||
|     private final int iconFadeInAnimDuration; | ||||
|     private final int iconFadeOutAnimDuration; | ||||
|     private final MaterialCardView materialCardView; | ||||
|     private ColorStateList rippleColor; | ||||
|     private Drawable rippleDrawable; | ||||
|     private ShapeAppearanceModel shapeAppearanceModel; | ||||
|     private ColorStateList strokeColor; | ||||
|     private int strokeWidth; | ||||
|     private final Rect userContentPadding = new Rect(); | ||||
|     private boolean isBackgroundOverwritten = false; | ||||
|     private float checkedAnimationProgress = 0.0f; | ||||
|  | ||||
|     private boolean isCheckedIconBottom() { | ||||
|         return (this.checkedIconGravity & 80) == 80; | ||||
|     } | ||||
|  | ||||
|     private boolean isCheckedIconEnd() { | ||||
|         return (this.checkedIconGravity & GravityCompat.END) == 8388613; | ||||
|     } | ||||
|  | ||||
|     MaterialShapeDrawable getBackground() { | ||||
|         return this.bgDrawable; | ||||
|     } | ||||
|  | ||||
|     Drawable getCheckedIcon() { | ||||
|         return this.checkedIcon; | ||||
|     } | ||||
|  | ||||
|     int getCheckedIconGravity() { | ||||
|         return this.checkedIconGravity; | ||||
|     } | ||||
|  | ||||
|     int getCheckedIconMargin() { | ||||
|         return this.checkedIconMargin; | ||||
|     } | ||||
|  | ||||
|     int getCheckedIconSize() { | ||||
|         return this.checkedIconSize; | ||||
|     } | ||||
|  | ||||
|     ColorStateList getCheckedIconTint() { | ||||
|         return this.checkedIconTint; | ||||
|     } | ||||
|  | ||||
|     ColorStateList getRippleColor() { | ||||
|         return this.rippleColor; | ||||
|     } | ||||
|  | ||||
|     ShapeAppearanceModel getShapeAppearanceModel() { | ||||
|         return this.shapeAppearanceModel; | ||||
|     } | ||||
|  | ||||
|     ColorStateList getStrokeColorStateList() { | ||||
|         return this.strokeColor; | ||||
|     } | ||||
|  | ||||
|     int getStrokeWidth() { | ||||
|         return this.strokeWidth; | ||||
|     } | ||||
|  | ||||
|     Rect getUserContentPadding() { | ||||
|         return this.userContentPadding; | ||||
|     } | ||||
|  | ||||
|     boolean isBackgroundOverwritten() { | ||||
|         return this.isBackgroundOverwritten; | ||||
|     } | ||||
|  | ||||
|     boolean isCheckable() { | ||||
|         return this.checkable; | ||||
|     } | ||||
|  | ||||
|     void setBackgroundOverwritten(boolean z) { | ||||
|         this.isBackgroundOverwritten = z; | ||||
|     } | ||||
|  | ||||
|     void setCheckable(boolean z) { | ||||
|         this.checkable = z; | ||||
|     } | ||||
|  | ||||
|     void setCheckedIconMargin(int i) { | ||||
|         this.checkedIconMargin = i; | ||||
|     } | ||||
|  | ||||
|     void setCheckedIconSize(int i) { | ||||
|         this.checkedIconSize = i; | ||||
|     } | ||||
|  | ||||
|     static { | ||||
|         CHECKED_ICON_NONE = Build.VERSION.SDK_INT <= 28 ? new ColorDrawable() : null; | ||||
|     } | ||||
|  | ||||
|     public MaterialCardViewHelper(MaterialCardView materialCardView, AttributeSet attributeSet, int i, int i2) { | ||||
|         this.materialCardView = materialCardView; | ||||
|         MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(materialCardView.getContext(), attributeSet, i, i2); | ||||
|         this.bgDrawable = materialShapeDrawable; | ||||
|         materialShapeDrawable.initializeElevationOverlay(materialCardView.getContext()); | ||||
|         materialShapeDrawable.setShadowColor(-12303292); | ||||
|         ShapeAppearanceModel.Builder builder = materialShapeDrawable.getShapeAppearanceModel().toBuilder(); | ||||
|         TypedArray obtainStyledAttributes = materialCardView.getContext().obtainStyledAttributes(attributeSet, R.styleable.CardView, i, R.style.CardView); | ||||
|         if (obtainStyledAttributes.hasValue(R.styleable.CardView_cardCornerRadius)) { | ||||
|             builder.setAllCornerSizes(obtainStyledAttributes.getDimension(R.styleable.CardView_cardCornerRadius, 0.0f)); | ||||
|         } | ||||
|         this.foregroundContentDrawable = new MaterialShapeDrawable(); | ||||
|         setShapeAppearanceModel(builder.build()); | ||||
|         this.iconFadeAnimInterpolator = MotionUtils.resolveThemeInterpolator(materialCardView.getContext(), R.attr.motionEasingLinearInterpolator, AnimationUtils.LINEAR_INTERPOLATOR); | ||||
|         this.iconFadeInAnimDuration = MotionUtils.resolveThemeDuration(materialCardView.getContext(), R.attr.motionDurationShort2, DEFAULT_FADE_ANIM_DURATION); | ||||
|         this.iconFadeOutAnimDuration = MotionUtils.resolveThemeDuration(materialCardView.getContext(), R.attr.motionDurationShort1, DEFAULT_FADE_ANIM_DURATION); | ||||
|         obtainStyledAttributes.recycle(); | ||||
|     } | ||||
|  | ||||
|     void loadFromAttributes(TypedArray typedArray) { | ||||
|         ColorStateList colorStateList = MaterialResources.getColorStateList(this.materialCardView.getContext(), typedArray, R.styleable.MaterialCardView_strokeColor); | ||||
|         this.strokeColor = colorStateList; | ||||
|         if (colorStateList == null) { | ||||
|             this.strokeColor = ColorStateList.valueOf(-1); | ||||
|         } | ||||
|         this.strokeWidth = typedArray.getDimensionPixelSize(R.styleable.MaterialCardView_strokeWidth, 0); | ||||
|         boolean z = typedArray.getBoolean(R.styleable.MaterialCardView_android_checkable, false); | ||||
|         this.checkable = z; | ||||
|         this.materialCardView.setLongClickable(z); | ||||
|         this.checkedIconTint = MaterialResources.getColorStateList(this.materialCardView.getContext(), typedArray, R.styleable.MaterialCardView_checkedIconTint); | ||||
|         setCheckedIcon(MaterialResources.getDrawable(this.materialCardView.getContext(), typedArray, R.styleable.MaterialCardView_checkedIcon)); | ||||
|         setCheckedIconSize(typedArray.getDimensionPixelSize(R.styleable.MaterialCardView_checkedIconSize, 0)); | ||||
|         setCheckedIconMargin(typedArray.getDimensionPixelSize(R.styleable.MaterialCardView_checkedIconMargin, 0)); | ||||
|         this.checkedIconGravity = typedArray.getInteger(R.styleable.MaterialCardView_checkedIconGravity, 8388661); | ||||
|         ColorStateList colorStateList2 = MaterialResources.getColorStateList(this.materialCardView.getContext(), typedArray, R.styleable.MaterialCardView_rippleColor); | ||||
|         this.rippleColor = colorStateList2; | ||||
|         if (colorStateList2 == null) { | ||||
|             this.rippleColor = ColorStateList.valueOf(MaterialColors.getColor(this.materialCardView, R.attr.colorControlHighlight)); | ||||
|         } | ||||
|         setCardForegroundColor(MaterialResources.getColorStateList(this.materialCardView.getContext(), typedArray, R.styleable.MaterialCardView_cardForegroundColor)); | ||||
|         updateRippleColor(); | ||||
|         updateElevation(); | ||||
|         updateStroke(); | ||||
|         this.materialCardView.setBackgroundInternal(insetDrawable(this.bgDrawable)); | ||||
|         Drawable clickableForeground = shouldUseClickableForeground() ? getClickableForeground() : this.foregroundContentDrawable; | ||||
|         this.fgDrawable = clickableForeground; | ||||
|         this.materialCardView.setForeground(insetDrawable(clickableForeground)); | ||||
|     } | ||||
|  | ||||
|     void setStrokeColor(ColorStateList colorStateList) { | ||||
|         if (this.strokeColor == colorStateList) { | ||||
|             return; | ||||
|         } | ||||
|         this.strokeColor = colorStateList; | ||||
|         updateStroke(); | ||||
|     } | ||||
|  | ||||
|     int getStrokeColor() { | ||||
|         ColorStateList colorStateList = this.strokeColor; | ||||
|         if (colorStateList == null) { | ||||
|             return -1; | ||||
|         } | ||||
|         return colorStateList.getDefaultColor(); | ||||
|     } | ||||
|  | ||||
|     void setStrokeWidth(int i) { | ||||
|         if (i == this.strokeWidth) { | ||||
|             return; | ||||
|         } | ||||
|         this.strokeWidth = i; | ||||
|         updateStroke(); | ||||
|     } | ||||
|  | ||||
|     void setCardBackgroundColor(ColorStateList colorStateList) { | ||||
|         this.bgDrawable.setFillColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     ColorStateList getCardBackgroundColor() { | ||||
|         return this.bgDrawable.getFillColor(); | ||||
|     } | ||||
|  | ||||
|     void setCardForegroundColor(ColorStateList colorStateList) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.foregroundContentDrawable; | ||||
|         if (colorStateList == null) { | ||||
|             colorStateList = ColorStateList.valueOf(0); | ||||
|         } | ||||
|         materialShapeDrawable.setFillColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     ColorStateList getCardForegroundColor() { | ||||
|         return this.foregroundContentDrawable.getFillColor(); | ||||
|     } | ||||
|  | ||||
|     void setUserContentPadding(int i, int i2, int i3, int i4) { | ||||
|         this.userContentPadding.set(i, i2, i3, i4); | ||||
|         updateContentPadding(); | ||||
|     } | ||||
|  | ||||
|     void updateClickable() { | ||||
|         Drawable drawable = this.fgDrawable; | ||||
|         Drawable clickableForeground = shouldUseClickableForeground() ? getClickableForeground() : this.foregroundContentDrawable; | ||||
|         this.fgDrawable = clickableForeground; | ||||
|         if (drawable != clickableForeground) { | ||||
|             updateInsetForeground(clickableForeground); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void animateCheckedIcon(boolean z) { | ||||
|         float f = z ? 1.0f : 0.0f; | ||||
|         float f2 = z ? 1.0f - this.checkedAnimationProgress : this.checkedAnimationProgress; | ||||
|         ValueAnimator valueAnimator = this.iconAnimator; | ||||
|         if (valueAnimator != null) { | ||||
|             valueAnimator.cancel(); | ||||
|             this.iconAnimator = null; | ||||
|         } | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(this.checkedAnimationProgress, f); | ||||
|         this.iconAnimator = ofFloat; | ||||
|         ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.card.MaterialCardViewHelper$$ExternalSyntheticLambda1 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public final void onAnimationUpdate(ValueAnimator valueAnimator2) { | ||||
|                 MaterialCardViewHelper.this.m193xa4d79c2b(valueAnimator2); | ||||
|             } | ||||
|         }); | ||||
|         this.iconAnimator.setInterpolator(this.iconFadeAnimInterpolator); | ||||
|         this.iconAnimator.setDuration((long) ((z ? this.iconFadeInAnimDuration : this.iconFadeOutAnimDuration) * f2)); | ||||
|         this.iconAnimator.start(); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$animateCheckedIcon$0$com-google-android-material-card-MaterialCardViewHelper, reason: not valid java name */ | ||||
|     /* synthetic */ void m193xa4d79c2b(ValueAnimator valueAnimator) { | ||||
|         float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); | ||||
|         this.checkedIcon.setAlpha((int) (255.0f * floatValue)); | ||||
|         this.checkedAnimationProgress = floatValue; | ||||
|     } | ||||
|  | ||||
|     void setCornerRadius(float f) { | ||||
|         setShapeAppearanceModel(this.shapeAppearanceModel.withCornerSize(f)); | ||||
|         this.fgDrawable.invalidateSelf(); | ||||
|         if (shouldAddCornerPaddingOutsideCardBackground() || shouldAddCornerPaddingInsideCardBackground()) { | ||||
|             updateContentPadding(); | ||||
|         } | ||||
|         if (shouldAddCornerPaddingOutsideCardBackground()) { | ||||
|             updateInsets(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     float getCornerRadius() { | ||||
|         return this.bgDrawable.getTopLeftCornerResolvedSize(); | ||||
|     } | ||||
|  | ||||
|     void setProgress(float f) { | ||||
|         this.bgDrawable.setInterpolation(f); | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.foregroundContentDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setInterpolation(f); | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable2 = this.foregroundShapeDrawable; | ||||
|         if (materialShapeDrawable2 != null) { | ||||
|             materialShapeDrawable2.setInterpolation(f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     float getProgress() { | ||||
|         return this.bgDrawable.getInterpolation(); | ||||
|     } | ||||
|  | ||||
|     void updateElevation() { | ||||
|         this.bgDrawable.setElevation(this.materialCardView.getCardElevation()); | ||||
|     } | ||||
|  | ||||
|     void updateInsets() { | ||||
|         if (!isBackgroundOverwritten()) { | ||||
|             this.materialCardView.setBackgroundInternal(insetDrawable(this.bgDrawable)); | ||||
|         } | ||||
|         this.materialCardView.setForeground(insetDrawable(this.fgDrawable)); | ||||
|     } | ||||
|  | ||||
|     void updateStroke() { | ||||
|         this.foregroundContentDrawable.setStroke(this.strokeWidth, this.strokeColor); | ||||
|     } | ||||
|  | ||||
|     void updateContentPadding() { | ||||
|         int calculateActualCornerPadding = (int) (((shouldAddCornerPaddingInsideCardBackground() || shouldAddCornerPaddingOutsideCardBackground()) ? calculateActualCornerPadding() : 0.0f) - getParentCardViewCalculatedCornerPadding()); | ||||
|         this.materialCardView.setAncestorContentPadding(this.userContentPadding.left + calculateActualCornerPadding, this.userContentPadding.top + calculateActualCornerPadding, this.userContentPadding.right + calculateActualCornerPadding, this.userContentPadding.bottom + calculateActualCornerPadding); | ||||
|     } | ||||
|  | ||||
|     void setRippleColor(ColorStateList colorStateList) { | ||||
|         this.rippleColor = colorStateList; | ||||
|         updateRippleColor(); | ||||
|     } | ||||
|  | ||||
|     void setCheckedIconTint(ColorStateList colorStateList) { | ||||
|         this.checkedIconTint = colorStateList; | ||||
|         Drawable drawable = this.checkedIcon; | ||||
|         if (drawable != null) { | ||||
|             DrawableCompat.setTintList(drawable, colorStateList); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setCheckedIcon(Drawable drawable) { | ||||
|         if (drawable != null) { | ||||
|             Drawable mutate = DrawableCompat.wrap(drawable).mutate(); | ||||
|             this.checkedIcon = mutate; | ||||
|             DrawableCompat.setTintList(mutate, this.checkedIconTint); | ||||
|             setChecked(this.materialCardView.isChecked()); | ||||
|         } else { | ||||
|             this.checkedIcon = CHECKED_ICON_NONE; | ||||
|         } | ||||
|         LayerDrawable layerDrawable = this.clickableForegroundDrawable; | ||||
|         if (layerDrawable != null) { | ||||
|             layerDrawable.setDrawableByLayerId(R.id.mtrl_card_checked_layer_id, this.checkedIcon); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void recalculateCheckedIconPosition(int i, int i2) { | ||||
|         int i3; | ||||
|         int i4; | ||||
|         int i5; | ||||
|         int i6; | ||||
|         if (this.clickableForegroundDrawable != null) { | ||||
|             if (this.materialCardView.getUseCompatPadding()) { | ||||
|                 i3 = (int) Math.ceil(calculateVerticalBackgroundPadding() * 2.0f); | ||||
|                 i4 = (int) Math.ceil(calculateHorizontalBackgroundPadding() * 2.0f); | ||||
|             } else { | ||||
|                 i3 = 0; | ||||
|                 i4 = 0; | ||||
|             } | ||||
|             int i7 = isCheckedIconEnd() ? ((i - this.checkedIconMargin) - this.checkedIconSize) - i4 : this.checkedIconMargin; | ||||
|             int i8 = isCheckedIconBottom() ? this.checkedIconMargin : ((i2 - this.checkedIconMargin) - this.checkedIconSize) - i3; | ||||
|             int i9 = isCheckedIconEnd() ? this.checkedIconMargin : ((i - this.checkedIconMargin) - this.checkedIconSize) - i4; | ||||
|             int i10 = isCheckedIconBottom() ? ((i2 - this.checkedIconMargin) - this.checkedIconSize) - i3 : this.checkedIconMargin; | ||||
|             if (ViewCompat.getLayoutDirection(this.materialCardView) == 1) { | ||||
|                 i6 = i9; | ||||
|                 i5 = i7; | ||||
|             } else { | ||||
|                 i5 = i9; | ||||
|                 i6 = i7; | ||||
|             } | ||||
|             this.clickableForegroundDrawable.setLayerInset(2, i6, i10, i5, i8); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void forceRippleRedraw() { | ||||
|         Drawable drawable = this.rippleDrawable; | ||||
|         if (drawable != null) { | ||||
|             Rect bounds = drawable.getBounds(); | ||||
|             int i = bounds.bottom; | ||||
|             this.rippleDrawable.setBounds(bounds.left, bounds.top, bounds.right, i - 1); | ||||
|             this.rippleDrawable.setBounds(bounds.left, bounds.top, bounds.right, i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|         this.bgDrawable.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         this.bgDrawable.setShadowBitmapDrawingEnable(!r0.isRoundRect()); | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.foregroundContentDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable2 = this.foregroundShapeDrawable; | ||||
|         if (materialShapeDrawable2 != null) { | ||||
|             materialShapeDrawable2.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable3 = this.compatRippleDrawable; | ||||
|         if (materialShapeDrawable3 != null) { | ||||
|             materialShapeDrawable3.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void updateInsetForeground(Drawable drawable) { | ||||
|         if (Build.VERSION.SDK_INT >= 23 && (this.materialCardView.getForeground() instanceof InsetDrawable)) { | ||||
|             ((InsetDrawable) this.materialCardView.getForeground()).setDrawable(drawable); | ||||
|         } else { | ||||
|             this.materialCardView.setForeground(insetDrawable(drawable)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Drawable insetDrawable(Drawable drawable) { | ||||
|         int i; | ||||
|         int i2; | ||||
|         if (this.materialCardView.getUseCompatPadding()) { | ||||
|             i2 = (int) Math.ceil(calculateVerticalBackgroundPadding()); | ||||
|             i = (int) Math.ceil(calculateHorizontalBackgroundPadding()); | ||||
|         } else { | ||||
|             i = 0; | ||||
|             i2 = 0; | ||||
|         } | ||||
|         return new InsetDrawable(drawable, i, i2, i, i2) { // from class: com.google.android.material.card.MaterialCardViewHelper.1 | ||||
|             @Override // android.graphics.drawable.Drawable | ||||
|             public int getMinimumHeight() { | ||||
|                 return -1; | ||||
|             } | ||||
|  | ||||
|             @Override // android.graphics.drawable.Drawable | ||||
|             public int getMinimumWidth() { | ||||
|                 return -1; | ||||
|             } | ||||
|  | ||||
|             @Override // android.graphics.drawable.InsetDrawable, android.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable | ||||
|             public boolean getPadding(Rect rect) { | ||||
|                 return false; | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     private float calculateVerticalBackgroundPadding() { | ||||
|         return (this.materialCardView.getMaxCardElevation() * CARD_VIEW_SHADOW_MULTIPLIER) + (shouldAddCornerPaddingOutsideCardBackground() ? calculateActualCornerPadding() : 0.0f); | ||||
|     } | ||||
|  | ||||
|     private float calculateHorizontalBackgroundPadding() { | ||||
|         return this.materialCardView.getMaxCardElevation() + (shouldAddCornerPaddingOutsideCardBackground() ? calculateActualCornerPadding() : 0.0f); | ||||
|     } | ||||
|  | ||||
|     private boolean canClipToOutline() { | ||||
|         return this.bgDrawable.isRoundRect(); | ||||
|     } | ||||
|  | ||||
|     private float getParentCardViewCalculatedCornerPadding() { | ||||
|         if (this.materialCardView.getPreventCornerOverlap() && this.materialCardView.getUseCompatPadding()) { | ||||
|             return (float) ((1.0d - COS_45) * this.materialCardView.getCardViewRadius()); | ||||
|         } | ||||
|         return 0.0f; | ||||
|     } | ||||
|  | ||||
|     private boolean shouldAddCornerPaddingInsideCardBackground() { | ||||
|         return this.materialCardView.getPreventCornerOverlap() && !canClipToOutline(); | ||||
|     } | ||||
|  | ||||
|     private boolean shouldAddCornerPaddingOutsideCardBackground() { | ||||
|         return this.materialCardView.getPreventCornerOverlap() && canClipToOutline() && this.materialCardView.getUseCompatPadding(); | ||||
|     } | ||||
|  | ||||
|     private float calculateActualCornerPadding() { | ||||
|         return Math.max(Math.max(calculateCornerPaddingForCornerTreatment(this.shapeAppearanceModel.getTopLeftCorner(), this.bgDrawable.getTopLeftCornerResolvedSize()), calculateCornerPaddingForCornerTreatment(this.shapeAppearanceModel.getTopRightCorner(), this.bgDrawable.getTopRightCornerResolvedSize())), Math.max(calculateCornerPaddingForCornerTreatment(this.shapeAppearanceModel.getBottomRightCorner(), this.bgDrawable.getBottomRightCornerResolvedSize()), calculateCornerPaddingForCornerTreatment(this.shapeAppearanceModel.getBottomLeftCorner(), this.bgDrawable.getBottomLeftCornerResolvedSize()))); | ||||
|     } | ||||
|  | ||||
|     private float calculateCornerPaddingForCornerTreatment(CornerTreatment cornerTreatment, float f) { | ||||
|         if (cornerTreatment instanceof RoundedCornerTreatment) { | ||||
|             return (float) ((1.0d - COS_45) * f); | ||||
|         } | ||||
|         if (cornerTreatment instanceof CutCornerTreatment) { | ||||
|             return f / 2.0f; | ||||
|         } | ||||
|         return 0.0f; | ||||
|     } | ||||
|  | ||||
|     private boolean shouldUseClickableForeground() { | ||||
|         if (this.materialCardView.isClickable()) { | ||||
|             return true; | ||||
|         } | ||||
|         View view = this.materialCardView; | ||||
|         while (view.isDuplicateParentStateEnabled() && (view.getParent() instanceof View)) { | ||||
|             view = (View) view.getParent(); | ||||
|         } | ||||
|         return view.isClickable(); | ||||
|     } | ||||
|  | ||||
|     private Drawable getClickableForeground() { | ||||
|         if (this.rippleDrawable == null) { | ||||
|             this.rippleDrawable = createForegroundRippleDrawable(); | ||||
|         } | ||||
|         if (this.clickableForegroundDrawable == null) { | ||||
|             LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{this.rippleDrawable, this.foregroundContentDrawable, this.checkedIcon}); | ||||
|             this.clickableForegroundDrawable = layerDrawable; | ||||
|             layerDrawable.setId(2, R.id.mtrl_card_checked_layer_id); | ||||
|         } | ||||
|         return this.clickableForegroundDrawable; | ||||
|     } | ||||
|  | ||||
|     private Drawable createForegroundRippleDrawable() { | ||||
|         if (RippleUtils.USE_FRAMEWORK_RIPPLE) { | ||||
|             this.foregroundShapeDrawable = createForegroundShapeDrawable(); | ||||
|             return new RippleDrawable(this.rippleColor, null, this.foregroundShapeDrawable); | ||||
|         } | ||||
|         return createCompatRippleDrawable(); | ||||
|     } | ||||
|  | ||||
|     private Drawable createCompatRippleDrawable() { | ||||
|         StateListDrawable stateListDrawable = new StateListDrawable(); | ||||
|         MaterialShapeDrawable createForegroundShapeDrawable = createForegroundShapeDrawable(); | ||||
|         this.compatRippleDrawable = createForegroundShapeDrawable; | ||||
|         createForegroundShapeDrawable.setFillColor(this.rippleColor); | ||||
|         stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, this.compatRippleDrawable); | ||||
|         return stateListDrawable; | ||||
|     } | ||||
|  | ||||
|     private void updateRippleColor() { | ||||
|         Drawable drawable; | ||||
|         if (RippleUtils.USE_FRAMEWORK_RIPPLE && (drawable = this.rippleDrawable) != null) { | ||||
|             ((RippleDrawable) drawable).setColor(this.rippleColor); | ||||
|             return; | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.compatRippleDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setFillColor(this.rippleColor); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private MaterialShapeDrawable createForegroundShapeDrawable() { | ||||
|         return new MaterialShapeDrawable(this.shapeAppearanceModel); | ||||
|     } | ||||
|  | ||||
|     public void setChecked(boolean z) { | ||||
|         setChecked(z, false); | ||||
|     } | ||||
|  | ||||
|     public void setChecked(boolean z, boolean z2) { | ||||
|         Drawable drawable = this.checkedIcon; | ||||
|         if (drawable != null) { | ||||
|             if (z2) { | ||||
|                 animateCheckedIcon(z); | ||||
|             } else { | ||||
|                 drawable.setAlpha(z ? 255 : 0); | ||||
|                 this.checkedAnimationProgress = z ? 1.0f : 0.0f; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setCheckedIconGravity(int i) { | ||||
|         this.checkedIconGravity = i; | ||||
|         recalculateCheckedIconPosition(this.materialCardView.getMeasuredWidth(), this.materialCardView.getMeasuredHeight()); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user