package com.google.android.material.chip; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Outline; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.RippleDrawable; import android.os.Bundle; import android.text.TextPaint; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.View; import android.view.ViewOutlineProvider; import android.view.ViewParent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.CompoundButton; import android.widget.TextView; import androidx.appcompat.widget.AppCompatCheckBox; import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import androidx.customview.widget.ExploreByTouchHelper; import com.google.android.material.R; import com.google.android.material.animation.MotionSpec; import com.google.android.material.chip.ChipDrawable; import com.google.android.material.internal.MaterialCheckable; import com.google.android.material.internal.ThemeEnforcement; import com.google.android.material.internal.ViewUtils; import com.google.android.material.resources.TextAppearance; import com.google.android.material.resources.TextAppearanceFontCallback; import com.google.android.material.ripple.RippleUtils; import com.google.android.material.shape.MaterialShapeUtils; import com.google.android.material.shape.ShapeAppearanceModel; import com.google.android.material.shape.Shapeable; import java.util.List; /* loaded from: classes2.dex */ public class Chip extends AppCompatCheckBox implements ChipDrawable.Delegate, Shapeable, MaterialCheckable { private static final String BUTTON_ACCESSIBILITY_CLASS_NAME = "android.widget.Button"; private static final int CHIP_BODY_VIRTUAL_ID = 0; private static final int CLOSE_ICON_VIRTUAL_ID = 1; private static final String GENERIC_VIEW_ACCESSIBILITY_CLASS_NAME = "android.view.View"; private static final int MIN_TOUCH_TARGET_DP = 48; private static final String NAMESPACE_ANDROID = "http://schemas.android.com/apk/res/android"; private static final String RADIO_BUTTON_ACCESSIBILITY_CLASS_NAME = "android.widget.RadioButton"; private static final String TAG = "Chip"; private CharSequence accessibilityClassName; private ChipDrawable chipDrawable; private boolean closeIconFocused; private boolean closeIconHovered; private boolean closeIconPressed; private boolean deferredCheckedValue; private boolean ensureMinTouchTargetSize; private final TextAppearanceFontCallback fontCallback; private InsetDrawable insetBackgroundDrawable; private int lastLayoutDirection; private int minTouchTargetSize; private CompoundButton.OnCheckedChangeListener onCheckedChangeListener; private MaterialCheckable.OnCheckedChangeListener onCheckedChangeListenerInternal; private View.OnClickListener onCloseIconClickListener; private final Rect rect; private final RectF rectF; private RippleDrawable ripple; private final ChipTouchHelper touchHelper; private boolean touchHelperEnabled; private static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_Chip_Action; private static final Rect EMPTY_BOUNDS = new Rect(); private static final int[] SELECTED_STATE = {android.R.attr.state_selected}; private static final int[] CHECKABLE_STATE_SET = {android.R.attr.state_checkable}; public Drawable getBackgroundDrawable() { InsetDrawable insetDrawable = this.insetBackgroundDrawable; return insetDrawable == null ? this.chipDrawable : insetDrawable; } public Drawable getChipDrawable() { return this.chipDrawable; } public void setAccessibilityClassName(CharSequence charSequence) { this.accessibilityClassName = charSequence; } @Override // com.google.android.material.internal.MaterialCheckable public void setInternalOnCheckedChangeListener(MaterialCheckable.OnCheckedChangeListener onCheckedChangeListener) { this.onCheckedChangeListenerInternal = onCheckedChangeListener; } @Override // android.widget.CompoundButton public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener onCheckedChangeListener) { this.onCheckedChangeListener = onCheckedChangeListener; } public boolean shouldEnsureMinTouchTargetSize() { return this.ensureMinTouchTargetSize; } public Chip(Context context) { this(context, null); } public Chip(Context context, AttributeSet attributeSet) { this(context, attributeSet, R.attr.chipStyle); } /* 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 Chip(android.content.Context r7, android.util.AttributeSet r8, int r9) { /* r6 = this; int r4 = com.google.android.material.chip.Chip.DEF_STYLE_RES android.content.Context r7 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r7, r8, r9, r4) r6.(r7, r8, r9) android.graphics.Rect r7 = new android.graphics.Rect r7.() r6.rect = r7 android.graphics.RectF r7 = new android.graphics.RectF r7.() r6.rectF = r7 com.google.android.material.chip.Chip$1 r7 = new com.google.android.material.chip.Chip$1 r7.() r6.fontCallback = r7 android.content.Context r0 = r6.getContext() r6.validateAttributes(r8) com.google.android.material.chip.ChipDrawable r7 = com.google.android.material.chip.ChipDrawable.createFromAttributes(r0, r8, r9, r4) r6.initMinTouchTarget(r0, r8, r9) r6.setChipDrawable(r7) float r1 = androidx.core.view.ViewCompat.getElevation(r6) r7.setElevation(r1) int[] r2 = com.google.android.material.R.styleable.Chip r1 = 0 int[] r5 = new int[r1] r1 = r8 r3 = r9 android.content.res.TypedArray r8 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r0, r1, r2, r3, r4, r5) int r9 = com.google.android.material.R.styleable.Chip_shapeAppearance boolean r9 = r8.hasValue(r9) r8.recycle() com.google.android.material.chip.Chip$ChipTouchHelper r8 = new com.google.android.material.chip.Chip$ChipTouchHelper r8.(r6) r6.touchHelper = r8 r6.updateAccessibilityDelegate() if (r9 != 0) goto L59 r6.initOutlineProvider() L59: boolean r8 = r6.deferredCheckedValue r6.setChecked(r8) java.lang.CharSequence r8 = r7.getText() r6.setText(r8) android.text.TextUtils$TruncateAt r7 = r7.getEllipsize() r6.setEllipsize(r7) r6.updateTextPaintDrawState() com.google.android.material.chip.ChipDrawable r7 = r6.chipDrawable boolean r7 = r7.shouldDrawText() if (r7 != 0) goto L7e r7 = 1 r6.setLines(r7) r6.setHorizontallyScrolling(r7) L7e: r7 = 8388627(0x800013, float:1.175497E-38) r6.setGravity(r7) r6.updatePaddingInternal() boolean r7 = r6.shouldEnsureMinTouchTargetSize() if (r7 == 0) goto L92 int r7 = r6.minTouchTargetSize r6.setMinHeight(r7) L92: int r7 = androidx.core.view.ViewCompat.getLayoutDirection(r6) r6.lastLayoutDirection = r7 com.google.android.material.chip.Chip$$ExternalSyntheticLambda0 r7 = new com.google.android.material.chip.Chip$$ExternalSyntheticLambda0 r7.() super.setOnCheckedChangeListener(r7) return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.chip.Chip.(android.content.Context, android.util.AttributeSet, int):void"); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: lambda$new$0$com-google-android-material-chip-Chip, reason: not valid java name */ public /* synthetic */ void m5488lambda$new$0$comgoogleandroidmaterialchipChip(CompoundButton compoundButton, boolean z) { MaterialCheckable.OnCheckedChangeListener onCheckedChangeListener = this.onCheckedChangeListenerInternal; if (onCheckedChangeListener != null) { onCheckedChangeListener.onCheckedChanged(this, z); } CompoundButton.OnCheckedChangeListener onCheckedChangeListener2 = this.onCheckedChangeListener; if (onCheckedChangeListener2 != null) { onCheckedChangeListener2.onCheckedChanged(compoundButton, z); } } @Override // android.widget.TextView, android.view.View protected void onAttachedToWindow() { super.onAttachedToWindow(); MaterialShapeUtils.setParentAbsoluteElevation(this, this.chipDrawable); } @Override // android.view.View public void setElevation(float f) { super.setElevation(f); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setElevation(f); } } @Override // android.view.View public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); accessibilityNodeInfo.setClassName(getAccessibilityClassName()); accessibilityNodeInfo.setCheckable(isCheckable()); accessibilityNodeInfo.setClickable(isClickable()); if (getParent() instanceof ChipGroup) { ChipGroup chipGroup = (ChipGroup) getParent(); AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo).setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(chipGroup.getRowIndex(this), 1, chipGroup.isSingleLine() ? chipGroup.getIndexOfChip(this) : -1, 1, false, isChecked())); } } private void updateAccessibilityDelegate() { if (hasCloseIcon() && isCloseIconVisible() && this.onCloseIconClickListener != null) { ViewCompat.setAccessibilityDelegate(this, this.touchHelper); this.touchHelperEnabled = true; } else { ViewCompat.setAccessibilityDelegate(this, null); this.touchHelperEnabled = false; } } private void initMinTouchTarget(Context context, AttributeSet attributeSet, int i) { TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(context, attributeSet, R.styleable.Chip, i, DEF_STYLE_RES, new int[0]); this.ensureMinTouchTargetSize = obtainStyledAttributes.getBoolean(R.styleable.Chip_ensureMinTouchTargetSize, false); this.minTouchTargetSize = (int) Math.ceil(obtainStyledAttributes.getDimension(R.styleable.Chip_chipMinTouchTargetSize, (float) Math.ceil(ViewUtils.dpToPx(getContext(), 48)))); obtainStyledAttributes.recycle(); } private void updatePaddingInternal() { ChipDrawable chipDrawable; if (TextUtils.isEmpty(getText()) || (chipDrawable = this.chipDrawable) == null) { return; } int chipEndPadding = (int) (chipDrawable.getChipEndPadding() + this.chipDrawable.getTextEndPadding() + this.chipDrawable.calculateCloseIconWidth()); int chipStartPadding = (int) (this.chipDrawable.getChipStartPadding() + this.chipDrawable.getTextStartPadding() + this.chipDrawable.calculateChipIconWidth()); if (this.insetBackgroundDrawable != null) { Rect rect = new Rect(); this.insetBackgroundDrawable.getPadding(rect); chipStartPadding += rect.left; chipEndPadding += rect.right; } ViewCompat.setPaddingRelative(this, chipStartPadding, getPaddingTop(), chipEndPadding, getPaddingBottom()); } @Override // android.widget.TextView, android.view.View public void onRtlPropertiesChanged(int i) { super.onRtlPropertiesChanged(i); if (this.lastLayoutDirection != i) { this.lastLayoutDirection = i; updatePaddingInternal(); } } private void validateAttributes(AttributeSet attributeSet) { if (attributeSet == null) { return; } if (attributeSet.getAttributeValue(NAMESPACE_ANDROID, "background") != null) { Log.w(TAG, "Do not set the background; Chip manages its own background drawable."); } if (attributeSet.getAttributeValue(NAMESPACE_ANDROID, "drawableLeft") != null) { throw new UnsupportedOperationException("Please set left drawable using R.attr#chipIcon."); } if (attributeSet.getAttributeValue(NAMESPACE_ANDROID, "drawableStart") != null) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (attributeSet.getAttributeValue(NAMESPACE_ANDROID, "drawableEnd") != null) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } if (attributeSet.getAttributeValue(NAMESPACE_ANDROID, "drawableRight") != null) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } if (!attributeSet.getAttributeBooleanValue(NAMESPACE_ANDROID, "singleLine", true) || attributeSet.getAttributeIntValue(NAMESPACE_ANDROID, "lines", 1) != 1 || attributeSet.getAttributeIntValue(NAMESPACE_ANDROID, "minLines", 1) != 1 || attributeSet.getAttributeIntValue(NAMESPACE_ANDROID, "maxLines", 1) != 1) { throw new UnsupportedOperationException("Chip does not support multi-line text"); } if (attributeSet.getAttributeIntValue(NAMESPACE_ANDROID, "gravity", 8388627) != 8388627) { Log.w(TAG, "Chip text must be vertically center and start aligned"); } } private void initOutlineProvider() { setOutlineProvider(new ViewOutlineProvider() { // from class: com.google.android.material.chip.Chip.2 @Override // android.view.ViewOutlineProvider public void getOutline(View view, Outline outline) { if (Chip.this.chipDrawable != null) { Chip.this.chipDrawable.getOutline(outline); } else { outline.setAlpha(0.0f); } } }); } public void setChipDrawable(ChipDrawable chipDrawable) { ChipDrawable chipDrawable2 = this.chipDrawable; if (chipDrawable2 != chipDrawable) { unapplyChipDrawable(chipDrawable2); this.chipDrawable = chipDrawable; chipDrawable.setShouldDrawText(false); applyChipDrawable(this.chipDrawable); ensureAccessibleTouchTarget(this.minTouchTargetSize); } } private void updateBackgroundDrawable() { if (RippleUtils.USE_FRAMEWORK_RIPPLE) { updateFrameworkRippleBackground(); return; } this.chipDrawable.setUseCompatRipple(true); ViewCompat.setBackground(this, getBackgroundDrawable()); updatePaddingInternal(); ensureChipDrawableHasCallback(); } private void ensureChipDrawableHasCallback() { if (getBackgroundDrawable() == this.insetBackgroundDrawable && this.chipDrawable.getCallback() == null) { this.chipDrawable.setCallback(this.insetBackgroundDrawable); } } private void updateFrameworkRippleBackground() { this.ripple = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(this.chipDrawable.getRippleColor()), getBackgroundDrawable(), null); this.chipDrawable.setUseCompatRipple(false); ViewCompat.setBackground(this, this.ripple); updatePaddingInternal(); } private void unapplyChipDrawable(ChipDrawable chipDrawable) { if (chipDrawable != null) { chipDrawable.setDelegate(null); } } private void applyChipDrawable(ChipDrawable chipDrawable) { chipDrawable.setDelegate(this); } @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View protected int[] onCreateDrawableState(int i) { int[] onCreateDrawableState = super.onCreateDrawableState(i + 2); if (isChecked()) { mergeDrawableStates(onCreateDrawableState, SELECTED_STATE); } if (isCheckable()) { mergeDrawableStates(onCreateDrawableState, CHECKABLE_STATE_SET); } return onCreateDrawableState; } @Override // android.widget.TextView public void setGravity(int i) { if (i != 8388627) { Log.w(TAG, "Chip text must be vertically center and start aligned"); } else { super.setGravity(i); } } @Override // android.view.View public void setBackgroundTintList(ColorStateList colorStateList) { Log.w(TAG, "Do not set the background tint list; Chip manages its own background drawable."); } @Override // android.view.View public void setBackgroundTintMode(PorterDuff.Mode mode) { Log.w(TAG, "Do not set the background tint mode; Chip manages its own background drawable."); } @Override // android.view.View public void setBackgroundColor(int i) { Log.w(TAG, "Do not set the background color; Chip manages its own background drawable."); } @Override // androidx.appcompat.widget.AppCompatCheckBox, android.view.View public void setBackgroundResource(int i) { Log.w(TAG, "Do not set the background resource; Chip manages its own background drawable."); } @Override // android.view.View public void setBackground(Drawable drawable) { if (drawable != getBackgroundDrawable() && drawable != this.ripple) { Log.w(TAG, "Do not set the background; Chip manages its own background drawable."); } else { super.setBackground(drawable); } } @Override // androidx.appcompat.widget.AppCompatCheckBox, android.view.View public void setBackgroundDrawable(Drawable drawable) { if (drawable != getBackgroundDrawable() && drawable != this.ripple) { Log.w(TAG, "Do not set the background drawable; Chip manages its own background drawable."); } else { super.setBackgroundDrawable(drawable); } } @Override // androidx.appcompat.widget.AppCompatCheckBox, android.widget.TextView public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { if (drawable != null) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (drawable3 != null) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4); } @Override // android.widget.TextView public void setCompoundDrawablesWithIntrinsicBounds(int i, int i2, int i3, int i4) { if (i != 0) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (i3 != 0) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } super.setCompoundDrawablesWithIntrinsicBounds(i, i2, i3, i4); } @Override // android.widget.TextView public void setCompoundDrawablesWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { if (drawable != null) { throw new UnsupportedOperationException("Please set left drawable using R.attr#chipIcon."); } if (drawable3 != null) { throw new UnsupportedOperationException("Please set right drawable using R.attr#closeIcon."); } super.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4); } @Override // androidx.appcompat.widget.AppCompatCheckBox, android.widget.TextView public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { if (drawable != null) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (drawable3 != null) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4); } @Override // android.widget.TextView public void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i2, int i3, int i4) { if (i != 0) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (i3 != 0) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } super.setCompoundDrawablesRelativeWithIntrinsicBounds(i, i2, i3, i4); } @Override // android.widget.TextView public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) { if (drawable != null) { throw new UnsupportedOperationException("Please set start drawable using R.attr#chipIcon."); } if (drawable3 != null) { throw new UnsupportedOperationException("Please set end drawable using R.attr#closeIcon."); } super.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4); } @Override // android.widget.TextView public TextUtils.TruncateAt getEllipsize() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getEllipsize(); } return null; } @Override // android.widget.TextView public void setEllipsize(TextUtils.TruncateAt truncateAt) { if (this.chipDrawable == null) { return; } if (truncateAt == TextUtils.TruncateAt.MARQUEE) { throw new UnsupportedOperationException("Text within a chip are not allowed to scroll."); } super.setEllipsize(truncateAt); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setEllipsize(truncateAt); } } @Override // android.widget.TextView public void setSingleLine(boolean z) { if (!z) { throw new UnsupportedOperationException("Chip does not support multi-line text"); } super.setSingleLine(z); } @Override // android.widget.TextView public void setLines(int i) { if (i > 1) { throw new UnsupportedOperationException("Chip does not support multi-line text"); } super.setLines(i); } @Override // android.widget.TextView public void setMinLines(int i) { if (i > 1) { throw new UnsupportedOperationException("Chip does not support multi-line text"); } super.setMinLines(i); } @Override // android.widget.TextView public void setMaxLines(int i) { if (i > 1) { throw new UnsupportedOperationException("Chip does not support multi-line text"); } super.setMaxLines(i); } @Override // android.widget.TextView public void setMaxWidth(int i) { super.setMaxWidth(i); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setMaxWidth(i); } } @Override // com.google.android.material.chip.ChipDrawable.Delegate public void onChipDrawableSizeChange() { ensureAccessibleTouchTarget(this.minTouchTargetSize); requestLayout(); invalidateOutline(); } @Override // android.widget.CompoundButton, android.widget.Checkable public void setChecked(boolean z) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable == null) { this.deferredCheckedValue = z; } else if (chipDrawable.isCheckable()) { super.setChecked(z); } } public void setOnCloseIconClickListener(View.OnClickListener onClickListener) { this.onCloseIconClickListener = onClickListener; updateAccessibilityDelegate(); } public boolean performCloseIconClick() { boolean z = false; playSoundEffect(0); View.OnClickListener onClickListener = this.onCloseIconClickListener; if (onClickListener != null) { onClickListener.onClick(this); z = true; } if (this.touchHelperEnabled) { this.touchHelper.sendEventForVirtualView(1, 1); } return z; } /* JADX WARN: Code restructure failed: missing block: B:7:0x001e, code lost: if (r0 != 3) goto L23; */ /* JADX WARN: Removed duplicated region for block: B:11:? A[RETURN, SYNTHETIC] */ @Override // android.widget.TextView, android.view.View /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public boolean onTouchEvent(android.view.MotionEvent r6) { /* r5 = this; int r0 = r6.getActionMasked() android.graphics.RectF r1 = r5.getCloseIconTouchBounds() float r2 = r6.getX() float r3 = r6.getY() boolean r1 = r1.contains(r2, r3) r2 = 1 r3 = 0 if (r0 == 0) goto L3b if (r0 == r2) goto L2b r4 = 2 if (r0 == r4) goto L21 r1 = 3 if (r0 == r1) goto L34 goto L41 L21: boolean r0 = r5.closeIconPressed if (r0 == 0) goto L41 if (r1 != 0) goto L49 r5.setCloseIconPressed(r3) goto L49 L2b: boolean r0 = r5.closeIconPressed if (r0 == 0) goto L34 r5.performCloseIconClick() r0 = r2 goto L35 L34: r0 = r3 L35: r5.setCloseIconPressed(r3) if (r0 != 0) goto L49 goto L41 L3b: if (r1 == 0) goto L41 r5.setCloseIconPressed(r2) goto L49 L41: boolean r5 = super.onTouchEvent(r6) if (r5 == 0) goto L48 goto L49 L48: r2 = r3 L49: return r2 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.chip.Chip.onTouchEvent(android.view.MotionEvent):boolean"); } @Override // android.view.View public boolean onHoverEvent(MotionEvent motionEvent) { int actionMasked = motionEvent.getActionMasked(); if (actionMasked == 7) { setCloseIconHovered(getCloseIconTouchBounds().contains(motionEvent.getX(), motionEvent.getY())); } else if (actionMasked == 10) { setCloseIconHovered(false); } return super.onHoverEvent(motionEvent); } @Override // android.view.View protected boolean dispatchHoverEvent(MotionEvent motionEvent) { if (this.touchHelperEnabled) { return this.touchHelper.dispatchHoverEvent(motionEvent) || super.dispatchHoverEvent(motionEvent); } return super.dispatchHoverEvent(motionEvent); } @Override // android.view.View public boolean dispatchKeyEvent(KeyEvent keyEvent) { if (!this.touchHelperEnabled) { return super.dispatchKeyEvent(keyEvent); } if (!this.touchHelper.dispatchKeyEvent(keyEvent) || this.touchHelper.getKeyboardFocusedVirtualViewId() == Integer.MIN_VALUE) { return super.dispatchKeyEvent(keyEvent); } return true; } @Override // android.widget.TextView, android.view.View protected void onFocusChanged(boolean z, int i, Rect rect) { super.onFocusChanged(z, i, rect); if (this.touchHelperEnabled) { this.touchHelper.onFocusChanged(z, i, rect); } } @Override // android.widget.TextView, android.view.View public void getFocusedRect(Rect rect) { if (this.touchHelperEnabled && (this.touchHelper.getKeyboardFocusedVirtualViewId() == 1 || this.touchHelper.getAccessibilityFocusedVirtualViewId() == 1)) { rect.set(getCloseIconTouchBoundsInt()); } else { super.getFocusedRect(rect); } } private void setCloseIconPressed(boolean z) { if (this.closeIconPressed != z) { this.closeIconPressed = z; refreshDrawableState(); } } private void setCloseIconHovered(boolean z) { if (this.closeIconHovered != z) { this.closeIconHovered = z; refreshDrawableState(); } } /* JADX INFO: Access modifiers changed from: protected */ @Override // androidx.appcompat.widget.AppCompatCheckBox, android.widget.CompoundButton, android.widget.TextView, android.view.View public void drawableStateChanged() { super.drawableStateChanged(); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null && chipDrawable.isCloseIconStateful() && this.chipDrawable.setCloseIconState(createCloseIconDrawableState())) { invalidate(); } } /* JADX WARN: Type inference failed for: r0v0, types: [boolean, int] */ private int[] createCloseIconDrawableState() { ?? isEnabled = isEnabled(); int i = isEnabled; if (this.closeIconFocused) { i = isEnabled + 1; } int i2 = i; if (this.closeIconHovered) { i2 = i + 1; } int i3 = i2; if (this.closeIconPressed) { i3 = i2 + 1; } int i4 = i3; if (isChecked()) { i4 = i3 + 1; } int[] iArr = new int[i4]; int i5 = 0; if (isEnabled()) { iArr[0] = 16842910; i5 = 1; } if (this.closeIconFocused) { iArr[i5] = 16842908; i5++; } if (this.closeIconHovered) { iArr[i5] = 16843623; i5++; } if (this.closeIconPressed) { iArr[i5] = 16842919; i5++; } if (isChecked()) { iArr[i5] = 16842913; } return iArr; } /* JADX INFO: Access modifiers changed from: private */ public boolean hasCloseIcon() { ChipDrawable chipDrawable = this.chipDrawable; return (chipDrawable == null || chipDrawable.getCloseIcon() == null) ? false : true; } /* JADX INFO: Access modifiers changed from: private */ public RectF getCloseIconTouchBounds() { this.rectF.setEmpty(); if (hasCloseIcon() && this.onCloseIconClickListener != null) { this.chipDrawable.getCloseIconTouchBounds(this.rectF); } return this.rectF; } /* JADX INFO: Access modifiers changed from: private */ public Rect getCloseIconTouchBoundsInt() { RectF closeIconTouchBounds = getCloseIconTouchBounds(); this.rect.set((int) closeIconTouchBounds.left, (int) closeIconTouchBounds.top, (int) closeIconTouchBounds.right, (int) closeIconTouchBounds.bottom); return this.rect; } @Override // android.widget.Button, android.widget.TextView, android.view.View public PointerIcon onResolvePointerIcon(MotionEvent motionEvent, int i) { if (getCloseIconTouchBounds().contains(motionEvent.getX(), motionEvent.getY()) && isEnabled()) { return PointerIcon.getSystemIcon(getContext(), 1002); } return super.onResolvePointerIcon(motionEvent, i); } /* JADX INFO: Access modifiers changed from: private */ /* loaded from: classes2.dex */ public class ChipTouchHelper extends ExploreByTouchHelper { ChipTouchHelper(Chip chip) { super(chip); } @Override // androidx.customview.widget.ExploreByTouchHelper protected int getVirtualViewAt(float f, float f2) { return (Chip.this.hasCloseIcon() && Chip.this.getCloseIconTouchBounds().contains(f, f2)) ? 1 : 0; } @Override // androidx.customview.widget.ExploreByTouchHelper protected void getVisibleVirtualViews(List list) { list.add(0); if (Chip.this.hasCloseIcon() && Chip.this.isCloseIconVisible() && Chip.this.onCloseIconClickListener != null) { list.add(1); } } @Override // androidx.customview.widget.ExploreByTouchHelper protected void onVirtualViewKeyboardFocusChanged(int i, boolean z) { if (i == 1) { Chip.this.closeIconFocused = z; Chip.this.refreshDrawableState(); } } @Override // androidx.customview.widget.ExploreByTouchHelper protected void onPopulateNodeForVirtualView(int i, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { if (i == 1) { CharSequence closeIconContentDescription = Chip.this.getCloseIconContentDescription(); if (closeIconContentDescription != null) { accessibilityNodeInfoCompat.setContentDescription(closeIconContentDescription); } else { CharSequence text = Chip.this.getText(); Context context = Chip.this.getContext(); int i2 = R.string.mtrl_chip_close_icon_content_description; Object[] objArr = new Object[1]; objArr[0] = TextUtils.isEmpty(text) ? "" : text; accessibilityNodeInfoCompat.setContentDescription(context.getString(i2, objArr).trim()); } accessibilityNodeInfoCompat.setBoundsInParent(Chip.this.getCloseIconTouchBoundsInt()); accessibilityNodeInfoCompat.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK); accessibilityNodeInfoCompat.setEnabled(Chip.this.isEnabled()); return; } accessibilityNodeInfoCompat.setContentDescription(""); accessibilityNodeInfoCompat.setBoundsInParent(Chip.EMPTY_BOUNDS); } @Override // androidx.customview.widget.ExploreByTouchHelper protected void onPopulateNodeForHost(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { accessibilityNodeInfoCompat.setCheckable(Chip.this.isCheckable()); accessibilityNodeInfoCompat.setClickable(Chip.this.isClickable()); accessibilityNodeInfoCompat.setClassName(Chip.this.getAccessibilityClassName()); accessibilityNodeInfoCompat.setText(Chip.this.getText()); } @Override // androidx.customview.widget.ExploreByTouchHelper protected boolean onPerformActionForVirtualView(int i, int i2, Bundle bundle) { if (i2 != 16) { return false; } if (i == 0) { return Chip.this.performClick(); } if (i == 1) { return Chip.this.performCloseIconClick(); } return false; } } public ColorStateList getChipBackgroundColor() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipBackgroundColor(); } return null; } public void setChipBackgroundColorResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipBackgroundColorResource(i); } } public void setChipBackgroundColor(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipBackgroundColor(colorStateList); } } public float getChipMinHeight() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipMinHeight(); } return 0.0f; } public void setChipMinHeightResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipMinHeightResource(i); } } public void setChipMinHeight(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipMinHeight(f); } } public float getChipCornerRadius() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return Math.max(0.0f, chipDrawable.getChipCornerRadius()); } return 0.0f; } @Deprecated public void setChipCornerRadiusResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipCornerRadiusResource(i); } } @Override // com.google.android.material.shape.Shapeable public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { this.chipDrawable.setShapeAppearanceModel(shapeAppearanceModel); } @Override // com.google.android.material.shape.Shapeable public ShapeAppearanceModel getShapeAppearanceModel() { return this.chipDrawable.getShapeAppearanceModel(); } @Deprecated public void setChipCornerRadius(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipCornerRadius(f); } } public ColorStateList getChipStrokeColor() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipStrokeColor(); } return null; } public void setChipStrokeColorResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStrokeColorResource(i); } } public void setChipStrokeColor(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStrokeColor(colorStateList); } } public float getChipStrokeWidth() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipStrokeWidth(); } return 0.0f; } public void setChipStrokeWidthResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStrokeWidthResource(i); } } public void setChipStrokeWidth(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStrokeWidth(f); } } public ColorStateList getRippleColor() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getRippleColor(); } return null; } public void setRippleColorResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setRippleColorResource(i); if (this.chipDrawable.getUseCompatRipple()) { return; } updateFrameworkRippleBackground(); } } public void setRippleColor(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setRippleColor(colorStateList); } if (this.chipDrawable.getUseCompatRipple()) { return; } updateFrameworkRippleBackground(); } @Deprecated public CharSequence getChipText() { return getText(); } @Override // android.view.View public void setLayoutDirection(int i) { if (this.chipDrawable == null) { return; } super.setLayoutDirection(i); } @Override // android.widget.TextView public void setText(CharSequence charSequence, TextView.BufferType bufferType) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable == null) { return; } if (charSequence == null) { charSequence = ""; } super.setText(chipDrawable.shouldDrawText() ? null : charSequence, bufferType); ChipDrawable chipDrawable2 = this.chipDrawable; if (chipDrawable2 != null) { chipDrawable2.setText(charSequence); } } @Deprecated public void setChipTextResource(int i) { setText(getResources().getString(i)); } @Deprecated public void setChipText(CharSequence charSequence) { setText(charSequence); } public void setTextAppearanceResource(int i) { setTextAppearance(getContext(), i); } public void setTextAppearance(TextAppearance textAppearance) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextAppearance(textAppearance); } updateTextPaintDrawState(); } @Override // android.widget.TextView public void setTextAppearance(Context context, int i) { super.setTextAppearance(context, i); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextAppearanceResource(i); } updateTextPaintDrawState(); } @Override // android.widget.TextView public void setTextAppearance(int i) { super.setTextAppearance(i); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextAppearanceResource(i); } updateTextPaintDrawState(); } @Override // android.widget.TextView public void setTextSize(int i, float f) { super.setTextSize(i, f); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextSize(TypedValue.applyDimension(i, f, getResources().getDisplayMetrics())); } updateTextPaintDrawState(); } private void updateTextPaintDrawState() { TextPaint paint = getPaint(); ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { paint.drawableState = chipDrawable.getState(); } TextAppearance textAppearance = getTextAppearance(); if (textAppearance != null) { textAppearance.updateDrawState(getContext(), paint, this.fontCallback); } } private TextAppearance getTextAppearance() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getTextAppearance(); } return null; } public boolean isChipIconVisible() { ChipDrawable chipDrawable = this.chipDrawable; return chipDrawable != null && chipDrawable.isChipIconVisible(); } @Deprecated public boolean isChipIconEnabled() { return isChipIconVisible(); } public void setChipIconVisible(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconVisible(i); } } public void setChipIconVisible(boolean z) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconVisible(z); } } @Deprecated public void setChipIconEnabledResource(int i) { setChipIconVisible(i); } @Deprecated public void setChipIconEnabled(boolean z) { setChipIconVisible(z); } public Drawable getChipIcon() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipIcon(); } return null; } public void setChipIconResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconResource(i); } } public void setChipIcon(Drawable drawable) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIcon(drawable); } } public ColorStateList getChipIconTint() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipIconTint(); } return null; } public void setChipIconTintResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconTintResource(i); } } public void setChipIconTint(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconTint(colorStateList); } } public float getChipIconSize() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipIconSize(); } return 0.0f; } public void setChipIconSizeResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconSizeResource(i); } } public void setChipIconSize(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipIconSize(f); } } public boolean isCloseIconVisible() { ChipDrawable chipDrawable = this.chipDrawable; return chipDrawable != null && chipDrawable.isCloseIconVisible(); } @Deprecated public boolean isCloseIconEnabled() { return isCloseIconVisible(); } public void setCloseIconVisible(int i) { setCloseIconVisible(getResources().getBoolean(i)); } public void setCloseIconVisible(boolean z) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconVisible(z); } updateAccessibilityDelegate(); } @Deprecated public void setCloseIconEnabledResource(int i) { setCloseIconVisible(i); } @Deprecated public void setCloseIconEnabled(boolean z) { setCloseIconVisible(z); } public Drawable getCloseIcon() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIcon(); } return null; } public void setCloseIconResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconResource(i); } updateAccessibilityDelegate(); } public void setCloseIcon(Drawable drawable) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIcon(drawable); } updateAccessibilityDelegate(); } public ColorStateList getCloseIconTint() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIconTint(); } return null; } public void setCloseIconTintResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconTintResource(i); } } public void setCloseIconTint(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconTint(colorStateList); } } public float getCloseIconSize() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIconSize(); } return 0.0f; } public void setCloseIconSizeResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconSizeResource(i); } } public void setCloseIconSize(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconSize(f); } } public void setCloseIconContentDescription(CharSequence charSequence) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconContentDescription(charSequence); } } public CharSequence getCloseIconContentDescription() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIconContentDescription(); } return null; } public boolean isCheckable() { ChipDrawable chipDrawable = this.chipDrawable; return chipDrawable != null && chipDrawable.isCheckable(); } public void setCheckableResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckableResource(i); } } public void setCheckable(boolean z) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckable(z); } } public boolean isCheckedIconVisible() { ChipDrawable chipDrawable = this.chipDrawable; return chipDrawable != null && chipDrawable.isCheckedIconVisible(); } @Deprecated public boolean isCheckedIconEnabled() { return isCheckedIconVisible(); } public void setCheckedIconVisible(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIconVisible(i); } } public void setCheckedIconVisible(boolean z) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIconVisible(z); } } @Deprecated public void setCheckedIconEnabledResource(int i) { setCheckedIconVisible(i); } @Deprecated public void setCheckedIconEnabled(boolean z) { setCheckedIconVisible(z); } public Drawable getCheckedIcon() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCheckedIcon(); } return null; } public void setCheckedIconResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIconResource(i); } } public void setCheckedIcon(Drawable drawable) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIcon(drawable); } } public ColorStateList getCheckedIconTint() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCheckedIconTint(); } return null; } public void setCheckedIconTintResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIconTintResource(i); } } public void setCheckedIconTint(ColorStateList colorStateList) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCheckedIconTint(colorStateList); } } public MotionSpec getShowMotionSpec() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getShowMotionSpec(); } return null; } public void setShowMotionSpecResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setShowMotionSpecResource(i); } } public void setShowMotionSpec(MotionSpec motionSpec) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setShowMotionSpec(motionSpec); } } public MotionSpec getHideMotionSpec() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getHideMotionSpec(); } return null; } public void setHideMotionSpecResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setHideMotionSpecResource(i); } } public void setHideMotionSpec(MotionSpec motionSpec) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setHideMotionSpec(motionSpec); } } public float getChipStartPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipStartPadding(); } return 0.0f; } public void setChipStartPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStartPaddingResource(i); } } public void setChipStartPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipStartPadding(f); } } public float getIconStartPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getIconStartPadding(); } return 0.0f; } public void setIconStartPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setIconStartPaddingResource(i); } } public void setIconStartPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setIconStartPadding(f); } } public float getIconEndPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getIconEndPadding(); } return 0.0f; } public void setIconEndPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setIconEndPaddingResource(i); } } public void setIconEndPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setIconEndPadding(f); } } public float getTextStartPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getTextStartPadding(); } return 0.0f; } public void setTextStartPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextStartPaddingResource(i); } } public void setTextStartPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextStartPadding(f); } } public float getTextEndPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getTextEndPadding(); } return 0.0f; } public void setTextEndPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextEndPaddingResource(i); } } public void setTextEndPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setTextEndPadding(f); } } public float getCloseIconStartPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIconStartPadding(); } return 0.0f; } public void setCloseIconStartPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconStartPaddingResource(i); } } public void setCloseIconStartPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconStartPadding(f); } } public float getCloseIconEndPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getCloseIconEndPadding(); } return 0.0f; } public void setCloseIconEndPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconEndPaddingResource(i); } } public void setCloseIconEndPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setCloseIconEndPadding(f); } } public float getChipEndPadding() { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { return chipDrawable.getChipEndPadding(); } return 0.0f; } public void setChipEndPaddingResource(int i) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipEndPaddingResource(i); } } public void setChipEndPadding(float f) { ChipDrawable chipDrawable = this.chipDrawable; if (chipDrawable != null) { chipDrawable.setChipEndPadding(f); } } public void setEnsureMinTouchTargetSize(boolean z) { this.ensureMinTouchTargetSize = z; ensureAccessibleTouchTarget(this.minTouchTargetSize); } public boolean ensureAccessibleTouchTarget(int i) { this.minTouchTargetSize = i; if (!shouldEnsureMinTouchTargetSize()) { if (this.insetBackgroundDrawable != null) { removeBackgroundInset(); } else { updateBackgroundDrawable(); } return false; } int max = Math.max(0, i - this.chipDrawable.getIntrinsicHeight()); int max2 = Math.max(0, i - this.chipDrawable.getIntrinsicWidth()); if (max2 <= 0 && max <= 0) { if (this.insetBackgroundDrawable != null) { removeBackgroundInset(); } else { updateBackgroundDrawable(); } return false; } int i2 = max2 > 0 ? max2 / 2 : 0; int i3 = max > 0 ? max / 2 : 0; if (this.insetBackgroundDrawable != null) { Rect rect = new Rect(); this.insetBackgroundDrawable.getPadding(rect); if (rect.top == i3 && rect.bottom == i3 && rect.left == i2 && rect.right == i2) { updateBackgroundDrawable(); return true; } } if (getMinHeight() != i) { setMinHeight(i); } if (getMinWidth() != i) { setMinWidth(i); } insetChipBackgroundDrawable(i2, i3, i2, i3); updateBackgroundDrawable(); return true; } @Override // android.widget.CheckBox, android.widget.CompoundButton, android.widget.Button, android.widget.TextView, android.view.View public CharSequence getAccessibilityClassName() { if (!TextUtils.isEmpty(this.accessibilityClassName)) { return this.accessibilityClassName; } if (!isCheckable()) { return isClickable() ? BUTTON_ACCESSIBILITY_CLASS_NAME : "android.view.View"; } ViewParent parent = getParent(); return ((parent instanceof ChipGroup) && ((ChipGroup) parent).isSingleSelection()) ? RADIO_BUTTON_ACCESSIBILITY_CLASS_NAME : BUTTON_ACCESSIBILITY_CLASS_NAME; } private void removeBackgroundInset() { if (this.insetBackgroundDrawable != null) { this.insetBackgroundDrawable = null; setMinWidth(0); setMinHeight((int) getChipMinHeight()); updateBackgroundDrawable(); } } private void insetChipBackgroundDrawable(int i, int i2, int i3, int i4) { this.insetBackgroundDrawable = new InsetDrawable((Drawable) this.chipDrawable, i, i2, i3, i4); } }