ADD week 5

This commit is contained in:
2025-03-31 16:33:42 +02:00
parent 86f265f22d
commit bf645048e6
4927 changed files with 544053 additions and 0 deletions

View File

@ -0,0 +1,462 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import androidx.constraintlayout.motion.widget.MotionHelper;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.motion.widget.MotionScene;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.R;
import androidx.recyclerview.widget.ItemTouchHelper;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class Carousel extends MotionHelper {
private static final boolean DEBUG = false;
private static final String TAG = "Carousel";
public static final int TOUCH_UP_CARRY_ON = 2;
public static final int TOUCH_UP_IMMEDIATE_STOP = 1;
private int backwardTransition;
private float dampening;
private int emptyViewBehavior;
private int firstViewReference;
private int forwardTransition;
private boolean infiniteCarousel;
private Adapter mAdapter;
private int mAnimateTargetDelay;
private int mIndex;
int mLastStartId;
private final ArrayList<View> mList;
private MotionLayout mMotionLayout;
private int mPreviousIndex;
private int mTargetIndex;
Runnable mUpdateRunnable;
private int nextState;
private int previousState;
private int startIndex;
private int touchUpMode;
private float velocityThreshold;
public interface Adapter {
int count();
void onNewItem(int index);
void populate(View view, int index);
}
public int getCurrentIndex() {
return this.mIndex;
}
@Override // androidx.constraintlayout.motion.widget.MotionHelper, androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
public void onTransitionChange(MotionLayout motionLayout, int startId, int endId, float progress) {
this.mLastStartId = startId;
}
public void setAdapter(Adapter adapter) {
this.mAdapter = adapter;
}
public Carousel(Context context) {
super(context);
this.mAdapter = null;
this.mList = new ArrayList<>();
this.mPreviousIndex = 0;
this.mIndex = 0;
this.firstViewReference = -1;
this.infiniteCarousel = false;
this.backwardTransition = -1;
this.forwardTransition = -1;
this.previousState = -1;
this.nextState = -1;
this.dampening = 0.9f;
this.startIndex = 0;
this.emptyViewBehavior = 4;
this.touchUpMode = 1;
this.velocityThreshold = 2.0f;
this.mTargetIndex = -1;
this.mAnimateTargetDelay = ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION;
this.mLastStartId = -1;
this.mUpdateRunnable = new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.setProgress(0.0f);
Carousel.this.updateItems();
Carousel.this.mAdapter.onNewItem(Carousel.this.mIndex);
float velocity = Carousel.this.mMotionLayout.getVelocity();
if (Carousel.this.touchUpMode != 2 || velocity <= Carousel.this.velocityThreshold || Carousel.this.mIndex >= Carousel.this.mAdapter.count() - 1) {
return;
}
final float f = velocity * Carousel.this.dampening;
if (Carousel.this.mIndex != 0 || Carousel.this.mPreviousIndex <= Carousel.this.mIndex) {
if (Carousel.this.mIndex != Carousel.this.mAdapter.count() - 1 || Carousel.this.mPreviousIndex >= Carousel.this.mIndex) {
Carousel.this.mMotionLayout.post(new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.touchAnimateTo(5, 1.0f, f);
}
});
}
}
}
};
}
public Carousel(Context context, AttributeSet attrs) {
super(context, attrs);
this.mAdapter = null;
this.mList = new ArrayList<>();
this.mPreviousIndex = 0;
this.mIndex = 0;
this.firstViewReference = -1;
this.infiniteCarousel = false;
this.backwardTransition = -1;
this.forwardTransition = -1;
this.previousState = -1;
this.nextState = -1;
this.dampening = 0.9f;
this.startIndex = 0;
this.emptyViewBehavior = 4;
this.touchUpMode = 1;
this.velocityThreshold = 2.0f;
this.mTargetIndex = -1;
this.mAnimateTargetDelay = ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION;
this.mLastStartId = -1;
this.mUpdateRunnable = new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.setProgress(0.0f);
Carousel.this.updateItems();
Carousel.this.mAdapter.onNewItem(Carousel.this.mIndex);
float velocity = Carousel.this.mMotionLayout.getVelocity();
if (Carousel.this.touchUpMode != 2 || velocity <= Carousel.this.velocityThreshold || Carousel.this.mIndex >= Carousel.this.mAdapter.count() - 1) {
return;
}
final float f = velocity * Carousel.this.dampening;
if (Carousel.this.mIndex != 0 || Carousel.this.mPreviousIndex <= Carousel.this.mIndex) {
if (Carousel.this.mIndex != Carousel.this.mAdapter.count() - 1 || Carousel.this.mPreviousIndex >= Carousel.this.mIndex) {
Carousel.this.mMotionLayout.post(new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.touchAnimateTo(5, 1.0f, f);
}
});
}
}
}
};
init(context, attrs);
}
public Carousel(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mAdapter = null;
this.mList = new ArrayList<>();
this.mPreviousIndex = 0;
this.mIndex = 0;
this.firstViewReference = -1;
this.infiniteCarousel = false;
this.backwardTransition = -1;
this.forwardTransition = -1;
this.previousState = -1;
this.nextState = -1;
this.dampening = 0.9f;
this.startIndex = 0;
this.emptyViewBehavior = 4;
this.touchUpMode = 1;
this.velocityThreshold = 2.0f;
this.mTargetIndex = -1;
this.mAnimateTargetDelay = ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION;
this.mLastStartId = -1;
this.mUpdateRunnable = new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.setProgress(0.0f);
Carousel.this.updateItems();
Carousel.this.mAdapter.onNewItem(Carousel.this.mIndex);
float velocity = Carousel.this.mMotionLayout.getVelocity();
if (Carousel.this.touchUpMode != 2 || velocity <= Carousel.this.velocityThreshold || Carousel.this.mIndex >= Carousel.this.mAdapter.count() - 1) {
return;
}
final float f = velocity * Carousel.this.dampening;
if (Carousel.this.mIndex != 0 || Carousel.this.mPreviousIndex <= Carousel.this.mIndex) {
if (Carousel.this.mIndex != Carousel.this.mAdapter.count() - 1 || Carousel.this.mPreviousIndex >= Carousel.this.mIndex) {
Carousel.this.mMotionLayout.post(new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel.1.1
@Override // java.lang.Runnable
public void run() {
Carousel.this.mMotionLayout.touchAnimateTo(5, 1.0f, f);
}
});
}
}
}
};
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, R.styleable.Carousel);
int indexCount = obtainStyledAttributes.getIndexCount();
for (int i = 0; i < indexCount; i++) {
int index = obtainStyledAttributes.getIndex(i);
if (index == R.styleable.Carousel_carousel_firstView) {
this.firstViewReference = obtainStyledAttributes.getResourceId(index, this.firstViewReference);
} else if (index == R.styleable.Carousel_carousel_backwardTransition) {
this.backwardTransition = obtainStyledAttributes.getResourceId(index, this.backwardTransition);
} else if (index == R.styleable.Carousel_carousel_forwardTransition) {
this.forwardTransition = obtainStyledAttributes.getResourceId(index, this.forwardTransition);
} else if (index == R.styleable.Carousel_carousel_emptyViewsBehavior) {
this.emptyViewBehavior = obtainStyledAttributes.getInt(index, this.emptyViewBehavior);
} else if (index == R.styleable.Carousel_carousel_previousState) {
this.previousState = obtainStyledAttributes.getResourceId(index, this.previousState);
} else if (index == R.styleable.Carousel_carousel_nextState) {
this.nextState = obtainStyledAttributes.getResourceId(index, this.nextState);
} else if (index == R.styleable.Carousel_carousel_touchUp_dampeningFactor) {
this.dampening = obtainStyledAttributes.getFloat(index, this.dampening);
} else if (index == R.styleable.Carousel_carousel_touchUpMode) {
this.touchUpMode = obtainStyledAttributes.getInt(index, this.touchUpMode);
} else if (index == R.styleable.Carousel_carousel_touchUp_velocityThreshold) {
this.velocityThreshold = obtainStyledAttributes.getFloat(index, this.velocityThreshold);
} else if (index == R.styleable.Carousel_carousel_infinite) {
this.infiniteCarousel = obtainStyledAttributes.getBoolean(index, this.infiniteCarousel);
}
}
obtainStyledAttributes.recycle();
}
}
public int getCount() {
Adapter adapter = this.mAdapter;
if (adapter != null) {
return adapter.count();
}
return 0;
}
public void transitionToIndex(int index, int delay) {
this.mTargetIndex = Math.max(0, Math.min(getCount() - 1, index));
int max = Math.max(0, delay);
this.mAnimateTargetDelay = max;
this.mMotionLayout.setTransitionDuration(max);
if (index < this.mIndex) {
this.mMotionLayout.transitionToState(this.previousState, this.mAnimateTargetDelay);
} else {
this.mMotionLayout.transitionToState(this.nextState, this.mAnimateTargetDelay);
}
}
public void jumpToIndex(int index) {
this.mIndex = Math.max(0, Math.min(getCount() - 1, index));
refresh();
}
public void refresh() {
int size = this.mList.size();
for (int i = 0; i < size; i++) {
View view = this.mList.get(i);
if (this.mAdapter.count() == 0) {
updateViewVisibility(view, this.emptyViewBehavior);
} else {
updateViewVisibility(view, 0);
}
}
this.mMotionLayout.rebuildScene();
updateItems();
}
@Override // androidx.constraintlayout.motion.widget.MotionHelper, androidx.constraintlayout.motion.widget.MotionLayout.TransitionListener
public void onTransitionCompleted(MotionLayout motionLayout, int currentId) {
int i = this.mIndex;
this.mPreviousIndex = i;
if (currentId == this.nextState) {
this.mIndex = i + 1;
} else if (currentId == this.previousState) {
this.mIndex = i - 1;
}
if (this.infiniteCarousel) {
if (this.mIndex >= this.mAdapter.count()) {
this.mIndex = 0;
}
if (this.mIndex < 0) {
this.mIndex = this.mAdapter.count() - 1;
}
} else {
if (this.mIndex >= this.mAdapter.count()) {
this.mIndex = this.mAdapter.count() - 1;
}
if (this.mIndex < 0) {
this.mIndex = 0;
}
}
if (this.mPreviousIndex != this.mIndex) {
this.mMotionLayout.post(this.mUpdateRunnable);
}
}
private void enableAllTransitions(boolean enable) {
Iterator<MotionScene.Transition> it = this.mMotionLayout.getDefinedTransitions().iterator();
while (it.hasNext()) {
it.next().setEnabled(enable);
}
}
private boolean enableTransition(int transitionID, boolean enable) {
MotionLayout motionLayout;
MotionScene.Transition transition;
if (transitionID == -1 || (motionLayout = this.mMotionLayout) == null || (transition = motionLayout.getTransition(transitionID)) == null || enable == transition.isEnabled()) {
return false;
}
transition.setEnabled(enable);
return true;
}
@Override // androidx.constraintlayout.widget.ConstraintHelper, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (getParent() instanceof MotionLayout) {
MotionLayout motionLayout = (MotionLayout) getParent();
for (int i = 0; i < this.mCount; i++) {
int i2 = this.mIds[i];
View viewById = motionLayout.getViewById(i2);
if (this.firstViewReference == i2) {
this.startIndex = i;
}
this.mList.add(viewById);
}
this.mMotionLayout = motionLayout;
if (this.touchUpMode == 2) {
MotionScene.Transition transition = motionLayout.getTransition(this.forwardTransition);
if (transition != null) {
transition.setOnTouchUp(5);
}
MotionScene.Transition transition2 = this.mMotionLayout.getTransition(this.backwardTransition);
if (transition2 != null) {
transition2.setOnTouchUp(5);
}
}
updateItems();
}
}
private boolean updateViewVisibility(View view, int visibility) {
MotionLayout motionLayout = this.mMotionLayout;
if (motionLayout == null) {
return false;
}
boolean z = false;
for (int i : motionLayout.getConstraintSetIds()) {
z |= updateViewVisibility(i, view, visibility);
}
return z;
}
private boolean updateViewVisibility(int constraintSetId, View view, int visibility) {
ConstraintSet.Constraint constraint;
ConstraintSet constraintSet = this.mMotionLayout.getConstraintSet(constraintSetId);
if (constraintSet == null || (constraint = constraintSet.getConstraint(view.getId())) == null) {
return false;
}
constraint.propertySet.mVisibilityMode = 1;
view.setVisibility(visibility);
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public void updateItems() {
Adapter adapter = this.mAdapter;
if (adapter == null || this.mMotionLayout == null || adapter.count() == 0) {
return;
}
int size = this.mList.size();
for (int i = 0; i < size; i++) {
View view = this.mList.get(i);
int i2 = (this.mIndex + i) - this.startIndex;
if (this.infiniteCarousel) {
if (i2 < 0) {
int i3 = this.emptyViewBehavior;
if (i3 != 4) {
updateViewVisibility(view, i3);
} else {
updateViewVisibility(view, 0);
}
if (i2 % this.mAdapter.count() == 0) {
this.mAdapter.populate(view, 0);
} else {
Adapter adapter2 = this.mAdapter;
adapter2.populate(view, adapter2.count() + (i2 % this.mAdapter.count()));
}
} else if (i2 >= this.mAdapter.count()) {
if (i2 == this.mAdapter.count()) {
i2 = 0;
} else if (i2 > this.mAdapter.count()) {
i2 %= this.mAdapter.count();
}
int i4 = this.emptyViewBehavior;
if (i4 != 4) {
updateViewVisibility(view, i4);
} else {
updateViewVisibility(view, 0);
}
this.mAdapter.populate(view, i2);
} else {
updateViewVisibility(view, 0);
this.mAdapter.populate(view, i2);
}
} else if (i2 < 0) {
updateViewVisibility(view, this.emptyViewBehavior);
} else if (i2 >= this.mAdapter.count()) {
updateViewVisibility(view, this.emptyViewBehavior);
} else {
updateViewVisibility(view, 0);
this.mAdapter.populate(view, i2);
}
}
int i5 = this.mTargetIndex;
if (i5 != -1 && i5 != this.mIndex) {
this.mMotionLayout.post(new Runnable() { // from class: androidx.constraintlayout.helper.widget.Carousel$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
Carousel.this.m48xc943cdea();
}
});
} else if (i5 == this.mIndex) {
this.mTargetIndex = -1;
}
if (this.backwardTransition == -1 || this.forwardTransition == -1) {
Log.w(TAG, "No backward or forward transitions defined for Carousel!");
return;
}
if (this.infiniteCarousel) {
return;
}
int count = this.mAdapter.count();
if (this.mIndex == 0) {
enableTransition(this.backwardTransition, false);
} else {
enableTransition(this.backwardTransition, true);
this.mMotionLayout.setTransition(this.backwardTransition);
}
if (this.mIndex == count - 1) {
enableTransition(this.forwardTransition, false);
} else {
enableTransition(this.forwardTransition, true);
this.mMotionLayout.setTransition(this.forwardTransition);
}
}
/* renamed from: lambda$updateItems$0$androidx-constraintlayout-helper-widget-Carousel, reason: not valid java name */
/* synthetic */ void m48xc943cdea() {
this.mMotionLayout.setTransitionDuration(this.mAnimateTargetDelay);
if (this.mTargetIndex < this.mIndex) {
this.mMotionLayout.transitionToState(this.previousState, this.mAnimateTargetDelay);
} else {
this.mMotionLayout.transitionToState(this.nextState, this.mAnimateTargetDelay);
}
}
}

