jimu-decompiled/sources/androidx/constraintlayout/widget/Placeholder.java
2025-05-13 19:24:51 +02:00

90 lines
2.8 KiB
Java

package androidx.constraintlayout.widget;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.view.View;
import androidx.constraintlayout.widget.ConstraintLayout;
/* loaded from: classes.dex */
public class Placeholder extends View {
private int a;
private View b;
private int c;
public void a(ConstraintLayout constraintLayout) {
if (this.b == null) {
return;
}
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) getLayoutParams();
ConstraintLayout.LayoutParams layoutParams2 = (ConstraintLayout.LayoutParams) this.b.getLayoutParams();
layoutParams2.k0.n(0);
layoutParams.k0.o(layoutParams2.k0.s());
layoutParams.k0.g(layoutParams2.k0.i());
layoutParams2.k0.n(8);
}
public void b(ConstraintLayout constraintLayout) {
if (this.a == -1 && !isInEditMode()) {
setVisibility(this.c);
}
this.b = constraintLayout.findViewById(this.a);
View view = this.b;
if (view != null) {
((ConstraintLayout.LayoutParams) view.getLayoutParams()).Z = true;
this.b.setVisibility(0);
setVisibility(0);
}
}
public View getContent() {
return this.b;
}
public int getEmptyVisibility() {
return this.c;
}
@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.a == i) {
return;
}
View view = this.b;
if (view != null) {
view.setVisibility(0);
((ConstraintLayout.LayoutParams) this.b.getLayoutParams()).Z = false;
this.b = null;
}
this.a = i;
if (i == -1 || (findViewById = ((View) getParent()).findViewById(i)) == null) {
return;
}
findViewById.setVisibility(8);
}
public void setEmptyVisibility(int i) {
this.c = i;
}
}