Initial commit
This commit is contained in:
157
sources/androidx/constraintlayout/widget/ConstraintHelper.java
Normal file
157
sources/androidx/constraintlayout/widget/ConstraintHelper.java
Normal file
@@ -0,0 +1,157 @@
|
||||
package androidx.constraintlayout.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.solver.widgets.Helper;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ConstraintHelper extends View {
|
||||
protected int[] a;
|
||||
protected int b;
|
||||
protected Context c;
|
||||
protected Helper d;
|
||||
protected boolean e;
|
||||
private String f;
|
||||
|
||||
public ConstraintHelper(Context context) {
|
||||
super(context);
|
||||
this.a = new int[32];
|
||||
this.e = false;
|
||||
this.c = context;
|
||||
a((AttributeSet) null);
|
||||
}
|
||||
|
||||
private void setIds(String str) {
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
int indexOf = str.indexOf(44, i);
|
||||
if (indexOf == -1) {
|
||||
a(str.substring(i));
|
||||
return;
|
||||
} else {
|
||||
a(str.substring(i, indexOf));
|
||||
i = indexOf + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(AttributeSet attributeSet) {
|
||||
if (attributeSet != null) {
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R$styleable.ConstraintLayout_Layout);
|
||||
int indexCount = obtainStyledAttributes.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = obtainStyledAttributes.getIndex(i);
|
||||
if (index == R$styleable.ConstraintLayout_Layout_constraint_referenced_ids) {
|
||||
this.f = obtainStyledAttributes.getString(index);
|
||||
setIds(this.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ConstraintLayout constraintLayout) {
|
||||
}
|
||||
|
||||
public void b(ConstraintLayout constraintLayout) {
|
||||
}
|
||||
|
||||
public void c(ConstraintLayout constraintLayout) {
|
||||
if (isInEditMode()) {
|
||||
setIds(this.f);
|
||||
}
|
||||
Helper helper = this.d;
|
||||
if (helper == null) {
|
||||
return;
|
||||
}
|
||||
helper.J();
|
||||
for (int i = 0; i < this.b; i++) {
|
||||
View a = constraintLayout.a(this.a[i]);
|
||||
if (a != null) {
|
||||
this.d.b(constraintLayout.a(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getReferencedIds() {
|
||||
return Arrays.copyOf(this.a, this.b);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onDraw(Canvas canvas) {
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (this.e) {
|
||||
super.onMeasure(i, i2);
|
||||
} else {
|
||||
setMeasuredDimension(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void setReferencedIds(int[] iArr) {
|
||||
this.b = 0;
|
||||
for (int i : iArr) {
|
||||
setTag(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setTag(int i, Object obj) {
|
||||
int i2 = this.b + 1;
|
||||
int[] iArr = this.a;
|
||||
if (i2 > iArr.length) {
|
||||
this.a = Arrays.copyOf(iArr, iArr.length * 2);
|
||||
}
|
||||
int[] iArr2 = this.a;
|
||||
int i3 = this.b;
|
||||
iArr2[i3] = i;
|
||||
this.b = i3 + 1;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.d == null) {
|
||||
return;
|
||||
}
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof ConstraintLayout.LayoutParams) {
|
||||
((ConstraintLayout.LayoutParams) layoutParams).k0 = this.d;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String str) {
|
||||
int i;
|
||||
Object a;
|
||||
if (str == null || this.c == null) {
|
||||
return;
|
||||
}
|
||||
String trim = str.trim();
|
||||
try {
|
||||
i = R$id.class.getField(trim).getInt(null);
|
||||
} catch (Exception unused) {
|
||||
i = 0;
|
||||
}
|
||||
if (i == 0) {
|
||||
i = this.c.getResources().getIdentifier(trim, JockstickDataConverter.ID, this.c.getPackageName());
|
||||
}
|
||||
if (i == 0 && isInEditMode() && (getParent() instanceof ConstraintLayout) && (a = ((ConstraintLayout) getParent()).a(0, trim)) != null && (a instanceof Integer)) {
|
||||
i = ((Integer) a).intValue();
|
||||
}
|
||||
if (i != 0) {
|
||||
setTag(i, null);
|
||||
return;
|
||||
}
|
||||
Log.w("ConstraintHelper", "Could not find id of \"" + trim + "\"");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user