what-the-bank/sources/androidx/constraintlayout/widget/Placeholder.java

103 lines
3.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.constraintlayout.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import androidx.constraintlayout.widget.ConstraintLayout;
import o.C3345avm;
/* loaded from: classes.dex */
public class Placeholder extends View {
int a;
View c;
int d;
public Placeholder(Context context) {
super(context);
this.d = -1;
this.c = null;
this.a = 4;
ls_(null);
}
public Placeholder(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.d = -1;
this.c = null;
this.a = 4;
ls_(attributeSet);
}
public Placeholder(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.d = -1;
this.c = null;
this.a = 4;
ls_(attributeSet);
}
private void ls_(AttributeSet attributeSet) {
super.setVisibility(this.a);
this.d = -1;
if (attributeSet != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, C3345avm.IeS.ConstraintLayout_placeholder);
int indexCount = obtainStyledAttributes.getIndexCount();
for (int i = 0; i < indexCount; i++) {
int index = obtainStyledAttributes.getIndex(i);
if (index == C3345avm.IeS.ConstraintLayout_placeholder_content) {
this.d = obtainStyledAttributes.getResourceId(index, this.d);
} else if (index == C3345avm.IeS.ConstraintLayout_placeholder_placeholder_emptyVisibility) {
this.a = obtainStyledAttributes.getInt(index, this.a);
}
}
obtainStyledAttributes.recycle();
}
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
if (isInEditMode()) {
canvas.drawRGB(223, 223, 223);
Paint paint = new Paint();
paint.setARGB(255, 210, 210, 210);
paint.setTextAlign(Paint.Align.CENTER);
paint.setTypeface(Typeface.create(Typeface.DEFAULT, 0));
Rect rect = new Rect();
canvas.getClipBounds(rect);
paint.setTextSize(rect.height());
int height = rect.height();
int width = rect.width();
paint.setTextAlign(Paint.Align.LEFT);
paint.getTextBounds("?", 0, 1, rect);
canvas.drawText("?", ((width / 2.0f) - (rect.width() / 2.0f)) - rect.left, ((height / 2.0f) + (rect.height() / 2.0f)) - rect.bottom, paint);
}
}
public void setContentId(int i) {
View findViewById;
if (this.d == i) {
return;
}
View view = this.c;
if (view != null) {
view.setVisibility(0);
((ConstraintLayout.Sts) this.c.getLayoutParams()).J = false;
this.c = null;
}
this.d = i;
if (i == -1 || (findViewById = ((View) getParent()).findViewById(i)) == null) {
return;
}
findViewById.setVisibility(8);
}
public void setEmptyVisibility(int i) {
this.a = i;
}
}