383 lines
13 KiB
Java
383 lines
13 KiB
Java
package com.google.android.material.chip;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.accessibility.AccessibilityNodeInfo;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
|
import com.google.android.material.internal.FlowLayout;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import o.C16235maC;
|
|
import o.C17052tZT;
|
|
import o.OeX;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ChipGroup extends FlowLayout {
|
|
private static final int d = C17052tZT.NHB.Widget_MaterialComponents_ChipGroup;
|
|
private int a;
|
|
private int b;
|
|
final C16235maC<Chip> c;
|
|
IeS e;
|
|
private final LWm f;
|
|
private final int j;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes2.dex */
|
|
public interface HBt {
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface IeS {
|
|
void c();
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
public static class RVV extends ViewGroup.MarginLayoutParams {
|
|
public RVV(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
}
|
|
|
|
public RVV(ViewGroup.LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
}
|
|
|
|
public RVV() {
|
|
super(-2, -2);
|
|
}
|
|
}
|
|
|
|
public ChipGroup(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public ChipGroup(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, C17052tZT.IeS.chipGroupStyle);
|
|
}
|
|
|
|
/* 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 ChipGroup(android.content.Context r12, android.util.AttributeSet r13, int r14) {
|
|
/*
|
|
r11 = this;
|
|
int r6 = com.google.android.material.chip.ChipGroup.d
|
|
android.content.Context r12 = o.hdZ.MQ_(r12, r13, r14, r6)
|
|
r11.<init>(r12, r13, r14)
|
|
o.maC r12 = new o.maC
|
|
r12.<init>()
|
|
r11.c = r12
|
|
com.google.android.material.chip.ChipGroup$LWm r7 = new com.google.android.material.chip.ChipGroup$LWm
|
|
r8 = 0
|
|
r7.<init>(r11, r8)
|
|
r11.f = r7
|
|
android.content.Context r9 = r11.getContext()
|
|
int[] r10 = o.C17052tZT.jNh.ChipGroup
|
|
int[] r5 = new int[r8]
|
|
o.uqW.Kb_(r9, r13, r14, r6)
|
|
r0 = r9
|
|
r1 = r13
|
|
r2 = r10
|
|
r3 = r14
|
|
r4 = r6
|
|
o.uqW.Kc_(r0, r1, r2, r3, r4, r5)
|
|
android.content.res.TypedArray r13 = r9.obtainStyledAttributes(r13, r10, r14, r6)
|
|
int r14 = o.C17052tZT.jNh.ChipGroup_chipSpacing
|
|
int r14 = r13.getDimensionPixelOffset(r14, r8)
|
|
int r0 = o.C17052tZT.jNh.ChipGroup_chipSpacingHorizontal
|
|
int r0 = r13.getDimensionPixelOffset(r0, r14)
|
|
r11.setChipSpacingHorizontal(r0)
|
|
int r0 = o.C17052tZT.jNh.ChipGroup_chipSpacingVertical
|
|
int r14 = r13.getDimensionPixelOffset(r0, r14)
|
|
r11.setChipSpacingVertical(r14)
|
|
int r14 = o.C17052tZT.jNh.ChipGroup_singleLine
|
|
boolean r14 = r13.getBoolean(r14, r8)
|
|
r11.setSingleLine(r14)
|
|
int r14 = o.C17052tZT.jNh.ChipGroup_singleSelection
|
|
boolean r14 = r13.getBoolean(r14, r8)
|
|
r11.setSingleSelection(r14)
|
|
int r14 = o.C17052tZT.jNh.ChipGroup_selectionRequired
|
|
boolean r14 = r13.getBoolean(r14, r8)
|
|
r11.setSelectionRequired(r14)
|
|
int r14 = o.C17052tZT.jNh.ChipGroup_checkedChip
|
|
r0 = -1
|
|
int r14 = r13.getResourceId(r14, r0)
|
|
r11.j = r14
|
|
r13.recycle()
|
|
com.google.android.material.chip.ChipGroup$5 r13 = new com.google.android.material.chip.ChipGroup$5
|
|
r13.<init>(r11)
|
|
r12.b = r13
|
|
super.setOnHierarchyChangeListener(r7)
|
|
r12 = 1
|
|
androidx.core.view.ViewCompat.g(r11, r12)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.chip.ChipGroup.<init>(android.content.Context, android.util.AttributeSet, int):void");
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
|
int i;
|
|
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
|
AccessibilityNodeInfoCompat tU_ = AccessibilityNodeInfoCompat.tU_(accessibilityNodeInfo);
|
|
if (super.a()) {
|
|
i = 0;
|
|
for (int i2 = 0; i2 < getChildCount(); i2++) {
|
|
if ((getChildAt(i2) instanceof Chip) && getChildAt(i2).getVisibility() == 0) {
|
|
i++;
|
|
}
|
|
}
|
|
} else {
|
|
i = -1;
|
|
}
|
|
tU_.e(AccessibilityNodeInfoCompat.CollectionInfoCompat.e(e(), i, false, this.c.a ? 1 : 2));
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new RVV(getContext(), attributeSet);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return new RVV(layoutParams);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
|
return new RVV();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return super.checkLayoutParams(layoutParams) && (layoutParams instanceof RVV);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onFinishInflate() {
|
|
C16235maC.HBt hBt;
|
|
super.onFinishInflate();
|
|
int i = this.j;
|
|
if (i != -1) {
|
|
C16235maC<Chip> c16235maC = this.c;
|
|
Chip chip = c16235maC.e.get(Integer.valueOf(i));
|
|
if (chip == null || !c16235maC.b(chip) || (hBt = c16235maC.b) == null) {
|
|
return;
|
|
}
|
|
new HashSet(c16235maC.c);
|
|
hBt.e();
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
public void setDividerDrawableHorizontal(Drawable drawable) {
|
|
throw new UnsupportedOperationException("Changing divider drawables have no effect. ChipGroup do not use divider drawables as spacing.");
|
|
}
|
|
|
|
@Deprecated
|
|
public void setDividerDrawableVertical(Drawable drawable) {
|
|
throw new UnsupportedOperationException("Changing divider drawables have no effect. ChipGroup do not use divider drawables as spacing.");
|
|
}
|
|
|
|
@Deprecated
|
|
public void setShowDividerHorizontal(int i) {
|
|
throw new UnsupportedOperationException("Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
|
|
}
|
|
|
|
@Deprecated
|
|
public void setShowDividerVertical(int i) {
|
|
throw new UnsupportedOperationException("Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
|
|
}
|
|
|
|
@Deprecated
|
|
public void setFlexWrap(int i) {
|
|
throw new UnsupportedOperationException("Changing flex wrap not allowed. ChipGroup exposes a singleLine attribute instead.");
|
|
}
|
|
|
|
@Deprecated
|
|
public void setOnCheckedChangeListener(HBt hBt) {
|
|
if (hBt == null) {
|
|
setOnCheckedStateChangeListener(null);
|
|
} else {
|
|
setOnCheckedStateChangeListener(new IeS(this, hBt) { // from class: com.google.android.material.chip.ChipGroup.4
|
|
private ChipGroup b;
|
|
private HBt e;
|
|
|
|
{
|
|
this.b = this;
|
|
this.e = hBt;
|
|
}
|
|
|
|
@Override // com.google.android.material.chip.ChipGroup.IeS
|
|
public final void c() {
|
|
if (this.b.c.a) {
|
|
this.b.c.d();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public void setChipSpacing(int i) {
|
|
setChipSpacingHorizontal(i);
|
|
setChipSpacingVertical(i);
|
|
}
|
|
|
|
public void setChipSpacingResource(int i) {
|
|
setChipSpacing(getResources().getDimensionPixelOffset(i));
|
|
}
|
|
|
|
public void setChipSpacingHorizontal(int i) {
|
|
if (this.a != i) {
|
|
this.a = i;
|
|
e(i);
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
public void setChipSpacingHorizontalResource(int i) {
|
|
setChipSpacingHorizontal(getResources().getDimensionPixelOffset(i));
|
|
}
|
|
|
|
public void setChipSpacingVertical(int i) {
|
|
if (this.b != i) {
|
|
this.b = i;
|
|
d(i);
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
public void setChipSpacingVerticalResource(int i) {
|
|
setChipSpacingVertical(getResources().getDimensionPixelOffset(i));
|
|
}
|
|
|
|
@Override // com.google.android.material.internal.FlowLayout
|
|
public final boolean a() {
|
|
return super.a();
|
|
}
|
|
|
|
@Override // com.google.android.material.internal.FlowLayout
|
|
public void setSingleLine(boolean z) {
|
|
super.setSingleLine(z);
|
|
}
|
|
|
|
public void setSingleLine(int i) {
|
|
setSingleLine(getResources().getBoolean(i));
|
|
}
|
|
|
|
public void setSingleSelection(boolean z) {
|
|
C16235maC.HBt hBt;
|
|
C16235maC<Chip> c16235maC = this.c;
|
|
if (c16235maC.a != z) {
|
|
c16235maC.a = z;
|
|
boolean isEmpty = c16235maC.c.isEmpty();
|
|
Iterator<Chip> it = c16235maC.e.values().iterator();
|
|
while (it.hasNext()) {
|
|
c16235maC.a(it.next(), false);
|
|
}
|
|
if (!(!isEmpty) || (hBt = c16235maC.b) == null) {
|
|
return;
|
|
}
|
|
new HashSet(c16235maC.c);
|
|
hBt.e();
|
|
}
|
|
}
|
|
|
|
public void setSingleSelection(int i) {
|
|
setSingleSelection(getResources().getBoolean(i));
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
class LWm implements ViewGroup.OnHierarchyChangeListener {
|
|
ViewGroup.OnHierarchyChangeListener c;
|
|
private ChipGroup e;
|
|
|
|
private LWm(ChipGroup chipGroup) {
|
|
this.e = chipGroup;
|
|
}
|
|
|
|
/* synthetic */ LWm(ChipGroup chipGroup, byte b) {
|
|
this(chipGroup);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup.OnHierarchyChangeListener
|
|
public final void onChildViewAdded(View view, View view2) {
|
|
if (view == this.e && (view2 instanceof Chip)) {
|
|
if (view2.getId() == -1) {
|
|
view2.setId(ViewCompat.a());
|
|
}
|
|
C16235maC<Chip> c16235maC = this.e.c;
|
|
Chip chip = (Chip) view2;
|
|
c16235maC.e.put(Integer.valueOf(chip.getId()), chip);
|
|
if (chip.isChecked()) {
|
|
c16235maC.b(chip);
|
|
}
|
|
chip.setInternalOnCheckedChangeListener(new OeX.HBt<T>(c16235maC) { // from class: o.maC.2
|
|
private C16235maC e;
|
|
|
|
public AnonymousClass2(C16235maC c16235maC2) {
|
|
this.e = c16235maC2;
|
|
}
|
|
|
|
@Override // o.OeX.HBt
|
|
public final /* synthetic */ void a(Object obj, boolean z) {
|
|
OeX<T> oeX = (OeX) obj;
|
|
if (!z) {
|
|
C16235maC c16235maC2 = this.e;
|
|
if (!c16235maC2.a(oeX, c16235maC2.d)) {
|
|
return;
|
|
}
|
|
} else if (!this.e.b(oeX)) {
|
|
return;
|
|
}
|
|
C16235maC c16235maC3 = this.e;
|
|
HBt hBt = c16235maC3.b;
|
|
if (hBt != null) {
|
|
new HashSet(c16235maC3.c);
|
|
hBt.e();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener = this.c;
|
|
if (onHierarchyChangeListener != null) {
|
|
onHierarchyChangeListener.onChildViewAdded(view, view2);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup.OnHierarchyChangeListener
|
|
public final void onChildViewRemoved(View view, View view2) {
|
|
ChipGroup chipGroup = this.e;
|
|
if (view == chipGroup && (view2 instanceof Chip)) {
|
|
C16235maC<Chip> c16235maC = chipGroup.c;
|
|
Chip chip = (Chip) view2;
|
|
chip.setInternalOnCheckedChangeListener(null);
|
|
c16235maC.e.remove(Integer.valueOf(chip.getId()));
|
|
c16235maC.c.remove(Integer.valueOf(chip.getId()));
|
|
}
|
|
ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener = this.c;
|
|
if (onHierarchyChangeListener != null) {
|
|
onHierarchyChangeListener.onChildViewRemoved(view, view2);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener) {
|
|
this.f.c = onHierarchyChangeListener;
|
|
}
|
|
|
|
public void setSelectionRequired(boolean z) {
|
|
this.c.d = z;
|
|
}
|
|
|
|
public void setOnCheckedStateChangeListener(IeS ieS) {
|
|
this.e = ieS;
|
|
}
|
|
}
|