190 lines
6.1 KiB
Java
190 lines
6.1 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;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes.dex */
|
|
public abstract class TOD<T extends View, Z> extends AbstractC0237CQu<Z> {
|
|
private static int c = PEz.Sts.glide_custom_view_target_tag;
|
|
protected final T a;
|
|
private View.OnAttachStateChangeListener b;
|
|
private boolean d;
|
|
private final Sts e;
|
|
|
|
public TOD(T t) {
|
|
if (t != null) {
|
|
this.a = t;
|
|
this.e = new Sts(t);
|
|
return;
|
|
}
|
|
throw new NullPointerException("Argument must not be null");
|
|
}
|
|
|
|
@Override // o.AbstractC0237CQu, o.YcZ
|
|
public void FU_(Drawable drawable) {
|
|
super.FU_(drawable);
|
|
}
|
|
|
|
@Override // o.YcZ
|
|
public final void c(QTj qTj) {
|
|
this.e.e.remove(qTj);
|
|
}
|
|
|
|
@Override // o.AbstractC0237CQu, o.YcZ
|
|
public void avx_(Drawable drawable) {
|
|
super.avx_(drawable);
|
|
this.e.c();
|
|
}
|
|
|
|
@Override // o.AbstractC0237CQu, o.YcZ
|
|
public final void d(PXc pXc) {
|
|
this.a.setTag(c, pXc);
|
|
}
|
|
|
|
@Override // o.AbstractC0237CQu, o.YcZ
|
|
public final PXc b() {
|
|
Object tag = this.a.getTag(c);
|
|
if (tag == null) {
|
|
return null;
|
|
}
|
|
if (tag instanceof PXc) {
|
|
return (PXc) tag;
|
|
}
|
|
throw new IllegalArgumentException("You must not call setTag() on a view Glide is targeting");
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder("Target for: ");
|
|
sb.append(this.a);
|
|
return sb.toString();
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class Sts {
|
|
private static Integer c;
|
|
ViewTreeObserverOnPreDrawListenerC0093Sts a;
|
|
final View b;
|
|
private boolean d;
|
|
final List<QTj> e = new ArrayList();
|
|
|
|
Sts(View view) {
|
|
this.b = view;
|
|
}
|
|
|
|
final void c() {
|
|
ViewTreeObserver viewTreeObserver = this.b.getViewTreeObserver();
|
|
if (viewTreeObserver.isAlive()) {
|
|
viewTreeObserver.removeOnPreDrawListener(this.a);
|
|
}
|
|
this.a = null;
|
|
this.e.clear();
|
|
}
|
|
|
|
final int b() {
|
|
int paddingTop = this.b.getPaddingTop();
|
|
int paddingBottom = this.b.getPaddingBottom();
|
|
ViewGroup.LayoutParams layoutParams = this.b.getLayoutParams();
|
|
return b(this.b.getHeight(), layoutParams != null ? layoutParams.height : 0, paddingTop + paddingBottom);
|
|
}
|
|
|
|
final int a() {
|
|
int paddingLeft = this.b.getPaddingLeft();
|
|
int paddingRight = this.b.getPaddingRight();
|
|
ViewGroup.LayoutParams layoutParams = this.b.getLayoutParams();
|
|
return b(this.b.getWidth(), layoutParams != null ? layoutParams.width : 0, paddingLeft + paddingRight);
|
|
}
|
|
|
|
private int b(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 */
|
|
/* renamed from: o.TOD$Sts$Sts, reason: collision with other inner class name */
|
|
/* loaded from: classes.dex */
|
|
public static final class ViewTreeObserverOnPreDrawListenerC0093Sts implements ViewTreeObserver.OnPreDrawListener {
|
|
private final WeakReference<Sts> c;
|
|
|
|
ViewTreeObserverOnPreDrawListenerC0093Sts(Sts sts) {
|
|
this.c = new WeakReference<>(sts);
|
|
}
|
|
|
|
@Override // android.view.ViewTreeObserver.OnPreDrawListener
|
|
public final boolean onPreDraw() {
|
|
Sts sts = this.c.get();
|
|
if (sts == null || sts.e.isEmpty()) {
|
|
return true;
|
|
}
|
|
int a = sts.a();
|
|
int b = sts.b();
|
|
if (a <= 0 && a != Integer.MIN_VALUE) {
|
|
return true;
|
|
}
|
|
if (b <= 0 && b != Integer.MIN_VALUE) {
|
|
return true;
|
|
}
|
|
Iterator it = new ArrayList(sts.e).iterator();
|
|
while (it.hasNext()) {
|
|
((QTj) it.next()).e(a, b);
|
|
}
|
|
sts.c();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.YcZ
|
|
public final void e(QTj qTj) {
|
|
Sts sts = this.e;
|
|
int a = sts.a();
|
|
int b = sts.b();
|
|
if ((a > 0 || a == Integer.MIN_VALUE) && (b > 0 || b == Integer.MIN_VALUE)) {
|
|
qTj.e(a, b);
|
|
return;
|
|
}
|
|
if (!sts.e.contains(qTj)) {
|
|
sts.e.add(qTj);
|
|
}
|
|
if (sts.a == null) {
|
|
ViewTreeObserver viewTreeObserver = sts.b.getViewTreeObserver();
|
|
Sts.ViewTreeObserverOnPreDrawListenerC0093Sts viewTreeObserverOnPreDrawListenerC0093Sts = new Sts.ViewTreeObserverOnPreDrawListenerC0093Sts(sts);
|
|
sts.a = viewTreeObserverOnPreDrawListenerC0093Sts;
|
|
viewTreeObserver.addOnPreDrawListener(viewTreeObserverOnPreDrawListenerC0093Sts);
|
|
}
|
|
}
|
|
}
|