package o; import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.media.ExifInterface; import android.media.Image; import android.net.Uri; import android.os.Environment; import android.text.TextUtils; import android.util.Base64; import android.view.View; import android.webkit.WebView; import android.widget.ImageView; import android.widget.RelativeLayout; import com.bumptech.glide.Glide; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.kofax.kmc.ken.engines.ImageProcessor; import com.kofax.kmc.ken.engines.data.BasicSettingsProfile; import com.kofax.kmc.ken.engines.data.BoundingTetragon; import com.kofax.kmc.ken.engines.data.Image; import com.kofax.kmc.ken.engines.data.ImagePerfectionProfile; import com.kofax.kmc.kut.utilities.error.KmcException; import com.scb.phone.view.custom.ImageTextView; import com.squareup.picasso.Picasso; import io.flutter.plugin.platform.PlatformPlugin; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.Objects; import o.fNW; import o.fZJ; import org.beyka.tiffbitmapfactory.CompressionScheme; import org.beyka.tiffbitmapfactory.ResolutionUnit; import org.beyka.tiffbitmapfactory.TiffBitmapFactory; import org.beyka.tiffbitmapfactory.TiffSaver; /* renamed from: o.fKc */ /* loaded from: classes5.dex */ public class C12891fKc { private C12891fKc() { } public static void azg_(Context context, Drawable drawable, ImageView imageView, String str, int i, int i2) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.c(new fLG(i, i2, context.getResources().getDimensionPixelSize(com.scb.phone.R.dimen.f27782131166544))); C13020fOa aBs_ = e.aBv_(drawable).aBs_(drawable); aBs_.e = true; aBs_.aBu_(imageView, null); } public static void azw_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa a = Picasso.d().e(str).a(EnumC12984fNP.NO_CACHE, new EnumC12984fNP[0]); Bitmap.Config config = Bitmap.Config.RGB_565; fNW.IeS ieS = a.a; if (config != null) { ieS.a = config; if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(a.aBt_()); return; } catch (IOException e) { imageView.setImageResource(android.R.color.transparent); guQ.c(e, "setCircularDrawableToImageView", new Object[0]); return; } } a.e = true; a.aBu_(imageView, new InterfaceC12980fNE(imageView) { // from class: o.fKc.1 private ImageView b; AnonymousClass1(ImageView imageView2) { this.b = imageView2; } @Override // o.InterfaceC12980fNE public final void d() { this.b.setVisibility(0); } @Override // o.InterfaceC12980fNE public final void b(Exception exc) { this.b.setVisibility(8); } }); return; } throw new IllegalArgumentException("config == null"); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.fKc$1 */ /* loaded from: classes5.dex */ public final class AnonymousClass1 implements InterfaceC12980fNE { private ImageView b; AnonymousClass1(ImageView imageView2) { this.b = imageView2; } @Override // o.InterfaceC12980fNE public final void d() { this.b.setVisibility(0); } @Override // o.InterfaceC12980fNE public final void b(Exception exc) { this.b.setVisibility(8); } } public static void azl_(Context context, Drawable drawable, ImageView imageView, String str, int i, int i2) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa aBv_ = Picasso.d().e(str).aBv_(drawable); aBv_.a.c(new C12918fLH(i, i2, context.getResources().getDimensionPixelSize(com.scb.phone.R.dimen.f27782131166544))); C13020fOa aBs_ = aBv_.aBs_(drawable); aBs_.a.e(imageView.getLayoutParams().width, imageView.getLayoutParams().height); fNW.IeS ieS = aBs_.a; if (ieS.e) { throw new IllegalStateException("Center inside can not be used after calling centerCrop"); } ieS.d = true; aBs_.aBu_(imageView, null); } public static void azh_(Drawable drawable, ImageView imageView, int i, int i2) { Picasso d = Picasso.d(); if (i == 0) { throw new IllegalArgumentException("Resource ID must not be zero."); } C13020fOa c13020fOa = new C13020fOa(d, null, i); c13020fOa.a.c(new fLG(i2)); C13020fOa aBs_ = c13020fOa.aBv_(drawable).aBs_(drawable); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(aBs_.aBt_()); return; } catch (IOException e) { guQ.c(e, "setCircularDrawableToImageView", new Object[0]); return; } } aBs_.e = true; aBs_.aBu_(imageView, null); } public static void azj_(ImageView imageView, String str, int i) { azk_(imageView, str, i, null); } public static void azk_(ImageView imageView, String str, int i, InterfaceC12980fNE interfaceC12980fNE) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.c(new fLG(i)); e.e = true; e.aBu_(imageView, interfaceC12980fNE); } public static void azi_(Drawable drawable, ImageView imageView, String str, int i) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.c(new fLG(i)); e.e = true; e.aBv_(drawable).aBs_(drawable).aBu_(imageView, null); } public static void aze_(int i, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } fLI fli = new fLI(); C13020fOa e = Picasso.d().e(str); e.a.c(fli); C13020fOa e2 = e.b(i).e(i); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(e2.aBt_()); return; } catch (IOException e3) { guQ.c(e3, "setCircularDrawableToImageView", new Object[0]); return; } } e2.e = true; e2.aBu_(imageView, null); } public static void azf_(Context context, int i, ImageView imageView, String str, int i2, int i3) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str).b(i).e(i); e.a.e(imageView.getLayoutParams().width, imageView.getLayoutParams().height); e.a.c(new fLG(i2, i3, context.getResources().getDimensionPixelSize(com.scb.phone.R.dimen.f27782131166544))); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(e.aBt_()); return; } catch (IOException e2) { guQ.c(e2, "setCircularDrawableToImageView", new Object[0]); return; } } e.aBu_(imageView, null); } public static void c(Context context, int i, ImageTextView imageTextView, String str, int i2, int i3) { synchronized (C12891fKc.class) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str).b(i).e(i); e.a.e(imageTextView.e, imageTextView.a); e.a.c(new fLG(i2, i3, context.getResources().getDimensionPixelSize(com.scb.phone.R.dimen.f27782131166544))); if (((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { e.d(e(imageTextView)); } else { try { imageTextView.setDrawableBitmap(e.aBt_()); } catch (IOException e2) { imageTextView.setDrawable(nMh.getDrawable(context, i)); guQ.c(e2, "setCircularDrawableToImageTextView in background", new Object[0]); } } } } public static void a(ImageTextView imageTextView, String str) { synchronized (C12891fKc.class) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.e(imageTextView.e, imageTextView.a); if (((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { e.d(e(imageTextView)); } else { try { imageTextView.setDrawableBitmap(e.aBt_()); } catch (IOException e2) { guQ.c(e2, "setDrawableToImageTextView", new Object[0]); } } } } /* renamed from: o.fKc$2 */ /* loaded from: classes5.dex */ public final class AnonymousClass2 implements InterfaceC13027fOh { private ImageTextView e; AnonymousClass2(ImageTextView imageTextView) { this.e = imageTextView; } @Override // o.InterfaceC13027fOh public final void aBB_(Bitmap bitmap) { synchronized (this) { this.e.setDrawableBitmap(bitmap); } } @Override // o.InterfaceC13027fOh public final void aBA_(Drawable drawable) { synchronized (this) { this.e.setDrawable(drawable); } } @Override // o.InterfaceC13027fOh public final void aBC_(Drawable drawable) { synchronized (this) { this.e.setDrawable(drawable); } } } private static InterfaceC13027fOh e(ImageTextView imageTextView) { InterfaceC13027fOh anonymousClass2; synchronized (C12891fKc.class) { anonymousClass2 = new InterfaceC13027fOh(imageTextView) { // from class: o.fKc.2 private ImageTextView e; AnonymousClass2(ImageTextView imageTextView2) { this.e = imageTextView2; } @Override // o.InterfaceC13027fOh public final void aBB_(Bitmap bitmap) { synchronized (this) { this.e.setDrawableBitmap(bitmap); } } @Override // o.InterfaceC13027fOh public final void aBA_(Drawable drawable) { synchronized (this) { this.e.setDrawable(drawable); } } @Override // o.InterfaceC13027fOh public final void aBC_(Drawable drawable) { synchronized (this) { this.e.setDrawable(drawable); } } }; if (imageTextView2.getTag() instanceof InterfaceC13027fOh) { anonymousClass2 = (InterfaceC13027fOh) imageTextView2.getTag(); } if (imageTextView2.getTag() == null) { imageTextView2.setTag(anonymousClass2); } } return anonymousClass2; } public static void azF_(File file, ImageView imageView) { C13020fOa c13020fOa = new C13020fOa(Picasso.d(), Uri.fromFile(file), 0); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(c13020fOa.aBt_()); return; } catch (IOException e) { guQ.c(e, "setFileToImageView", new Object[0]); return; } } c13020fOa.aBu_(imageView, null); } public static Bitmap ayW_(File file) { try { return new C13020fOa(Picasso.d(), Uri.fromFile(file), 0).aBt_(); } catch (IOException e) { guQ.c(e, "loadBitmapFromFile", new Object[0]); return null; } } public static void azn_(Drawable drawable, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa aBs_ = Picasso.d().e(str).aBv_(drawable).aBs_(drawable); aBs_.e = true; aBs_.aBu_(imageView, null); } public static void azp_(Drawable drawable, Drawable drawable2, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa aBs_ = Picasso.d().e(str).aBv_(drawable).aBs_(drawable2); aBs_.e = true; aBs_.aBu_(imageView, null); } public static void azC_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Picasso.d().e(str).a(EnumC12984fNP.NO_STORE, new EnumC12984fNP[0]).aBu_(imageView, null); } public static void azD_(int i, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Picasso.d().e(str).b(i).a(EnumC12984fNP.NO_STORE, new EnumC12984fNP[0]).aBu_(imageView, null); } public static void azm_(int i, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str).b(i).e(i); e.e = true; e.aBu_(imageView, null); } public static void azB_(Context context, int i, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Glide.e(context).c(str).b(new PNS().c(i)).Dq_(imageView); } public static void azy_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.e = true; e.aBu_(imageView, null); } public static void azz_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Picasso.d().e(str).aBu_(imageView, null); } public static void azo_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.e(imageView.getLayoutParams().width, imageView.getLayoutParams().height); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(e.aBt_()); return; } catch (IOException e2) { guQ.c(e2, "setCircularDrawableToImageView", new Object[0]); return; } } e.aBu_(imageView, null); } public static void azE_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); if (!((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) { try { imageView.setImageBitmap(e.aBt_()); return; } catch (IOException e2) { guQ.c(e2, "setDrawableToImageViewWithoutCustomSize", new Object[0]); return; } } e.aBu_(imageView, null); } public static void azq_(Drawable drawable, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa aBs_ = Picasso.d().e(str).aBv_(drawable).aBs_(drawable); aBs_.e = true; fNW.IeS ieS = aBs_.a; if (ieS.d) { throw new IllegalStateException("Center crop can not be used after calling centerInside"); } ieS.e = true; ieS.c = 17; aBs_.aBu_(imageView, null); } public static void azA_(Drawable drawable, ImageView imageView, String str, int i) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.a.c(new fLG(i)); C13020fOa aBs_ = e.aBv_(drawable).aBs_(drawable); aBs_.e = true; fNW.IeS ieS = aBs_.a; if (ieS.d) { throw new IllegalStateException("Center crop can not be used after calling centerInside"); } ieS.e = true; ieS.c = 17; aBs_.aBu_(imageView, null); } public static void azt_(Drawable drawable, ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa aBs_ = Picasso.d().e(str).aBv_(drawable).aBs_(drawable); aBs_.e = true; fNW.IeS ieS = aBs_.a; if (ieS.e) { throw new IllegalStateException("Center inside can not be used after calling centerCrop"); } ieS.d = true; aBs_.aBu_(imageView, null); } public static void azu_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.e = true; fNW.IeS ieS = e.a; if (ieS.e) { throw new IllegalStateException("Center inside can not be used after calling centerCrop"); } ieS.d = true; e.aBu_(imageView, null); } public static void b(String str, InterfaceC13027fOh interfaceC13027fOh) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Picasso.d().e(str).d(interfaceC13027fOh); } public static void azr_(ImageView imageView, String str, InterfaceC12980fNE interfaceC12980fNE) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str); e.e = true; Bitmap.Config config = Bitmap.Config.RGB_565; fNW.IeS ieS = e.a; if (config != null) { ieS.a = config; fNW.IeS ieS2 = e.a; if (!ieS2.d) { ieS2.e = true; ieS2.c = 17; e.aBu_(imageView, interfaceC12980fNE); return; } throw new IllegalStateException("Center crop can not be used after calling centerInside"); } throw new IllegalArgumentException("config == null"); } public static void azG_(File file, ImageView imageView, Drawable drawable) { C13020fOa c13020fOa; Picasso d = Picasso.d(); if (file != null) { c13020fOa = new C13020fOa(d, Uri.fromFile(file), 0); } else { c13020fOa = new C13020fOa(d, null, 0); } c13020fOa.e = true; Bitmap.Config config = Bitmap.Config.RGB_565; fNW.IeS ieS = c13020fOa.a; if (config != null) { ieS.a = config; fNW.IeS ieS2 = c13020fOa.a; if (ieS2.d) { throw new IllegalStateException("Center crop can not be used after calling centerInside"); } ieS2.e = true; ieS2.c = 17; c13020fOa.aBs_(drawable).aBu_(imageView, null); return; } throw new IllegalArgumentException("config == null"); } public static void c(File file, InterfaceC13027fOh interfaceC13027fOh) { C13020fOa c13020fOa; Picasso d = Picasso.d(); if (file != null) { c13020fOa = new C13020fOa(d, Uri.fromFile(file), 0); } else { c13020fOa = new C13020fOa(d, null, 0); } c13020fOa.d(interfaceC13027fOh); } public static File b(Context context) throws IOException { return a(context, true); } public static File a(Context context, boolean z) throws IOException { File filesDir; String format = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); StringBuilder sb = new StringBuilder("IMAGE_"); sb.append(format); sb.append("_"); String obj = sb.toString(); if (z) { filesDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES); } else { filesDir = context.getFilesDir(); } return File.createTempFile(obj, ".jpg", filesDir); } public static String ayS_(Context context, Uri uri) { String str = null; if (context == null) { return null; } String[] strArr = {"_data"}; Cursor query = context.getContentResolver().query(uri, strArr, null, null, null); if (query != null) { query.moveToFirst(); try { str = query.getString(query.getColumnIndex(strArr[0])); } finally { query.close(); } } return str; } public static int e(String str) { return (int) new File(str).length(); } public static String b(String str) { return new File(str).getName(); } public static void azK_(String str, ImageView imageView) { azL_(str, imageView, null); } public static void azL_(String str, ImageView imageView, Picasso.Sts sts) { Uri fromParts = Uri.fromParts("base64", str, null); Picasso.RVV rvv = new Picasso.RVV(imageView.getContext()); if (sts != null) { rvv.c(sts); } new C13020fOa(rvv.d(new fJN()).a(), fromParts, 0).a(EnumC12984fNP.NO_CACHE, EnumC12984fNP.NO_STORE).aBu_(imageView, null); } public static String e(Context context, String str) { try { InputStream openInputStream = context.getContentResolver().openInputStream(Uri.parse(str)); Bitmap decodeStream = BitmapFactory.decodeStream(openInputStream); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); decodeStream.compress(Bitmap.CompressFormat.JPEG, 75, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); decodeStream.recycle(); openInputStream.close(); return Base64.encodeToString(byteArray, 2); } catch (IOException | NullPointerException e) { guQ.e(e); return ""; } } public static AbstractC13175fSw e(File file, byte[] bArr) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(bArr, file) { // from class: o.fKe private byte[] a; private File c; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.c(this.a, this.c, interfaceC13178fSz); } { this.a = bArr; this.c = file; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void c(byte[] bArr, File file, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { Bitmap bitmap; try { bitmap = BitmapFactory.decodeByteArray(bArr, 0, bArr.length); } catch (Exception e) { guQ.e(e); interfaceC13178fSz.e(e); bitmap = null; } if (bitmap != null) { StringBuilder sb = new StringBuilder("temp_"); sb.append(System.currentTimeMillis()); sb.append(".jpg"); try { File file2 = new File(file, sb.toString()); if (!file2.exists()) { file2.getParentFile().mkdirs(); file2.createNewFile(); } ayP_(file2, bitmap); interfaceC13178fSz.c(file2); } catch (IOException | NullPointerException e2) { guQ.e(e2); interfaceC13178fSz.e(e2); } } } private static void ayP_(File file, Bitmap bitmap) throws Exception { try { FileOutputStream fileOutputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); } finally { bitmap.recycle(); } } public static AbstractC13175fSw ayZ_(Context context, Bitmap bitmap) { return AbstractC13175fSw.d(new fSB(context, bitmap) { // from class: o.fKg private Context a; private Bitmap e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.ayT_(this.a, this.e, interfaceC13178fSz); } { this.a = context; this.e = bitmap; } }); } /* JADX WARN: Removed duplicated region for block: B:10:0x002c A[Catch: IOException -> 0x0039, TryCatch #0 {IOException -> 0x0039, blocks: (B:2:0x0000, B:4:0x000c, B:8:0x001c, B:10:0x002c, B:13:0x0030), top: B:1:0x0000 }] */ /* JADX WARN: Removed duplicated region for block: B:13:0x0030 A[Catch: IOException -> 0x0039, TRY_LEAVE, TryCatch #0 {IOException -> 0x0039, blocks: (B:2:0x0000, B:4:0x000c, B:8:0x001c, B:10:0x002c, B:13:0x0030), top: B:1:0x0000 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static /* synthetic */ void ayT_(android.content.Context r2, android.graphics.Bitmap r3, o.InterfaceC13178fSz r4) throws java.lang.Throwable { /* java.lang.String r0 = "mounted" java.lang.String r1 = android.os.Environment.getExternalStorageState() // Catch: java.io.IOException -> L39 boolean r0 = r0.equals(r1) // Catch: java.io.IOException -> L39 if (r0 != 0) goto L1b java.lang.String r0 = "mounted_ro" java.lang.String r1 = android.os.Environment.getExternalStorageState() // Catch: java.io.IOException -> L39 boolean r0 = r0.equals(r1) // Catch: java.io.IOException -> L39 if (r0 == 0) goto L19 goto L1b L19: r0 = 0 goto L1c L1b: r0 = 1 L1c: java.io.File r2 = a(r2, r0) // Catch: java.io.IOException -> L39 java.lang.String r0 = r2.getPath() // Catch: java.io.IOException -> L39 ayP_(r2, r3) // Catch: java.io.IOException -> L39 r3.recycle() // Catch: java.io.IOException -> L39 if (r0 == 0) goto L30 r4.c(r0) // Catch: java.io.IOException -> L39 return L30: java.lang.Throwable r2 = new java.lang.Throwable // Catch: java.io.IOException -> L39 r2.() // Catch: java.io.IOException -> L39 r4.e(r2) // Catch: java.io.IOException -> L39 return L39: r2 = move-exception r4.e(r2) return */ throw new UnsupportedOperationException("Method not decompiled: o.C12891fKc.ayT_(android.content.Context, android.graphics.Bitmap, o.fSz):void"); } public static AbstractC13175fSw aza_(Context context, Bitmap bitmap) { return AbstractC13175fSw.d(new fSB(context, bitmap) { // from class: o.fKr private Bitmap a; private Context e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.ayU_(this.e, this.a, interfaceC13178fSz); } { this.e = context; this.a = bitmap; } }); } public static /* synthetic */ void ayU_(Context context, Bitmap bitmap, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { TiffSaver.SaveOptions saveOptions = new TiffSaver.SaveOptions(); saveOptions.compressionScheme = CompressionScheme.CCITTFAX4; saveOptions.resUnit = ResolutionUnit.INCH; saveOptions.xResolution = 300.0f; saveOptions.yResolution = 300.0f; String d = d(context); boolean saveBitmap = TiffSaver.saveBitmap(d, bitmap, saveOptions); bitmap.recycle(); if (saveBitmap) { interfaceC13178fSz.c(d); } else { interfaceC13178fSz.e(new Throwable()); } } public static AbstractC13175fSw d(String str, int i) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str, i) { // from class: o.fKu private String c; private int d; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.c(this.c, this.d, interfaceC13178fSz); } { this.c = str; this.d = i; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void c(String str, int i, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(str, options); try { Bitmap azd_ = azd_(str, options, Math.min(i, PlatformPlugin.DEFAULT_SYSTEM_UI)); File file = new File(str); if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); azd_.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); FileOutputStream fileOutputStream = new FileOutputStream(file); try { fileOutputStream.write(byteArray); fileOutputStream.flush(); fileOutputStream.close(); azd_.recycle(); interfaceC13178fSz.c(file); } finally { } } catch (Exception e) { interfaceC13178fSz.e(e); } catch (OutOfMemoryError e2) { guQ.e(e2, "OutOfMemoryError occurs during compressing image", new Object[0]); interfaceC13178fSz.c(new File(str)); } } private static Bitmap azd_(String str, BitmapFactory.Options options, float f) throws IOException { BitmapFactory.Options options2 = new BitmapFactory.Options(); options2.inSampleSize = ayO_(options, f); Bitmap decodeFile = BitmapFactory.decodeFile(str, options2); float min = Math.min(f / decodeFile.getWidth(), f / decodeFile.getHeight()); if (min < 1.0f) { decodeFile = Bitmap.createScaledBitmap(decodeFile, Math.round(decodeFile.getWidth() * min), Math.round(min * decodeFile.getHeight()), true); } return ayX_(str, decodeFile); } private static int ayO_(BitmapFactory.Options options, float f) { int i = options.outHeight; int i2 = options.outWidth; int i3 = 1; if (i > f || i2 > f) { int i4 = i / 2; int i5 = i2 / 2; while (i4 / i3 >= f && i5 / i3 >= f) { i3 <<= 1; } } return i3; } private static Bitmap ayX_(String str, Bitmap bitmap) throws IOException { int attributeInt = new ExifInterface(str).getAttributeInt("Orientation", 0); return ayY_(bitmap, attributeInt != 3 ? attributeInt != 6 ? attributeInt != 8 ? BitmapDescriptorFactory.HUE_RED : 270.0f : 90.0f : 180.0f); } private static Bitmap ayY_(Bitmap bitmap, float f) { if (f <= BitmapDescriptorFactory.HUE_RED) { return bitmap; } Matrix matrix = new Matrix(); matrix.postRotate(f); Bitmap createBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); bitmap.recycle(); return createBitmap; } public static AbstractC13175fSw e(String str, int i) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str, i) { // from class: o.fKn private int c; private String d; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.d(this.d, this.c, interfaceC13178fSz); } { this.d = str; this.c = i; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void d(String str, int i, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(str, options); Bitmap azd_ = azd_(str, options, Math.min(i, PlatformPlugin.DEFAULT_SYSTEM_UI)); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); azd_.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); azd_.recycle(); interfaceC13178fSz.c(Base64.encodeToString(byteArray, 2)); } catch (Exception e) { interfaceC13178fSz.e(e); } } public static AbstractC13175fSw azb_(ContentResolver contentResolver, Resources resources, Image image, Uri uri, float f, int i) { try { ByteBuffer buffer = image.getPlanes()[0].getBuffer(); byte[] bArr = new byte[buffer.remaining()]; buffer.get(bArr); return AbstractC13175fSw.d((fSB) new C12901fKm(contentResolver, uri, resources, bArr, f, i)); } catch (Exception e) { return AbstractC13175fSw.e(e); } finally { image.close(); } } public static AbstractC13175fSw azc_(ContentResolver contentResolver, Resources resources, byte[] bArr, Uri uri, float f, int i) { return AbstractC13175fSw.d((fSB) new C12901fKm(contentResolver, uri, resources, bArr, f, i)); } public static /* synthetic */ void ayV_(ContentResolver contentResolver, Uri uri, Resources resources, byte[] bArr, float f, int i, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { boolean z; int width; int height; int i2; int i3; boolean z2; boolean z3 = false; try { OutputStream openOutputStream = contentResolver.openOutputStream(uri); try { Bitmap ayQ_ = ayQ_(resources, bArr); Matrix matrix = new Matrix(); matrix.postRotate(i); if (f < 1.0f) { width = (int) (ayQ_.getWidth() * f); height = (int) (ayQ_.getHeight() * f); i2 = (int) ((ayQ_.getWidth() - r10) / 2.0f); i3 = (int) ((ayQ_.getHeight() - r11) / 2.0f); } else { width = ayQ_.getWidth(); height = ayQ_.getHeight(); i2 = 0; i3 = 0; } Bitmap createBitmap = Bitmap.createBitmap(ayQ_, i2, i3, width, height, matrix, true); z = true; if (createBitmap != ayQ_) { ayQ_.recycle(); z2 = true; } else { z2 = false; } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); createBitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); if (!z2) { ayQ_.recycle(); } createBitmap.recycle(); openOutputStream.write(byteArray); if (openOutputStream != null) { try { openOutputStream.close(); } catch (FileNotFoundException | NullPointerException e) { e = e; z3 = true; interfaceC13178fSz.e(e); z = z3; interfaceC13178fSz.c(Boolean.valueOf(z)); } } } finally { } } catch (FileNotFoundException e2) { e = e2; } catch (NullPointerException e3) { e = e3; } interfaceC13178fSz.c(Boolean.valueOf(z)); } public static Bitmap ayQ_(Resources resources, byte[] bArr) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options); options.inSampleSize = ayO_(options, Math.max(resources.getDisplayMetrics().widthPixels, PlatformPlugin.DEFAULT_SYSTEM_UI)); options.inJustDecodeBounds = false; options.inPreferredConfig = Bitmap.Config.RGB_565; options.inDither = true; return BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options); } public static AbstractC13175fSw c(String str) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str) { // from class: o.fKj private String e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.a(this.e, interfaceC13178fSz); } { this.e = str; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void a(String str, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { File file = new File(str); if (file.length() == 0) { interfaceC13178fSz.e(new Throwable("O bytes file")); return; } com.kofax.kmc.ken.engines.data.Image image = new com.kofax.kmc.ken.engines.data.Image(file, j(str)); ImageProcessor imageProcessor = new ImageProcessor(); imageProcessor.addAnalysisCompleteEventListener(new ImageProcessor.AnalysisCompleteListener(image, interfaceC13178fSz) { // from class: o.fKs private com.kofax.kmc.ken.engines.data.Image a; private InterfaceC13178fSz c; @Override // com.kofax.kmc.ken.engines.ImageProcessor.AnalysisCompleteListener public final void analysisComplete(ImageProcessor.AnalysisCompleteEvent analysisCompleteEvent) { C12891fKc.a(this.a, this.c, analysisCompleteEvent); } { this.a = image; this.c = interfaceC13178fSz; } }); imageProcessor.doQuickAnalysis(image, false); } public static /* synthetic */ void a(com.kofax.kmc.ken.engines.data.Image image, InterfaceC13178fSz interfaceC13178fSz, ImageProcessor.AnalysisCompleteEvent analysisCompleteEvent) { image.imageClearBitmap(); interfaceC13178fSz.c(analysisCompleteEvent.getImage()); } public static AbstractC13175fSw e(Context context, String str, String str2) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str, str2, context) { // from class: o.fKo private Context c; private String d; private String e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.b(this.d, this.e, this.c, interfaceC13178fSz); } { this.d = str; this.e = str2; this.c = context; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void b(String str, String str2, Context context, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { String str3; com.kofax.kmc.ken.engines.data.Image image = new com.kofax.kmc.ken.engines.data.Image(new File(str), j(str)); ImageProcessor imageProcessor = new ImageProcessor(); ImagePerfectionProfile imagePerfectionProfile = new ImagePerfectionProfile(); if (BkY.SALARY_TYPE.type.equalsIgnoreCase(str2)) { str3 = "_DoNoPageDetection__DocDimLarge_11.69_DocDimSmall_8.27__DoEdgeCleanup__DoSharpen_3_DoScaleBWImageToDPI_300_DoEnhancedBinarization__Do90DegreeRotation_4_DoIlluminationCorrection__LoadInlineSetting_[intelligent_brightness_enabled=1]_LoadInlineSetting_[CBinarize.Do_Adv_Clarity.Bool=1]_LoadInlineSetting_[CBinarize.Cleanup_Slider_Pos.Int=2]_LoadInlineSetting_[intelligent_contrast_enabled=1]_LoadInlineSetting_[CBinarize.Contrast_Slider_Pos.Int=2]_DoBackgroundSmothing__DoHoleFill_"; } else { str3 = BkY.CID_TYPE.type.equalsIgnoreCase(str2) ? "_DeviceType_0__DoNoPageDetection__DocDimLarge_8.56_DocDimSmall_5.4__DoScaleImageToDPI_150_Do90DegreeRotation_9__LoadInlineSetting_[CSkewDetect.correct_illumination.Bool=0]" : "_DeviceType_0_DoEdgeCleanup__DoSharpen_3_DoScaleImageToDPI_150_Do90DegreeRotation_4"; } imagePerfectionProfile.setIpOperations(str3); imageProcessor.setImagePerfectionProfile(imagePerfectionProfile); imageProcessor.addImageOutEventListener(new ImageProcessor.ImageOutListener(context, str, interfaceC13178fSz, image) { // from class: o.fKl private Context a; private String b; private InterfaceC13178fSz d; private com.kofax.kmc.ken.engines.data.Image e; @Override // com.kofax.kmc.ken.engines.ImageProcessor.ImageOutListener public final void imageOut(ImageProcessor.ImageOutEvent imageOutEvent) { C12891fKc.d(this.a, this.b, this.d, this.e, imageOutEvent); } { this.a = context; this.b = str; this.d = interfaceC13178fSz; this.e = image; } }); try { imageProcessor.processImage(image); } catch (KmcException unused) { image.imageClearBitmap(); try { image.imageClearFileBuffer(); } catch (KmcException unused2) { } b(context, (InterfaceC13178fSz) interfaceC13178fSz, new BES(str, null, null, null)); } } public static AbstractC13175fSw d(Context context, String str) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str, context) { // from class: o.fKd private String a; private Context b; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.c(this.a, this.b, interfaceC13178fSz); } { this.a = str; this.b = context; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void c(String str, Context context, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { com.kofax.kmc.ken.engines.data.Image image = new com.kofax.kmc.ken.engines.data.Image(new File(str), j(str)); ImageProcessor imageProcessor = new ImageProcessor(); ImagePerfectionProfile imagePerfectionProfile = new ImagePerfectionProfile(); imagePerfectionProfile.setIpOperations("_DoNoPageDetection__DocDimLarge_11.69_DocDimSmall_8.27__DoEdgeCleanup__DoSharpen_3_DoScaleBWImageToDPI_300_DoEnhancedBinarization__Do90DegreeRotation_4_DoIlluminationCorrection__LoadInlineSetting_[intelligent_brightness_enabled=1]_LoadInlineSetting_[CBinarize.Do_Adv_Clarity.Bool=1]_LoadInlineSetting_[CBinarize.Cleanup_Slider_Pos.Int=2]_LoadInlineSetting_[intelligent_contrast_enabled=1]_LoadInlineSetting_[CBinarize.Contrast_Slider_Pos.Int=2]_DoBackgroundSmothing__DoHoleFill_"); imageProcessor.setImagePerfectionProfile(imagePerfectionProfile); imageProcessor.setProcessedImageMimeType(Image.ImageMimeType.MIMETYPE_TIFF); imageProcessor.setProcessedImageRepresentation(Image.ImageRep.IMAGE_REP_FILE); imageProcessor.setProcessedImageFilePath(d(context)); imageProcessor.addImageOutEventListener(new ImageProcessor.ImageOutListener(image, interfaceC13178fSz) { // from class: o.fKf private InterfaceC13178fSz b; private com.kofax.kmc.ken.engines.data.Image e; @Override // com.kofax.kmc.ken.engines.ImageProcessor.ImageOutListener public final void imageOut(ImageProcessor.ImageOutEvent imageOutEvent) { C12891fKc.b(this.e, this.b, imageOutEvent); } { this.e = image; this.b = interfaceC13178fSz; } }); try { imageProcessor.processImage(image); } catch (KmcException e) { image.imageClearBitmap(); try { image.imageClearFileBuffer(); } catch (KmcException unused) { } interfaceC13178fSz.e(e); } } public static /* synthetic */ void b(com.kofax.kmc.ken.engines.data.Image image, InterfaceC13178fSz interfaceC13178fSz, ImageProcessor.ImageOutEvent imageOutEvent) { image.imageClearBitmap(); try { image.imageClearFileBuffer(); } catch (KmcException unused) { } if (imageOutEvent.getImage() != null && imageOutEvent.getImage().getImageFilePath() != null) { interfaceC13178fSz.c(imageOutEvent.getImage().getImageFilePath()); } else { interfaceC13178fSz.e(new Throwable()); } } private static String d(Context context) { File externalFilesDir; String format = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); StringBuilder sb = new StringBuilder("TIFF_"); sb.append(format); sb.append(".tif"); String obj = sb.toString(); if ("mounted".equals(Environment.getExternalStorageState()) || "mounted_ro".equals(Environment.getExternalStorageState())) { externalFilesDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES); } else { externalFilesDir = context.getFilesDir(); } StringBuilder sb2 = new StringBuilder(); sb2.append(externalFilesDir); sb2.append("/"); sb2.append(obj); return sb2.toString(); } public static AbstractC13175fSw a(Context context, com.kofax.kmc.ken.engines.data.Image image, String str, BoundingTetragon boundingTetragon) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(boundingTetragon, context, str, image) { // from class: o.fJX private BoundingTetragon a; private Context b; private String d; private com.kofax.kmc.ken.engines.data.Image e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.e(this.a, this.b, this.d, this.e, interfaceC13178fSz); } { this.a = boundingTetragon; this.b = context; this.d = str; this.e = image; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void e(BoundingTetragon boundingTetragon, Context context, String str, com.kofax.kmc.ken.engines.data.Image image, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { ImageProcessor imageProcessor = new ImageProcessor(); BasicSettingsProfile basicSettingsProfile = new BasicSettingsProfile(); basicSettingsProfile.setCroppingTetragon(boundingTetragon); basicSettingsProfile.setCropType(BasicSettingsProfile.CropType.CROP_TETRAGON); imageProcessor.setBasicSettingsProfile(basicSettingsProfile); imageProcessor.addImageOutEventListener(new ImageProcessor.ImageOutListener(context, str, interfaceC13178fSz, image) { // from class: o.fKh private InterfaceC13178fSz b; private String c; private Context d; private com.kofax.kmc.ken.engines.data.Image e; @Override // com.kofax.kmc.ken.engines.ImageProcessor.ImageOutListener public final void imageOut(ImageProcessor.ImageOutEvent imageOutEvent) { C12891fKc.d(this.d, this.c, this.b, this.e, imageOutEvent); } { this.d = context; this.c = str; this.b = interfaceC13178fSz; this.e = image; } }); try { imageProcessor.processImage(image); } catch (KmcException unused) { image.imageClearBitmap(); try { image.imageClearFileBuffer(); } catch (KmcException unused2) { } b(context, (InterfaceC13178fSz) interfaceC13178fSz, new BES(str, null, null, null)); } } public static AbstractC13175fSw i(String str) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str) { // from class: o.fKi private String a; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.c(this.a, interfaceC13178fSz); } { this.a = str; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void c(String str, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { Bitmap decodeFile = BitmapFactory.decodeFile(str); int attributeInt = new ExifInterface(str).getAttributeInt("Orientation", 0); interfaceC13178fSz.c(ayY_(decodeFile, attributeInt != 3 ? attributeInt != 6 ? attributeInt != 8 ? BitmapDescriptorFactory.HUE_RED : 270.0f : 90.0f : 180.0f)); } public static AbstractC13175fSw e(String str, int i, int i2, long j) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(i2, str, j, i) { // from class: o.fKp private int a; private int b; private String d; private long e; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.e(this.a, this.d, this.e, this.b, interfaceC13178fSz); } { this.a = i2; this.d = str; this.e = j; this.b = i; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void e(int i, String str, long j, int i2, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { Bitmap decodePath; try { TiffBitmapFactory.Options options = new TiffBitmapFactory.Options(); if (i > 256) { decodePath = TiffBitmapFactory.decodePath(str); } else { options.inAvailableMemory = j; decodePath = TiffBitmapFactory.decodePath(str, options); } Bitmap ayY_ = ayY_(decodePath, i2); if (ayY_ != null) { interfaceC13178fSz.c(ayY_); } else { interfaceC13178fSz.e(new Exception("Bitmap rotation failed")); } } catch (Exception e) { interfaceC13178fSz.e(e); } } public static void d(Context context, String str, InterfaceC13178fSz interfaceC13178fSz, com.kofax.kmc.ken.engines.data.Image image, ImageProcessor.ImageOutEvent imageOutEvent) { image.imageClearBitmap(); try { image.imageClearFileBuffer(); } catch (KmcException unused) { } if (imageOutEvent.getImage() != null) { try { b(context, interfaceC13178fSz, new BES(a(imageOutEvent, context), null, null, null)); return; } catch (KmcException | IOException unused2) { b(context, interfaceC13178fSz, new BES(str, null, null, null)); return; } } b(context, interfaceC13178fSz, new BES(str, null, null, null)); } private static String a(ImageProcessor.ImageOutEvent imageOutEvent, Context context) throws IOException, KmcException { File a = a(context, "mounted".equals(Environment.getExternalStorageState()) || "mounted_ro".equals(Environment.getExternalStorageState())); FileOutputStream fileOutputStream = new FileOutputStream(a); imageOutEvent.getImage().getImageBitmap().compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); imageOutEvent.getImage().imageClearBitmap(); imageOutEvent.getImage().imageClearFileBuffer(); fileOutputStream.flush(); fileOutputStream.close(); return a.getPath(); } public static AbstractC13175fSw d(Context context, String str, boolean z) { AbstractC13175fSw d = AbstractC13175fSw.d((fSB) new C12899fKk(z, str, context)); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void b(boolean z, String str, Context context, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { BES bes; if (z) { bes = h(str); } else { bes = new BES(str, null, null, null); } b(context, (InterfaceC13178fSz) interfaceC13178fSz, bes); } private static BES h(String str) { String str2; String str3; float[] fArr = new float[2]; String str4 = null; try { ExifInterface exifInterface = new ExifInterface(str); exifInterface.getLatLong(fArr); String attribute = exifInterface.getAttribute("DateTime"); try { float f = fArr[0]; str3 = f != BitmapDescriptorFactory.HUE_RED ? String.valueOf(f) : null; try { float f2 = fArr[1]; if (f2 != BitmapDescriptorFactory.HUE_RED) { str4 = String.valueOf(f2); } } catch (Exception unused) { } str2 = str4; } catch (Exception unused2) { str2 = null; str3 = null; } str4 = attribute; } catch (Exception unused3) { str2 = null; str3 = null; } return new BES(str, str4, str3, str2); } private static File a(Context context, String str) { Bitmap decodeFile = BitmapFactory.decodeFile(str, new BitmapFactory.Options()); boolean z = "mounted".equals(Environment.getExternalStorageState()) || "mounted_ro".equals(Environment.getExternalStorageState()); try { new ExifInterface(str).getLatLong(new float[2]); File a = a(context, z); FileOutputStream fileOutputStream = new FileOutputStream(a); decodeFile.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); decodeFile.recycle(); return a; } catch (IOException unused) { return null; } } public static boolean d(String str) { return new File(str).length() < 9437184; } public static Image.ImageMimeType j(String str) { char c; int lastIndexOf = str.lastIndexOf(46) + 1; String substring = lastIndexOf < str.length() ? str.substring(lastIndexOf) : ""; int hashCode = substring.hashCode(); if (hashCode == 105441) { if (substring.equals("jpg")) { c = 2; } c = 65535; } else if (hashCode != 111145) { if (hashCode == 114833 && substring.equals("tif")) { c = 0; } c = 65535; } else { if (substring.equals("png")) { c = 1; } c = 65535; } if (c == 0) { return Image.ImageMimeType.MIMETYPE_TIFF; } if (c == 1) { return Image.ImageMimeType.MIMETYPE_PNG; } return Image.ImageMimeType.MIMETYPE_JPEG; } public static boolean g(String str) { int lastIndexOf = str.lastIndexOf(46) + 1; return (lastIndexOf < str.length() ? str.substring(lastIndexOf) : "").equalsIgnoreCase("tif"); } public static AbstractC13175fSw a(String str) { AbstractC13175fSw d = AbstractC13175fSw.d(new fSB(str) { // from class: o.fKq private String c; @Override // o.fSB public final void d(InterfaceC13178fSz interfaceC13178fSz) { C12891fKc.d(this.c, interfaceC13178fSz); } { this.c = str; } }); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } public static /* synthetic */ void d(String str, InterfaceC13178fSz interfaceC13178fSz) throws Throwable { File file = new File(str); TiffBitmapFactory.Options options = new TiffBitmapFactory.Options(); options.inJustDecodeBounds = true; TiffBitmapFactory.decodeFile(file, options); if (options.outDirectoryCount > 0) { options.inDirectoryNumber = 0; TiffBitmapFactory.decodeFile(file, options); options.inJustDecodeBounds = false; options.inSampleSize = 1; interfaceC13178fSz.c(TiffBitmapFactory.decodeFile(file, options)); return; } interfaceC13178fSz.e(new Throwable()); } public static void azs_(ImageView imageView, String str) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str).b(com.scb.phone.R.drawable.reward_img_placeholder).e(com.scb.phone.R.drawable.reward_img_placeholder); e.e = true; fNW.IeS ieS = e.a; if (ieS.d) { throw new IllegalStateException("Center crop can not be used after calling centerInside"); } ieS.e = true; ieS.c = 17; e.a(EnumC12984fNP.NO_CACHE, new EnumC12984fNP[0]).aBu_(imageView, null); } public static void azv_(String str, int i, int i2, ImageView imageView) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } C13020fOa e = Picasso.d().e(str).b(i).e(i2); e.e = true; e.a(EnumC12984fNP.NO_STORE, new EnumC12984fNP[0]).aBu_(imageView, null); } public static void azx_(String str, ImageView imageView) { if (TextUtils.isEmpty(str)) { str = "http://url.with.error"; } Picasso.d().e(str).b(com.scb.phone.R.drawable.default_card).e(com.scb.phone.R.drawable.default_card_without_logo).a(EnumC12984fNP.NO_STORE, new EnumC12984fNP[0]).aBu_(imageView, null); } public static Bitmap ayR_(WebView webView) { Bitmap bitmap = null; if (webView != null) { webView.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0)); if (webView.getMeasuredWidth() > 0 && webView.getMeasuredHeight() > 0) { bitmap = Bitmap.createBitmap(webView.getMeasuredWidth(), webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888); } if (bitmap != null) { Canvas canvas = new Canvas(bitmap); canvas.drawBitmap(bitmap, BitmapDescriptorFactory.HUE_RED, bitmap.getHeight(), new Paint()); webView.draw(canvas); } } return bitmap; } private static void b(Context context, InterfaceC13178fSz interfaceC13178fSz, BES bes) { String str = bes.c; File file = new File(str); int lastIndexOf = str.lastIndexOf(46) + 1; if ((lastIndexOf < str.length() ? str.substring(lastIndexOf) : "").equalsIgnoreCase("heic")) { file = a(context, str); } while (file != null && file.length() > 9437184) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 2; Bitmap decodeFile = BitmapFactory.decodeFile(str, options); try { File a = a(context, "mounted".equals(Environment.getExternalStorageState()) || "mounted_ro".equals(Environment.getExternalStorageState())); FileOutputStream fileOutputStream = new FileOutputStream(a); decodeFile.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); decodeFile.recycle(); file = a; } catch (IOException unused) { file = null; } } if (file != null) { String path = file.getPath(); String str2 = bes.a; String str3 = bes.d; String str4 = bes.e; C14957gcv.e(path, ""); interfaceC13178fSz.c(new BES(path, str2, str3, str4)); return; } interfaceC13178fSz.e(new Throwable()); } public static void azH_(Context context, RelativeLayout relativeLayout, ImageView imageView) { try { fZJ.Sts sts = new fZJ.Sts(context); sts.b.c = 15; sts.b.a = 1; sts.b.e = nMh.getColor(context, com.scb.phone.R.color.f14082131100916); sts.e = true; sts.d = 600; new fZJ.RVV(sts.a, relativeLayout, sts.b, sts.c, sts.h).aCT_(imageView); imageView.setVisibility(0); } catch (NullPointerException | OutOfMemoryError e) { guQ.c(e, "setLifestyleTutorialOverlayImageFromRelative", new Object[0]); } } public static void azI_(Context context, RelativeLayout relativeLayout, ImageView imageView) { try { fZJ.Sts sts = new fZJ.Sts(context); sts.b.c = 15; sts.b.a = 1; sts.c = true; sts.b.e = nMh.getColor(context, com.scb.phone.R.color.f3002131099807); sts.e = true; sts.d = 600; new fZJ.RVV(sts.a, relativeLayout, sts.b, sts.c, sts.h).aCT_(imageView); imageView.setVisibility(0); } catch (NullPointerException | OutOfMemoryError e) { guQ.c(e, "setTutorialOverlayImageFromRelative", new Object[0]); } } public static void azJ_(Context context, RelativeLayout relativeLayout, ImageView imageView) { try { fZJ.Sts sts = new fZJ.Sts(context); sts.b.c = 15; sts.b.a = 1; sts.c = true; sts.b.e = nMh.getColor(context, com.scb.phone.R.color.f3022131099809); sts.e = true; sts.d = 600; new fZJ.RVV(sts.a, relativeLayout, sts.b, sts.c, sts.h).aCT_(imageView); imageView.setVisibility(0); } catch (NullPointerException | OutOfMemoryError e) { guQ.c(e, "setTutorialOverlayImageFromRelative", new Object[0]); } } public static AbstractC13175fSw b(Context context, String str) { AbstractC13175fSw d = AbstractC13175fSw.d((fSB) new C12899fKk(false, str, context)); AbstractC13173fSu c = C13417fZt.c(); Objects.requireNonNull(c, "scheduler is null"); C13376fYo c13376fYo = new C13376fYo(d, c); AbstractC13173fSu e = fRR.e(); Objects.requireNonNull(e, "scheduler is null"); return new C13371fYj(c13376fYo, e); } }