正在查看: Clash Legends v0.0.1 应用的 AddressVerificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 AddressVerificationActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package co.paystack.android.ui;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListPopupWindow;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import co.paystack.android.R;
import co.paystack.android.api.service.PaystackApiService;
import co.paystack.android.mobilemoney.data.api.PaystackApiFactory;
import co.paystack.android.model.AvsState;
import co.paystack.android.ui.AddressHolder;
import com.facebook.appevents.integrity.IntegrityManager;
import java.util.List;
import java.util.concurrent.CancellationException;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.MutablePropertyReference1Impl;
import kotlin.jvm.internal.Reflection;
import kotlin.properties.Delegates;
import kotlin.properties.ObservableProperty;
import kotlin.properties.ReadWriteProperty;
import kotlin.reflect.KProperty;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.JobKt;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000¦\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010 \n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u0000 d2\u00020\u00012\u00020\u0002:\u0001dB\u0005¢\u0006\u0002\u0010\u0003J2\u0010O\u001a\u00020P2\u0006\u0010Q\u001a\u00020R2\f\u0010S\u001a\b\u0012\u0004\u0012\u00020T0C2\u0012\u0010U\u001a\u000e\u0012\u0004\u0012\u00020W\u0012\u0004\u0012\u00020X0VH\u0002J\u0010\u0010Y\u001a\u00020X2\u0006\u0010Z\u001a\u00020TH\u0002J\u0012\u0010[\u001a\u00020X2\b\u0010\\\u001a\u0004\u0018\u00010]H\u0014J\b\u0010^\u001a\u00020XH\u0016J\b\u0010_\u001a\u00020XH\u0002J\u0012\u0010`\u001a\u00020X2\b\u0010a\u001a\u0004\u0018\u00010bH\u0002J\b\u0010c\u001a\u00020XH\u0002R\u0016\u0010\u0004\u001a\n \u0006*\u0004\u0018\u00010\u00050\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R#\u0010\u0007\u001a\n \u0006*\u0004\u0018\u00010\b0\b8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u000b\u0010\f\u001a\u0004\b\t\u0010\nR#\u0010\r\u001a\n \u0006*\u0004\u0018\u00010\u000e0\u000e8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0011\u0010\f\u001a\u0004\b\u000f\u0010\u0010R#\u0010\u0012\u001a\n \u0006*\u0004\u0018\u00010\u000e0\u000e8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0014\u0010\f\u001a\u0004\b\u0013\u0010\u0010R\u0014\u0010\u0015\u001a\u00020\u00168VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0017\u0010\u0018R#\u0010\u0019\u001a\n \u0006*\u0004\u0018\u00010\u001a0\u001a8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001d\u0010\f\u001a\u0004\b\u001b\u0010\u001cR#\u0010\u001e\u001a\n \u0006*\u0004\u0018\u00010\u001f0\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\"\u0010\f\u001a\u0004\b \u0010!R#\u0010#\u001a\n \u0006*\u0004\u0018\u00010\u001f0\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b%\u0010\f\u001a\u0004\b$\u0010!R#\u0010&\u001a\n \u0006*\u0004\u0018\u00010\u001f0\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b(\u0010\f\u001a\u0004\b'\u0010!R#\u0010)\u001a\n \u0006*\u0004\u0018\u00010\u001f0\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b+\u0010\f\u001a\u0004\b*\u0010!R\u000e\u0010,\u001a\u00020-X\u0082.¢\u0006\u0002\n\u0000R\u0016\u0010.\u001a\n \u0006*\u0004\u0018\u00010/0/X\u0082\u0004¢\u0006\u0002\n\u0000R\u001b\u00100\u001a\u0002018BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b4\u0010\f\u001a\u0004\b2\u00103R#\u00105\u001a\n \u0006*\u0004\u0018\u000106068BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b9\u0010\f\u001a\u0004\b7\u00108R/\u0010<\u001a\u0004\u0018\u00010;2\b\u0010:\u001a\u0004\u0018\u00010;8B@BX\u0082\u008e\u0002¢\u0006\u0012\n\u0004\bA\u0010B\u001a\u0004\b=\u0010>\"\u0004\b?\u0010@R7\u0010D\u001a\b\u0012\u0004\u0012\u00020;0C2\f\u0010:\u001a\b\u0012\u0004\u0012\u00020;0C8B@BX\u0082\u008e\u0002¢\u0006\u0012\n\u0004\bI\u0010B\u001a\u0004\bE\u0010F\"\u0004\bG\u0010HR#\u0010J\u001a\n \u0006*\u0004\u0018\u00010K0K8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bN\u0010\f\u001a\u0004\bL\u0010M¨\u0006e"}, d2 = {"Lco/paystack/android/ui/AddressVerificationActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lkotlinx/coroutines/CoroutineScope;", "()V", "addressHolder", "Lco/paystack/android/ui/AddressHolder;", "kotlin.jvm.PlatformType", "avsForm", "Landroid/widget/ScrollView;", "getAvsForm", "()Landroid/widget/ScrollView;", "avsForm$delegate", "Lkotlin/Lazy;", "btnConfirm", "Landroid/widget/Button;", "getBtnConfirm", "()Landroid/widget/Button;", "btnConfirm$delegate", "btnRetry", "getBtnRetry", "btnRetry$delegate", "coroutineContext", "Lkotlin/coroutines/CoroutineContext;", "getCoroutineContext", "()Lkotlin/coroutines/CoroutineContext;", "errorContainer", "Landroid/widget/LinearLayout;", "getErrorContainer", "()Landroid/widget/LinearLayout;", "errorContainer$delegate", "etCity", "Landroid/widget/EditText;", "getEtCity", "()Landroid/widget/EditText;", "etCity$delegate", "etState", "getEtState", "etState$delegate", "etStreet", "getEtStreet", "etStreet$delegate", "etZipCode", "getEtZipCode", "etZipCode$delegate", "job", "Lkotlinx/coroutines/Job;", "lock", "", "paystackApiService", "Lco/paystack/android/api/service/PaystackApiService;", "getPaystackApiService", "()Lco/paystack/android/api/service/PaystackApiService;", "paystackApiService$delegate", "pbLoadingStates", "Landroid/widget/ProgressBar;", "getPbLoadingStates", "()Landroid/widget/ProgressBar;", "pbLoadingStates$delegate", "<set-?>", "Lco/paystack/android/model/AvsState;", "selectedState", "getSelectedState", "()Lco/paystack/android/model/AvsState;", "setSelectedState", "(Lco/paystack/android/model/AvsState;)V", "selectedState$delegate", "Lkotlin/properties/ReadWriteProperty;", "", "states", "getStates", "()Ljava/util/List;", "setStates", "(Ljava/util/List;)V", "states$delegate", "tvError", "Landroid/widget/TextView;", "getTvError", "()Landroid/widget/TextView;", "tvError$delegate", "initPopupMenu", "Landroid/widget/ListPopupWindow;", "anchorView", "Landroid/view/View;", "items", "", "onItemClickListener", "Lkotlin/Function1;", "", "", "loadStates", "countryCode", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "setupForm", "submit", IntegrityManager.INTEGRITY_TYPE_ADDRESS, "Lco/paystack/android/ui/AddressHolder$Address;", "validateForm", "Companion", "paystack_release"}, k = 1, mv = {1, 1, 16})
public final class AddressVerificationActivity extends AppCompatActivity implements CoroutineScope {
static final KProperty[] $$delegatedProperties = {(KProperty) Reflection.mutableProperty1(new MutablePropertyReference1Impl(Reflection.getOrCreateKotlinClass(AddressVerificationActivity.class), "states", "getStates()Ljava/util/List;")), (KProperty) Reflection.mutableProperty1(new MutablePropertyReference1Impl(Reflection.getOrCreateKotlinClass(AddressVerificationActivity.class), "selectedState", "getSelectedState()Lco/paystack/android/model/AvsState;"))};
public static final String EXTRA_COUNTRY_CODE = "country_code";
private static final String TAG = "AddressVerificationActi";
private Job job;
private final ReadWriteProperty selectedState;
private final ReadWriteProperty states;
private final AddressHolder addressHolder = AddressHolder.getInstance();
private final Object lock = AddressHolder.getLock();
private final Lazy paystackApiService = LazyKt.lazy(new Function0<PaystackApiService>() {
public final PaystackApiService m66invoke() {
return PaystackApiFactory.INSTANCE.createRetrofitService();
}
});
private final Lazy etState = LazyKt.lazy(new Function0<EditText>() {
{
super(0);
}
public final EditText m63invoke() {
return (EditText) AddressVerificationActivity.this.findViewById(R.id.etState);
}
});
private final Lazy etStreet = LazyKt.lazy(new Function0<EditText>() {
{
super(0);
}
public final EditText m64invoke() {
return (EditText) AddressVerificationActivity.this.findViewById(R.id.etStreet);
}
});
private final Lazy etCity = LazyKt.lazy(new Function0<EditText>() {
{
super(0);
}
public final EditText m62invoke() {
return (EditText) AddressVerificationActivity.this.findViewById(R.id.etCity);
}
});
private final Lazy etZipCode = LazyKt.lazy(new Function0<EditText>() {
{
super(0);
}
public final EditText m65invoke() {
return (EditText) AddressVerificationActivity.this.findViewById(R.id.etZipCode);
}
});
private final Lazy tvError = LazyKt.lazy(new Function0<TextView>() {
{
super(0);
}
public final TextView m68invoke() {
return (TextView) AddressVerificationActivity.this.findViewById(R.id.tvError);
}
});
private final Lazy btnRetry = LazyKt.lazy(new Function0<Button>() {
{
super(0);
}
public final Button m60invoke() {
return (Button) AddressVerificationActivity.this.findViewById(R.id.btnRetry);
}
});
private final Lazy btnConfirm = LazyKt.lazy(new Function0<Button>() {
{
super(0);
}
public final Button m59invoke() {
return (Button) AddressVerificationActivity.this.findViewById(R.id.btnConfirm);
}
});
private final Lazy errorContainer = LazyKt.lazy(new Function0<LinearLayout>() {
{
super(0);
}
public final LinearLayout m61invoke() {
return (LinearLayout) AddressVerificationActivity.this.findViewById(R.id.errorContainer);
}
});
private final Lazy avsForm = LazyKt.lazy(new Function0<ScrollView>() {
{
super(0);
}
public final ScrollView m58invoke() {
return (ScrollView) AddressVerificationActivity.this.findViewById(R.id.avsForm);
}
});
private final Lazy pbLoadingStates = LazyKt.lazy(new Function0<ProgressBar>() {
{
super(0);
}
public final ProgressBar m67invoke() {
return (ProgressBar) AddressVerificationActivity.this.findViewById(R.id.pbLoadingStates);
}
});
public final ScrollView getAvsForm() {
return (ScrollView) this.avsForm.getValue();
}
private final Button getBtnConfirm() {
return (Button) this.btnConfirm.getValue();
}
private final Button getBtnRetry() {
return (Button) this.btnRetry.getValue();
}
public final LinearLayout getErrorContainer() {
return (LinearLayout) this.errorContainer.getValue();
}
public final EditText getEtCity() {
return (EditText) this.etCity.getValue();
}
public final EditText getEtState() {
return (EditText) this.etState.getValue();
}
public final EditText getEtStreet() {
return (EditText) this.etStreet.getValue();
}
public final EditText getEtZipCode() {
return (EditText) this.etZipCode.getValue();
}
public final PaystackApiService getPaystackApiService() {
return (PaystackApiService) this.paystackApiService.getValue();
}
public final ProgressBar getPbLoadingStates() {
return (ProgressBar) this.pbLoadingStates.getValue();
}
public final AvsState getSelectedState() {
return (AvsState) this.selectedState.getValue(this, $$delegatedProperties[1]);
}
public final List<AvsState> getStates() {
return (List) this.states.getValue(this, $$delegatedProperties[0]);
}
public final TextView getTvError() {
return (TextView) this.tvError.getValue();
}
public final void setSelectedState(AvsState avsState) {
this.selectedState.setValue(this, $$delegatedProperties[1], avsState);
}
public final void setStates(List<AvsState> list) {
this.states.setValue(this, $$delegatedProperties[0], list);
}
public AddressVerificationActivity() {
Delegates delegates = Delegates.INSTANCE;
Object initialValue$iv = CollectionsKt.emptyList();
this.states = new AddressVerificationActivity$$special$$inlined$observable$1(initialValue$iv, initialValue$iv, this);
Delegates delegates2 = Delegates.INSTANCE;
final Object initialValue$iv2 = null;
this.selectedState = new ObservableProperty<AvsState>(initialValue$iv2) {
protected void afterChange(KProperty<?> property, AvsState oldValue, AvsState newValue) {
EditText etState;
Intrinsics.checkParameterIsNotNull(property, "property");
AvsState selectedState = newValue;
etState = this.getEtState();
etState.setText(selectedState != null ? selectedState.getName() : null);
this.validateForm();
}
};
}
public CoroutineContext getCoroutineContext() {
Job job = this.job;
if (job == null) {
Intrinsics.throwUninitializedPropertyAccessException("job");
}
return job.plus(Dispatchers.getMain());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.job = JobKt.Job$default((Job) null, 1, (Object) null);
setContentView(R.layout.co_paystack_android____activity_avs);
getWindow().addFlags(128);
setupForm();
}
private final void setupForm() {
TextWatcher textWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
AddressVerificationActivity.this.validateForm();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
};
getEtStreet().addTextChangedListener(textWatcher);
getEtCity().addTextChangedListener(textWatcher);
getEtZipCode().addTextChangedListener(textWatcher);
final String countryCode = getIntent().getStringExtra(EXTRA_COUNTRY_CODE);
if (countryCode == null) {
Intrinsics.throwNpe();
}
getBtnRetry().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View it) {
AddressVerificationActivity.this.loadStates(countryCode);
}
});
loadStates(countryCode);
getBtnConfirm().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View it) {
EditText etStreet;
EditText etCity;
EditText etZipCode;
AvsState selectedState;
AddressHolder.Address address = new AddressHolder.Address();
etStreet = AddressVerificationActivity.this.getEtStreet();
Intrinsics.checkExpressionValueIsNotNull(etStreet, "etStreet");
address.setStreet(etStreet.getText().toString());
etCity = AddressVerificationActivity.this.getEtCity();
Intrinsics.checkExpressionValueIsNotNull(etCity, "etCity");
address.setCity(etCity.getText().toString());
etZipCode = AddressVerificationActivity.this.getEtZipCode();
Intrinsics.checkExpressionValueIsNotNull(etZipCode, "etZipCode");
address.setZipCode(etZipCode.getText().toString());
selectedState = AddressVerificationActivity.this.getSelectedState();
address.setState(selectedState != null ? selectedState.getName() : null);
AddressVerificationActivity.this.submit(address);
}
});
}
public final void validateForm() {
throw new UnsupportedOperationException("Method not decompiled: co.paystack.android.ui.AddressVerificationActivity.validateForm():void");
}
public final void loadStates(String countryCode) {
LinearLayout errorContainer = getErrorContainer();
Intrinsics.checkExpressionValueIsNotNull(errorContainer, "errorContainer");
errorContainer.setVisibility(8);
ScrollView avsForm = getAvsForm();
Intrinsics.checkExpressionValueIsNotNull(avsForm, "avsForm");
avsForm.setVisibility(8);
ProgressBar pbLoadingStates = getPbLoadingStates();
Intrinsics.checkExpressionValueIsNotNull(pbLoadingStates, "pbLoadingStates");
pbLoadingStates.setVisibility(0);
BuildersKt.launch$default(this, getCoroutineContext(), (CoroutineStart) null, new AddressVerificationActivity$loadStates$1(this, countryCode, null), 2, (Object) null);
}
public final void submit(AddressHolder.Address address) {
Object obj = this.lock;
Intrinsics.checkExpressionValueIsNotNull(obj, "lock");
synchronized (obj) {
AddressHolder addressHolder = this.addressHolder;
Intrinsics.checkExpressionValueIsNotNull(addressHolder, "addressHolder");
addressHolder.setAddress(address);
Object obj2 = this.lock;
if (obj2 == null) {
throw new TypeCastException("null cannot be cast to non-null type java.lang.Object");
}
obj2.notify();
Unit unit = Unit.INSTANCE;
}
finish();
}
@Override
public void onDestroy() {
super.onDestroy();
submit(null);
Job job = this.job;
if (job == null) {
Intrinsics.throwUninitializedPropertyAccessException("job");
}
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
public final ListPopupWindow initPopupMenu(View anchorView, List<String> items, final Function1<? super Integer, Unit> onItemClickListener) {
final ListPopupWindow listPopupWindow = new ListPopupWindow(this, null, R.attr.listPopupWindowStyle);
ArrayAdapter adapter = new ArrayAdapter(this, R.layout.support_simple_spinner_dropdown_item, items);
listPopupWindow.setAdapter(adapter);
listPopupWindow.setAnchorView(anchorView);
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public final void onItemClick(AdapterView<?> adapterView, View $noName_1, int position, long $noName_3) {
onItemClickListener.invoke(Integer.valueOf(position));
listPopupWindow.dismiss();
}
});
return listPopupWindow;
}
}