1536 lines
		
	
	
		
			58 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			1536 lines
		
	
	
		
			58 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package com.google.android.material.chip;
 | |
| 
 | |
| import android.R;
 | |
| import android.content.Context;
 | |
| import android.content.res.ColorStateList;
 | |
| import android.content.res.TypedArray;
 | |
| import android.graphics.Canvas;
 | |
| import android.graphics.ColorFilter;
 | |
| import android.graphics.Outline;
 | |
| import android.graphics.Paint;
 | |
| import android.graphics.Path;
 | |
| import android.graphics.PointF;
 | |
| import android.graphics.PorterDuff;
 | |
| import android.graphics.PorterDuffColorFilter;
 | |
| import android.graphics.Rect;
 | |
| import android.graphics.RectF;
 | |
| import android.graphics.drawable.Drawable;
 | |
| import android.graphics.drawable.RippleDrawable;
 | |
| import android.graphics.drawable.ShapeDrawable;
 | |
| import android.graphics.drawable.shapes.OvalShape;
 | |
| import android.os.Build;
 | |
| import android.text.TextUtils;
 | |
| import android.util.AttributeSet;
 | |
| import androidx.appcompat.content.res.AppCompatResources;
 | |
| import androidx.core.graphics.ColorUtils;
 | |
| import androidx.core.graphics.drawable.DrawableCompat;
 | |
| import androidx.core.graphics.drawable.TintAwareDrawable;
 | |
| import androidx.core.internal.view.SupportMenu;
 | |
| import androidx.core.text.BidiFormatter;
 | |
| import androidx.core.view.ViewCompat;
 | |
| import com.google.android.material.animation.MotionSpec;
 | |
| import com.google.android.material.canvas.CanvasCompat;
 | |
| import com.google.android.material.drawable.DrawableUtils;
 | |
| import com.google.android.material.internal.TextDrawableHelper;
 | |
| import com.google.android.material.internal.ThemeEnforcement;
 | |
| import com.google.android.material.internal.ViewUtils;
 | |
| import com.google.android.material.resources.MaterialResources;
 | |
| import com.google.android.material.resources.TextAppearance;
 | |
| import com.google.android.material.ripple.RippleUtils;
 | |
| import com.google.android.material.shape.MaterialShapeDrawable;
 | |
| import java.lang.ref.WeakReference;
 | |
| import java.util.Arrays;
 | |
| import kotlinx.coroutines.scheduling.WorkQueueKt;
 | |
| 
 | |
| /* loaded from: classes.dex */
 | |