View File

@ -0,0 +1,349 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.R;
import androidx.constraintlayout.widget.VirtualLayout;
import java.util.Arrays;
/* loaded from: classes.dex */
public class CircularFlow extends VirtualLayout {
private static float DEFAULT_ANGLE = 0.0f;
private static int DEFAULT_RADIUS = 0;
private static final String TAG = "CircularFlow";
private float[] mAngles;
ConstraintLayout mContainer;
private int mCountAngle;
private int mCountRadius;
private int[] mRadius;
private String mReferenceAngles;
private Float mReferenceDefaultAngle;
private Integer mReferenceDefaultRadius;
private String mReferenceRadius;
int mViewCenter;
public void setDefaultAngle(float angle) {
DEFAULT_ANGLE = angle;
}
public void setDefaultRadius(int radius) {
DEFAULT_RADIUS = radius;
}
public CircularFlow(Context context) {
super(context);
}
public CircularFlow(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CircularFlow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public int[] getRadius() {
return Arrays.copyOf(this.mRadius, this.mCountRadius);
}
public float[] getAngles() {
return Arrays.copyOf(this.mAngles, this.mCountAngle);
}
@Override // androidx.constraintlayout.widget.VirtualLayout, androidx.constraintlayout.widget.ConstraintHelper
protected void init(AttributeSet attrs) {
super.init(attrs);
if (attrs != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, 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_circularflow_viewCenter) {
this.mViewCenter = obtainStyledAttributes.getResourceId(index, 0);
} else if (index == R.styleable.ConstraintLayout_Layout_circularflow_angles) {
String string = obtainStyledAttributes.getString(index);
this.mReferenceAngles = string;
setAngles(string);
} else if (index == R.styleable.ConstraintLayout_Layout_circularflow_radiusInDP) {
String string2 = obtainStyledAttributes.getString(index);
this.mReferenceRadius = string2;
setRadius(string2);
} else if (index == R.styleable.ConstraintLayout_Layout_circularflow_defaultAngle) {
Float valueOf = Float.valueOf(obtainStyledAttributes.getFloat(index, DEFAULT_ANGLE));
this.mReferenceDefaultAngle = valueOf;
setDefaultAngle(valueOf.floatValue());
} else if (index == R.styleable.ConstraintLayout_Layout_circularflow_defaultRadius) {
Integer valueOf2 = Integer.valueOf(obtainStyledAttributes.getDimensionPixelSize(index, DEFAULT_RADIUS));
this.mReferenceDefaultRadius = valueOf2;
setDefaultRadius(valueOf2.intValue());
}
}
obtainStyledAttributes.recycle();
}
}
@Override // androidx.constraintlayout.widget.VirtualLayout, androidx.constraintlayout.widget.ConstraintHelper, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
String str = this.mReferenceAngles;
if (str != null) {
this.mAngles = new float[1];
setAngles(str);
}
String str2 = this.mReferenceRadius;
if (str2 != null) {
this.mRadius = new int[1];
setRadius(str2);
}
Float f = this.mReferenceDefaultAngle;
if (f != null) {
setDefaultAngle(f.floatValue());
}
Integer num = this.mReferenceDefaultRadius;
if (num != null) {
setDefaultRadius(num.intValue());
}
anchorReferences();
}
private void anchorReferences() {
this.mContainer = (ConstraintLayout) getParent();
for (int i = 0; i < this.mCount; i++) {
View viewById = this.mContainer.getViewById(this.mIds[i]);
if (viewById != null) {
int i2 = DEFAULT_RADIUS;
float f = DEFAULT_ANGLE;
int[] iArr = this.mRadius;
if (iArr != null && i < iArr.length) {
i2 = iArr[i];
} else {
Integer num = this.mReferenceDefaultRadius;
if (num == null || num.intValue() == -1) {
Log.e(TAG, "Added radius to view with id: " + this.mMap.get(Integer.valueOf(viewById.getId())));
} else {
this.mCountRadius++;
if (this.mRadius == null) {
this.mRadius = new int[1];
}
int[] radius = getRadius();
this.mRadius = radius;
radius[this.mCountRadius - 1] = i2;
}
}
float[] fArr = this.mAngles;
if (fArr == null || i >= fArr.length) {
Float f2 = this.mReferenceDefaultAngle;
if (f2 == null || f2.floatValue() == -1.0f) {
Log.e(TAG, "Added angle to view with id: " + this.mMap.get(Integer.valueOf(viewById.getId())));
} else {
this.mCountAngle++;
if (this.mAngles == null) {
this.mAngles = new float[1];
}
float[] angles = getAngles();
this.mAngles = angles;
angles[this.mCountAngle - 1] = f;
}
} else {
f = fArr[i];
}
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) viewById.getLayoutParams();
layoutParams.circleAngle = f;
layoutParams.circleConstraint = this.mViewCenter;
layoutParams.circleRadius = i2;
viewById.setLayoutParams(layoutParams);
}
}
applyLayoutFeatures();
}
public void addViewToCircularFlow(View view, int radius, float angle) {
if (containsId(view.getId())) {
return;
}
addView(view);
this.mCountAngle++;
float[] angles = getAngles();
this.mAngles = angles;
angles[this.mCountAngle - 1] = angle;
this.mCountRadius++;
int[] radius2 = getRadius();
this.mRadius = radius2;
radius2[this.mCountRadius - 1] = (int) (radius * this.myContext.getResources().getDisplayMetrics().density);
anchorReferences();
}
public void updateRadius(View view, int radius) {
if (!isUpdatable(view)) {
Log.e(TAG, "It was not possible to update radius to view with id: " + view.getId());
return;
}
int indexFromId = indexFromId(view.getId());
if (indexFromId > this.mRadius.length) {
return;
}
int[] radius2 = getRadius();
this.mRadius = radius2;
radius2[indexFromId] = (int) (radius * this.myContext.getResources().getDisplayMetrics().density);
anchorReferences();
}
public void updateAngle(View view, float angle) {
if (!isUpdatable(view)) {
Log.e(TAG, "It was not possible to update angle to view with id: " + view.getId());
return;
}
int indexFromId = indexFromId(view.getId());
if (indexFromId > this.mAngles.length) {
return;
}
float[] angles = getAngles();
this.mAngles = angles;
angles[indexFromId] = angle;
anchorReferences();
}
public void updateReference(View view, int radius, float angle) {
if (!isUpdatable(view)) {
Log.e(TAG, "It was not possible to update radius and angle to view with id: " + view.getId());
return;
}
int indexFromId = indexFromId(view.getId());
if (getAngles().length > indexFromId) {
float[] angles = getAngles();
this.mAngles = angles;
angles[indexFromId] = angle;
}
if (getRadius().length > indexFromId) {
int[] radius2 = getRadius();
this.mRadius = radius2;
radius2[indexFromId] = (int) (radius * this.myContext.getResources().getDisplayMetrics().density);
}
anchorReferences();
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
public int removeView(View view) {
int removeView = super.removeView(view);
if (removeView == -1) {
return removeView;
}
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(this.mContainer);
constraintSet.clear(view.getId(), 8);
constraintSet.applyTo(this.mContainer);
float[] fArr = this.mAngles;
if (removeView < fArr.length) {
this.mAngles = removeAngle(fArr, removeView);
this.mCountAngle--;
}
int[] iArr = this.mRadius;
if (removeView < iArr.length) {
this.mRadius = removeRadius(iArr, removeView);
this.mCountRadius--;
}
anchorReferences();
return removeView;
}
private float[] removeAngle(float[] angles, int index) {
return (angles == null || index < 0 || index >= this.mCountAngle) ? angles : removeElementFromArray(angles, index);
}
private int[] removeRadius(int[] radius, int index) {
return (radius == null || index < 0 || index >= this.mCountRadius) ? radius : removeElementFromArray(radius, index);
}
private void setAngles(String idList) {
if (idList == null) {
return;
}
int i = 0;
this.mCountAngle = 0;
while (true) {
int indexOf = idList.indexOf(44, i);
if (indexOf == -1) {
addAngle(idList.substring(i).trim());
return;
} else {
addAngle(idList.substring(i, indexOf).trim());
i = indexOf + 1;
}
}
}
private void setRadius(String idList) {
if (idList == null) {
return;
}
int i = 0;
this.mCountRadius = 0;
while (true) {
int indexOf = idList.indexOf(44, i);
if (indexOf == -1) {
addRadius(idList.substring(i).trim());
return;
} else {
addRadius(idList.substring(i, indexOf).trim());
i = indexOf + 1;
}
}
}
private void addAngle(String angleString) {
float[] fArr;
if (angleString == null || angleString.length() == 0 || this.myContext == null || (fArr = this.mAngles) == null) {
return;
}
if (this.mCountAngle + 1 > fArr.length) {
this.mAngles = Arrays.copyOf(fArr, fArr.length + 1);
}
this.mAngles[this.mCountAngle] = Integer.parseInt(angleString);
this.mCountAngle++;
}
private void addRadius(String radiusString) {
int[] iArr;
if (radiusString == null || radiusString.length() == 0 || this.myContext == null || (iArr = this.mRadius) == null) {
return;
}
if (this.mCountRadius + 1 > iArr.length) {
this.mRadius = Arrays.copyOf(iArr, iArr.length + 1);
}
this.mRadius[this.mCountRadius] = (int) (Integer.parseInt(radiusString) * this.myContext.getResources().getDisplayMetrics().density);
this.mCountRadius++;
}
public static int[] removeElementFromArray(int[] array, int index) {
int[] iArr = new int[array.length - 1];
int i = 0;
for (int i2 = 0; i2 < array.length; i2++) {
if (i2 != index) {
iArr[i] = array[i2];
i++;
}
}
return iArr;
}
public static float[] removeElementFromArray(float[] array, int index) {
float[] fArr = new float[array.length - 1];
int i = 0;
for (int i2 = 0; i2 < array.length; i2++) {
if (i2 != index) {
fArr[i] = array[i2];
i++;
}
}
return fArr;
}
public boolean isUpdatable(View view) {
return containsId(view.getId()) && indexFromId(view.getId()) != -1;
}
}

