Rabbit-R1/android (non root)/java/sources/androidx/constraintlayout/solver/widgets/analyzer/ChainRun.java
2024-05-21 17:08:36 -04:00

209 lines
8.2 KiB
Java

package androidx.constraintlayout.solver.widgets.analyzer;
import androidx.constraintlayout.solver.widgets.ConstraintAnchor;
import androidx.constraintlayout.solver.widgets.ConstraintWidget;
import androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class ChainRun extends WidgetRun {
private int chainStyle;
ArrayList<WidgetRun> widgets;
public ChainRun(ConstraintWidget constraintWidget, int i) {
super(constraintWidget);
this.widgets = new ArrayList<>();
this.orientation = i;
build();
}
public String toString() {
String concat = "ChainRun ".concat(this.orientation == 0 ? "horizontal : " : "vertical : ");
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
concat = ((concat + "<") + it.next()) + "> ";
}
return concat;
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
boolean supportsWrapComputation() {
int size = this.widgets.size();
for (int i = 0; i < size; i++) {
if (!this.widgets.get(i).supportsWrapComputation()) {
return false;
}
}
return true;
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
public long getWrapDimension() {
int size = this.widgets.size();
long j = 0;
for (int i = 0; i < size; i++) {
j = j + r4.start.margin + this.widgets.get(i).getWrapDimension() + r4.end.margin;
}
return j;
}
private void build() {
ConstraintWidget constraintWidget;
ConstraintWidget constraintWidget2 = this.widget;
ConstraintWidget previousChainMember = constraintWidget2.getPreviousChainMember(this.orientation);
while (true) {
ConstraintWidget constraintWidget3 = previousChainMember;
constraintWidget = constraintWidget2;
constraintWidget2 = constraintWidget3;
if (constraintWidget2 == null) {
break;
} else {
previousChainMember = constraintWidget2.getPreviousChainMember(this.orientation);
}
}
this.widget = constraintWidget;
this.widgets.add(constraintWidget.getRun(this.orientation));
ConstraintWidget nextChainMember = constraintWidget.getNextChainMember(this.orientation);
while (nextChainMember != null) {
this.widgets.add(nextChainMember.getRun(this.orientation));
nextChainMember = nextChainMember.getNextChainMember(this.orientation);
}
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
WidgetRun next = it.next();
if (this.orientation == 0) {
next.widget.horizontalChainRun = this;
} else if (this.orientation == 1) {
next.widget.verticalChainRun = this;
}
}
if (this.orientation == 0 && ((ConstraintWidgetContainer) this.widget.getParent()).isRtl() && this.widgets.size() > 1) {
ArrayList<WidgetRun> arrayList = this.widgets;
this.widget = arrayList.get(arrayList.size() - 1).widget;
}
this.chainStyle = this.orientation == 0 ? this.widget.getHorizontalChainStyle() : this.widget.getVerticalChainStyle();
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
void clear() {
this.runGroup = null;
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
it.next().clear();
}
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
void reset() {
this.start.resolved = false;
this.end.resolved = false;
}
/* JADX WARN: Code restructure failed: missing block: B:292:0x040e, code lost:
r3 = r3 - r9;
*/
/* JADX WARN: Code restructure failed: missing block: B:70:0x00cf, code lost:
if (r2.dimension.resolved != false) goto L59;
*/
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun, androidx.constraintlayout.solver.widgets.analyzer.Dependency
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void update(androidx.constraintlayout.solver.widgets.analyzer.Dependency r23) {
/*
Method dump skipped, instructions count: 1078
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.solver.widgets.analyzer.ChainRun.update(androidx.constraintlayout.solver.widgets.analyzer.Dependency):void");
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
public void applyToWidget() {
for (int i = 0; i < this.widgets.size(); i++) {
this.widgets.get(i).applyToWidget();
}
}
private ConstraintWidget getFirstVisibleWidget() {
for (int i = 0; i < this.widgets.size(); i++) {
WidgetRun widgetRun = this.widgets.get(i);
if (widgetRun.widget.getVisibility() != 8) {
return widgetRun.widget;
}
}
return null;
}
private ConstraintWidget getLastVisibleWidget() {
for (int size = this.widgets.size() - 1; size >= 0; size--) {
WidgetRun widgetRun = this.widgets.get(size);
if (widgetRun.widget.getVisibility() != 8) {
return widgetRun.widget;
}
}
return null;
}
@Override // androidx.constraintlayout.solver.widgets.analyzer.WidgetRun
void apply() {
Iterator<WidgetRun> it = this.widgets.iterator();
while (it.hasNext()) {
it.next().apply();
}
int size = this.widgets.size();
if (size < 1) {
return;
}
ConstraintWidget constraintWidget = this.widgets.get(0).widget;
ConstraintWidget constraintWidget2 = this.widgets.get(size - 1).widget;
if (this.orientation == 0) {
ConstraintAnchor constraintAnchor = constraintWidget.mLeft;
ConstraintAnchor constraintAnchor2 = constraintWidget2.mRight;
DependencyNode target = getTarget(constraintAnchor, 0);
int margin = constraintAnchor.getMargin();
ConstraintWidget firstVisibleWidget = getFirstVisibleWidget();
if (firstVisibleWidget != null) {
margin = firstVisibleWidget.mLeft.getMargin();
}
if (target != null) {
addTarget(this.start, target, margin);
}
DependencyNode target2 = getTarget(constraintAnchor2, 0);
int margin2 = constraintAnchor2.getMargin();
ConstraintWidget lastVisibleWidget = getLastVisibleWidget();
if (lastVisibleWidget != null) {
margin2 = lastVisibleWidget.mRight.getMargin();
}
if (target2 != null) {
addTarget(this.end, target2, -margin2);
}
} else {
ConstraintAnchor constraintAnchor3 = constraintWidget.mTop;
ConstraintAnchor constraintAnchor4 = constraintWidget2.mBottom;
DependencyNode target3 = getTarget(constraintAnchor3, 1);
int margin3 = constraintAnchor3.getMargin();
ConstraintWidget firstVisibleWidget2 = getFirstVisibleWidget();
if (firstVisibleWidget2 != null) {
margin3 = firstVisibleWidget2.mTop.getMargin();
}
if (target3 != null) {
addTarget(this.start, target3, margin3);
}
DependencyNode target4 = getTarget(constraintAnchor4, 1);
int margin4 = constraintAnchor4.getMargin();
ConstraintWidget lastVisibleWidget2 = getLastVisibleWidget();
if (lastVisibleWidget2 != null) {
margin4 = lastVisibleWidget2.mBottom.getMargin();
}
if (target4 != null) {
addTarget(this.end, target4, -margin4);
}
}
this.start.updateDelegate = this;
this.end.updateDelegate = this;
}
}