198 lines
5.8 KiB
Java
198 lines
5.8 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Point;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.view.Display;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import android.view.ViewTreeObserver;
|
||
|
import android.view.WindowManager;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import o.PEz;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class RqC<T extends View, Z> implements YcZ<Z> {
|
||
|
private static final int a = PEz.Sts.glide_custom_view_target_tag;
|
||
|
private boolean b;
|
||
|
private T c;
|
||
|
private View.OnAttachStateChangeListener d;
|
||
|
private final RVV e;
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final void FU_(Drawable drawable) {
|
||
|
}
|
||
|
|
||
|
@Override // o.Lco
|
||
|
public final void a() {
|
||
|
}
|
||
|
|
||
|
@Override // o.Lco
|
||
|
public final void c() {
|
||
|
}
|
||
|
|
||
|
@Override // o.Lco
|
||
|
public final void d() {
|
||
|
}
|
||
|
|
||
|
public RqC(T t) {
|
||
|
if (t != null) {
|
||
|
this.c = t;
|
||
|
this.e = new RVV(t);
|
||
|
return;
|
||
|
}
|
||
|
throw new NullPointerException("Argument must not be null");
|
||
|
}
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final void c(QTj qTj) {
|
||
|
this.e.e.remove(qTj);
|
||
|
}
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final void avx_(Drawable drawable) {
|
||
|
this.e.b();
|
||
|
}
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final void d(PXc pXc) {
|
||
|
this.c.setTag(a, pXc);
|
||
|
}
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final PXc b() {
|
||
|
Object tag = this.c.getTag(a);
|
||
|
if (tag == null) {
|
||
|
return null;
|
||
|
}
|
||
|
if (tag instanceof PXc) {
|
||
|
return (PXc) tag;
|
||
|
}
|
||
|
throw new IllegalArgumentException("You must not pass non-R.id ids to setTag(id)");
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
StringBuilder sb = new StringBuilder("Target for: ");
|
||
|
sb.append(this.c);
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
static final class RVV {
|
||
|
private static Integer c;
|
||
|
HBt a;
|
||
|
final View b;
|
||
|
private boolean d;
|
||
|
final List<QTj> e = new ArrayList();
|
||
|
|
||
|
RVV(View view) {
|
||
|
this.b = view;
|
||
|
}
|
||
|
|
||
|
final void b() {
|
||
|
ViewTreeObserver viewTreeObserver = this.b.getViewTreeObserver();
|
||
|
if (viewTreeObserver.isAlive()) {
|
||
|
viewTreeObserver.removeOnPreDrawListener(this.a);
|
||
|
}
|
||
|
this.a = null;
|
||
|
this.e.clear();
|
||
|
}
|
||
|
|
||
|
final int c() {
|
||
|
int paddingTop = this.b.getPaddingTop();
|
||
|
int paddingBottom = this.b.getPaddingBottom();
|
||
|
ViewGroup.LayoutParams layoutParams = this.b.getLayoutParams();
|
||
|
return a(this.b.getHeight(), layoutParams != null ? layoutParams.height : 0, paddingTop + paddingBottom);
|
||
|
}
|
||
|
|
||
|
final int d() {
|
||
|
int paddingLeft = this.b.getPaddingLeft();
|
||
|
int paddingRight = this.b.getPaddingRight();
|
||
|
ViewGroup.LayoutParams layoutParams = this.b.getLayoutParams();
|
||
|
return a(this.b.getWidth(), layoutParams != null ? layoutParams.width : 0, paddingLeft + paddingRight);
|
||
|
}
|
||
|
|
||
|
private int a(int i, int i2, int i3) {
|
||
|
int i4 = i2 - i3;
|
||
|
if (i4 > 0) {
|
||
|
return i4;
|
||
|
}
|
||
|
int i5 = i - i3;
|
||
|
if (i5 > 0) {
|
||
|
return i5;
|
||
|
}
|
||
|
if (this.b.isLayoutRequested() || i2 != -2) {
|
||
|
return 0;
|
||
|
}
|
||
|
Context context = this.b.getContext();
|
||
|
if (c == null) {
|
||
|
WindowManager windowManager = (WindowManager) context.getSystemService("window");
|
||
|
if (windowManager != null) {
|
||
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
||
|
Point point = new Point();
|
||
|
defaultDisplay.getSize(point);
|
||
|
c = Integer.valueOf(Math.max(point.x, point.y));
|
||
|
} else {
|
||
|
throw new NullPointerException("Argument must not be null");
|
||
|
}
|
||
|
}
|
||
|
return c.intValue();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class HBt implements ViewTreeObserver.OnPreDrawListener {
|
||
|
private final WeakReference<RVV> a;
|
||
|
|
||
|
HBt(RVV rvv) {
|
||
|
this.a = new WeakReference<>(rvv);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewTreeObserver.OnPreDrawListener
|
||
|
public final boolean onPreDraw() {
|
||
|
RVV rvv = this.a.get();
|
||
|
if (rvv == null || rvv.e.isEmpty()) {
|
||
|
return true;
|
||
|
}
|
||
|
int d = rvv.d();
|
||
|
int c = rvv.c();
|
||
|
if (d <= 0 && d != Integer.MIN_VALUE) {
|
||
|
return true;
|
||
|
}
|
||
|
if (c <= 0 && c != Integer.MIN_VALUE) {
|
||
|
return true;
|
||
|
}
|
||
|
Iterator it = new ArrayList(rvv.e).iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((QTj) it.next()).e(d, c);
|
||
|
}
|
||
|
rvv.b();
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.YcZ
|
||
|
public final void e(QTj qTj) {
|
||
|
RVV rvv = this.e;
|
||
|
int d = rvv.d();
|
||
|
int c = rvv.c();
|
||
|
if ((d > 0 || d == Integer.MIN_VALUE) && (c > 0 || c == Integer.MIN_VALUE)) {
|
||
|
qTj.e(d, c);
|
||
|
return;
|
||
|
}
|
||
|
if (!rvv.e.contains(qTj)) {
|
||
|
rvv.e.add(qTj);
|
||
|
}
|
||
|
if (rvv.a == null) {
|
||
|
ViewTreeObserver viewTreeObserver = rvv.b.getViewTreeObserver();
|
||
|
RVV.HBt hBt = new RVV.HBt(rvv);
|
||
|
rvv.a = hBt;
|
||
|
viewTreeObserver.addOnPreDrawListener(hBt);
|
||
|
}
|
||
|
}
|
||
|
}
|