| public class ChipDrawable extends MaterialShapeDrawable implements TintAwareDrawable, Drawable.Callback, TextDrawableHelper.TextDrawableDelegate {
 | |
|     private static final boolean DEBUG = false;
 | |
|     private static final int MAX_CHIP_ICON_HEIGHT = 24;
 | |
|     private static final String NAMESPACE_APP = "http://schemas.android.com/apk/res-auto";
 | |
|     private int alpha;
 | |
|     private boolean checkable;
 | |
|     private Drawable checkedIcon;
 | |
|     private ColorStateList checkedIconTint;
 | |
|     private boolean checkedIconVisible;
 | |
|     private ColorStateList chipBackgroundColor;
 | |
|     private float chipCornerRadius;
 | |
|     private float chipEndPadding;
 | |
|     private Drawable chipIcon;
 | |
|     private float chipIconSize;
 | |
|     private ColorStateList chipIconTint;
 | |
|     private boolean chipIconVisible;
 | |
|     private float chipMinHeight;
 | |
|     private final Paint chipPaint;
 | |
|     private float chipStartPadding;
 | |
|     private ColorStateList chipStrokeColor;
 | |
|     private float chipStrokeWidth;
 | |
|     private ColorStateList chipSurfaceColor;
 | |
|     private Drawable closeIcon;
 | |
|     private CharSequence closeIconContentDescription;
 | |
|     private float closeIconEndPadding;
 | |
|     private Drawable closeIconRipple;
 | |
|     private float closeIconSize;
 | |
|     private float closeIconStartPadding;
 | |
|     private int[] closeIconStateSet;
 | |
|     private ColorStateList closeIconTint;
 | |
|     private boolean closeIconVisible;
 | |
|     private ColorFilter colorFilter;
 | |
|     private ColorStateList compatRippleColor;
 | |
|     private final Context context;
 | |
|     private boolean currentChecked;
 | |
|     private int currentChipBackgroundColor;
 | |
|     private int currentChipStrokeColor;
 | |
|     private int currentChipSurfaceColor;
 | |
|     private int currentCompatRippleColor;
 | |
|     private int currentCompositeSurfaceBackgroundColor;
 | |
|     private int currentTextColor;
 | |
|     private int currentTint;
 | |
|     private final Paint debugPaint;
 | |
|     private WeakReference<Delegate> delegate;
 | |
|     private final Paint.FontMetrics fontMetrics;
 | |
|     private boolean hasChipIconTint;
 | |
|     private MotionSpec hideMotionSpec;
 | |
|     private float iconEndPadding;
 | |
|     private float iconStartPadding;
 | |
|     private boolean isShapeThemingEnabled;
 | |
|     private int maxWidth;
 | |
|     private final PointF pointF;
 | |
|     private final RectF rectF;
 | |
|     private ColorStateList rippleColor;
 | |
|     private final Path shapePath;
 | |
|     private boolean shouldDrawText;
 | |
|     private MotionSpec showMotionSpec;
 | |
|     private CharSequence text;
 | |
|     private final TextDrawableHelper textDrawableHelper;
 | |
|     private float textEndPadding;
 | |
|     private float textStartPadding;
 | |
|     private ColorStateList tint;
 | |
|     private PorterDuffColorFilter tintFilter;
 | |
|     private PorterDuff.Mode tintMode;
 | |
|     private TextUtils.TruncateAt truncateAt;
 | |
|     private boolean useCompatRipple;
 | |
|     private static final int[] DEFAULT_STATE = {R.attr.state_enabled};
 | |
|     private static final ShapeDrawable closeIconRippleMask = new ShapeDrawable(new OvalShape());
 | |
| 
 | |
|     public interface Delegate {
 | |
|         void onChipDrawableSizeChange();
 | |
|     }
 | |
| 
 | |
|     private boolean canShowCheckedIcon() {
 | |
|         return this.checkedIconVisible && this.checkedIcon != null && this.checkable;
 | |
|     }
 | |
| 
 | |
|     private ColorFilter getTintColorFilter() {
 | |
|         ColorFilter colorFilter = this.colorFilter;
 | |
|         return colorFilter != null ? colorFilter : this.tintFilter;
 | |
|     }
 | |
| 
 | |
|     private boolean showsCheckedIcon() {
 | |
|         return this.checkedIconVisible && this.checkedIcon != null && this.currentChecked;
 | |
|     }
 | |
| 
 | |
|     private boolean showsChipIcon() {
 | |
|         return this.chipIconVisible && this.chipIcon != null;
 | |
|     }
 | |
| 
 | |
|     private boolean showsCloseIcon() {
 | |
|         return this.closeIconVisible && this.closeIcon != null;
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public int getAlpha() {
 | |
|         return this.alpha;
 | |
|     }
 | |
| 
 | |
|     public Drawable getCheckedIcon() {
 | |
|         return this.checkedIcon;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getCheckedIconTint() {
 | |
|         return this.checkedIconTint;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getChipBackgroundColor() {
 | |
|         return this.chipBackgroundColor;
 | |
|     }
 | |
| 
 | |
|     public float getChipEndPadding() {
 | |
|         return this.chipEndPadding;
 | |
|     }
 | |
| 
 | |
|     public float getChipIconSize() {
 | |
|         return this.chipIconSize;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getChipIconTint() {
 | |
|         return this.chipIconTint;
 | |
|     }
 | |
| 
 | |
|     public float getChipMinHeight() {
 | |
|         return this.chipMinHeight;
 | |
|     }
 | |
| 
 | |
|     public float getChipStartPadding() {
 | |
|         return this.chipStartPadding;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getChipStrokeColor() {
 | |
|         return this.chipStrokeColor;
 | |
|     }
 | |
| 
 | |
|     public float getChipStrokeWidth() {
 | |
|         return this.chipStrokeWidth;
 | |
|     }
 | |
| 
 | |
|     public CharSequence getCloseIconContentDescription() {
 | |
|         return this.closeIconContentDescription;
 | |
|     }
 | |
| 
 | |
|     public float getCloseIconEndPadding() {
 | |
|         return this.closeIconEndPadding;
 | |
|     }
 | |
| 
 | |
|     public float getCloseIconSize() {
 | |
|         return this.closeIconSize;
 | |
|     }
 | |
| 
 | |
|     public float getCloseIconStartPadding() {
 | |
|         return this.closeIconStartPadding;
 | |
|     }
 | |
| 
 | |
|     public int[] getCloseIconState() {
 | |
|         return this.closeIconStateSet;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getCloseIconTint() {
 | |
|         return this.closeIconTint;
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     public ColorFilter getColorFilter() {
 | |
|         return this.colorFilter;
 | |
|     }
 | |
| 
 | |
|     public TextUtils.TruncateAt getEllipsize() {
 | |
|         return this.truncateAt;
 | |
|     }
 | |
| 
 | |
|     public MotionSpec getHideMotionSpec() {
 | |
|         return this.hideMotionSpec;
 | |
|     }
 | |
| 
 | |
|     public float getIconEndPadding() {
 | |
|         return this.iconEndPadding;
 | |
|     }
 | |
| 
 | |
|     public float getIconStartPadding() {
 | |
|         return this.iconStartPadding;
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     public int getIntrinsicHeight() {
 | |
|         return (int) this.chipMinHeight;
 | |
|     }
 | |
| 
 | |
|     public int getMaxWidth() {
 | |
|         return this.maxWidth;
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public int getOpacity() {
 | |
|         return -3;
 | |
|     }
 | |
| 
 | |
|     public ColorStateList getRippleColor() {
 | |
|         return this.rippleColor;
 | |
|     }
 | |
| 
 | |
|     public MotionSpec getShowMotionSpec() {
 | |
|         return this.showMotionSpec;
 | |
|     }
 | |
| 
 | |
|     public CharSequence getText() {
 | |
|         return this.text;
 | |
|     }
 | |
| 
 | |
|     public float getTextEndPadding() {
 | |
|         return this.textEndPadding;
 | |
|     }
 | |
| 
 | |
|     public float getTextStartPadding() {
 | |
|         return this.textStartPadding;
 | |
|     }
 | |
| 
 | |
|     public boolean getUseCompatRipple() {
 | |
|         return this.useCompatRipple;
 | |
|     }
 | |
| 
 | |
|     public boolean isCheckable() {
 | |
|         return this.checkable;
 | |
|     }
 | |
| 
 | |
|     public boolean isCheckedIconVisible() {
 | |
|         return this.checkedIconVisible;
 | |
|     }
 | |
| 
 | |
|     public boolean isChipIconVisible() {
 | |
|         return this.chipIconVisible;
 | |
|     }
 | |
| 
 | |
|     public boolean isCloseIconVisible() {
 | |
|         return this.closeIconVisible;
 | |
|     }
 | |
| 
 | |
|     boolean isShapeThemingEnabled() {
 | |
|         return this.isShapeThemingEnabled;
 | |
|     }
 | |
| 
 | |
|     public void setEllipsize(TextUtils.TruncateAt truncateAt) {
 | |
|         this.truncateAt = truncateAt;
 | |
|     }
 | |
| 
 | |
|     public void setHideMotionSpec(MotionSpec motionSpec) {
 | |
|         this.hideMotionSpec = motionSpec;
 | |
|     }
 | |
| 
 | |
|     public void setMaxWidth(int i) {
 | |
|         this.maxWidth = i;
 | |
|     }
 | |
| 
 | |
|     void setShouldDrawText(boolean z) {
 | |
|         this.shouldDrawText = z;
 | |
|     }
 | |
| 
 | |
|     public void setShowMotionSpec(MotionSpec motionSpec) {
 | |
|         this.showMotionSpec = motionSpec;
 | |
|     }
 | |
| 
 | |
|     boolean shouldDrawText() {
 | |
|         return this.shouldDrawText;
 | |
|     }
 | |
| 
 | |
|     public static ChipDrawable createFromAttributes(Context context, AttributeSet attributeSet, int i, int i2) {
 | |
|         ChipDrawable chipDrawable = new ChipDrawable(context, attributeSet, i, i2);
 | |
|         chipDrawable.loadFromAttributes(attributeSet, i, i2);
 | |
|         return chipDrawable;
 | |
|     }
 | |
| 
 | |
|     public static ChipDrawable createFromResource(Context context, int i) {
 | |
|         AttributeSet parseDrawableXml = DrawableUtils.parseDrawableXml(context, i, "chip");
 | |
|         int styleAttribute = parseDrawableXml.getStyleAttribute();
 | |
|         if (styleAttribute == 0) {
 | |
|             styleAttribute = com.google.android.material.R.style.Widget_MaterialComponents_Chip_Entry;
 | |
|         }
 | |
|         return createFromAttributes(context, parseDrawableXml, com.google.android.material.R.attr.chipStandaloneStyle, styleAttribute);
 | |
|     }
 | |
| 
 | |
|     private ChipDrawable(Context context, AttributeSet attributeSet, int i, int i2) {
 | |
|         super(context, attributeSet, i, i2);
 | |
|         this.chipCornerRadius = -1.0f;
 | |
|         this.chipPaint = new Paint(1);
 | |
|         this.fontMetrics = new Paint.FontMetrics();
 | |
|         this.rectF = new RectF();
 | |
|         this.pointF = new PointF();
 | |
|         this.shapePath = new Path();
 | |
|         this.alpha = 255;
 | |
|         this.tintMode = PorterDuff.Mode.SRC_IN;
 | |
|         this.delegate = new WeakReference<>(null);
 | |
|         initializeElevationOverlay(context);
 | |
|         this.context = context;
 | |
|         TextDrawableHelper textDrawableHelper = new TextDrawableHelper(this);
 | |
|         this.textDrawableHelper = textDrawableHelper;
 | |
|         this.text = "";
 | |
|         textDrawableHelper.getTextPaint().density = context.getResources().getDisplayMetrics().density;
 | |
|         this.debugPaint = null;
 | |
|         int[] iArr = DEFAULT_STATE;
 | |
|         setState(iArr);
 | |
|         setCloseIconState(iArr);
 | |
|         this.shouldDrawText = true;
 | |
|         if (RippleUtils.USE_FRAMEWORK_RIPPLE) {
 | |
|             closeIconRippleMask.setTint(-1);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void loadFromAttributes(AttributeSet attributeSet, int i, int i2) {
 | |
|         TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(this.context, attributeSet, com.google.android.material.R.styleable.Chip, i, i2, new int[0]);
 | |
|         this.isShapeThemingEnabled = obtainStyledAttributes.hasValue(com.google.android.material.R.styleable.Chip_shapeAppearance);
 | |
|         setChipSurfaceColor(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_chipSurfaceColor));
 | |
|         setChipBackgroundColor(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_chipBackgroundColor));
 | |
|         setChipMinHeight(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipMinHeight, 0.0f));
 | |
|         if (obtainStyledAttributes.hasValue(com.google.android.material.R.styleable.Chip_chipCornerRadius)) {
 | |
|             setChipCornerRadius(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipCornerRadius, 0.0f));
 | |
|         }
 | |
|         setChipStrokeColor(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_chipStrokeColor));
 | |
|         setChipStrokeWidth(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipStrokeWidth, 0.0f));
 | |
|         setRippleColor(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_rippleColor));
 | |
|         setText(obtainStyledAttributes.getText(com.google.android.material.R.styleable.Chip_android_text));
 | |
|         TextAppearance textAppearance = MaterialResources.getTextAppearance(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_android_textAppearance);
 | |
|         textAppearance.setTextSize(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_android_textSize, textAppearance.getTextSize()));
 | |
|         if (Build.VERSION.SDK_INT < 23) {
 | |
|             textAppearance.setTextColor(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_android_textColor));
 | |
|         }
 | |
|         setTextAppearance(textAppearance);
 | |
|         int i3 = obtainStyledAttributes.getInt(com.google.android.material.R.styleable.Chip_android_ellipsize, 0);
 | |
|         if (i3 == 1) {
 | |
|             setEllipsize(TextUtils.TruncateAt.START);
 | |
|         } else if (i3 == 2) {
 | |
|             setEllipsize(TextUtils.TruncateAt.MIDDLE);
 | |
|         } else if (i3 == 3) {
 | |
|             setEllipsize(TextUtils.TruncateAt.END);
 | |
|         }
 | |
|         setChipIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_chipIconVisible, false));
 | |
|         if (attributeSet != null && attributeSet.getAttributeValue(NAMESPACE_APP, "chipIconEnabled") != null && attributeSet.getAttributeValue(NAMESPACE_APP, "chipIconVisible") == null) {
 | |
|             setChipIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_chipIconEnabled, false));
 | |
|         }
 | |
