ADD week 5
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
package androidx.constraintlayout.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Constraints extends ViewGroup {
|
||||
public static final String TAG = "Constraints";
|
||||
ConstraintSet myConstraintSet;
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
}
|
||||
|
||||
public Constraints(Context context) {
|
||||
super(context);
|
||||
super.setVisibility(8);
|
||||
}
|
||||
|
||||
public Constraints(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(attrs);
|
||||
super.setVisibility(8);
|
||||
}
|
||||
|
||||
public Constraints(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(attrs);
|
||||
super.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new LayoutParams(getContext(), attrs);
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ConstraintLayout.LayoutParams {
|
||||
public float alpha;
|
||||
public boolean applyElevation;
|
||||
public float elevation;
|
||||
public float rotation;
|
||||
public float rotationX;
|
||||
public float rotationY;
|
||||
public float scaleX;
|
||||
public float scaleY;
|
||||
public float transformPivotX;
|
||||
public float transformPivotY;
|
||||
public float translationX;
|
||||
public float translationY;
|
||||
public float translationZ;
|
||||
|
||||
public LayoutParams(int width, int height) {
|
||||
super(width, height);
|
||||
this.alpha = 1.0f;
|
||||
this.applyElevation = false;
|
||||
this.elevation = 0.0f;
|
||||
this.rotation = 0.0f;
|
||||
this.rotationX = 0.0f;
|
||||
this.rotationY = 0.0f;
|
||||
this.scaleX = 1.0f;
|
||||
this.scaleY = 1.0f;
|
||||
this.transformPivotX = 0.0f;
|
||||
this.transformPivotY = 0.0f;
|
||||
this.translationX = 0.0f;
|
||||
this.translationY = 0.0f;
|
||||
this.translationZ = 0.0f;
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams source) {
|
||||
super((ConstraintLayout.LayoutParams) source);
|
||||
this.alpha = 1.0f;
|
||||
this.applyElevation = false;
|
||||
this.elevation = 0.0f;
|
||||
this.rotation = 0.0f;
|
||||
this.rotationX = 0.0f;
|
||||
this.rotationY = 0.0f;
|
||||
this.scaleX = 1.0f;
|
||||
this.scaleY = 1.0f;
|
||||
this.transformPivotX = 0.0f;
|
||||
this.transformPivotY = 0.0f;
|
||||
this.translationX = 0.0f;
|
||||
this.translationY = 0.0f;
|
||||
this.translationZ = 0.0f;
|
||||
}
|
||||
|
||||
public LayoutParams(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
this.alpha = 1.0f;
|
||||
this.applyElevation = false;
|
||||
this.elevation = 0.0f;
|
||||
this.rotation = 0.0f;
|
||||
this.rotationX = 0.0f;
|
||||
this.rotationY = 0.0f;
|
||||
this.scaleX = 1.0f;
|
||||
this.scaleY = 1.0f;
|
||||
this.transformPivotX = 0.0f;
|
||||
this.transformPivotY = 0.0f;
|
||||
this.translationX = 0.0f;
|
||||
this.translationY = 0.0f;
|
||||
this.translationZ = 0.0f;
|
||||
TypedArray obtainStyledAttributes = c.obtainStyledAttributes(attrs, R.styleable.ConstraintSet);
|
||||
int indexCount = obtainStyledAttributes.getIndexCount();
|
||||
for (int i = 0; i < indexCount; i++) {
|
||||
int index = obtainStyledAttributes.getIndex(i);
|
||||
if (index == R.styleable.ConstraintSet_android_alpha) {
|
||||
this.alpha = obtainStyledAttributes.getFloat(index, this.alpha);
|
||||
} else if (index == R.styleable.ConstraintSet_android_elevation) {
|
||||
this.elevation = obtainStyledAttributes.getFloat(index, this.elevation);
|
||||
this.applyElevation = true;
|
||||
} else if (index == R.styleable.ConstraintSet_android_rotationX) {
|
||||
this.rotationX = obtainStyledAttributes.getFloat(index, this.rotationX);
|
||||
} else if (index == R.styleable.ConstraintSet_android_rotationY) {
|
||||
this.rotationY = obtainStyledAttributes.getFloat(index, this.rotationY);
|
||||
} else if (index == R.styleable.ConstraintSet_android_rotation) {
|
||||
this.rotation = obtainStyledAttributes.getFloat(index, this.rotation);
|
||||
} else if (index == R.styleable.ConstraintSet_android_scaleX) {
|
||||
this.scaleX = obtainStyledAttributes.getFloat(index, this.scaleX);
|
||||
} else if (index == R.styleable.ConstraintSet_android_scaleY) {
|
||||
this.scaleY = obtainStyledAttributes.getFloat(index, this.scaleY);
|
||||
} else if (index == R.styleable.ConstraintSet_android_transformPivotX) {
|
||||
this.transformPivotX = obtainStyledAttributes.getFloat(index, this.transformPivotX);
|
||||
} else if (index == R.styleable.ConstraintSet_android_transformPivotY) {
|
||||
this.transformPivotY = obtainStyledAttributes.getFloat(index, this.transformPivotY);
|
||||
} else if (index == R.styleable.ConstraintSet_android_translationX) {
|
||||
this.translationX = obtainStyledAttributes.getFloat(index, this.translationX);
|
||||
} else if (index == R.styleable.ConstraintSet_android_translationY) {
|
||||
this.translationY = obtainStyledAttributes.getFloat(index, this.translationY);
|
||||
} else if (index == R.styleable.ConstraintSet_android_translationZ) {
|
||||
this.translationZ = obtainStyledAttributes.getFloat(index, this.translationZ);
|
||||
}
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
return new LayoutParams(-2, -2);
|
||||
}
|
||||
|
||||
private void init(AttributeSet attrs) {
|
||||
Log.v(TAG, " ################# init");
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return new ConstraintLayout.LayoutParams(p);
|
||||
}
|
||||
|
||||
public ConstraintSet getConstraintSet() {
|
||||
if (this.myConstraintSet == null) {
|
||||
this.myConstraintSet = new ConstraintSet();
|
||||
}
|
||||
this.myConstraintSet.clone(this);
|
||||
return this.myConstraintSet;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user