View File

@ -0,0 +1,270 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.HelperWidget;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.R;
import androidx.constraintlayout.widget.VirtualLayout;
/* loaded from: classes.dex */
public class Flow extends VirtualLayout {
public static final int CHAIN_PACKED = 2;
public static final int CHAIN_SPREAD = 0;
public static final int CHAIN_SPREAD_INSIDE = 1;
public static final int HORIZONTAL = 0;
public static final int HORIZONTAL_ALIGN_CENTER = 2;
public static final int HORIZONTAL_ALIGN_END = 1;
public static final int HORIZONTAL_ALIGN_START = 0;
private static final String TAG = "Flow";
public static final int VERTICAL = 1;
public static final int VERTICAL_ALIGN_BASELINE = 3;
public static final int VERTICAL_ALIGN_BOTTOM = 1;
public static final int VERTICAL_ALIGN_CENTER = 2;
public static final int VERTICAL_ALIGN_TOP = 0;
public static final int WRAP_ALIGNED = 2;
public static final int WRAP_CHAIN = 1;
public static final int WRAP_NONE = 0;
private androidx.constraintlayout.core.widgets.Flow mFlow;
public Flow(Context context) {
super(context);
}
public Flow(Context context, AttributeSet attrs) {
super(context, attrs);
}
public Flow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
public void resolveRtl(ConstraintWidget widget, boolean isRtl) {
this.mFlow.applyRtl(isRtl);
}
@Override // androidx.constraintlayout.widget.ConstraintHelper, android.view.View
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
onMeasure(this.mFlow, widthMeasureSpec, heightMeasureSpec);
}
@Override // androidx.constraintlayout.widget.VirtualLayout
public void onMeasure(androidx.constraintlayout.core.widgets.VirtualLayout layout, int widthMeasureSpec, int heightMeasureSpec) {
int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int size = View.MeasureSpec.getSize(widthMeasureSpec);
int mode2 = View.MeasureSpec.getMode(heightMeasureSpec);
int size2 = View.MeasureSpec.getSize(heightMeasureSpec);
if (layout != null) {
layout.measure(mode, size, mode2, size2);
setMeasuredDimension(layout.getMeasuredWidth(), layout.getMeasuredHeight());
} else {
setMeasuredDimension(0, 0);
}
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
public void loadParameters(ConstraintSet.Constraint constraint, HelperWidget child, ConstraintLayout.LayoutParams layoutParams, SparseArray<ConstraintWidget> mapIdToWidget) {
super.loadParameters(constraint, child, layoutParams, mapIdToWidget);
if (child instanceof androidx.constraintlayout.core.widgets.Flow) {
androidx.constraintlayout.core.widgets.Flow flow = (androidx.constraintlayout.core.widgets.Flow) child;
if (layoutParams.orientation != -1) {
flow.setOrientation(layoutParams.orientation);
}
}
}
@Override // androidx.constraintlayout.widget.VirtualLayout, androidx.constraintlayout.widget.ConstraintHelper
protected void init(AttributeSet attrs) {
super.init(attrs);
this.mFlow = new androidx.constraintlayout.core.widgets.Flow();
if (attrs != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, 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_android_orientation) {
this.mFlow.setOrientation(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_padding) {
this.mFlow.setPadding(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingStart) {
this.mFlow.setPaddingStart(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingEnd) {
this.mFlow.setPaddingEnd(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingLeft) {
this.mFlow.setPaddingLeft(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingTop) {
this.mFlow.setPaddingTop(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingRight) {
this.mFlow.setPaddingRight(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_android_paddingBottom) {
this.mFlow.setPaddingBottom(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_wrapMode) {
this.mFlow.setWrapMode(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_horizontalStyle) {
this.mFlow.setHorizontalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_verticalStyle) {
this.mFlow.setVerticalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_firstHorizontalStyle) {
this.mFlow.setFirstHorizontalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_lastHorizontalStyle) {
this.mFlow.setLastHorizontalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_firstVerticalStyle) {
this.mFlow.setFirstVerticalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_lastVerticalStyle) {
this.mFlow.setLastVerticalStyle(obtainStyledAttributes.getInt(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_horizontalBias) {
this.mFlow.setHorizontalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_firstHorizontalBias) {
this.mFlow.setFirstHorizontalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_lastHorizontalBias) {
this.mFlow.setLastHorizontalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_firstVerticalBias) {
this.mFlow.setFirstVerticalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_lastVerticalBias) {
this.mFlow.setLastVerticalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_verticalBias) {
this.mFlow.setVerticalBias(obtainStyledAttributes.getFloat(index, 0.5f));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_horizontalAlign) {
this.mFlow.setHorizontalAlign(obtainStyledAttributes.getInt(index, 2));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_verticalAlign) {
this.mFlow.setVerticalAlign(obtainStyledAttributes.getInt(index, 2));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_horizontalGap) {
this.mFlow.setHorizontalGap(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_verticalGap) {
this.mFlow.setVerticalGap(obtainStyledAttributes.getDimensionPixelSize(index, 0));
} else if (index == R.styleable.ConstraintLayout_Layout_flow_maxElementsWrap) {
this.mFlow.setMaxElementsWrap(obtainStyledAttributes.getInt(index, -1));
}
}
obtainStyledAttributes.recycle();
}
this.mHelperWidget = this.mFlow;
validateParams();
}
public void setOrientation(int orientation) {
this.mFlow.setOrientation(orientation);
requestLayout();
}
public void setPadding(int padding) {
this.mFlow.setPadding(padding);
requestLayout();
}
public void setPaddingLeft(int paddingLeft) {
this.mFlow.setPaddingLeft(paddingLeft);
requestLayout();
}
public void setPaddingTop(int paddingTop) {
this.mFlow.setPaddingTop(paddingTop);
requestLayout();
}
public void setPaddingRight(int paddingRight) {
this.mFlow.setPaddingRight(paddingRight);
requestLayout();
}
public void setPaddingBottom(int paddingBottom) {
this.mFlow.setPaddingBottom(paddingBottom);
requestLayout();
}
public void setLastHorizontalStyle(int style) {
this.mFlow.setLastHorizontalStyle(style);
requestLayout();
}
public void setLastVerticalStyle(int style) {
this.mFlow.setLastVerticalStyle(style);
requestLayout();
}
public void setLastHorizontalBias(float bias) {
this.mFlow.setLastHorizontalBias(bias);
requestLayout();
}
public void setLastVerticalBias(float bias) {
this.mFlow.setLastVerticalBias(bias);
requestLayout();
}
public void setWrapMode(int mode) {
this.mFlow.setWrapMode(mode);
requestLayout();
}
public void setHorizontalStyle(int style) {
this.mFlow.setHorizontalStyle(style);
requestLayout();
}
public void setVerticalStyle(int style) {
this.mFlow.setVerticalStyle(style);
requestLayout();
}
public void setHorizontalBias(float bias) {
this.mFlow.setHorizontalBias(bias);
requestLayout();
}
public void setVerticalBias(float bias) {
this.mFlow.setVerticalBias(bias);
requestLayout();
}
public void setFirstHorizontalStyle(int style) {
this.mFlow.setFirstHorizontalStyle(style);
requestLayout();
}
public void setFirstVerticalStyle(int style) {
this.mFlow.setFirstVerticalStyle(style);
requestLayout();
}
public void setFirstHorizontalBias(float bias) {
this.mFlow.setFirstHorizontalBias(bias);
requestLayout();
}
public void setFirstVerticalBias(float bias) {
this.mFlow.setFirstVerticalBias(bias);
requestLayout();
}
public void setHorizontalAlign(int align) {
this.mFlow.setHorizontalAlign(align);
requestLayout();
}
public void setVerticalAlign(int align) {
this.mFlow.setVerticalAlign(align);
requestLayout();
}
public void setHorizontalGap(int gap) {
this.mFlow.setHorizontalGap(gap);
requestLayout();
}
public void setVerticalGap(int gap) {
this.mFlow.setVerticalGap(gap);
requestLayout();
}
public void setMaxElementsWrap(int max) {
this.mFlow.setMaxElementsWrap(max);
requestLayout();
}
}

View File

@ -0,0 +1,303 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.widget.ConstraintHelper;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.R;
/* loaded from: classes.dex */
public class Layer extends ConstraintHelper {
private static final String TAG = "Layer";
private boolean mApplyElevationOnAttach;
private boolean mApplyVisibilityOnAttach;
protected float mComputedCenterX;
protected float mComputedCenterY;
protected float mComputedMaxX;
protected float mComputedMaxY;
protected float mComputedMinX;
protected float mComputedMinY;
ConstraintLayout mContainer;
private float mGroupRotateAngle;
boolean mNeedBounds;
private float mRotationCenterX;
private float mRotationCenterY;
private float mScaleX;
private float mScaleY;
private float mShiftX;
private float mShiftY;
View[] mViews;
public Layer(Context context) {
super(context);
this.mRotationCenterX = Float.NaN;
this.mRotationCenterY = Float.NaN;
this.mGroupRotateAngle = Float.NaN;
this.mScaleX = 1.0f;
this.mScaleY = 1.0f;
this.mComputedCenterX = Float.NaN;
this.mComputedCenterY = Float.NaN;
this.mComputedMaxX = Float.NaN;
this.mComputedMaxY = Float.NaN;
this.mComputedMinX = Float.NaN;
this.mComputedMinY = Float.NaN;
this.mNeedBounds = true;
this.mViews = null;
this.mShiftX = 0.0f;
this.mShiftY = 0.0f;
}
public Layer(Context context, AttributeSet attrs) {
super(context, attrs);
this.mRotationCenterX = Float.NaN;
this.mRotationCenterY = Float.NaN;
this.mGroupRotateAngle = Float.NaN;
this.mScaleX = 1.0f;
this.mScaleY = 1.0f;
this.mComputedCenterX = Float.NaN;
this.mComputedCenterY = Float.NaN;
this.mComputedMaxX = Float.NaN;
this.mComputedMaxY = Float.NaN;
this.mComputedMinX = Float.NaN;
this.mComputedMinY = Float.NaN;
this.mNeedBounds = true;
this.mViews = null;
this.mShiftX = 0.0f;
this.mShiftY = 0.0f;
}
public Layer(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mRotationCenterX = Float.NaN;
this.mRotationCenterY = Float.NaN;
this.mGroupRotateAngle = Float.NaN;
this.mScaleX = 1.0f;
this.mScaleY = 1.0f;
this.mComputedCenterX = Float.NaN;
this.mComputedCenterY = Float.NaN;
this.mComputedMaxX = Float.NaN;
this.mComputedMaxY = Float.NaN;
this.mComputedMinX = Float.NaN;
this.mComputedMinY = Float.NaN;
this.mNeedBounds = true;
this.mViews = null;
this.mShiftX = 0.0f;
this.mShiftY = 0.0f;
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
protected void init(AttributeSet attrs) {
super.init(attrs);
this.mUseViewMeasure = false;
if (attrs != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, 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_android_visibility) {
this.mApplyVisibilityOnAttach = true;
} else if (index == R.styleable.ConstraintLayout_Layout_android_elevation) {
this.mApplyElevationOnAttach = true;
}
}
obtainStyledAttributes.recycle();
}
}
@Override // androidx.constraintlayout.widget.ConstraintHelper, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
this.mContainer = (ConstraintLayout) getParent();
if (this.mApplyVisibilityOnAttach || this.mApplyElevationOnAttach) {
int visibility = getVisibility();
float elevation = getElevation();
for (int i = 0; i < this.mCount; i++) {
View viewById = this.mContainer.getViewById(this.mIds[i]);
if (viewById != null) {
if (this.mApplyVisibilityOnAttach) {
viewById.setVisibility(visibility);
}
if (this.mApplyElevationOnAttach && elevation > 0.0f) {
viewById.setTranslationZ(viewById.getTranslationZ() + elevation);
}
}
}
}
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
public void updatePreDraw(ConstraintLayout container) {
this.mContainer = container;
float rotation = getRotation();
if (rotation != 0.0f) {
this.mGroupRotateAngle = rotation;
} else {
if (Float.isNaN(this.mGroupRotateAngle)) {
return;
}
this.mGroupRotateAngle = rotation;
}
}
@Override // android.view.View
public void setRotation(float angle) {
this.mGroupRotateAngle = angle;
transform();
}
@Override // android.view.View
public void setScaleX(float scaleX) {
this.mScaleX = scaleX;
transform();
}
@Override // android.view.View
public void setScaleY(float scaleY) {
this.mScaleY = scaleY;
transform();
}
@Override // android.view.View
public void setPivotX(float pivotX) {
this.mRotationCenterX = pivotX;
transform();
}
@Override // android.view.View
public void setPivotY(float pivotY) {
this.mRotationCenterY = pivotY;
transform();
}
@Override // android.view.View
public void setTranslationX(float dx) {
this.mShiftX = dx;
transform();
}
@Override // android.view.View
public void setTranslationY(float dy) {
this.mShiftY = dy;
transform();
}
@Override // android.view.View
public void setVisibility(int visibility) {
super.setVisibility(visibility);
applyLayoutFeatures();
}
@Override // android.view.View
public void setElevation(float elevation) {
super.setElevation(elevation);
applyLayoutFeatures();
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
public void updatePostLayout(ConstraintLayout container) {
reCacheViews();
this.mComputedCenterX = Float.NaN;
this.mComputedCenterY = Float.NaN;
ConstraintWidget constraintWidget = ((ConstraintLayout.LayoutParams) getLayoutParams()).getConstraintWidget();
constraintWidget.setWidth(0);
constraintWidget.setHeight(0);
calcCenters();
layout(((int) this.mComputedMinX) - getPaddingLeft(), ((int) this.mComputedMinY) - getPaddingTop(), ((int) this.mComputedMaxX) + getPaddingRight(), ((int) this.mComputedMaxY) + getPaddingBottom());
transform();
}
private void reCacheViews() {
if (this.mContainer == null || this.mCount == 0) {
return;
}
View[] viewArr = this.mViews;
if (viewArr == null || viewArr.length != this.mCount) {
this.mViews = new View[this.mCount];
}
for (int i = 0; i < this.mCount; i++) {
this.mViews[i] = this.mContainer.getViewById(this.mIds[i]);
}
}
protected void calcCenters() {
if (this.mContainer == null) {
return;
}
if (this.mNeedBounds || Float.isNaN(this.mComputedCenterX) || Float.isNaN(this.mComputedCenterY)) {
if (!Float.isNaN(this.mRotationCenterX) && !Float.isNaN(this.mRotationCenterY)) {
this.mComputedCenterY = this.mRotationCenterY;
this.mComputedCenterX = this.mRotationCenterX;
return;
}
View[] views = getViews(this.mContainer);
int left = views[0].getLeft();
int top = views[0].getTop();
int right = views[0].getRight();
int bottom = views[0].getBottom();
for (int i = 0; i < this.mCount; i++) {
View view = views[i];
left = Math.min(left, view.getLeft());
top = Math.min(top, view.getTop());
right = Math.max(right, view.getRight());
bottom = Math.max(bottom, view.getBottom());
}
this.mComputedMaxX = right;
this.mComputedMaxY = bottom;
this.mComputedMinX = left;
this.mComputedMinY = top;
if (Float.isNaN(this.mRotationCenterX)) {
this.mComputedCenterX = (left + right) / 2;
} else {
this.mComputedCenterX = this.mRotationCenterX;
}
if (Float.isNaN(this.mRotationCenterY)) {
this.mComputedCenterY = (top + bottom) / 2;
} else {
this.mComputedCenterY = this.mRotationCenterY;
}
}
}
private void transform() {
if (this.mContainer == null) {
return;
}
if (this.mViews == null) {
reCacheViews();
}
calcCenters();
double radians = Float.isNaN(this.mGroupRotateAngle) ? 0.0d : Math.toRadians(this.mGroupRotateAngle);
float sin = (float) Math.sin(radians);
float cos = (float) Math.cos(radians);
float f = this.mScaleX;
float f2 = f * cos;
float f3 = this.mScaleY;
float f4 = (-f3) * sin;
float f5 = f * sin;
float f6 = f3 * cos;
for (int i = 0; i < this.mCount; i++) {
View view = this.mViews[i];
int left = (view.getLeft() + view.getRight()) / 2;
int top = (view.getTop() + view.getBottom()) / 2;
float f7 = left - this.mComputedCenterX;
float f8 = top - this.mComputedCenterY;
float f9 = (((f2 * f7) + (f4 * f8)) - f7) + this.mShiftX;
float f10 = (((f7 * f5) + (f6 * f8)) - f8) + this.mShiftY;
view.setTranslationX(f9);
view.setTranslationY(f10);
view.setScaleY(this.mScaleY);
view.setScaleX(this.mScaleX);
if (!Float.isNaN(this.mGroupRotateAngle)) {
view.setRotation(this.mGroupRotateAngle);
}
}
}
@Override // androidx.constraintlayout.widget.ConstraintHelper
protected void applyLayoutFeaturesInConstraintSet(ConstraintLayout container) {
applyLayoutFeatures(container);
}
}

View File

@ -0,0 +1,141 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.constraintlayout.motion.widget.MotionHelper;
import androidx.constraintlayout.widget.R;
/* loaded from: classes.dex */
public class MotionEffect extends MotionHelper {
public static final int AUTO = -1;
public static final int EAST = 2;
public static final int NORTH = 0;
public static final int SOUTH = 1;
public static final String TAG = "FadeMove";
private static final int UNSET = -1;
public static final int WEST = 3;
private int fadeMove;
private float motionEffectAlpha;
private int motionEffectEnd;
private int motionEffectStart;
private boolean motionEffectStrictMove;
private int motionEffectTranslationX;
private int motionEffectTranslationY;
private int viewTransitionId;
@Override // androidx.constraintlayout.motion.widget.MotionHelper, androidx.constraintlayout.motion.widget.MotionHelperInterface
public boolean isDecorator() {
return true;
}
public MotionEffect(Context context) {
super(context);
this.motionEffectAlpha = 0.1f;
this.motionEffectStart = 49;
this.motionEffectEnd = 50;
this.motionEffectTranslationX = 0;
this.motionEffectTranslationY = 0;
this.motionEffectStrictMove = true;
this.viewTransitionId = -1;
this.fadeMove = -1;
}
public MotionEffect(Context context, AttributeSet attrs) {
super(context, attrs);
this.motionEffectAlpha = 0.1f;
this.motionEffectStart = 49;
this.motionEffectEnd = 50;
this.motionEffectTranslationX = 0;
this.motionEffectTranslationY = 0;
this.motionEffectStrictMove = true;
this.viewTransitionId = -1;
this.fadeMove = -1;
init(context, attrs);
}
public MotionEffect(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.motionEffectAlpha = 0.1f;
this.motionEffectStart = 49;
this.motionEffectEnd = 50;
this.motionEffectTranslationX = 0;
this.motionEffectTranslationY = 0;
this.motionEffectStrictMove = true;
this.viewTransitionId = -1;
this.fadeMove = -1;
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, R.styleable.MotionEffect);
int indexCount = obtainStyledAttributes.getIndexCount();
for (int i = 0; i < indexCount; i++) {
int index = obtainStyledAttributes.getIndex(i);
if (index == R.styleable.MotionEffect_motionEffect_start) {
int i2 = obtainStyledAttributes.getInt(index, this.motionEffectStart);
this.motionEffectStart = i2;
this.motionEffectStart = Math.max(Math.min(i2, 99), 0);
} else if (index == R.styleable.MotionEffect_motionEffect_end) {
int i3 = obtainStyledAttributes.getInt(index, this.motionEffectEnd);
this.motionEffectEnd = i3;
this.motionEffectEnd = Math.max(Math.min(i3, 99), 0);
} else if (index == R.styleable.MotionEffect_motionEffect_translationX) {
this.motionEffectTranslationX = obtainStyledAttributes.getDimensionPixelOffset(index, this.motionEffectTranslationX);
} else if (index == R.styleable.MotionEffect_motionEffect_translationY) {
this.motionEffectTranslationY = obtainStyledAttributes.getDimensionPixelOffset(index, this.motionEffectTranslationY);
} else if (index == R.styleable.MotionEffect_motionEffect_alpha) {
this.motionEffectAlpha = obtainStyledAttributes.getFloat(index, this.motionEffectAlpha);
} else if (index == R.styleable.MotionEffect_motionEffect_move) {
this.fadeMove = obtainStyledAttributes.getInt(index, this.fadeMove);
} else if (index == R.styleable.MotionEffect_motionEffect_strict) {
this.motionEffectStrictMove = obtainStyledAttributes.getBoolean(index, this.motionEffectStrictMove);
} else if (index == R.styleable.MotionEffect_motionEffect_viewTransition) {
this.viewTransitionId = obtainStyledAttributes.getResourceId(index, this.viewTransitionId);
}
}
int i4 = this.motionEffectStart;
int i5 = this.motionEffectEnd;
if (i4 == i5) {
if (i4 > 0) {
this.motionEffectStart = i4 - 1;
} else {
this.motionEffectEnd = i5 + 1;
}
}
obtainStyledAttributes.recycle();
}
}
/* JADX WARN: Code restructure failed: missing block: B:60:0x0187, code lost:
if (r14 == 0.0f) goto L55;
*/
/* JADX WARN: Code restructure failed: missing block: B:82:0x019a, code lost:
if (r14 == 0.0f) goto L55;
*/
/* JADX WARN: Code restructure failed: missing block: B:90:0x01aa, code lost:
if (r15 == 0.0f) goto L55;
*/
/* JADX WARN: Code restructure failed: missing block: B:98:0x01ba, code lost:
if (r15 == 0.0f) goto L46;
*/
/* JADX WARN: Removed duplicated region for block: B:65:0x01c2 */
/* JADX WARN: Removed duplicated region for block: B:73:0x01e5 */
@Override // androidx.constraintlayout.motion.widget.MotionHelper, androidx.constraintlayout.motion.widget.MotionHelperInterface
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onPreSetup(androidx.constraintlayout.motion.widget.MotionLayout r23, java.util.HashMap<android.view.View, androidx.constraintlayout.motion.widget.MotionController> r24) {
/*
Method dump skipped, instructions count: 497
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.helper.widget.MotionEffect.onPreSetup(androidx.constraintlayout.motion.widget.MotionLayout, java.util.HashMap):void");
}
}

View File

@ -0,0 +1,63 @@
package androidx.constraintlayout.helper.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.Helper;
import androidx.constraintlayout.core.widgets.Placeholder;
import androidx.constraintlayout.widget.VirtualLayout;
/* loaded from: classes.dex */
public class MotionPlaceholder extends VirtualLayout {
private static final String TAG = "MotionPlaceholder";
Placeholder mPlaceholder;
@Override // androidx.constraintlayout.widget.ConstraintHelper
public void updatePreLayout(ConstraintWidgetContainer container, Helper helper, SparseArray<ConstraintWidget> map) {
}
public MotionPlaceholder(Context context) {
super(context);
}
public MotionPlaceholder(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MotionPlaceholder(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public MotionPlaceholder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr);
}
@Override // androidx.constraintlayout.widget.ConstraintHelper, android.view.View
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
onMeasure(this.mPlaceholder, widthMeasureSpec, heightMeasureSpec);
}
@Override // androidx.constraintlayout.widget.VirtualLayout
public void onMeasure(androidx.constraintlayout.core.widgets.VirtualLayout layout, int widthMeasureSpec, int heightMeasureSpec) {
int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int size = View.MeasureSpec.getSize(widthMeasureSpec);
int mode2 = View.MeasureSpec.getMode(heightMeasureSpec);
int size2 = View.MeasureSpec.getSize(heightMeasureSpec);
if (layout != null) {
layout.measure(mode, size, mode2, size2);
setMeasuredDimension(layout.getMeasuredWidth(), layout.getMeasuredHeight());
} else {
setMeasuredDimension(0, 0);
}
}
@Override // androidx.constraintlayout.widget.VirtualLayout, androidx.constraintlayout.widget.ConstraintHelper
protected void init(AttributeSet attrs) {
super.init(attrs);
this.mHelperWidget = new Placeholder();
validateParams();
}
}