|         setChipIcon(MaterialResources.getDrawable(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_chipIcon));
 | |
|         if (obtainStyledAttributes.hasValue(com.google.android.material.R.styleable.Chip_chipIconTint)) {
 | |
|             setChipIconTint(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_chipIconTint));
 | |
|         }
 | |
|         setChipIconSize(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipIconSize, -1.0f));
 | |
|         setCloseIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_closeIconVisible, false));
 | |
|         if (attributeSet != null && attributeSet.getAttributeValue(NAMESPACE_APP, "closeIconEnabled") != null && attributeSet.getAttributeValue(NAMESPACE_APP, "closeIconVisible") == null) {
 | |
|             setCloseIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_closeIconEnabled, false));
 | |
|         }
 | |
|         setCloseIcon(MaterialResources.getDrawable(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_closeIcon));
 | |
|         setCloseIconTint(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_closeIconTint));
 | |
|         setCloseIconSize(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_closeIconSize, 0.0f));
 | |
|         setCheckable(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_android_checkable, false));
 | |
|         setCheckedIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_checkedIconVisible, false));
 | |
|         if (attributeSet != null && attributeSet.getAttributeValue(NAMESPACE_APP, "checkedIconEnabled") != null && attributeSet.getAttributeValue(NAMESPACE_APP, "checkedIconVisible") == null) {
 | |
|             setCheckedIconVisible(obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.Chip_checkedIconEnabled, false));
 | |
|         }
 | |
|         setCheckedIcon(MaterialResources.getDrawable(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_checkedIcon));
 | |
|         if (obtainStyledAttributes.hasValue(com.google.android.material.R.styleable.Chip_checkedIconTint)) {
 | |
|             setCheckedIconTint(MaterialResources.getColorStateList(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_checkedIconTint));
 | |
|         }
 | |
|         setShowMotionSpec(MotionSpec.createFromAttribute(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_showMotionSpec));
 | |
|         setHideMotionSpec(MotionSpec.createFromAttribute(this.context, obtainStyledAttributes, com.google.android.material.R.styleable.Chip_hideMotionSpec));
 | |
|         setChipStartPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipStartPadding, 0.0f));
 | |
|         setIconStartPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_iconStartPadding, 0.0f));
 | |
|         setIconEndPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_iconEndPadding, 0.0f));
 | |
|         setTextStartPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_textStartPadding, 0.0f));
 | |
|         setTextEndPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_textEndPadding, 0.0f));
 | |
|         setCloseIconStartPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_closeIconStartPadding, 0.0f));
 | |
|         setCloseIconEndPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_closeIconEndPadding, 0.0f));
 | |
|         setChipEndPadding(obtainStyledAttributes.getDimension(com.google.android.material.R.styleable.Chip_chipEndPadding, 0.0f));
 | |
|         setMaxWidth(obtainStyledAttributes.getDimensionPixelSize(com.google.android.material.R.styleable.Chip_android_maxWidth, Integer.MAX_VALUE));
 | |
|         obtainStyledAttributes.recycle();
 | |
|     }
 | |
| 
 | |
