what-the-bank/sources/androidx/constraintlayout/widget/ConstraintHelper.java

388 lines
12 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package androidx.constraintlayout.widget;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.Arrays;
import java.util.HashMap;
import o.C17026tNn;
import o.C3345avm;
import o.InterfaceC15462grE;
import o.NsV;
import o.WqU;
import o.yqQ;
import org.simpleframework.xml.strategy.Name;
/* loaded from: classes.dex */
public abstract class ConstraintHelper extends View {
private HashMap<Integer, String> a;
public InterfaceC15462grE b;
public int c;
private String d;
private String e;
private View[] g;
protected boolean h;
protected int[] i;
private Context j;
public void a() {
}
public void b(ConstraintLayout constraintLayout) {
}
public void e(C17026tNn c17026tNn, boolean z) {
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
}
public ConstraintHelper(Context context) {
super(context);
this.i = new int[32];
this.h = false;
this.g = null;
this.a = new HashMap<>();
this.j = context;
lt_(null);
}
public ConstraintHelper(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.i = new int[32];
this.h = false;
this.g = null;
this.a = new HashMap<>();
this.j = context;
lt_(attributeSet);
}
public ConstraintHelper(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.i = new int[32];
this.h = false;
this.g = null;
this.a = new HashMap<>();
this.j = context;
lt_(attributeSet);
}
public void lt_(AttributeSet attributeSet) {
if (attributeSet != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, C3345avm.IeS.ConstraintLayout_Layout);
int indexCount = obtainStyledAttributes.getIndexCount();
for (int i = 0; i < indexCount; i++) {
int index = obtainStyledAttributes.getIndex(i);
if (index == C3345avm.IeS.ConstraintLayout_Layout_constraint_referenced_ids) {
String string = obtainStyledAttributes.getString(index);
this.e = string;
a(string);
} else if (index == C3345avm.IeS.ConstraintLayout_Layout_constraint_referenced_tags) {
String string2 = obtainStyledAttributes.getString(index);
this.d = string2;
b(string2);
}
}
obtainStyledAttributes.recycle();
}
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
String str = this.e;
if (str != null) {
a(str);
}
String str2 = this.d;
if (str2 != null) {
b(str2);
}
}
public final int[] e() {
return Arrays.copyOf(this.i, this.c);
}
public void setReferencedIds(int[] iArr) {
this.e = null;
this.c = 0;
for (int i : iArr) {
c(i);
}
}
private void c(int i) {
if (i == getId()) {
return;
}
int i2 = this.c;
int[] iArr = this.i;
if (i2 + 1 > iArr.length) {
this.i = Arrays.copyOf(iArr, iArr.length << 1);
}
int[] iArr2 = this.i;
int i3 = this.c;
iArr2[i3] = i;
this.c = i3 + 1;
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
setMeasuredDimension(0, 0);
}
public final void d() {
if (this.b == null) {
return;
}
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof ConstraintLayout.Sts) {
((ConstraintLayout.Sts) layoutParams).as = (C17026tNn) this.b;
}
}
private void c(String str) {
if (str == null || str.length() == 0 || this.j == null) {
return;
}
String trim = str.trim();
if (getParent() instanceof ConstraintLayout) {
}
int d = d(trim);
if (d != 0) {
this.a.put(Integer.valueOf(d), trim);
c(d);
}
}
private void e(String str) {
if (str == null || str.length() == 0 || this.j == null) {
return;
}
String trim = str.trim();
ConstraintLayout constraintLayout = getParent() instanceof ConstraintLayout ? (ConstraintLayout) getParent() : null;
if (constraintLayout == null) {
return;
}
int childCount = constraintLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = constraintLayout.getChildAt(i);
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
if ((layoutParams instanceof ConstraintLayout.Sts) && trim.equals(((ConstraintLayout.Sts) layoutParams).f6383o) && childAt.getId() != -1) {
c(childAt.getId());
}
}
}
private int d(String str) {
ConstraintLayout constraintLayout = getParent() instanceof ConstraintLayout ? (ConstraintLayout) getParent() : null;
int i = 0;
if (isInEditMode() && constraintLayout != null) {
Object e = constraintLayout.e(str);
if (e instanceof Integer) {
i = ((Integer) e).intValue();
}
}
if (i == 0 && constraintLayout != null) {
i = b(constraintLayout, str);
}
if (i == 0) {
try {
i = C3345avm.RVV.class.getField(str).getInt(null);
} catch (Exception unused) {
}
}
return i == 0 ? this.j.getResources().getIdentifier(str, Name.MARK, this.j.getPackageName()) : i;
}
private int b(ConstraintLayout constraintLayout, String str) {
Resources resources;
String str2;
if (str == null || constraintLayout == null || (resources = this.j.getResources()) == null) {
return 0;
}
int childCount = constraintLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = constraintLayout.getChildAt(i);
if (childAt.getId() != -1) {
try {
str2 = resources.getResourceEntryName(childAt.getId());
} catch (Resources.NotFoundException unused) {
str2 = null;
}
if (str.equals(str2)) {
return childAt.getId();
}
}
}
return 0;
}
private void a(String str) {
this.e = str;
if (str == null) {
return;
}
int i = 0;
this.c = 0;
while (true) {
int indexOf = str.indexOf(44, i);
if (indexOf == -1) {
c(str.substring(i));
return;
} else {
c(str.substring(i, indexOf));
i = indexOf + 1;
}
}
}
private void b(String str) {
this.d = str;
if (str == null) {
return;
}
int i = 0;
this.c = 0;
while (true) {
int indexOf = str.indexOf(44, i);
if (indexOf == -1) {
e(str.substring(i));
return;
} else {
e(str.substring(i, indexOf));
i = indexOf + 1;
}
}
}
/* JADX INFO: Access modifiers changed from: protected */
public final void d(ConstraintLayout constraintLayout) {
int visibility = getVisibility();
float elevation = getElevation();
for (int i = 0; i < this.c; i++) {
View view = constraintLayout.w.get(this.i[i]);
if (view != null) {
view.setVisibility(visibility);
if (elevation > BitmapDescriptorFactory.HUE_RED) {
view.setTranslationZ(view.getTranslationZ() + elevation);
}
}
}
}
/* JADX INFO: Access modifiers changed from: protected */
public final void c() {
ViewParent parent = getParent();
if (parent == null || !(parent instanceof ConstraintLayout)) {
return;
}
d((ConstraintLayout) parent);
}
public final void c(ConstraintLayout constraintLayout) {
String str;
int b;
if (isInEditMode()) {
a(this.e);
}
InterfaceC15462grE interfaceC15462grE = this.b;
if (interfaceC15462grE == null) {
return;
}
interfaceC15462grE.b();
for (int i = 0; i < this.c; i++) {
int i2 = this.i[i];
View view = constraintLayout.w.get(i2);
if (view == null && (b = b(constraintLayout, (str = this.a.get(Integer.valueOf(i2))))) != 0) {
this.i[i] = b;
this.a.put(Integer.valueOf(b), str);
view = constraintLayout.w.get(b);
}
if (view != null) {
this.b.c(constraintLayout.e(view));
}
}
InterfaceC15462grE interfaceC15462grE2 = this.b;
WqU wqU = constraintLayout.z;
interfaceC15462grE2.j();
}
public final void lf_(InterfaceC15462grE interfaceC15462grE, SparseArray<C17026tNn> sparseArray) {
interfaceC15462grE.b();
for (int i = 0; i < this.c; i++) {
interfaceC15462grE.c(sparseArray.get(this.i[i]));
}
}
/* JADX INFO: Access modifiers changed from: protected */
public final View[] e(ConstraintLayout constraintLayout) {
View[] viewArr = this.g;
if (viewArr == null || viewArr.length != this.c) {
this.g = new View[this.c];
}
for (int i = 0; i < this.c; i++) {
this.g[i] = constraintLayout.w.get(this.i[i]);
}
return this.g;
}
public void le_(yqQ.Sts sts, NsV nsV, ConstraintLayout.Sts sts2, SparseArray<C17026tNn> sparseArray) {
if (sts.a.T != null) {
setReferencedIds(sts.a.T);
} else if (sts.a.V != null) {
if (sts.a.V.length() > 0) {
yqQ.IeS ieS = sts.a;
String[] split = sts.a.V.split(",");
getContext();
int[] iArr = new int[split.length];
int i = 0;
for (String str : split) {
int d = d(str.trim());
if (d != 0) {
iArr[i] = d;
i++;
}
}
if (i != split.length) {
iArr = Arrays.copyOf(iArr, i);
}
ieS.T = iArr;
} else {
sts.a.T = null;
}
}
if (nsV != null) {
nsV.aF = 0;
Arrays.fill(nsV.aD, (Object) null);
if (sts.a.T != null) {
for (int i2 = 0; i2 < sts.a.T.length; i2++) {
C17026tNn c17026tNn = sparseArray.get(sts.a.T[i2]);
if (c17026tNn != null) {
nsV.c(c17026tNn);
}
}
}
}
}
@Override // android.view.View
public void setTag(int i, Object obj) {
super.setTag(i, obj);
if (obj == null && this.e == null) {
c(i);
}
}
}