package o; import android.graphics.Bitmap; import android.graphics.Rect; import android.view.ViewTreeObserver; import com.bumptech.glide.Glide; import com.lyft.android.scissors.CropView; import com.nostra13.universalimageloader.core.ImageLoader; import com.squareup.picasso.Picasso; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public final class rcp { private static boolean c = e("com.squareup.picasso.Picasso"); private static boolean d = e("com.bumptech.glide.Glide"); private static boolean b = e("com.nostra13.universalimageloader.core.ImageLoader"); rcp() { } /* loaded from: classes3.dex */ public static class RVV { public final CropView a; public uGc d; public RVV(CropView cropView) { C0413GaN.b(cropView, "cropView == null"); this.a = cropView; } public final void d(Object obj) { if (this.d == null) { this.d = rcp.e(this.a); } this.d.aAk_(obj, this.a); } public final void a(Object obj) { if (this.a.getViewTreeObserver().isAlive()) { this.a.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(this, obj) { // from class: o.rcp.RVV.5 private RVV a; private Object b; { this.a = this; this.b = obj; } @Override // android.view.ViewTreeObserver.OnGlobalLayoutListener public final void onGlobalLayout() { if (this.a.a.getViewTreeObserver().isAlive()) { this.a.a.getViewTreeObserver().removeGlobalOnLayoutListener(this); } this.a.d(this.b); } }); } } } /* loaded from: classes3.dex */ public static class IeS { public final CropView e; public Bitmap.CompressFormat b = Bitmap.CompressFormat.JPEG; public int a = 100; public IeS(CropView cropView) { C0413GaN.b(cropView, "cropView == null"); this.e = cropView; } } private static boolean e(String str) { try { Class.forName(str); return true; } catch (ClassNotFoundException unused) { return false; } } /* JADX INFO: Access modifiers changed from: package-private */ public static Rect OD_(int i, int i2, int i3, int i4) { float f; float f2; if (i == i3 && i2 == i4) { return new Rect(0, 0, i3, i4); } if (i * i4 > i3 * i2) { f = i4; f2 = i2; } else { f = i3; f2 = i; } float f3 = f / f2; return new Rect(0, 0, (int) ((i * f3) + 0.5f), (int) ((i2 * f3) + 0.5f)); } static uGc e(CropView cropView) { if (!c) { if (!d) { if (!b) { throw new IllegalStateException("You must provide a BitmapLoader."); } return new C16427oKK(ImageLoader.getInstance(), new C17506xNa(cropView.a.h, cropView.a.j)); } return new C16961skk(Glide.e(cropView.getContext()), ZXd.a(Glide.a(cropView.getContext()).a, cropView.a.h, cropView.a.j)); } return new Ppq(Picasso.with(cropView.getContext()), new aQV(cropView.a.h, cropView.a.j)); } }