96 lines
3.1 KiB
Java
96 lines
3.1 KiB
Java
package androidx.constraintlayout.solver.widgets;
|
|
|
|
import androidx.constraintlayout.solver.Cache;
|
|
import java.util.ArrayList;
|
|
/* loaded from: classes.dex */
|
|
public class WidgetContainer extends ConstraintWidget {
|
|
public ArrayList<ConstraintWidget> mChildren = new ArrayList<>();
|
|
|
|
public WidgetContainer() {
|
|
}
|
|
|
|
public WidgetContainer(int i, int i2) {
|
|
super(i, i2);
|
|
}
|
|
|
|
public WidgetContainer(int i, int i2, int i3, int i4) {
|
|
super(i, i2, i3, i4);
|
|
}
|
|
|
|
public void add(ConstraintWidget constraintWidget) {
|
|
this.mChildren.add(constraintWidget);
|
|
if (constraintWidget.getParent() != null) {
|
|
((WidgetContainer) constraintWidget.getParent()).remove(constraintWidget);
|
|
}
|
|
constraintWidget.setParent(this);
|
|
}
|
|
|
|
public void add(ConstraintWidget... constraintWidgetArr) {
|
|
for (ConstraintWidget constraintWidget : constraintWidgetArr) {
|
|
add(constraintWidget);
|
|
}
|
|
}
|
|
|
|
public ArrayList<ConstraintWidget> getChildren() {
|
|
return this.mChildren;
|
|
}
|
|
|
|
public ConstraintWidgetContainer getRootConstraintContainer() {
|
|
ConstraintWidget parent = getParent();
|
|
ConstraintWidgetContainer constraintWidgetContainer = this instanceof ConstraintWidgetContainer ? (ConstraintWidgetContainer) this : null;
|
|
while (parent != null) {
|
|
parent = parent.getParent();
|
|
if (parent instanceof ConstraintWidgetContainer) {
|
|
constraintWidgetContainer = (ConstraintWidgetContainer) parent;
|
|
}
|
|
}
|
|
return constraintWidgetContainer;
|
|
}
|
|
|
|
public void layout() {
|
|
ArrayList<ConstraintWidget> arrayList = this.mChildren;
|
|
if (arrayList != null) {
|
|
int size = arrayList.size();
|
|
for (int i = 0; i < size; i++) {
|
|
ConstraintWidget constraintWidget = this.mChildren.get(i);
|
|
if (constraintWidget instanceof WidgetContainer) {
|
|
((WidgetContainer) constraintWidget).layout();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void remove(ConstraintWidget constraintWidget) {
|
|
this.mChildren.remove(constraintWidget);
|
|
constraintWidget.reset();
|
|
}
|
|
|
|
public void removeAllChildren() {
|
|
this.mChildren.clear();
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
|
|
public void reset() {
|
|
this.mChildren.clear();
|
|
super.reset();
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
|
|
public void resetSolverVariables(Cache cache) {
|
|
super.resetSolverVariables(cache);
|
|
int size = this.mChildren.size();
|
|
for (int i = 0; i < size; i++) {
|
|
this.mChildren.get(i).resetSolverVariables(cache);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.widgets.ConstraintWidget
|
|
public void setOffset(int i, int i2) {
|
|
super.setOffset(i, i2);
|
|
int size = this.mChildren.size();
|
|
for (int i3 = 0; i3 < size; i3++) {
|
|
this.mChildren.get(i3).setOffset(getRootX(), getRootY());
|
|
}
|
|
}
|
|
}
|