what-the-bank/sources/com/scb/phone/view/fragment/ccrredemption/ecoupon/ECouponBarCodeFragment.java

711 lines
21 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.ccrredemption.ecoupon;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.activity.creditcard.CreditCardDetailActivity;
import com.scb.phone.view.fragment.ccrredemption.ecoupon.ECouponBarCodeFragment;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import o.C12891fKc;
import o.C14957gcv;
import o.C3142art;
import o.C6583cXR;
import o.InterfaceC13391fZD;
import o.InterfaceC9040dcH;
import o.ZI;
import o.nMh;
import o.pug;
/* loaded from: classes5.dex */
public final class ECouponBarCodeFragment extends Hilt_ECouponBarCodeFragment implements InterfaceC9040dcH.LWm {
public static final LWm c = new LWm(0);
@BindView
public LinearLayout barCodeLayout;
@BindView
public Button buttonDeactivate;
private String d;
private CountDownTimer f;
private String g;
private String h;
private final SimpleDateFormat i = new SimpleDateFormat("mm:ss", Locale.getDefault());
@BindView
public ImageView ivBarcode;
@BindView
public ImageView ivECouponDetail;
@BindView
public ImageView ivQRCode;
@BindView
public ImageView ivTimerActive;
private boolean j;
@BindView
public View lineAboveTimeCountDownLayout;
private int m;
@InterfaceC13391fZD
public C3142art presenter;
@BindView
public LinearLayout rootLayout;
@BindView
public LinearLayout timeCountDownLayout;
@BindView
public TextView tvBarcodeResult;
@BindView
public TextView tvDesc;
@BindView
public TextView tvQRCodeResult;
@BindView
public TextView tvRefIdValue;
@BindView
public TextView tvRemark;
@BindView
public TextView tvTimeCountDown;
@BindView
public TextView tvTimeExpiredTitle;
@BindView
public TextView tvTitleCoupon;
@BindView
public TextView tvValidityValue;
/* loaded from: classes5.dex */
public static final class LWm {
private LWm() {
}
public /* synthetic */ LWm(byte b) {
this();
}
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
return layoutInflater.inflate(R.layout.2131559580, viewGroup, false);
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroy() {
CountDownTimer countDownTimer = this.f;
if (countDownTimer != null) {
countDownTimer.cancel();
}
C3142art c3142art = this.presenter;
if (c3142art == null) {
C14957gcv.a("");
c3142art = null;
}
c3142art.w_();
super.onDestroy();
}
@Override // androidx.fragment.app.Fragment
public final void onPause() {
super.onPause();
C3142art c3142art = this.presenter;
if (c3142art == null) {
C14957gcv.a("");
c3142art = null;
}
ZI.IeS ieS = new ZI.IeS() { // from class: o.arD
private float a = -1.0f;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9040dcH.LWm) obj).c(this.a);
}
};
if (c3142art.f != 0) {
ieS.e(c3142art.f);
}
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
final String str;
final String str2;
final String str3;
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
ButterKnife.c(this, view);
C3142art c3142art = this.presenter;
if (c3142art == null) {
C14957gcv.a("");
c3142art = null;
}
c3142art.e((C3142art) this);
C3142art c3142art2 = this.presenter;
if (c3142art2 == null) {
C14957gcv.a("");
c3142art2 = null;
}
ZI.IeS ieS = new ZI.IeS() { // from class: o.arx
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9040dcH.LWm) obj).d();
}
};
if (c3142art2.f != 0) {
ieS.e(c3142art2.f);
}
C3142art c3142art3 = this.presenter;
if (c3142art3 == null) {
C14957gcv.a("");
c3142art3 = null;
}
String str4 = this.d;
if (str4 == null) {
C14957gcv.a("");
str = null;
} else {
str = str4;
}
String str5 = this.g;
if (str5 == null) {
C14957gcv.a("");
str2 = null;
} else {
str2 = str5;
}
final int i = this.m;
String str6 = this.h;
if (str6 == null) {
C14957gcv.a("");
str3 = null;
} else {
str3 = str6;
}
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
C14957gcv.e(str3, "");
final C3142art c3142art4 = c3142art3;
ZI.IeS ieS2 = new ZI.IeS(c3142art4, str2, i, str3, str) { // from class: o.arJ
private String a;
private String b;
private C3142art c;
private String d;
private int e;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3142art.d(this.c, this.d, this.e, this.b, this.a, (InterfaceC9040dcH.LWm) obj);
}
{
this.c = c3142art4;
this.d = str2;
this.e = i;
this.b = str3;
this.a = str;
}
};
if (c3142art3.f != 0) {
ieS2.e(c3142art3.f);
}
}
@Override // androidx.fragment.app.Fragment
public final void onCreate(Bundle bundle) {
String string;
String string2;
super.onCreate(bundle);
Bundle arguments = getArguments();
if (arguments != null) {
String str = "";
C14957gcv.e("EXTRA_CARD_REF_NO_KEY", "");
if (arguments == null) {
string = "";
} else {
string = arguments.getString("EXTRA_CARD_REF_NO_KEY", "");
C14957gcv.c((Object) string, "");
}
this.d = string;
C14957gcv.e("EXTRA_REF_ID_KEY", "");
if (arguments == null) {
string2 = "";
} else {
string2 = arguments.getString("EXTRA_REF_ID_KEY", "");
C14957gcv.c((Object) string2, "");
}
this.g = string2;
C14957gcv.e("EXTRA_ITEM_CODE_KEY", "");
if (arguments != null) {
String string3 = arguments.getString("EXTRA_ITEM_CODE_KEY", "");
C14957gcv.c((Object) string3, "");
str = string3;
}
this.h = str;
this.m = arguments.getInt("EXTRA_RELATION_ID_KEY");
this.j = arguments.getBoolean("EXTRA_E_COUPON_IS_FROM_DEEP_LINK_FLOW");
}
}
@OnClick
public final void onClickDeactivate() {
final String str;
final String str2;
final String str3;
C3142art c3142art = this.presenter;
if (c3142art == null) {
C14957gcv.a("");
c3142art = null;
}
String str4 = this.d;
if (str4 == null) {
C14957gcv.a("");
str = null;
} else {
str = str4;
}
String str5 = this.g;
if (str5 == null) {
C14957gcv.a("");
str2 = null;
} else {
str2 = str5;
}
final int i = this.m;
String str6 = this.h;
if (str6 == null) {
C14957gcv.a("");
str3 = null;
} else {
str3 = str6;
}
final boolean z = this.j;
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
C14957gcv.e(str3, "");
final C3142art c3142art2 = c3142art;
ZI.IeS ieS = new ZI.IeS(c3142art2, str2, i, str3, str, z) { // from class: o.arI
private String a;
private String b;
private C3142art c;
private int d;
private String e;
private boolean h;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3142art.c(this.c, this.b, this.d, this.e, this.a, this.h, (InterfaceC9040dcH.LWm) obj);
}
{
this.c = c3142art2;
this.b = str2;
this.d = i;
this.e = str3;
this.a = str;
this.h = z;
}
};
if (c3142art.f != 0) {
ieS.e(c3142art.f);
}
}
@Override // o.InterfaceC9040dcH.LWm
public final void d(String str) {
C14957gcv.e(str, "");
ImageView imageView = this.ivECouponDetail;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
C12891fKc.azD_(R.drawable.donations_place_holder, imageView, "https://fasteasy.scbeasy.com:8888/api/ccrewardredemption/".concat(String.valueOf(str)));
}
@Override // o.InterfaceC9040dcH.LWm
public final void c(String str) {
C14957gcv.e(str, "");
String str2 = str;
ImageView imageView = null;
if (str2.length() == 0) {
TextView textView = this.tvBarcodeResult;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setVisibility(8);
ImageView imageView2 = this.ivBarcode;
if (imageView2 != null) {
imageView = imageView2;
} else {
C14957gcv.a("");
}
imageView.setVisibility(8);
return;
}
TextView textView2 = this.tvBarcodeResult;
if (textView2 == null) {
C14957gcv.a("");
textView2 = null;
}
textView2.setText(str2);
ImageView imageView3 = this.ivBarcode;
if (imageView3 != null) {
imageView = imageView3;
} else {
C14957gcv.a("");
}
Bitmap VT_ = C6583cXR.VT_(str, 900, 220);
C14957gcv.c(VT_, "");
imageView.setImageBitmap(VT_);
}
@Override // o.InterfaceC9040dcH.LWm
public final void e(String str) {
C14957gcv.e(str, "");
String str2 = str;
ImageView imageView = null;
if (str2.length() == 0) {
TextView textView = this.tvQRCodeResult;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setVisibility(8);
ImageView imageView2 = this.ivQRCode;
if (imageView2 != null) {
imageView = imageView2;
} else {
C14957gcv.a("");
}
imageView.setVisibility(8);
return;
}
TextView textView2 = this.tvQRCodeResult;
if (textView2 == null) {
C14957gcv.a("");
textView2 = null;
}
textView2.setText(str2);
ImageView imageView3 = this.ivQRCode;
if (imageView3 != null) {
imageView = imageView3;
} else {
C14957gcv.a("");
}
Bitmap VV_ = C6583cXR.VV_(str, 500, 500);
C14957gcv.c(VV_, "");
imageView.setImageBitmap(VV_);
}
@Override // o.InterfaceC9040dcH.LWm
public final void b(String str) {
C14957gcv.e(str, "");
TextView textView = this.tvDesc;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
@Override // o.InterfaceC9040dcH.LWm
public final void a(String str) {
C14957gcv.e(str, "");
TextView textView = this.tvRefIdValue;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
@Override // o.InterfaceC9040dcH.LWm
public final void h(String str) {
C14957gcv.e(str, "");
TextView textView = this.tvValidityValue;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
@Override // o.InterfaceC9040dcH.LWm
public final void f(String str) {
C14957gcv.e(str, "");
TextView textView = this.tvTitleCoupon;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
@Override // o.InterfaceC9040dcH.LWm
public final void f() {
TextView textView = this.tvTimeExpiredTitle;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(getString(R.string.e_coupon_detail_validity_title_use_within));
}
@Override // o.InterfaceC9040dcH.LWm
public final void j() {
TextView textView = this.tvTimeExpiredTitle;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(getString(R.string.e_coupon_detail_validity_title_expired_on));
}
@Override // o.InterfaceC9040dcH.LWm
public final void h() {
TextView textView = this.tvTimeExpiredTitle;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(getString(R.string.e_coupon_detail_validity_title_used_on));
}
@Override // o.InterfaceC9040dcH.LWm
public final void e() {
FragmentActivity activity = getActivity();
if (activity != null) {
Intent intent = new Intent(activity, (Class<?>) CreditCardDetailActivity.class);
intent.setFlags(603979776);
activity.finish();
activity.startActivity(intent);
}
}
/* loaded from: classes5.dex */
public static final class HBt extends CountDownTimer {
private ECouponBarCodeFragment a;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
HBt(ECouponBarCodeFragment eCouponBarCodeFragment, long j) {
super(j, 1000L);
this.a = eCouponBarCodeFragment;
}
@Override // android.os.CountDownTimer
public final void onTick(long j) {
String format = this.a.i.format(new Date(j));
TextView textView = this.a.tvTimeCountDown;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(this.a.getString(R.string.e_coupon_scan_expire_in, format));
if (C14957gcv.b((Object) format, (Object) "00:01")) {
Handler are_ = ECouponBarCodeFragment.are_();
final ECouponBarCodeFragment eCouponBarCodeFragment = this.a;
are_.postDelayed(new Runnable(eCouponBarCodeFragment) { // from class: o.eKC
private ECouponBarCodeFragment b;
@Override // java.lang.Runnable
public final void run() {
ECouponBarCodeFragment eCouponBarCodeFragment2 = this.b;
C14957gcv.e(eCouponBarCodeFragment2, "");
CountDownTimer countDownTimer = eCouponBarCodeFragment2.f;
if (countDownTimer != null) {
countDownTimer.onFinish();
}
}
{
this.b = eCouponBarCodeFragment;
}
}, 1000L);
}
}
@Override // android.os.CountDownTimer
public final void onFinish() {
C3142art c3142art = this.a.presenter;
if (c3142art == null) {
C14957gcv.a("");
c3142art = null;
}
ZI.IeS ieS = new ZI.IeS() { // from class: o.arC
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9040dcH.LWm) obj).i();
}
};
if (c3142art.f != 0) {
ieS.e(c3142art.f);
}
CountDownTimer countDownTimer = this.a.f;
if (countDownTimer != null) {
countDownTimer.cancel();
}
}
}
@Override // o.InterfaceC9040dcH.LWm
public final void c(double d) {
this.f = new HBt(this, (long) d).start();
}
@Override // o.InterfaceC9040dcH.LWm
public final void i() {
ImageView imageView = this.ivTimerActive;
Button button = null;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
imageView.setVisibility(8);
TextView textView = this.tvRemark;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setVisibility(8);
TextView textView2 = this.tvTimeCountDown;
if (textView2 == null) {
C14957gcv.a("");
textView2 = null;
}
textView2.setText(getString(R.string.e_coupon_expire));
textView2.setTextColor(nMh.getColor(textView2.getContext(), R.color.f13582131100866));
Button button2 = this.buttonDeactivate;
if (button2 != null) {
button = button2;
} else {
C14957gcv.a("");
}
button.setVisibility(4);
}
@Override // o.InterfaceC9040dcH.LWm
public final void c(boolean z) {
LinearLayout linearLayout = this.rootLayout;
if (linearLayout == null) {
C14957gcv.a("");
linearLayout = null;
}
linearLayout.setVisibility(z ? 0 : 8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void d(boolean z) {
LinearLayout linearLayout = this.timeCountDownLayout;
if (linearLayout == null) {
C14957gcv.a("");
linearLayout = null;
}
linearLayout.setVisibility(z ? 0 : 8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void a(boolean z) {
LinearLayout linearLayout = this.barCodeLayout;
if (linearLayout == null) {
C14957gcv.a("");
linearLayout = null;
}
linearLayout.setVisibility(z ? 0 : 8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void k() {
TextView textView = this.tvRemark;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setVisibility(8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void g() {
Button button = this.buttonDeactivate;
if (button == null) {
C14957gcv.a("");
button = null;
}
button.setVisibility(8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void c() {
View view = this.lineAboveTimeCountDownLayout;
if (view == null) {
C14957gcv.a("");
view = null;
}
view.setVisibility(8);
}
@Override // o.InterfaceC9040dcH.LWm
public final void c(float f) {
Window window;
FragmentActivity activity = getActivity();
WindowManager.LayoutParams attributes = (activity == null || (window = activity.getWindow()) == null) ? null : window.getAttributes();
if (attributes != null) {
attributes.screenBrightness = f;
}
FragmentActivity activity2 = getActivity();
Window window2 = activity2 != null ? activity2.getWindow() : null;
if (window2 != null) {
window2.setAttributes(attributes);
}
}
@Override // o.InterfaceC9040dcH.LWm
public final void d() {
c("ecoupon_barcode", new pug("source", "successfulpagemyecoupon"));
}
@Override // o.InterfaceC9040dcH.LWm
public final void b() {
c("ecoupon_usebutton", new pug[0]);
}
@Override // o.InterfaceC9040dcH.LWm
public final void a() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.finish();
}
}
public static final /* synthetic */ Handler are_() {
return new Handler();
}
}