package o; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; import java.lang.ref.WeakReference; /* loaded from: classes.dex */ public final class fNC implements ViewTreeObserver.OnPreDrawListener, View.OnAttachStateChangeListener { public InterfaceC12980fNE b; public final C13020fOa c; public final WeakReference e; /* JADX INFO: Access modifiers changed from: package-private */ public fNC(C13020fOa c13020fOa, ImageView imageView, InterfaceC12980fNE interfaceC12980fNE) { this.c = c13020fOa; this.e = new WeakReference<>(imageView); this.b = interfaceC12980fNE; imageView.addOnAttachStateChangeListener(this); if (imageView.getWindowToken() != null) { onViewAttachedToWindow(imageView); } } @Override // android.view.View.OnAttachStateChangeListener public final void onViewAttachedToWindow(View view) { view.getViewTreeObserver().addOnPreDrawListener(this); } @Override // android.view.View.OnAttachStateChangeListener public final void onViewDetachedFromWindow(View view) { view.getViewTreeObserver().removeOnPreDrawListener(this); } @Override // android.view.ViewTreeObserver.OnPreDrawListener public final boolean onPreDraw() { ImageView imageView = this.e.get(); if (imageView == null) { return true; } ViewTreeObserver viewTreeObserver = imageView.getViewTreeObserver(); if (!viewTreeObserver.isAlive()) { return true; } int width = imageView.getWidth(); int height = imageView.getHeight(); if (width > 0 && height > 0) { imageView.removeOnAttachStateChangeListener(this); viewTreeObserver.removeOnPreDrawListener(this); this.e.clear(); C13020fOa c13020fOa = this.c; c13020fOa.e = false; c13020fOa.a.e(width, height); c13020fOa.aBu_(imageView, this.b); } return true; } }