what-the-bank/sources/com/scb/phone/view/fragment/promptpay/PromptPayQRSuccessFragment....

354 lines
14 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.promptpay;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Optional;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.HomeActivity;
import com.scb.phone.view.activity.promptpay.PromptPayQRActivity;
import com.scb.phone.view.custom.common.CustomDialog;
import com.scb.phone.view.custom.transferandpay.CustomTransferAndPayItem;
import com.scb.phone.view.fragment.promptpay.PromptPayQRScreenshotFragment;
import com.scb.phone.view.fragment.promptpay.PromptPayQRSuccessFragment;
import java.util.Calendar;
import java.util.concurrent.Callable;
import o.AbstractC13163fSk;
import o.C1082Ve;
import o.C1087Vh;
import o.C13417fZt;
import o.C14547fvK;
import o.C7885cwl;
import o.C7891cwr;
import o.EnumC8951daY;
import o.InterfaceC13391fZD;
import o.InterfaceC15577gud;
import o.InterfaceC8975daw;
import o.ZI;
import o.fRR;
import o.fSQ;
import o.guQ;
import o.ihb;
import org.jmrtd.lds.ImageInfo;
/* loaded from: classes5.dex */
public class PromptPayQRSuccessFragment extends Hilt_PromptPayQRSuccessFragment implements InterfaceC8975daw.RVV {
@BindView
CustomTransferAndPayItem accountNumberCustomTarget;
@BindView
CustomTransferAndPayItem amountCustomTarget;
private boolean c = false;
private Uri d;
@InterfaceC13391fZD
public C7885cwl promptPayQRSuccessPresenter;
@BindView
ImageView qrCodeImageView;
public static PromptPayQRSuccessFragment d() {
return new PromptPayQRSuccessFragment();
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
byte b = 0;
View inflate = layoutInflater.inflate(R.layout.2131559839, viewGroup, false);
ButterKnife.c(this, inflate);
this.promptPayQRSuccessPresenter.e((C7885cwl) this);
C7885cwl c7885cwl = this.promptPayQRSuccessPresenter;
if (!c7885cwl.c && c7885cwl.f != 0) {
c7885cwl.c = true;
ZI.IeS ieS = new ZI.IeS() { // from class: o.cwo
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC8975daw.RVV) obj).y();
}
};
if (c7885cwl.f != 0) {
ieS.e(c7885cwl.f);
}
c7885cwl.a.b();
ihb ihbVar = c7885cwl.a;
ihbVar.d(ihbVar.i, new C7885cwl.HBt(c7885cwl, b));
}
return inflate;
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
WindowManager.LayoutParams attributes = getActivity().getWindow().getAttributes();
attributes.screenBrightness = 1.0f;
getActivity().getWindow().setAttributes(attributes);
}
@Override // androidx.fragment.app.Fragment
public void onPause() {
super.onPause();
WindowManager.LayoutParams attributes = getActivity().getWindow().getAttributes();
attributes.screenBrightness = -1.0f;
getActivity().getWindow().setAttributes(attributes);
}
@Override // o.InterfaceC8975daw.RVV
public final void awS_(Bitmap bitmap) {
this.qrCodeImageView.setImageBitmap(bitmap);
}
@Override // o.InterfaceC8975daw.RVV
public final void awR_(final C1087Vh c1087Vh, final String str, final Bitmap bitmap, final boolean z) {
final Context context = getContext();
if (isDetached() || context == null) {
return;
}
AbstractC13163fSk.fromCallable(new Callable<Uri>(c1087Vh, str, bitmap, context, z) { // from class: o.fLn.2
private double a = 5.0d;
private Bitmap b;
private boolean c;
private C1087Vh d;
private Context e;
private String j;
public AnonymousClass2(final C1087Vh c1087Vh2, final String str2, final Bitmap bitmap2, final Context context2, final boolean z2) {
this.d = c1087Vh2;
this.j = str2;
this.b = bitmap2;
this.e = context2;
this.c = z2;
}
@Override // java.util.concurrent.Callable
/* renamed from: aAw_ */
public Uri call() throws Exception {
Uri VO_;
String format = String.format("Moment_%s.jpg", String.valueOf(Calendar.getInstance().getTimeInMillis()));
Bitmap bitmap2 = null;
try {
C1087Vh c1087Vh2 = this.d;
String str2 = this.j;
Bitmap bitmap3 = this.b;
double d = this.a;
Context context2 = this.e;
LinearLayout linearLayout = new LinearLayout(context2);
linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
View inflate = LayoutInflater.from(context2).inflate(com.scb.phone.R.layout.2131560121, (ViewGroup) linearLayout, false);
PromptPayQRScreenshotFragment promptPayQRScreenshotFragment = new PromptPayQRScreenshotFragment();
ButterKnife.c(promptPayQRScreenshotFragment, inflate);
promptPayQRScreenshotFragment.accountNumberCustomTarget.setValue(c1087Vh2.f);
if (c1087Vh2.a == 0.0d) {
promptPayQRScreenshotFragment.payerSpecifyAmountTextView.setVisibility(0);
promptPayQRScreenshotFragment.amountTextView.setText(context2.getString(com.scb.phone.R.string.qr_code_generation_slip_no_amount));
} else {
promptPayQRScreenshotFragment.amountTextView.setText(c1087Vh2.b);
}
if (!TextUtils.isEmpty(str2)) {
promptPayQRScreenshotFragment.qrCodeImageView.setImageBitmap(C6583cXR.VZ_(str2, 600, 600, bitmap3, d));
}
DisplayMetrics displayMetrics = new DisplayMetrics();
((WindowManager) context2.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
Bitmap aAB_ = C12946fLx.aAB_(inflate, displayMetrics.widthPixels, displayMetrics.widthPixels << 2);
if (this.c) {
VO_ = C6582cXO.VN_(aAB_, format, this.e);
} else {
VO_ = C6582cXO.VO_(aAB_, this.e, "screen_image.jpg");
}
if (aAB_ != null) {
aAB_.recycle();
}
return VO_;
} catch (Throwable th) {
if (0 != 0) {
bitmap2.recycle();
}
throw th;
}
}
}).observeOn(fRR.e()).subscribeOn(C13417fZt.b()).subscribe(new fSQ(this) { // from class: o.fvF
private PromptPayQRSuccessFragment e;
@Override // o.fSQ
public final void c(Object obj) {
PromptPayQRSuccessFragment.awQ_(this.e, (Uri) obj);
}
{
this.e = this;
}
}, new fSQ(this) { // from class: o.fvI
private PromptPayQRSuccessFragment b;
@Override // o.fSQ
public final void c(Object obj) {
PromptPayQRSuccessFragment.a(this.b, (Throwable) obj);
}
{
this.b = this;
}
});
}
public static void j() {
guQ.b("onPermissionDeniedAndroid13", new Object[0]);
}
public static void i() {
guQ.b("onPermissionDenied", new Object[0]);
}
public final void d(final InterfaceC15577gud interfaceC15577gud) {
guQ.b("onShowRationale", new Object[0]);
((CustomDialog) CustomDialog.e(new Object[]{CustomDialog.b(getContext()).c(R.string.permission_storage_title).d(R.string.permission_storage).aoT_(R.string.permission_allow, new DialogInterface.OnClickListener(interfaceC15577gud) { // from class: o.fvE
private InterfaceC15577gud e;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
this.e.c();
}
{
this.e = interfaceC15577gud;
}
}), Integer.valueOf(R.string.permission_deny), new DialogInterface.OnClickListener(interfaceC15577gud) { // from class: o.fvG
private InterfaceC15577gud b;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
this.b.e();
}
{
this.b = interfaceC15577gud;
}
}})).show();
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
@Optional
public void onShareButtonClick() {
Uri uri = this.d;
if (uri == null || uri.toString().isEmpty()) {
EnumC8951daY enumC8951daY = EnumC8951daY.ERROR;
FragmentActivity activity = getActivity();
if (activity != null) {
String string = getString(R.string.share_error);
if (getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) getActivity(), activity, Integer.valueOf(R.id.view_container), string, enumC8951daY}, 855668825, -855668822, R.id.view_container);
return;
}
return;
}
return;
}
Intent intent = new Intent("android.intent.action.SEND");
intent.setType(ImageInfo.JPEG_MIME_TYPE);
intent.addFlags(1);
intent.putExtra("android.intent.extra.STREAM", this.d);
startActivity(Intent.createChooser(intent, getString(R.string.share_slip)));
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void onCreateQRCodeButtonClick() {
if (getActivity() != null) {
((PromptPayQRActivity) getActivity()).y();
((PromptPayQRActivity) getActivity()).f();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void onReturnHomeClick() {
Intent intent = new Intent(getContext(), (Class<?>) HomeActivity.class);
intent.addFlags(603979776);
intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_LAYOUT", R.id.account_summary_tab);
intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_REFRESH", true);
startActivity(intent);
}
public static /* synthetic */ void awQ_(PromptPayQRSuccessFragment promptPayQRSuccessFragment, Uri uri) {
promptPayQRSuccessFragment.d = uri;
FragmentActivity activity = promptPayQRSuccessFragment.getActivity();
if (uri.toString().isEmpty() || !promptPayQRSuccessFragment.getUserVisibleHint() || activity == null || !promptPayQRSuccessFragment.c) {
return;
}
EnumC8951daY enumC8951daY = EnumC8951daY.SUCCESS;
FragmentActivity activity2 = promptPayQRSuccessFragment.getActivity();
if (activity2 != null) {
String string = promptPayQRSuccessFragment.getString(R.string.qr_code_generation_save_successful);
if (promptPayQRSuccessFragment.getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) promptPayQRSuccessFragment.getActivity(), activity2, Integer.valueOf(R.id.view_container), string, enumC8951daY}, 855668825, -855668822, R.id.view_container);
}
}
promptPayQRSuccessFragment.c = false;
}
public static /* synthetic */ void a(PromptPayQRSuccessFragment promptPayQRSuccessFragment, Throwable th) {
guQ.a(th, "onSaveScreenshotError", new Object[0]);
FragmentActivity activity = promptPayQRSuccessFragment.getActivity();
if (promptPayQRSuccessFragment.isDetached() || activity == null) {
return;
}
EnumC8951daY enumC8951daY = EnumC8951daY.ERROR;
FragmentActivity activity2 = promptPayQRSuccessFragment.getActivity();
if (activity2 != null) {
String string = promptPayQRSuccessFragment.getString(R.string.qr_code_generation_save_error);
if (promptPayQRSuccessFragment.getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) promptPayQRSuccessFragment.getActivity(), activity2, Integer.valueOf(R.id.view_container), string, enumC8951daY}, 855668825, -855668822, R.id.view_container);
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void saveSlipButton() {
this.c = true;
if (getActivity() != null) {
if (BaseActivity.P()) {
C14547fvK.d(this);
return;
}
}
C14547fvK.e(this);
}
@Override // o.InterfaceC8975daw.RVV
public final void d(C1082Ve c1082Ve) {
this.accountNumberCustomTarget.setValue(c1082Ve.c.f);
if (c1082Ve.c.a == 0.0d) {
this.amountCustomTarget.setValue(getString(R.string.qr_code_generation_specify_amount));
} else {
this.amountCustomTarget.setValue(c1082Ve.c.b);
}
this.c = false;
C7885cwl c7885cwl = this.promptPayQRSuccessPresenter;
C7891cwr c7891cwr = new C7891cwr(c7885cwl, false);
if (c7885cwl.f != 0) {
c7891cwr.e(c7885cwl.f);
}
if (getActivity() != null) {
((BaseActivity) getActivity()).ar_();
}
}
}