正在查看: BodyTech v7.6.4 应用的 AddPaymentCardActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 AddPaymentCardActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.fitnessmobileapps.fma.views;
import android.animation.LayoutTransition;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.lifecycle.Observer;
import com.android.volley.Response;
import com.fitnessmobileapps.bodytech39559.R;
import com.fitnessmobileapps.fma.Application;
import com.fitnessmobileapps.fma.core.functional.h;
import com.fitnessmobileapps.fma.feature.buy.AddPaymentCardViewModel;
import com.fitnessmobileapps.fma.feature.common.activity.BmaAppCompatActivity;
import com.fitnessmobileapps.fma.feature.common.navigation.ToolbarKt;
import com.google.android.material.textfield.TextInputLayout;
import com.mindbodyonline.android.api.sales.model.payments.Address;
import com.mindbodyonline.android.api.sales.model.payments.BillingInfo;
import com.mindbodyonline.android.api.sales.model.payments.PaymentConfiguration;
import com.mindbodyonline.android.api.sales.model.payments.PaymentMethod;
import com.mindbodyonline.android.api.sales.model.pos.ConnectCreditCardPaymentAddRequest;
import com.mindbodyonline.android.util.time.FastDateFormat;
import com.mindbodyonline.connect.utils.POSPaymentUtils;
import com.mindbodyonline.domain.WorldRegionCountry;
import com.mindbodyonline.domain.WorldRegionProvince;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import kotlin.Lazy;
import lf.b;
import org.koin.android.compat.ViewModelCompat;
import org.koin.java.KoinJavaComponent;
import s2.o1;
public class AddPaymentCardActivity extends BmaAppCompatActivity implements o1.d {
public static final FastDateFormat f10461o0 = FastDateFormat.e("M/yyyy");
private static final String f10462p0;
private static final String f10463q0;
private static final String f10464r0;
private static final String f10465s0;
private static final String f10466t0;
private static final String f10467u0;
private static final String f10468v0;
private static final String f10469w0;
private static final String f10470x0;
private static final String f10471y0;
private static final String f10472z0;
private String A;
private ViewGroup C;
private Spinner G;
private List<WorldRegionCountry> H;
private ArrayAdapter<String> I;
private String J;
private Integer K;
private TextInputLayout L;
private EditText M;
private String N;
private TextInputLayout O;
private EditText P;
private String Q;
private TextInputLayout R;
private EditText S;
private String T;
private Spinner U;
private List<WorldRegionProvince> V;
private ArrayAdapter<String> W;
private String X;
private Integer Y;
private CheckBox Z;
private TextView f10473a0;
private Drawable f10475c0;
private MenuItem f10477d0;
private s2.o1 f10478e;
private int f10479e0;
private String[] f10480f0;
private com.fitnessmobileapps.fma.util.t f10481g0;
private boolean f10482h0;
private boolean f10483i0;
private boolean f10484j0;
private ViewGroup f10485k;
private Calendar f10486k0;
private int f10487l0;
private int f10488m0;
private LayoutInflater f10489n;
private final Lazy<com.fitnessmobileapps.fma.feature.familyaccounts.domain.interactor.a> f10490n0;
private ViewGroup f10491p;
private EditText f10492q;
private TextInputLayout f10493r;
private String f10494t;
private EditText f10495v;
private TextInputLayout f10496w;
private String f10497x;
private EditText f10498y;
private TextInputLayout f10499z;
private final Lazy<AddPaymentCardViewModel> f10476d = ViewModelCompat.b(this, AddPaymentCardViewModel.class);
private boolean B = true;
private boolean f10474b0 = false;
class e extends ArrayAdapter<String> {
final ArrayList f10504c;
e(Context context, int i10, List list, ArrayList arrayList) {
super(context, i10, list);
this.f10504c = arrayList;
}
@Override
public View getDropDownView(int i10, View view, ViewGroup viewGroup) {
return i10 == 0 ? AddPaymentCardActivity.this.h0() : AddPaymentCardActivity.this.i0((String) this.f10504c.get(i10));
}
}
class g extends ArrayAdapter<String> {
final ArrayList f10507c;
g(Context context, int i10, List list, ArrayList arrayList) {
super(context, i10, list);
this.f10507c = arrayList;
}
@Override
public View getDropDownView(int i10, View view, ViewGroup viewGroup) {
return i10 == 0 ? AddPaymentCardActivity.this.h0() : AddPaymentCardActivity.this.i0((String) this.f10507c.get(i10));
}
}
static {
String canonicalName = AddPaymentCardActivity.class.getCanonicalName();
f10462p0 = canonicalName;
f10463q0 = canonicalName + ".SIS_FULL_NAME";
f10464r0 = canonicalName + ".SIS_CREDIT_CARD";
f10465s0 = canonicalName + ".SIS_EXPIRATION_DATE";
f10466t0 = canonicalName + ".SIS_STORE_CARD_CHECKED";
f10467u0 = canonicalName + ".SIS_COUNTRY";
f10468v0 = canonicalName + ".SIS_ADDRESS";
f10469w0 = canonicalName + ".SIS_CITY";
f10470x0 = canonicalName + ".SIS_STATE";
f10471y0 = canonicalName + ".SIS_ZIP";
f10472z0 = canonicalName + ".SIS_IN_BILLING_INFO";
}
public AddPaymentCardActivity() {
Calendar calendar = Calendar.getInstance();
this.f10486k0 = calendar;
this.f10487l0 = calendar.get(2);
this.f10488m0 = this.f10486k0.get(1);
this.f10490n0 = KoinJavaComponent.e(com.fitnessmobileapps.fma.feature.familyaccounts.domain.interactor.a.class);
}
private void A0(Bundle bundle) {
if (bundle != null) {
this.f10494t = bundle.getString(f10463q0);
this.f10497x = bundle.getString(f10464r0);
this.A = bundle.getString(f10465s0);
this.B = bundle.getBoolean(f10466t0);
String str = f10467u0;
if (bundle.containsKey(str)) {
this.K = Integer.valueOf(bundle.getInt(str));
}
this.N = bundle.getString(f10468v0);
this.Q = bundle.getString(f10469w0);
this.T = bundle.getString(f10471y0);
String str2 = f10470x0;
if (bundle.containsKey(str2)) {
this.Y = Integer.valueOf(bundle.getInt(str2));
}
this.f10482h0 = bundle.getBoolean("UPLOAD_TO_SUBSCRIBER", false);
this.f10480f0 = bundle.getStringArray("ACCEPTED_CARDS");
this.f10474b0 = bundle.getBoolean(f10472z0);
}
}
public static Intent B0(Context context, PaymentConfiguration paymentConfiguration, Boolean bool) {
Intent putExtra = new Intent(context, (Class<?>) AddPaymentCardActivity.class).putExtra("ACCEPTED_CARDS", (paymentConfiguration == null || paymentConfiguration.getCreditCardRules() == null) ? null : paymentConfiguration.getCreditCardRules().getCreditCardTypesAccepted());
if (paymentConfiguration != null) {
putExtra.putExtra("UPLOAD_TO_SUBSCRIBER", !POSPaymentUtils.T(paymentConfiguration.getPaymentMethods()));
} else {
putExtra.putExtra("UPLOAD_TO_SUBSCRIBER", bool);
}
return putExtra;
}
private void C0() {
this.f10492q.clearFocus();
this.f10495v.clearFocus();
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
if (n0()) {
R0();
}
}
private void D0() {
G0(true);
this.f10473a0.setEnabled(false);
}
private void E0() {
G0(false);
this.f10473a0.setEnabled(true);
}
private void F0() {
EditText editText = this.f10492q;
if (editText != null) {
this.f10494t = editText.getText().toString();
}
EditText editText2 = this.f10495v;
if (editText2 != null) {
this.f10497x = editText2.getText().toString();
}
EditText editText3 = this.f10498y;
if (editText3 != null) {
this.A = editText3.getText().toString();
}
Spinner spinner = this.G;
if (spinner != null) {
this.K = Integer.valueOf(spinner.getSelectedItemPosition());
}
EditText editText4 = this.M;
if (editText4 != null) {
this.N = editText4.getText().toString();
}
EditText editText5 = this.P;
if (editText5 != null) {
this.Q = editText5.getText().toString();
}
EditText editText6 = this.S;
if (editText6 != null) {
this.T = editText6.getText().toString();
}
Spinner spinner2 = this.U;
if (spinner2 != null) {
this.Y = Integer.valueOf(spinner2.getSelectedItemPosition());
}
}
private void G0(boolean z10) {
if (z10) {
k0().I();
} else {
k0().l();
}
}
private void H0() {
this.M.setText(this.N);
this.M.addTextChangedListener(new i());
}
private void I0() {
this.P.setText(this.Q);
this.P.addTextChangedListener(new j());
}
private void J0() {
ArrayList arrayList = new ArrayList();
List<WorldRegionCountry> y10 = qf.d.E().y();
this.H = y10;
if (y10.isEmpty()) {
this.f10478e.p0();
arrayList.add(getResources().getString(R.string.progress_dialog_loading_message));
} else {
arrayList.add(getResources().getString(R.string.country_placeholder));
Iterator<WorldRegionCountry> it = this.H.iterator();
while (it.hasNext()) {
arrayList.add(it.next().toString());
}
}
g gVar = new g(this, R.layout.simple_spinner_closed_light_black_thin, arrayList, arrayList);
this.I = gVar;
gVar.setDropDownViewResource(R.layout.simple_spinner_dropdown_light_black_thin);
this.G.setAdapter((SpinnerAdapter) this.I);
this.G.setOnItemSelectedListener(new h());
Spinner spinner = this.G;
Integer num = this.K;
spinner.setSelection(num == null ? qf.d.A(this.H) + 1 : num.intValue());
}
private void K0() {
ArrayList arrayList = new ArrayList();
this.V = new ArrayList();
arrayList.add(getResources().getString(R.string.stateprovince_placeholder));
Iterator<WorldRegionProvince> it = this.V.iterator();
while (it.hasNext()) {
arrayList.add(it.next().getName());
}
e eVar = new e(this, R.layout.simple_spinner_closed_light_black_thin, arrayList, arrayList);
this.W = eVar;
eVar.setDropDownViewResource(R.layout.simple_spinner_dropdown_light_black_thin);
this.U.setAdapter((SpinnerAdapter) this.W);
this.U.setOnItemSelectedListener(new f());
}
private void L0() {
this.S.setText(this.T);
this.S.addTextChangedListener(new a());
}
private void M0() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(getResources().getString(R.string.please_add_payment_method));
}
ToolbarKt.j(toolbar, new View.OnClickListener() {
@Override
public final void onClick(View view) {
AddPaymentCardActivity.this.s0(view);
}
});
}
private void N0() {
ViewGroup viewGroup = (ViewGroup) this.f10489n.inflate(R.layout.add_new_billing_info_view, this.f10485k, false);
this.C = viewGroup;
this.G = (Spinner) viewGroup.findViewById(R.id.country_spinner);
this.L = (TextInputLayout) this.C.findViewById(R.id.address_view);
this.M = (EditText) this.C.findViewById(R.id.address_edit_text);
this.O = (TextInputLayout) this.C.findViewById(R.id.city_view);
this.P = (EditText) this.C.findViewById(R.id.city_edit_text);
this.R = (TextInputLayout) this.C.findViewById(R.id.zip_view);
this.S = (EditText) this.C.findViewById(R.id.zip_edit_text);
this.U = (Spinner) this.C.findViewById(R.id.state_spinner);
this.f10473a0 = (TextView) this.C.findViewById(R.id.save_button);
K0();
J0();
H0();
I0();
L0();
this.f10473a0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AddPaymentCardActivity.this.t0(view);
}
});
}
private void O0() {
ViewGroup viewGroup = (ViewGroup) this.f10489n.inflate(R.layout.add_payment_card_view, this.f10485k, false);
this.f10491p = viewGroup;
this.f10485k.addView(viewGroup);
this.f10493r = (TextInputLayout) findViewById(R.id.full_name_layout);
this.f10492q = (EditText) findViewById(R.id.full_name_edit_text);
this.f10496w = (TextInputLayout) findViewById(R.id.credit_card_layout);
this.f10495v = (EditText) findViewById(R.id.credit_card_edit_text);
this.f10499z = (TextInputLayout) findViewById(R.id.add_card_expiration_et_layout);
this.f10498y = (EditText) findViewById(R.id.add_card_expiration_et);
this.Z = (CheckBox) findViewById(R.id.save_card);
TextView textView = (TextView) findViewById(R.id.add_a_card_disclaimer);
Button button = (Button) findViewById(R.id.next_button);
this.f10492q.setText(this.f10494t);
this.f10492q.addTextChangedListener(new b());
this.f10495v.setText(this.f10497x);
com.fitnessmobileapps.fma.util.m.a(this.f10495v);
this.f10495v.addTextChangedListener(new c());
this.f10498y.setText(this.A);
this.f10498y.addTextChangedListener(new d());
this.f10498y.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AddPaymentCardActivity.this.u0(view);
}
});
this.f10498y.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z10) {
AddPaymentCardActivity.this.v0(view, z10);
}
});
this.Z.setVisibility(this.f10484j0 ? 0 : 8);
textView.setText(this.f10484j0 ? R.string.save_card_checkbox_title : R.string.add_a_credit_card_disclaimer);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AddPaymentCardActivity.this.w0(view);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
AddPaymentCardActivity.this.x0(view);
}
});
}
private void P0() {
k0().C(R.string.expiration_date, new DatePickerDialog.OnDateSetListener() {
@Override
public final void onDateSet(DatePicker datePicker, int i10, int i11, int i12) {
AddPaymentCardActivity.this.y0(datePicker, i10, i11, i12);
}
}, new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
AddPaymentCardActivity.this.z0(dialogInterface);
}
});
}
private void Q0() {
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
this.f10485k.removeAllViews();
this.f10485k.addView(this.f10491p);
this.f10474b0 = false;
MenuItem menuItem = this.f10477d0;
if (menuItem != null) {
menuItem.setTitle(getResources().getString(R.string.next));
}
}
private void R0() {
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
this.f10485k.removeAllViews();
this.f10485k.addView(this.C);
this.f10474b0 = true;
MenuItem menuItem = this.f10477d0;
if (menuItem != null) {
menuItem.setTitle(getResources().getString(R.string.save_action));
}
}
private void c0() {
for (String str : this.f10480f0) {
if (str.equalsIgnoreCase(le.b.e(j0(), false))) {
C0();
return;
}
}
lf.b D = new lf.b().I(getString(R.string.pos_card_not_accepted_message, Application.d().e().getStudio())).M(R.string.button_continue).G(true).D("CARD_NOT_ACCEPTED_DIALOG_TAG");
D.P(new b.d() {
@Override
public final void a(lf.b bVar, View view) {
AddPaymentCardActivity.this.o0(bVar, view);
}
});
D.O(new b.d() {
@Override
public final void a(lf.b bVar, View view) {
bVar.dismissAllowingStateLoss();
}
});
D.show(getSupportFragmentManager(), "CARD_NOT_ACCEPTED_DIALOG_TAG");
}
public void d0(String str) {
String[] split = str.split("/");
if (split.length == 2 && split[1].length() == 2) {
split[1] = "20" + split[1];
try {
this.f10487l0 = Integer.parseInt(split[0]);
this.f10488m0 = Integer.parseInt(split[1]);
} catch (NumberFormatException unused) {
}
}
}
private void e0() {
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
if (!n0()) {
this.f10492q.clearFocus();
this.f10495v.clearFocus();
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
} else if (this.f10480f0 != null) {
c0();
} else {
C0();
}
}
private void f0(String str, PaymentMethod paymentMethod) {
Intent intent = new Intent();
intent.putExtra("SELECTED_PAYMENT_METHOD_LAST_FOUR", str);
intent.putExtra("IS_STORED", this.f10482h0 || this.f10483i0);
intent.putExtra("CARDS_CHANGED", true);
setResult(-1, intent);
intent.putExtra("ADD_CARD_EXTRA", cf.d.g(paymentMethod));
finish();
}
private void g0() {
D0();
int i10 = this.f10487l0;
int i11 = this.f10488m0;
String a10 = this.f10490n0.getValue().a();
String obj = this.f10492q.getText().toString();
String j02 = j0();
Address address = new Address();
if (this.f10474b0) {
address.setStreet(this.M.getText().toString());
address.setCity(this.P.getText().toString());
address.setPostalCode(this.S.getText().toString());
address.setStateCode(this.V.isEmpty() ? "00" : this.X);
address.setCountryCode(this.J);
}
BillingInfo billingInfo = new BillingInfo();
billingInfo.setName(obj);
billingInfo.setAddress(address);
boolean z10 = false;
final ConnectCreditCardPaymentAddRequest connectCreditCardPaymentAddRequest = new ConnectCreditCardPaymentAddRequest(j02, le.b.e(j02, false), i10, i11, billingInfo, le.b.c(j02, true) == 5, false, a10);
AddPaymentCardViewModel value = this.f10476d.getValue();
if ((this.f10482h0 || this.Z.isChecked()) && a10 == null) {
z10 = true;
}
value.A(connectCreditCardPaymentAddRequest, z10).observe(this, new Observer() {
@Override
public final void onChanged(Object obj2) {
AddPaymentCardActivity.this.q0(connectCreditCardPaymentAddRequest, (com.fitnessmobileapps.fma.core.functional.h) obj2);
}
});
}
public TextView h0() {
TextView textView = new TextView(this);
textView.setHeight(0);
textView.setVisibility(8);
return textView;
}
public TextView i0(String str) {
TextView textView = (TextView) getLayoutInflater().inflate(R.layout.simple_spinner_dropdown_light_black_thin, (ViewGroup) null);
textView.setText(str);
return textView;
}
private String j0() {
return this.f10495v.getText().toString().replace(" ", "");
}
private com.fitnessmobileapps.fma.util.t k0() {
if (this.f10481g0 == null) {
this.f10481g0 = new com.fitnessmobileapps.fma.util.t(this);
}
return this.f10481g0;
}
public void l0(WorldRegionCountry worldRegionCountry) {
final ArrayAdapter<String> arrayAdapter = this.W;
arrayAdapter.clear();
arrayAdapter.add(getString(R.string.progress_dialog_loading_message));
arrayAdapter.notifyDataSetChanged();
this.U.setEnabled(false);
qf.d.E().H(worldRegionCountry, new Response.Listener() {
@Override
public final void onResponse(Object obj) {
AddPaymentCardActivity.this.r0(arrayAdapter, (List) obj);
}
}, null);
}
private boolean m0() {
TextView textView;
boolean z10 = true;
if (!this.f10474b0) {
return true;
}
if (this.S.getText().toString().trim().equals("")) {
this.R.setError(getResources().getString(R.string.error_field_required));
z10 = false;
}
if (this.P.getText().toString().trim().equals("")) {
this.O.setError(getResources().getString(R.string.error_field_required));
z10 = false;
}
if (this.M.getText().toString().trim().equals("")) {
this.L.setError(getResources().getString(R.string.error_field_required));
z10 = false;
}
if (this.V.size() <= 0 || this.U.getSelectedItemPosition() != 0 || (textView = (TextView) this.U.getSelectedView()) == null) {
return z10;
}
textView.setError(getResources().getString(R.string.error_field_required), this.f10475c0);
return false;
}
private boolean n0() {
boolean z10;
if (this.f10498y.getText().toString().trim().equals("")) {
this.f10499z.setError(getString(R.string.error_expiration_required));
z10 = false;
} else {
z10 = true;
}
if (this.f10495v.getText().toString().trim().equals("")) {
this.f10496w.setError(getString(R.string.error_field_required));
z10 = false;
}
if (le.b.c(j0(), true) == 0) {
this.f10496w.setError(getString(R.string.invalid_card_number));
z10 = false;
}
if (!le.b.g(j0())) {
this.f10496w.setError(getString(R.string.invalid_card_number));
z10 = false;
}
if (!this.f10492q.getText().toString().trim().equals("")) {
return z10;
}
this.f10493r.setError(getString(R.string.please_enter_full_name));
return false;
}
public void o0(lf.b bVar, View view) {
this.f10495v.setText("");
bVar.dismissAllowingStateLoss();
}
public void q0(ConnectCreditCardPaymentAddRequest connectCreditCardPaymentAddRequest, com.fitnessmobileapps.fma.core.functional.h hVar) {
if (hVar instanceof h.Success) {
E0();
f0(this.f10476d.getValue().u(connectCreditCardPaymentAddRequest), (PaymentMethod) ((h.Success) hVar).a());
} else if (hVar instanceof h.Error) {
mo.a.i("PaymentMethods").r(((h.Error) hVar).getError(), "Error uploading credit card", new Object[0]);
E0();
Toast.makeText(getApplicationContext(), getString(R.string.generic_error_message), 0).show();
}
}
public void r0(ArrayAdapter arrayAdapter, List list) {
arrayAdapter.clear();
this.V = new ArrayList();
if (list == null || list.size() == 0) {
this.U.setEnabled(false);
this.S.setImeActionLabel(getResources().getString(R.string.done), 6);
arrayAdapter.add(getResources().getString(R.string.no_provinces_message));
} else {
this.V.addAll(list);
this.S.setImeActionLabel(getResources().getString(R.string.next), 5);
this.R.invalidate();
this.U.setEnabled(true);
arrayAdapter.add(getResources().getString(R.string.stateprovince_placeholder));
this.X = "";
Iterator<WorldRegionProvince> it = this.V.iterator();
while (it.hasNext()) {
arrayAdapter.add(it.next().getName());
}
Spinner spinner = this.U;
Integer num = this.Y;
spinner.setSelection(num != null ? num.intValue() : 0);
}
arrayAdapter.notifyDataSetChanged();
}
public void s0(View view) {
finish();
}
public void t0(View view) {
if (m0()) {
g0();
}
}
public void u0(View view) {
this.f10498y.setEnabled(false);
this.f10498y.clearFocus();
this.f10498y.requestFocus();
}
public void v0(View view, boolean z10) {
if (z10) {
this.f10498y.setEnabled(false);
com.fitnessmobileapps.fma.util.d0.a(getBaseContext(), view);
this.f10498y.requestFocus();
P0();
}
}
public void w0(View view) {
com.fitnessmobileapps.fma.util.w0.d(getSupportFragmentManager(), "AddACardInfoDialog", Boolean.valueOf(this.f10484j0)).U(getSupportFragmentManager());
}
public void x0(View view) {
e0();
}
public void y0(DatePicker datePicker, int i10, int i11, int i12) {
this.f10486k0.set(i10, i11, i12);
this.f10498y.setEnabled(true);
this.f10498y.setText(f10461o0.b(this.f10486k0));
this.f10487l0 = i11 + 1;
this.f10488m0 = i10;
}
public void z0(DialogInterface dialogInterface) {
this.f10498y.setEnabled(true);
}
@Override
public void finish() {
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
super.finish();
}
@Override
public void g(List<WorldRegionCountry> list, int i10) {
ArrayList arrayList = new ArrayList();
arrayList.add(getResources().getString(R.string.country_placeholder));
this.H = list;
Iterator<WorldRegionCountry> it = list.iterator();
while (it.hasNext()) {
arrayList.add(it.next().toString());
}
this.I.clear();
this.I.addAll(arrayList);
this.I.notifyDataSetChanged();
List<WorldRegionCountry> list2 = this.H;
if (list2 == null || list2.size() <= 0) {
return;
}
this.G.setSelection(i10 + 1);
}
@Override
public void n(Exception exc) {
mo.a.i("AddPaymentCardActivity").f(exc, "onCountryListFetchFailure: ", new Object[0]);
Toast.makeText(getApplicationContext(), getString(R.string.generic_error_message), 0).show();
}
@Override
public void onBackPressed() {
com.fitnessmobileapps.fma.util.d0.a(this, getWindow().getDecorView().getRootView().findFocus());
this.f10485k.removeAllViews();
if (this.f10474b0) {
Q0();
} else {
finish();
super.onBackPressed();
}
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
com.fitnessmobileapps.fma.util.i.h(this.f10486k0);
A0(bundle);
s2.o1 o1Var = (s2.o1) getLastCustomNonConfigurationInstance();
this.f10478e = o1Var;
if (o1Var == null) {
this.f10478e = new s2.o1();
}
this.f10489n = (LayoutInflater) getSystemService("layout_inflater");
setContentView(R.layout.activity_add_payment_card);
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.main_view);
this.f10485k = viewGroup;
viewGroup.setLayoutTransition(new LayoutTransition());
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.hazard);
this.f10475c0 = drawable;
boolean z10 = false;
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), this.f10475c0.getIntrinsicHeight());
this.f10479e0 = Application.d().e().getStudioId().intValue();
this.f10482h0 = getIntent().getBooleanExtra("UPLOAD_TO_SUBSCRIBER", false);
if (getIntent().hasExtra("ACCEPTED_CARDS")) {
this.f10480f0 = getIntent().getStringArrayExtra("ACCEPTED_CARDS");
}
boolean w10 = this.f10476d.getValue().w();
this.f10483i0 = w10;
if (w10 && !this.f10482h0) {
z10 = true;
}
this.f10484j0 = z10;
M0();
O0();
N0();
if (this.f10474b0) {
R0();
} else {
Q0();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.one_action_menu, menu);
MenuItem findItem = menu.findItem(R.id.menu_item);
this.f10477d0 = findItem;
findItem.setTitle(R.string.next);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
boolean onOptionsItemSelected = super.onOptionsItemSelected(menuItem);
if (menuItem.getItemId() != R.id.menu_item) {
if (menuItem.getItemId() != 16908332) {
return onOptionsItemSelected;
}
onBackPressed();
return true;
}
if (this.f10477d0.getTitle().equals(getResources().getString(R.string.next))) {
e0();
return onOptionsItemSelected;
}
if (!this.f10477d0.getTitle().equals(getResources().getString(R.string.save_action)) || !m0()) {
return onOptionsItemSelected;
}
g0();
return onOptionsItemSelected;
}
@Override
protected void onResume() {
super.onResume();
this.f10478e.H1(this);
}
@Override
public Object onRetainCustomNonConfigurationInstance() {
return this.f10478e;
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
F0();
bundle.putString(f10463q0, this.f10494t);
bundle.putString(f10464r0, this.f10497x);
bundle.putString(f10465s0, this.A);
bundle.putBoolean(f10466t0, this.B);
Integer num = this.K;
if (num != null) {
bundle.putInt(f10467u0, num.intValue());
}
bundle.putString(f10468v0, this.N);
bundle.putString(f10469w0, this.Q);
bundle.putString(f10471y0, this.T);
Integer num2 = this.Y;
if (num2 != null) {
bundle.putInt(f10470x0, num2.intValue());
}
bundle.putBoolean(f10472z0, this.f10474b0);
bundle.putBoolean("UPLOAD_TO_SUBSCRIBER", this.f10482h0);
bundle.putStringArray("ACCEPTED_CARDS", this.f10480f0);
}
@Override
protected void onStop() {
super.onStop();
this.f10478e.e();
}
class f implements AdapterView.OnItemSelectedListener {
f() {
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i10, long j10) {
if (view == null || i10 == 0) {
return;
}
AddPaymentCardActivity addPaymentCardActivity = AddPaymentCardActivity.this;
addPaymentCardActivity.X = ((WorldRegionProvince) addPaymentCardActivity.V.get(i10 - 1)).getCode();
((TextView) view).setTextColor(ResourcesCompat.getColor(AddPaymentCardActivity.this.getResources(), R.color.black_1, null));
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
class h implements AdapterView.OnItemSelectedListener {
h() {
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i10, long j10) {
if (AddPaymentCardActivity.this.K != null && i10 != AddPaymentCardActivity.this.K.intValue()) {
AddPaymentCardActivity.this.Y = null;
}
if (view == null || i10 == 0) {
return;
}
WorldRegionCountry worldRegionCountry = (WorldRegionCountry) AddPaymentCardActivity.this.H.get(i10 - 1);
AddPaymentCardActivity.this.J = worldRegionCountry.getCode();
AddPaymentCardActivity.this.l0(worldRegionCountry);
((TextView) view).setTextColor(ResourcesCompat.getColor(AddPaymentCardActivity.this.getResources(), R.color.black_1, null));
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
class a implements TextWatcher {
a() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.R.setErrorEnabled(false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
class b implements TextWatcher {
b() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.f10493r.setErrorEnabled(false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
class c implements TextWatcher {
c() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.f10496w.setErrorEnabled(false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
class d implements TextWatcher {
d() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.f10499z.setErrorEnabled(false);
AddPaymentCardActivity.this.d0(editable.toString());
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
class i implements TextWatcher {
i() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.L.setErrorEnabled(false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
class j implements TextWatcher {
j() {
}
@Override
public void afterTextChanged(Editable editable) {
AddPaymentCardActivity.this.O.setErrorEnabled(false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
}
}
}