|     public void setUseCompatRipple(boolean z) {
 | |
|         if (this.useCompatRipple != z) {
 | |
|             this.useCompatRipple = z;
 | |
|             updateCompatRippleColor();
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setDelegate(Delegate delegate) {
 | |
|         this.delegate = new WeakReference<>(delegate);
 | |
|     }
 | |
| 
 | |
|     protected void onSizeChange() {
 | |
|         Delegate delegate = this.delegate.get();
 | |
|         if (delegate != null) {
 | |
|             delegate.onChipDrawableSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void getChipTouchBounds(RectF rectF) {
 | |
|         calculateChipTouchBounds(getBounds(), rectF);
 | |
|     }
 | |
| 
 | |
|     public void getCloseIconTouchBounds(RectF rectF) {
 | |
|         calculateCloseIconTouchBounds(getBounds(), rectF);
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     public int getIntrinsicWidth() {
 | |
|         return Math.min(Math.round(this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding + this.textDrawableHelper.getTextWidth(getText().toString()) + this.textEndPadding + calculateCloseIconWidth() + this.chipEndPadding), this.maxWidth);
 | |
|     }
 | |
| 
 | |
|     float calculateChipIconWidth() {
 | |
|         if (showsChipIcon() || showsCheckedIcon()) {
 | |
|             return this.iconStartPadding + getCurrentChipIconWidth() + this.iconEndPadding;
 | |
|         }
 | |
|         return 0.0f;
 | |
|     }
 | |
| 
 | |
|     private float getCurrentChipIconWidth() {
 | |
|         Drawable drawable = this.currentChecked ? this.checkedIcon : this.chipIcon;
 | |
|         float f = this.chipIconSize;
 | |
|         return (f > 0.0f || drawable == null) ? f : drawable.getIntrinsicWidth();
 | |
|     }
 | |
| 
 | |
|     private float getCurrentChipIconHeight() {
 | |
|         Drawable drawable = this.currentChecked ? this.checkedIcon : this.chipIcon;
 | |
|         float f = this.chipIconSize;
 | |
|         if (f <= 0.0f && drawable != null) {
 | |
|             f = (float) Math.ceil(ViewUtils.dpToPx(this.context, 24));
 | |
|             if (drawable.getIntrinsicHeight() <= f) {
 | |
|                 return drawable.getIntrinsicHeight();
 | |
|             }
 | |
|         }
 | |
|         return f;
 | |
|     }
 | |
| 
 | |
|     float calculateCloseIconWidth() {
 | |
|         if (showsCloseIcon()) {
 | |
|             return this.closeIconStartPadding + this.closeIconSize + this.closeIconEndPadding;
 | |
|         }
 | |
|         return 0.0f;
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public void draw(Canvas canvas) {
 | |
|         Rect bounds = getBounds();
 | |
|         if (bounds.isEmpty() || getAlpha() == 0) {
 | |
|             return;
 | |
|         }
 | |
|         int saveLayerAlpha = this.alpha < 255 ? CanvasCompat.saveLayerAlpha(canvas, bounds.left, bounds.top, bounds.right, bounds.bottom, this.alpha) : 0;
 | |
|         drawChipSurface(canvas, bounds);
 | |
|         drawChipBackground(canvas, bounds);
 | |
|         if (this.isShapeThemingEnabled) {
 | |
|             super.draw(canvas);
 | |
|         }
 | |
|         drawChipStroke(canvas, bounds);
 | |
|         drawCompatRipple(canvas, bounds);
 | |
|         drawChipIcon(canvas, bounds);
 | |
|         drawCheckedIcon(canvas, bounds);
 | |
|         if (this.shouldDrawText) {
 | |
|             drawText(canvas, bounds);
 | |
|         }
 | |
|         drawCloseIcon(canvas, bounds);
 | |
|         drawDebug(canvas, bounds);
 | |
|         if (this.alpha < 255) {
 | |
|             canvas.restoreToCount(saveLayerAlpha);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawChipSurface(Canvas canvas, Rect rect) {
 | |
|         if (this.isShapeThemingEnabled) {
 | |
|             return;
 | |
|         }
 | |
|         this.chipPaint.setColor(this.currentChipSurfaceColor);
 | |
|         this.chipPaint.setStyle(Paint.Style.FILL);
 | |
|         this.rectF.set(rect);
 | |
|         canvas.drawRoundRect(this.rectF, getChipCornerRadius(), getChipCornerRadius(), this.chipPaint);
 | |
|     }
 | |
| 
 | |
|     private void drawChipBackground(Canvas canvas, Rect rect) {
 | |
|         if (this.isShapeThemingEnabled) {
 | |
|             return;
 | |
|         }
 | |
|         this.chipPaint.setColor(this.currentChipBackgroundColor);
 | |
|         this.chipPaint.setStyle(Paint.Style.FILL);
 | |
|         this.chipPaint.setColorFilter(getTintColorFilter());
 | |
|         this.rectF.set(rect);
 | |
|         canvas.drawRoundRect(this.rectF, getChipCornerRadius(), getChipCornerRadius(), this.chipPaint);
 | |
|     }
 | |
| 
 | |
|     private void drawChipStroke(Canvas canvas, Rect rect) {
 | |
|         if (this.chipStrokeWidth <= 0.0f || this.isShapeThemingEnabled) {
 | |
|             return;
 | |
|         }
 | |
|         this.chipPaint.setColor(this.currentChipStrokeColor);
 | |
|         this.chipPaint.setStyle(Paint.Style.STROKE);
 | |
|         if (!this.isShapeThemingEnabled) {
 | |
|             this.chipPaint.setColorFilter(getTintColorFilter());
 | |
|         }
 | |
|         this.rectF.set(rect.left + (this.chipStrokeWidth / 2.0f), rect.top + (this.chipStrokeWidth / 2.0f), rect.right - (this.chipStrokeWidth / 2.0f), rect.bottom - (this.chipStrokeWidth / 2.0f));
 | |
|         float f = this.chipCornerRadius - (this.chipStrokeWidth / 2.0f);
 | |
|         canvas.drawRoundRect(this.rectF, f, f, this.chipPaint);
 | |
|     }
 | |
| 
 | |
|     private void drawCompatRipple(Canvas canvas, Rect rect) {
 | |
|         this.chipPaint.setColor(this.currentCompatRippleColor);
 | |
|         this.chipPaint.setStyle(Paint.Style.FILL);
 | |
|         this.rectF.set(rect);
 | |
|         if (!this.isShapeThemingEnabled) {
 | |
|             canvas.drawRoundRect(this.rectF, getChipCornerRadius(), getChipCornerRadius(), this.chipPaint);
 | |
|         } else {
 | |
|             calculatePathForSize(new RectF(rect), this.shapePath);
 | |
|             super.drawShape(canvas, this.chipPaint, this.shapePath, getBoundsAsRectF());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawChipIcon(Canvas canvas, Rect rect) {
 | |
|         if (showsChipIcon()) {
 | |
|             calculateChipIconBounds(rect, this.rectF);
 | |
|             float f = this.rectF.left;
 | |
|             float f2 = this.rectF.top;
 | |
|             canvas.translate(f, f2);
 | |
|             this.chipIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height());
 | |
|             this.chipIcon.draw(canvas);
 | |
|             canvas.translate(-f, -f2);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawCheckedIcon(Canvas canvas, Rect rect) {
 | |
|         if (showsCheckedIcon()) {
 | |
|             calculateChipIconBounds(rect, this.rectF);
 | |
|             float f = this.rectF.left;
 | |
|             float f2 = this.rectF.top;
 | |
|             canvas.translate(f, f2);
 | |
|             this.checkedIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height());
 | |
|             this.checkedIcon.draw(canvas);
 | |
|             canvas.translate(-f, -f2);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawText(Canvas canvas, Rect rect) {
 | |
|         if (this.text != null) {
 | |
|             Paint.Align calculateTextOriginAndAlignment = calculateTextOriginAndAlignment(rect, this.pointF);
 | |
|             calculateTextBounds(rect, this.rectF);
 | |
|             if (this.textDrawableHelper.getTextAppearance() != null) {
 | |
|                 this.textDrawableHelper.getTextPaint().drawableState = getState();
 | |
|                 this.textDrawableHelper.updateTextPaintDrawState(this.context);
 | |
|             }
 | |
|             this.textDrawableHelper.getTextPaint().setTextAlign(calculateTextOriginAndAlignment);
 | |
|             int i = 0;
 | |
|             boolean z = Math.round(this.textDrawableHelper.getTextWidth(getText().toString())) > Math.round(this.rectF.width());
 | |
|             if (z) {
 | |
|                 i = canvas.save();
 | |
|                 canvas.clipRect(this.rectF);
 | |
|             }
 | |
|             CharSequence charSequence = this.text;
 | |
|             if (z && this.truncateAt != null) {
 | |
|                 charSequence = TextUtils.ellipsize(charSequence, this.textDrawableHelper.getTextPaint(), this.rectF.width(), this.truncateAt);
 | |
|             }
 | |
|             CharSequence charSequence2 = charSequence;
 | |
|             canvas.drawText(charSequence2, 0, charSequence2.length(), this.pointF.x, this.pointF.y, this.textDrawableHelper.getTextPaint());
 | |
|             if (z) {
 | |
|                 canvas.restoreToCount(i);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawCloseIcon(Canvas canvas, Rect rect) {
 | |
|         if (showsCloseIcon()) {
 | |
|             calculateCloseIconBounds(rect, this.rectF);
 | |
|             float f = this.rectF.left;
 | |
|             float f2 = this.rectF.top;
 | |
|             canvas.translate(f, f2);
 | |
|             this.closeIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height());
 | |
|             if (RippleUtils.USE_FRAMEWORK_RIPPLE) {
 | |
|                 this.closeIconRipple.setBounds(this.closeIcon.getBounds());
 | |
|                 this.closeIconRipple.jumpToCurrentState();
 | |
|                 this.closeIconRipple.draw(canvas);
 | |
|             } else {
 | |
|                 this.closeIcon.draw(canvas);
 | |
|             }
 | |
|             canvas.translate(-f, -f2);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void drawDebug(Canvas canvas, Rect rect) {
 | |
|         Paint paint = this.debugPaint;
 | |
|         if (paint != null) {
 | |
|             paint.setColor(ColorUtils.setAlphaComponent(ViewCompat.MEASURED_STATE_MASK, WorkQueueKt.MASK));
 | |
|             canvas.drawRect(rect, this.debugPaint);
 | |
|             if (showsChipIcon() || showsCheckedIcon()) {
 | |
|                 calculateChipIconBounds(rect, this.rectF);
 | |
|                 canvas.drawRect(this.rectF, this.debugPaint);
 | |
|             }
 | |
|             if (this.text != null) {
 | |
|                 canvas.drawLine(rect.left, rect.exactCenterY(), rect.right, rect.exactCenterY(), this.debugPaint);
 | |
|             }
 | |
|             if (showsCloseIcon()) {
 | |
|                 calculateCloseIconBounds(rect, this.rectF);
 | |
|                 canvas.drawRect(this.rectF, this.debugPaint);
 | |
|             }
 | |
|             this.debugPaint.setColor(ColorUtils.setAlphaComponent(SupportMenu.CATEGORY_MASK, WorkQueueKt.MASK));
 | |
|             calculateChipTouchBounds(rect, this.rectF);
 | |
|             canvas.drawRect(this.rectF, this.debugPaint);
 | |
|             this.debugPaint.setColor(ColorUtils.setAlphaComponent(-16711936, WorkQueueKt.MASK));
 | |
|             calculateCloseIconTouchBounds(rect, this.rectF);
 | |
|             canvas.drawRect(this.rectF, this.debugPaint);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void calculateChipIconBounds(Rect rect, RectF rectF) {
 | |
|         rectF.setEmpty();
 | |
|         if (showsChipIcon() || showsCheckedIcon()) {
 | |
|             float f = this.chipStartPadding + this.iconStartPadding;
 | |
|             float currentChipIconWidth = getCurrentChipIconWidth();
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 rectF.left = rect.left + f;
 | |
|                 rectF.right = rectF.left + currentChipIconWidth;
 | |
|             } else {
 | |
|                 rectF.right = rect.right - f;
 | |
|                 rectF.left = rectF.right - currentChipIconWidth;
 | |
|             }
 | |
|             float currentChipIconHeight = getCurrentChipIconHeight();
 | |
|             rectF.top = rect.exactCenterY() - (currentChipIconHeight / 2.0f);
 | |
|             rectF.bottom = rectF.top + currentChipIconHeight;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     Paint.Align calculateTextOriginAndAlignment(Rect rect, PointF pointF) {
 | |
|         pointF.set(0.0f, 0.0f);
 | |
|         Paint.Align align = Paint.Align.LEFT;
 | |
|         if (this.text != null) {
 | |
|             float calculateChipIconWidth = this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding;
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 pointF.x = rect.left + calculateChipIconWidth;
 | |
|                 align = Paint.Align.LEFT;
 | |
|             } else {
 | |
|                 pointF.x = rect.right - calculateChipIconWidth;
 | |
|                 align = Paint.Align.RIGHT;
 | |
|             }
 | |
|             pointF.y = rect.centerY() - calculateTextCenterFromBaseline();
 | |
|         }
 | |
|         return align;
 | |
|     }
 | |
| 
 | |
|     private float calculateTextCenterFromBaseline() {
 | |
|         this.textDrawableHelper.getTextPaint().getFontMetrics(this.fontMetrics);
 | |
|         return (this.fontMetrics.descent + this.fontMetrics.ascent) / 2.0f;
 | |
|     }
 | |
| 
 | |
|     private void calculateTextBounds(Rect rect, RectF rectF) {
 | |
|         rectF.setEmpty();
 | |
|         if (this.text != null) {
 | |
|             float calculateChipIconWidth = this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding;
 | |
|             float calculateCloseIconWidth = this.chipEndPadding + calculateCloseIconWidth() + this.textEndPadding;
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 rectF.left = rect.left + calculateChipIconWidth;
 | |
|                 rectF.right = rect.right - calculateCloseIconWidth;
 | |
|             } else {
 | |
|                 rectF.left = rect.left + calculateCloseIconWidth;
 | |
|                 rectF.right = rect.right - calculateChipIconWidth;
 | |
|             }
 | |
|             rectF.top = rect.top;
 | |
|             rectF.bottom = rect.bottom;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void calculateCloseIconBounds(Rect rect, RectF rectF) {
 | |
|         rectF.setEmpty();
 | |
|         if (showsCloseIcon()) {
 | |
|             float f = this.chipEndPadding + this.closeIconEndPadding;
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 rectF.right = rect.right - f;
 | |
|                 rectF.left = rectF.right - this.closeIconSize;
 | |
|             } else {
 | |
|                 rectF.left = rect.left + f;
 | |
|                 rectF.right = rectF.left + this.closeIconSize;
 | |
|             }
 | |
|             rectF.top = rect.exactCenterY() - (this.closeIconSize / 2.0f);
 | |
|             rectF.bottom = rectF.top + this.closeIconSize;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void calculateChipTouchBounds(Rect rect, RectF rectF) {
 | |
|         rectF.set(rect);
 | |
|         if (showsCloseIcon()) {
 | |
|             float f = this.chipEndPadding + this.closeIconEndPadding + this.closeIconSize + this.closeIconStartPadding + this.textEndPadding;
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 rectF.right = rect.right - f;
 | |
|             } else {
 | |
|                 rectF.left = rect.left + f;
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void calculateCloseIconTouchBounds(Rect rect, RectF rectF) {
 | |
|         rectF.setEmpty();
 | |
|         if (showsCloseIcon()) {
 | |
|             float f = this.chipEndPadding + this.closeIconEndPadding + this.closeIconSize + this.closeIconStartPadding + this.textEndPadding;
 | |
|             if (DrawableCompat.getLayoutDirection(this) == 0) {
 | |
|                 rectF.right = rect.right;
 | |
|                 rectF.left = rectF.right - f;
 | |
|             } else {
 | |
|                 rectF.left = rect.left;
 | |
|                 rectF.right = rect.left + f;
 | |
|             }
 | |
|             rectF.top = rect.top;
 | |
|             rectF.bottom = rect.bottom;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public boolean isStateful() {
 | |
|         return isStateful(this.chipSurfaceColor) || isStateful(this.chipBackgroundColor) || isStateful(this.chipStrokeColor) || (this.useCompatRipple && isStateful(this.compatRippleColor)) || isStateful(this.textDrawableHelper.getTextAppearance()) || canShowCheckedIcon() || isStateful(this.chipIcon) || isStateful(this.checkedIcon) || isStateful(this.tint);
 | |
|     }
 | |
| 
 | |
|     public boolean isCloseIconStateful() {
 | |
|         return isStateful(this.closeIcon);
 | |
|     }
 | |
| 
 | |
|     public boolean setCloseIconState(int[] iArr) {
 | |
|         if (Arrays.equals(this.closeIconStateSet, iArr)) {
 | |
|             return false;
 | |
|         }
 | |
|         this.closeIconStateSet = iArr;
 | |
|         if (showsCloseIcon()) {
 | |
|             return onStateChange(getState(), iArr);
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.internal.TextDrawableHelper.TextDrawableDelegate
 | |
|     public void onTextSizeChange() {
 | |
|         onSizeChange();
 | |
|         invalidateSelf();
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable, com.google.android.material.internal.TextDrawableHelper.TextDrawableDelegate
 | |
|     public boolean onStateChange(int[] iArr) {
 | |
|         if (this.isShapeThemingEnabled) {
 | |
|             super.onStateChange(iArr);
 | |
|         }
 | |
|         return onStateChange(iArr, getCloseIconState());
 | |
|     }
 | |
| 
 | |
|     /* JADX WARN: Removed duplicated region for block: B:60:0x00e7  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:63:0x00f3  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:66:0x0109  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:69:0x0118  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:72:0x0127  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:79:0x0151  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:81:0x0156  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:84:0x0100  */
 | |
|     /* JADX WARN: Removed duplicated region for block: B:85:0x00ee  */
 | |
|     /*
 | |
|         Code decompiled incorrectly, please refer to instructions dump.
 | |
|         To view partially-correct add '--show-bad-code' argument
 | |
|     */
 | |
|     private boolean onStateChange(int[] r7, int[] r8) {
 | |
|         /*
 | |
|             Method dump skipped, instructions count: 346
 | |
|             To view this dump add '--comments-level debug' option
 | |
|         */
 | |
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.chip.ChipDrawable.onStateChange(int[], int[]):boolean");
 | |
|     }
 | |
| 
 | |
|     private static boolean isStateful(ColorStateList colorStateList) {
 | |
|         return colorStateList != null && colorStateList.isStateful();
 | |
|     }
 | |
| 
 | |
|     private static boolean isStateful(Drawable drawable) {
 | |
|         return drawable != null && drawable.isStateful();
 | |
|     }
 | |
| 
 | |
|     private static boolean isStateful(TextAppearance textAppearance) {
 | |
|         return (textAppearance == null || textAppearance.getTextColor() == null || !textAppearance.getTextColor().isStateful()) ? false : true;
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     public boolean onLayoutDirectionChanged(int i) {
 | |
|         boolean onLayoutDirectionChanged = super.onLayoutDirectionChanged(i);
 | |
|         if (showsChipIcon()) {
 | |
|             onLayoutDirectionChanged |= DrawableCompat.setLayoutDirection(this.chipIcon, i);
 | |
|         }
 | |
|         if (showsCheckedIcon()) {
 | |
|             onLayoutDirectionChanged |= DrawableCompat.setLayoutDirection(this.checkedIcon, i);
 | |
|         }
 | |
|         if (showsCloseIcon()) {
 | |
|             onLayoutDirectionChanged |= DrawableCompat.setLayoutDirection(this.closeIcon, i);
 | |
|         }
 | |
|         if (!onLayoutDirectionChanged) {
 | |
|             return true;
 | |
|         }
 | |
|         invalidateSelf();
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     protected boolean onLevelChange(int i) {
 | |
|         boolean onLevelChange = super.onLevelChange(i);
 | |
|         if (showsChipIcon()) {
 | |
|             onLevelChange |= this.chipIcon.setLevel(i);
 | |
|         }
 | |
|         if (showsCheckedIcon()) {
 | |
|             onLevelChange |= this.checkedIcon.setLevel(i);
 | |
|         }
 | |
|         if (showsCloseIcon()) {
 | |
|             onLevelChange |= this.closeIcon.setLevel(i);
 | |
|         }
 | |
|         if (onLevelChange) {
 | |
|             invalidateSelf();
 | |
|         }
 | |
|         return onLevelChange;
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable
 | |
|     public boolean setVisible(boolean z, boolean z2) {
 | |
|         boolean visible = super.setVisible(z, z2);
 | |
|         if (showsChipIcon()) {
 | |
|             visible |= this.chipIcon.setVisible(z, z2);
 | |
|         }
 | |
|         if (showsCheckedIcon()) {
 | |
|             visible |= this.checkedIcon.setVisible(z, z2);
 | |
|         }
 | |
|         if (showsCloseIcon()) {
 | |
|             visible |= this.closeIcon.setVisible(z, z2);
 | |
|         }
 | |
|         if (visible) {
 | |
|             invalidateSelf();
 | |
|         }
 | |
|         return visible;
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public void setAlpha(int i) {
 | |
|         if (this.alpha != i) {
 | |
|             this.alpha = i;
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public void setColorFilter(ColorFilter colorFilter) {
 | |
|         if (this.colorFilter != colorFilter) {
 | |
|             this.colorFilter = colorFilter;
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
 | |
|     public void setTintList(ColorStateList colorStateList) {
 | |
|         if (this.tint != colorStateList) {
 | |
|             this.tint = colorStateList;
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
 | |
|     public void setTintMode(PorterDuff.Mode mode) {
 | |
|         if (this.tintMode != mode) {
 | |
|             this.tintMode = mode;
 | |
|             this.tintFilter = DrawableUtils.updateTintFilter(this, this.tint, mode);
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable
 | |
|     public void getOutline(Outline outline) {
 | |
|         if (this.isShapeThemingEnabled) {
 | |
|             super.getOutline(outline);
 | |
|             return;
 | |
|         }
 | |
|         Rect bounds = getBounds();
 | |
|         if (!bounds.isEmpty()) {
 | |
|             outline.setRoundRect(bounds, this.chipCornerRadius);
 | |
|         } else {
 | |
|             outline.setRoundRect(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), this.chipCornerRadius);
 | |
|         }
 | |
|         outline.setAlpha(getAlpha() / 255.0f);
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable.Callback
 | |
|     public void invalidateDrawable(Drawable drawable) {
 | |
|         Drawable.Callback callback = getCallback();
 | |
|         if (callback != null) {
 | |
|             callback.invalidateDrawable(this);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable.Callback
 | |
|     public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
 | |
|         Drawable.Callback callback = getCallback();
 | |
|         if (callback != null) {
 | |
|             callback.scheduleDrawable(this, runnable, j);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.graphics.drawable.Drawable.Callback
 | |
|     public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
 | |
|         Drawable.Callback callback = getCallback();
 | |
|         if (callback != null) {
 | |
|             callback.unscheduleDrawable(this, runnable);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void unapplyChildDrawable(Drawable drawable) {
 | |
|         if (drawable != null) {
 | |
|             drawable.setCallback(null);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void applyChildDrawable(Drawable drawable) {
 | |
|         if (drawable == null) {
 | |
|             return;
 | |
|         }
 | |
|         drawable.setCallback(this);
 | |
|         DrawableCompat.setLayoutDirection(drawable, DrawableCompat.getLayoutDirection(this));
 | |
|         drawable.setLevel(getLevel());
 | |
|         drawable.setVisible(isVisible(), false);
 | |
|         if (drawable == this.closeIcon) {
 | |
|             if (drawable.isStateful()) {
 | |
|                 drawable.setState(getCloseIconState());
 | |
|             }
 | |
|             DrawableCompat.setTintList(drawable, this.closeIconTint);
 | |
|             return;
 | |
|         }
 | |
|         Drawable drawable2 = this.chipIcon;
 | |
|         if (drawable == drawable2 && this.hasChipIconTint) {
 | |
|             DrawableCompat.setTintList(drawable2, this.chipIconTint);
 | |
|         }
 | |
|         if (drawable.isStateful()) {
 | |
|             drawable.setState(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void updateCompatRippleColor() {
 | |
|         this.compatRippleColor = this.useCompatRipple ? RippleUtils.sanitizeRippleDrawableColor(this.rippleColor) : null;
 | |
|     }
 | |
| 
 | |
|     private void setChipSurfaceColor(ColorStateList colorStateList) {
 | |
|         if (this.chipSurfaceColor != colorStateList) {
 | |
|             this.chipSurfaceColor = colorStateList;
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private static boolean hasState(int[] iArr, int i) {
 | |
|         if (iArr == null) {
 | |
|             return false;
 | |
|         }
 | |
|         for (int i2 : iArr) {
 | |
|             if (i2 == i) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     public void setTextSize(float f) {
 | |
|         TextAppearance textAppearance = getTextAppearance();
 | |
|         if (textAppearance != null) {
 | |
|             textAppearance.setTextSize(f);
 | |
|             this.textDrawableHelper.getTextPaint().setTextSize(f);
 | |
|             onTextSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setTextColor(int i) {
 | |
|         setTextColor(ColorStateList.valueOf(i));
 | |
|     }
 | |
| 
 | |
|     public void setTextColor(ColorStateList colorStateList) {
 | |
|         TextAppearance textAppearance = getTextAppearance();
 | |
|         if (textAppearance != null) {
 | |
|             textAppearance.setTextColor(colorStateList);
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipBackgroundColorResource(int i) {
 | |
|         setChipBackgroundColor(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setChipBackgroundColor(ColorStateList colorStateList) {
 | |
|         if (this.chipBackgroundColor != colorStateList) {
 | |
|             this.chipBackgroundColor = colorStateList;
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipMinHeightResource(int i) {
 | |
|         setChipMinHeight(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipMinHeight(float f) {
 | |
|         if (this.chipMinHeight != f) {
 | |
|             this.chipMinHeight = f;
 | |
|             invalidateSelf();
 | |
|             onSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public float getChipCornerRadius() {
 | |
|         return this.isShapeThemingEnabled ? getTopLeftCornerResolvedSize() : this.chipCornerRadius;
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setChipCornerRadiusResource(int i) {
 | |
|         setChipCornerRadius(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setChipCornerRadius(float f) {
 | |
|         if (this.chipCornerRadius != f) {
 | |
|             this.chipCornerRadius = f;
 | |
|             setShapeAppearanceModel(getShapeAppearanceModel().withCornerSize(f));
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipStrokeColorResource(int i) {
 | |
|         setChipStrokeColor(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setChipStrokeColor(ColorStateList colorStateList) {
 | |
|         if (this.chipStrokeColor != colorStateList) {
 | |
|             this.chipStrokeColor = colorStateList;
 | |
|             if (this.isShapeThemingEnabled) {
 | |
|                 setStrokeColor(colorStateList);
 | |
|             }
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipStrokeWidthResource(int i) {
 | |
|         setChipStrokeWidth(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipStrokeWidth(float f) {
 | |
|         if (this.chipStrokeWidth != f) {
 | |
|             this.chipStrokeWidth = f;
 | |
|             this.chipPaint.setStrokeWidth(f);
 | |
|             if (this.isShapeThemingEnabled) {
 | |
|                 super.setStrokeWidth(f);
 | |
|             }
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setRippleColorResource(int i) {
 | |
|         setRippleColor(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setRippleColor(ColorStateList colorStateList) {
 | |
|         if (this.rippleColor != colorStateList) {
 | |
|             this.rippleColor = colorStateList;
 | |
|             updateCompatRippleColor();
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setTextResource(int i) {
 | |
|         setText(this.context.getResources().getString(i));
 | |
|     }
 | |
| 
 | |
|     public void setText(CharSequence charSequence) {
 | |
|         if (charSequence == null) {
 | |
|             charSequence = "";
 | |
|         }
 | |
|         if (TextUtils.equals(this.text, charSequence)) {
 | |
|             return;
 | |
|         }
 | |
|         this.text = charSequence;
 | |
|         this.textDrawableHelper.setTextWidthDirty(true);
 | |
|         invalidateSelf();
 | |
|         onSizeChange();
 | |
|     }
 | |
| 
 | |
|     public TextAppearance getTextAppearance() {
 | |
|         return this.textDrawableHelper.getTextAppearance();
 | |
|     }
 | |
| 
 | |
|     public void setTextAppearanceResource(int i) {
 | |
|         setTextAppearance(new TextAppearance(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setTextAppearance(TextAppearance textAppearance) {
 | |
|         this.textDrawableHelper.setTextAppearance(textAppearance, this.context);
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public boolean isChipIconEnabled() {
 | |
|         return isChipIconVisible();
 | |
|     }
 | |
| 
 | |
|     public void setChipIconVisible(int i) {
 | |
|         setChipIconVisible(this.context.getResources().getBoolean(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipIconVisible(boolean z) {
 | |
|         if (this.chipIconVisible != z) {
 | |
|             boolean showsChipIcon = showsChipIcon();
 | |
|             this.chipIconVisible = z;
 | |
|             boolean showsChipIcon2 = showsChipIcon();
 | |
|             if (showsChipIcon != showsChipIcon2) {
 | |
|                 if (showsChipIcon2) {
 | |
|                     applyChildDrawable(this.chipIcon);
 | |
|                 } else {
 | |
|                     unapplyChildDrawable(this.chipIcon);
 | |
|                 }
 | |
|                 invalidateSelf();
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setChipIconEnabledResource(int i) {
 | |
|         setChipIconVisible(i);
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setChipIconEnabled(boolean z) {
 | |
|         setChipIconVisible(z);
 | |
|     }
 | |
| 
 | |
|     public Drawable getChipIcon() {
 | |
|         Drawable drawable = this.chipIcon;
 | |
|         if (drawable != null) {
 | |
|             return DrawableCompat.unwrap(drawable);
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     public void setChipIconResource(int i) {
 | |
|         setChipIcon(AppCompatResources.getDrawable(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setChipIcon(Drawable drawable) {
 | |
|         Drawable chipIcon = getChipIcon();
 | |
|         if (chipIcon != drawable) {
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             this.chipIcon = drawable != null ? DrawableCompat.wrap(drawable).mutate() : null;
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             unapplyChildDrawable(chipIcon);
 | |
|             if (showsChipIcon()) {
 | |
|                 applyChildDrawable(this.chipIcon);
 | |
|             }
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipIconTintResource(int i) {
 | |
|         setChipIconTint(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setChipIconTint(ColorStateList colorStateList) {
 | |
|         this.hasChipIconTint = true;
 | |
|         if (this.chipIconTint != colorStateList) {
 | |
|             this.chipIconTint = colorStateList;
 | |
|             if (showsChipIcon()) {
 | |
|                 DrawableCompat.setTintList(this.chipIcon, colorStateList);
 | |
|             }
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipIconSizeResource(int i) {
 | |
|         setChipIconSize(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipIconSize(float f) {
 | |
|         if (this.chipIconSize != f) {
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             this.chipIconSize = f;
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public boolean isCloseIconEnabled() {
 | |
|         return isCloseIconVisible();
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconVisible(int i) {
 | |
|         setCloseIconVisible(this.context.getResources().getBoolean(i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconVisible(boolean z) {
 | |
|         if (this.closeIconVisible != z) {
 | |
|             boolean showsCloseIcon = showsCloseIcon();
 | |
|             this.closeIconVisible = z;
 | |
|             boolean showsCloseIcon2 = showsCloseIcon();
 | |
|             if (showsCloseIcon != showsCloseIcon2) {
 | |
|                 if (showsCloseIcon2) {
 | |
|                     applyChildDrawable(this.closeIcon);
 | |
|                 } else {
 | |
|                     unapplyChildDrawable(this.closeIcon);
 | |
|                 }
 | |
|                 invalidateSelf();
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setCloseIconEnabledResource(int i) {
 | |
|         setCloseIconVisible(i);
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setCloseIconEnabled(boolean z) {
 | |
|         setCloseIconVisible(z);
 | |
|     }
 | |
| 
 | |
|     public Drawable getCloseIcon() {
 | |
|         Drawable drawable = this.closeIcon;
 | |
|         if (drawable != null) {
 | |
|             return DrawableCompat.unwrap(drawable);
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconResource(int i) {
 | |
|         setCloseIcon(AppCompatResources.getDrawable(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIcon(Drawable drawable) {
 | |
|         Drawable closeIcon = getCloseIcon();
 | |
|         if (closeIcon != drawable) {
 | |
|             float calculateCloseIconWidth = calculateCloseIconWidth();
 | |
|             this.closeIcon = drawable != null ? DrawableCompat.wrap(drawable).mutate() : null;
 | |
|             if (RippleUtils.USE_FRAMEWORK_RIPPLE) {
 | |
|                 updateFrameworkCloseIconRipple();
 | |
|             }
 | |
|             float calculateCloseIconWidth2 = calculateCloseIconWidth();
 | |
|             unapplyChildDrawable(closeIcon);
 | |
|             if (showsCloseIcon()) {
 | |
|                 applyChildDrawable(this.closeIcon);
 | |
|             }
 | |
|             invalidateSelf();
 | |
|             if (calculateCloseIconWidth != calculateCloseIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void updateFrameworkCloseIconRipple() {
 | |
|         this.closeIconRipple = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(getRippleColor()), this.closeIcon, closeIconRippleMask);
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconTintResource(int i) {
 | |
|         setCloseIconTint(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconTint(ColorStateList colorStateList) {
 | |
|         if (this.closeIconTint != colorStateList) {
 | |
|             this.closeIconTint = colorStateList;
 | |
|             if (showsCloseIcon()) {
 | |
|                 DrawableCompat.setTintList(this.closeIcon, colorStateList);
 | |
|             }
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconSizeResource(int i) {
 | |
|         setCloseIconSize(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconSize(float f) {
 | |
|         if (this.closeIconSize != f) {
 | |
|             this.closeIconSize = f;
 | |
|             invalidateSelf();
 | |
|             if (showsCloseIcon()) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconContentDescription(CharSequence charSequence) {
 | |
|         if (this.closeIconContentDescription != charSequence) {
 | |
|             this.closeIconContentDescription = BidiFormatter.getInstance().unicodeWrap(charSequence);
 | |
|             invalidateSelf();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCheckableResource(int i) {
 | |
|         setCheckable(this.context.getResources().getBoolean(i));
 | |
|     }
 | |
| 
 | |
|     public void setCheckable(boolean z) {
 | |
|         if (this.checkable != z) {
 | |
|             this.checkable = z;
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             if (!z && this.currentChecked) {
 | |
|                 this.currentChecked = false;
 | |
|             }
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public boolean isCheckedIconEnabled() {
 | |
|         return isCheckedIconVisible();
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIconVisible(int i) {
 | |
|         setCheckedIconVisible(this.context.getResources().getBoolean(i));
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIconVisible(boolean z) {
 | |
|         if (this.checkedIconVisible != z) {
 | |
|             boolean showsCheckedIcon = showsCheckedIcon();
 | |
|             this.checkedIconVisible = z;
 | |
|             boolean showsCheckedIcon2 = showsCheckedIcon();
 | |
|             if (showsCheckedIcon != showsCheckedIcon2) {
 | |
|                 if (showsCheckedIcon2) {
 | |
|                     applyChildDrawable(this.checkedIcon);
 | |
|                 } else {
 | |
|                     unapplyChildDrawable(this.checkedIcon);
 | |
|                 }
 | |
|                 invalidateSelf();
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setCheckedIconEnabledResource(int i) {
 | |
|         setCheckedIconVisible(this.context.getResources().getBoolean(i));
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setCheckedIconEnabled(boolean z) {
 | |
|         setCheckedIconVisible(z);
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIconResource(int i) {
 | |
|         setCheckedIcon(AppCompatResources.getDrawable(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIcon(Drawable drawable) {
 | |
|         if (this.checkedIcon != drawable) {
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             this.checkedIcon = drawable;
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             unapplyChildDrawable(this.checkedIcon);
 | |
|             applyChildDrawable(this.checkedIcon);
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIconTintResource(int i) {
 | |
|         setCheckedIconTint(AppCompatResources.getColorStateList(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setCheckedIconTint(ColorStateList colorStateList) {
 | |
|         if (this.checkedIconTint != colorStateList) {
 | |
|             this.checkedIconTint = colorStateList;
 | |
|             if (canShowCheckedIcon()) {
 | |
|                 DrawableCompat.setTintList(this.checkedIcon, colorStateList);
 | |
|             }
 | |
|             onStateChange(getState());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setShowMotionSpecResource(int i) {
 | |
|         setShowMotionSpec(MotionSpec.createFromResource(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setHideMotionSpecResource(int i) {
 | |
|         setHideMotionSpec(MotionSpec.createFromResource(this.context, i));
 | |
|     }
 | |
| 
 | |
|     public void setChipStartPaddingResource(int i) {
 | |
|         setChipStartPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipStartPadding(float f) {
 | |
|         if (this.chipStartPadding != f) {
 | |
|             this.chipStartPadding = f;
 | |
|             invalidateSelf();
 | |
|             onSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setIconStartPaddingResource(int i) {
 | |
|         setIconStartPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setIconStartPadding(float f) {
 | |
|         if (this.iconStartPadding != f) {
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             this.iconStartPadding = f;
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setIconEndPaddingResource(int i) {
 | |
|         setIconEndPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setIconEndPadding(float f) {
 | |
|         if (this.iconEndPadding != f) {
 | |
|             float calculateChipIconWidth = calculateChipIconWidth();
 | |
|             this.iconEndPadding = f;
 | |
|             float calculateChipIconWidth2 = calculateChipIconWidth();
 | |
|             invalidateSelf();
 | |
|             if (calculateChipIconWidth != calculateChipIconWidth2) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setTextStartPaddingResource(int i) {
 | |
|         setTextStartPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setTextStartPadding(float f) {
 | |
|         if (this.textStartPadding != f) {
 | |
|             this.textStartPadding = f;
 | |
|             invalidateSelf();
 | |
|             onSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setTextEndPaddingResource(int i) {
 | |
|         setTextEndPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setTextEndPadding(float f) {
 | |
|         if (this.textEndPadding != f) {
 | |
|             this.textEndPadding = f;
 | |
|             invalidateSelf();
 | |
|             onSizeChange();
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconStartPaddingResource(int i) {
 | |
|         setCloseIconStartPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconStartPadding(float f) {
 | |
|         if (this.closeIconStartPadding != f) {
 | |
|             this.closeIconStartPadding = f;
 | |
|             invalidateSelf();
 | |
|             if (showsCloseIcon()) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconEndPaddingResource(int i) {
 | |
|         setCloseIconEndPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setCloseIconEndPadding(float f) {
 | |
|         if (this.closeIconEndPadding != f) {
 | |
|             this.closeIconEndPadding = f;
 | |
|             invalidateSelf();
 | |
|             if (showsCloseIcon()) {
 | |
|                 onSizeChange();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setChipEndPaddingResource(int i) {
 | |
|         setChipEndPadding(this.context.getResources().getDimension(i));
 | |
|     }
 | |
| 
 | |
|     public void setChipEndPadding(float f) {
 | |
|         if (this.chipEndPadding != f) {
 | |
|             this.chipEndPadding = f;
 | |
|             invalidateSelf();
 | |
|             onSizeChange();
 | |
|         }
 | |
|     }
 | |
| }
 |