导航菜单

页面标题

页面副标题

Rilo v2.0.21 - PaymentMethodsActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 PaymentMethodsActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.stripe.android.view;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcherKt;
import androidx.activity.result.ActivityResultLauncher;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.text.util.LinkifyCompat;
import androidx.core.view.ViewCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import com.stripe.android.CustomerSession;
import com.stripe.android.R;
import com.stripe.android.databinding.StripePaymentMethodsActivityBinding;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.utils.ActivityUtilsKt;
import com.stripe.android.view.AddPaymentMethodActivityStarter;
import com.stripe.android.view.AlertDisplayer;
import com.stripe.android.view.PaymentMethodsActivityStarter;
import com.stripe.android.view.PaymentMethodsAdapter;
import com.stripe.android.view.PaymentMethodsViewModel;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;

@Metadata(d1 = {"\u0000\u0082\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0007\u0018\u0000 E2\u00020\u0001:\u0001EB\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010.\u001a\u0004\u0018\u00010/2\u0006\u00100\u001a\u000201H\u0002J\b\u00102\u001a\u000203H\u0002J\u001c\u00104\u001a\u0002032\b\u00105\u001a\u0004\u0018\u0001062\b\b\u0002\u00107\u001a\u000208H\u0002J\b\u00109\u001a\u000203H\u0002J\u0015\u0010:\u001a\u0002032\u0006\u0010;\u001a\u00020<H\u0001¢\u0006\u0002\b=J\u0010\u0010>\u001a\u0002032\u0006\u00105\u001a\u000206H\u0002J\u0012\u0010?\u001a\u0002032\b\u0010@\u001a\u0004\u0018\u00010AH\u0014J\b\u0010B\u001a\u000203H\u0014J\b\u0010C\u001a\u00020\u001fH\u0016J\b\u0010D\u001a\u000203H\u0002R\u001b\u0010\u0003\u001a\u00020\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0007\u0010\b\u001a\u0004\b\u0005\u0010\u0006R\u001b\u0010\t\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\r\u0010\b\u001a\u0004\b\u000b\u0010\fR\u001b\u0010\u000e\u001a\u00020\u000f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\b\u001a\u0004\b\u0010\u0010\u0011R\u001b\u0010\u0013\u001a\u00020\u00148BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0017\u0010\b\u001a\u0004\b\u0015\u0010\u0016R*\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u001a0\u00198BX\u0082\u0084\u0002ø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\f\n\u0004\b\u001d\u0010\b\u001a\u0004\b\u001b\u0010\u001cR\u000e\u0010\u001e\u001a\u00020\u001fX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010 \u001a\u00020\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b#\u0010\b\u001a\u0004\b!\u0010\"R\u001b\u0010$\u001a\u00020%8@X\u0080\u0084\u0002¢\u0006\f\n\u0004\b(\u0010\b\u001a\u0004\b&\u0010'R\u001b\u0010)\u001a\u00020*8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b-\u0010\b\u001a\u0004\b+\u0010,\u0082\u0002\u000f\n\u0002\b\u0019\n\u0005\b¡\u001e0\u0001\n\u0002\b!¨\u0006F"}, d2 = {"Lcom/stripe/android/view/PaymentMethodsActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "adapter", "Lcom/stripe/android/view/PaymentMethodsAdapter;", "getAdapter", "()Lcom/stripe/android/view/PaymentMethodsAdapter;", "adapter$delegate", "Lkotlin/Lazy;", "alertDisplayer", "Lcom/stripe/android/view/AlertDisplayer;", "getAlertDisplayer", "()Lcom/stripe/android/view/AlertDisplayer;", "alertDisplayer$delegate", "args", "Lcom/stripe/android/view/PaymentMethodsActivityStarter$Args;", "getArgs", "()Lcom/stripe/android/view/PaymentMethodsActivityStarter$Args;", "args$delegate", "cardDisplayTextFactory", "Lcom/stripe/android/view/CardDisplayTextFactory;", "getCardDisplayTextFactory", "()Lcom/stripe/android/view/CardDisplayTextFactory;", "cardDisplayTextFactory$delegate", "customerSession", "Lkotlin/Result;", "Lcom/stripe/android/CustomerSession;", "getCustomerSession-d1pmJ48", "()Ljava/lang/Object;", "customerSession$delegate", "earlyExitDueToIllegalState", "", "startedFromPaymentSession", "getStartedFromPaymentSession", "()Z", "startedFromPaymentSession$delegate", "viewBinding", "Lcom/stripe/android/databinding/StripePaymentMethodsActivityBinding;", "getViewBinding$payments_core_release", "()Lcom/stripe/android/databinding/StripePaymentMethodsActivityBinding;", "viewBinding$delegate", "viewModel", "Lcom/stripe/android/view/PaymentMethodsViewModel;", "getViewModel", "()Lcom/stripe/android/view/PaymentMethodsViewModel;", "viewModel$delegate", "createFooterView", "Landroid/view/View;", "contentRoot", "Landroid/view/ViewGroup;", "finishWithGooglePay", "", "finishWithResult", "paymentMethod", "Lcom/stripe/android/model/PaymentMethod;", "resultCode", "", "observePaymentMethodData", "onAddPaymentMethodResult", "result", "Lcom/stripe/android/view/AddPaymentMethodActivityStarter$Result;", "onAddPaymentMethodResult$payments_core_release", "onAddedPaymentMethod", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onSupportNavigateUp", "setupRecyclerView", "Companion", "payments-core_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PaymentMethodsActivity extends AppCompatActivity {
    public static final String PRODUCT_TOKEN = "PaymentMethodsActivity";
    private boolean earlyExitDueToIllegalState;

    private final Lazy viewModel;
    public static final int $stable = 8;

    private final Lazy viewBinding = LazyKt.lazy(new Function0<StripePaymentMethodsActivityBinding>() {
        {
            super(0);
        }

        public final StripePaymentMethodsActivityBinding m1024invoke() {
            StripePaymentMethodsActivityBinding inflate = StripePaymentMethodsActivityBinding.inflate(PaymentMethodsActivity.this.getLayoutInflater());
            Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
            return inflate;
        }
    });

    private final Lazy startedFromPaymentSession = LazyKt.lazy(new Function0<Boolean>() {
        {
            super(0);
        }

        public final Boolean m1023invoke() {
            PaymentMethodsActivityStarter.Args args;
            args = PaymentMethodsActivity.this.getArgs();
            return Boolean.valueOf(args.isPaymentSessionActive$payments_core_release());
        }
    });

    private final Lazy customerSession = LazyKt.lazy(new Function0<Result<? extends CustomerSession>>() {
        {
            super(0);
        }

        public Object invoke() {
            return Result.m1546boximpl(m1021invoked1pmJ48());
        }

        public final Object m1021invoked1pmJ48() {
            try {
                Result.Companion companion = Result.INSTANCE;
                return Result.m1547constructorimpl(CustomerSession.Companion.getInstance());
            } catch (Throwable th) {
                Result.Companion companion2 = Result.INSTANCE;
                return Result.m1547constructorimpl(ResultKt.createFailure(th));
            }
        }
    });

    private final Lazy cardDisplayTextFactory = LazyKt.lazy(new Function0<CardDisplayTextFactory>() {
        {
            super(0);
        }

        public final CardDisplayTextFactory m1020invoke() {
            return new CardDisplayTextFactory((Context) PaymentMethodsActivity.this);
        }
    });

    private final Lazy alertDisplayer = LazyKt.lazy(new Function0<AlertDisplayer.DefaultAlertDisplayer>() {
        {
            super(0);
        }

        public final AlertDisplayer.DefaultAlertDisplayer m1018invoke() {
            return new AlertDisplayer.DefaultAlertDisplayer((Activity) PaymentMethodsActivity.this);
        }
    });

    private final Lazy args = LazyKt.lazy(new Function0<PaymentMethodsActivityStarter.Args>() {
        {
            super(0);
        }

        public final PaymentMethodsActivityStarter.Args m1019invoke() {
            PaymentMethodsActivityStarter.Args.Companion companion = PaymentMethodsActivityStarter.Args.INSTANCE;
            Intent intent = PaymentMethodsActivity.this.getIntent();
            Intrinsics.checkNotNullExpressionValue(intent, "intent");
            return companion.create$payments_core_release(intent);
        }
    });

    private final Lazy adapter = LazyKt.lazy(new Function0<PaymentMethodsAdapter>() {
        {
            super(0);
        }

        public final PaymentMethodsAdapter m1017invoke() {
            PaymentMethodsActivityStarter.Args args;
            PaymentMethodsActivityStarter.Args args2;
            PaymentMethodsViewModel viewModel;
            PaymentMethodsActivityStarter.Args args3;
            PaymentMethodsActivityStarter.Args args4;
            PaymentMethodsActivityStarter.Args args5;
            args = PaymentMethodsActivity.this.getArgs();
            args2 = PaymentMethodsActivity.this.getArgs();
            List<PaymentMethod.Type> paymentMethodTypes$payments_core_release = args2.getPaymentMethodTypes$payments_core_release();
            viewModel = PaymentMethodsActivity.this.getViewModel();
            String selectedPaymentMethodId = viewModel.getSelectedPaymentMethodId();
            args3 = PaymentMethodsActivity.this.getArgs();
            boolean shouldShowGooglePay$payments_core_release = args3.getShouldShowGooglePay$payments_core_release();
            args4 = PaymentMethodsActivity.this.getArgs();
            boolean useGooglePay$payments_core_release = args4.getUseGooglePay$payments_core_release();
            args5 = PaymentMethodsActivity.this.getArgs();
            return new PaymentMethodsAdapter(args, paymentMethodTypes$payments_core_release, selectedPaymentMethodId, shouldShowGooglePay$payments_core_release, useGooglePay$payments_core_release, args5.getCanDeletePaymentMethods$payments_core_release());
        }
    });

    public PaymentMethodsActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PaymentMethodsViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m1015invoke() {
                ViewModelStore viewModelStore = componentActivity.getViewModelStore();
                Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
                return viewModelStore;
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m1025invoke() {
                Object m1013getCustomerSessiond1pmJ48;
                PaymentMethodsActivityStarter.Args args;
                boolean startedFromPaymentSession;
                Application application = PaymentMethodsActivity.this.getApplication();
                Intrinsics.checkNotNullExpressionValue(application, "application");
                m1013getCustomerSessiond1pmJ48 = PaymentMethodsActivity.this.m1013getCustomerSessiond1pmJ48();
                args = PaymentMethodsActivity.this.getArgs();
                String initialPaymentMethodId$payments_core_release = args.getInitialPaymentMethodId$payments_core_release();
                startedFromPaymentSession = PaymentMethodsActivity.this.getStartedFromPaymentSession();
                return new PaymentMethodsViewModel.Factory(application, m1013getCustomerSessiond1pmJ48, initialPaymentMethodId$payments_core_release, startedFromPaymentSession);
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m1016invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                if (function02 != null && (creationExtras = (CreationExtras) function02.invoke()) != null) {
                    return creationExtras;
                }
                CreationExtras defaultViewModelCreationExtras = componentActivity.getDefaultViewModelCreationExtras();
                Intrinsics.checkNotNullExpressionValue(defaultViewModelCreationExtras, "this.defaultViewModelCreationExtras");
                return defaultViewModelCreationExtras;
            }
        });
    }

    public final StripePaymentMethodsActivityBinding getViewBinding$payments_core_release() {
        return (StripePaymentMethodsActivityBinding) this.viewBinding.getValue();
    }

    public final boolean getStartedFromPaymentSession() {
        return ((Boolean) this.startedFromPaymentSession.getValue()).booleanValue();
    }

    public final Object m1013getCustomerSessiond1pmJ48() {
        return ((Result) this.customerSession.getValue()).getValue();
    }

    private final CardDisplayTextFactory getCardDisplayTextFactory() {
        return (CardDisplayTextFactory) this.cardDisplayTextFactory.getValue();
    }

    public final AlertDisplayer getAlertDisplayer() {
        return (AlertDisplayer) this.alertDisplayer.getValue();
    }

    public final PaymentMethodsActivityStarter.Args getArgs() {
        return (PaymentMethodsActivityStarter.Args) this.args.getValue();
    }

    public final PaymentMethodsViewModel getViewModel() {
        return (PaymentMethodsViewModel) this.viewModel.getValue();
    }

    public final PaymentMethodsAdapter getAdapter() {
        return (PaymentMethodsAdapter) this.adapter.getValue();
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Result.m1553isFailureimpl(m1013getCustomerSessiond1pmJ48())) {
            finishWithResult(null, 0);
            return;
        }
        if (ActivityUtilsKt.argsAreInvalid((Activity) this, new Function0<Unit>() {
            {
                super(0);
            }

            public Object invoke() {
                m1022invoke();
                return Unit.INSTANCE;
            }

            public final void m1022invoke() {
                PaymentMethodsActivity.this.getArgs();
            }
        })) {
            this.earlyExitDueToIllegalState = true;
            return;
        }
        setContentView(getViewBinding$payments_core_release().getRoot());
        Integer windowFlags$payments_core_release = getArgs().getWindowFlags$payments_core_release();
        if (windowFlags$payments_core_release != null) {
            getWindow().addFlags(windowFlags$payments_core_release.intValue());
        }
        OnBackPressedDispatcher onBackPressedDispatcher = getOnBackPressedDispatcher();
        Intrinsics.checkNotNullExpressionValue(onBackPressedDispatcher, "onBackPressedDispatcher");
        OnBackPressedDispatcherKt.addCallback$default(onBackPressedDispatcher, (LifecycleOwner) null, false, new Function1<OnBackPressedCallback, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((OnBackPressedCallback) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(OnBackPressedCallback onBackPressedCallback) {
                PaymentMethodsAdapter adapter;
                Intrinsics.checkNotNullParameter(onBackPressedCallback, "$this$addCallback");
                PaymentMethodsActivity paymentMethodsActivity = PaymentMethodsActivity.this;
                adapter = paymentMethodsActivity.getAdapter();
                paymentMethodsActivity.finishWithResult(adapter.getSelectedPaymentMethod$payments_core_release(), 0);
            }
        }, 3, (Object) null);
        LifecycleOwner lifecycleOwner = (LifecycleOwner) this;
        BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope(lifecycleOwner), (CoroutineContext) null, (CoroutineStart) null, new PaymentMethodsActivity$onCreate$4(this, null), 3, (Object) null);
        BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope(lifecycleOwner), (CoroutineContext) null, (CoroutineStart) null, new PaymentMethodsActivity$onCreate$5(this, null), 3, (Object) null);
        observePaymentMethodData();
        setupRecyclerView();
        ActivityResultLauncher registerForActivityResult = registerForActivityResult(new AddPaymentMethodContract(), new PaymentMethodsActivity$onCreate$addPaymentMethodLauncher$1(this));
        Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…entMethodResult\n        )");
        BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope(lifecycleOwner), (CoroutineContext) null, (CoroutineStart) null, new PaymentMethodsActivity$onCreate$6(this, registerForActivityResult, null), 3, (Object) null);
        setSupportActionBar(getViewBinding$payments_core_release().toolbar);
        ActionBar supportActionBar = getSupportActionBar();
        if (supportActionBar != null) {
            supportActionBar.setDisplayHomeAsUpEnabled(true);
            supportActionBar.setDisplayShowHomeEnabled(true);
        }
        FrameLayout frameLayout = getViewBinding$payments_core_release().footerContainer;
        Intrinsics.checkNotNullExpressionValue(frameLayout, "viewBinding.footerContainer");
        View createFooterView = createFooterView(frameLayout);
        if (createFooterView != null) {
            if (Build.VERSION.SDK_INT >= 22) {
                getViewBinding$payments_core_release().recycler.setAccessibilityTraversalBefore(createFooterView.getId());
                createFooterView.setAccessibilityTraversalAfter(getViewBinding$payments_core_release().recycler.getId());
            }
            getViewBinding$payments_core_release().footerContainer.addView(createFooterView);
            FrameLayout frameLayout2 = getViewBinding$payments_core_release().footerContainer;
            Intrinsics.checkNotNullExpressionValue(frameLayout2, "viewBinding.footerContainer");
            frameLayout2.setVisibility(0);
        }
        getViewBinding$payments_core_release().recycler.requestFocusFromTouch();
    }

    private final void setupRecyclerView() {
        Context context = (Context) this;
        final DeletePaymentMethodDialogFactory deletePaymentMethodDialogFactory = new DeletePaymentMethodDialogFactory(context, getAdapter(), getCardDisplayTextFactory(), m1013getCustomerSessiond1pmJ48(), getViewModel().getProductUsage$payments_core_release(), new Function1<PaymentMethod, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PaymentMethod) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(PaymentMethod paymentMethod) {
                PaymentMethodsViewModel viewModel;
                Intrinsics.checkNotNullParameter(paymentMethod, "it");
                viewModel = PaymentMethodsActivity.this.getViewModel();
                viewModel.onPaymentMethodRemoved$payments_core_release(paymentMethod);
            }
        });
        getAdapter().setListener$payments_core_release(new PaymentMethodsAdapter.Listener() {
            @Override
            public void onPaymentMethodClick(PaymentMethod paymentMethod) {
                Intrinsics.checkNotNullParameter(paymentMethod, "paymentMethod");
                PaymentMethodsActivity.this.getViewBinding$payments_core_release().recycler.setTappedPaymentMethod$payments_core_release(paymentMethod);
            }

            @Override
            public void onGooglePayClick() {
                PaymentMethodsActivity.this.finishWithGooglePay();
            }

            @Override
            public void onDeletePaymentMethodAction(PaymentMethod paymentMethod) {
                Intrinsics.checkNotNullParameter(paymentMethod, "paymentMethod");
                deletePaymentMethodDialogFactory.create(paymentMethod).show();
            }
        });
        getViewBinding$payments_core_release().recycler.setAdapter(getAdapter());
        getViewBinding$payments_core_release().recycler.setPaymentMethodSelectedCallback$payments_core_release(new Function1<PaymentMethod, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((PaymentMethod) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(PaymentMethod paymentMethod) {
                Intrinsics.checkNotNullParameter(paymentMethod, "it");
                PaymentMethodsActivity.finishWithResult$default(PaymentMethodsActivity.this, paymentMethod, 0, 2, null);
            }
        });
        if (getArgs().getCanDeletePaymentMethods$payments_core_release()) {
            getViewBinding$payments_core_release().recycler.attachItemTouchHelper$payments_core_release(new PaymentMethodSwipeCallback(context, getAdapter(), new SwipeToDeleteCallbackListener(deletePaymentMethodDialogFactory)));
        }
    }

    public boolean onSupportNavigateUp() {
        finishWithResult(getAdapter().getSelectedPaymentMethod$payments_core_release(), 0);
        return true;
    }

    public final void onAddPaymentMethodResult$payments_core_release(AddPaymentMethodActivityStarter.Result result) {
        Intrinsics.checkNotNullParameter(result, "result");
        if (result instanceof AddPaymentMethodActivityStarter.Result.Success) {
            onAddedPaymentMethod(((AddPaymentMethodActivityStarter.Result.Success) result).getPaymentMethod());
        } else {
            boolean z = result instanceof AddPaymentMethodActivityStarter.Result.Failure;
        }
    }

    private final void onAddedPaymentMethod(PaymentMethod paymentMethod) {
        PaymentMethod.Type type = paymentMethod.type;
        if (type != null && type.isReusable) {
            getViewModel().onPaymentMethodAdded$payments_core_release(paymentMethod);
        } else {
            finishWithResult$default(this, paymentMethod, 0, 2, null);
        }
    }

    public final void finishWithGooglePay() {
        setResult(-1, new Intent().putExtras(new PaymentMethodsActivityStarter.Result(null, true, 1, null).toBundle()));
        finish();
    }

    static void finishWithResult$default(PaymentMethodsActivity paymentMethodsActivity, PaymentMethod paymentMethod, int i2, int i3, Object obj) {
        if ((i3 & 2) != 0) {
            i2 = -1;
        }
        paymentMethodsActivity.finishWithResult(paymentMethod, i2);
    }

    public final void finishWithResult(PaymentMethod paymentMethod, int resultCode) {
        Intent intent = new Intent();
        intent.putExtras(new PaymentMethodsActivityStarter.Result(paymentMethod, getArgs().getUseGooglePay$payments_core_release() && paymentMethod == null).toBundle());
        Unit unit = Unit.INSTANCE;
        setResult(resultCode, intent);
        finish();
    }

    private final View createFooterView(ViewGroup contentRoot) {
        if (getArgs().getPaymentMethodsFooterLayoutId() <= 0) {
            return null;
        }
        View inflate = getLayoutInflater().inflate(getArgs().getPaymentMethodsFooterLayoutId(), contentRoot, false);
        inflate.setId(R.id.stripe_payment_methods_footer);
        if (!(inflate instanceof TextView)) {
            return inflate;
        }
        TextView textView = (TextView) inflate;
        LinkifyCompat.addLinks(textView, 15);
        ViewCompat.enableAccessibleClickableSpanSupport(inflate);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        return inflate;
    }

    private final void observePaymentMethodData() {
        BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new PaymentMethodsActivity$observePaymentMethodData$1(this, null), 3, (Object) null);
    }

    protected void onDestroy() {
        if (!this.earlyExitDueToIllegalState) {
            PaymentMethodsViewModel viewModel = getViewModel();
            PaymentMethod selectedPaymentMethod$payments_core_release = getAdapter().getSelectedPaymentMethod$payments_core_release();
            viewModel.setSelectedPaymentMethodId$payments_core_release(selectedPaymentMethod$payments_core_release != null ? selectedPaymentMethod$payments_core_release.id : null);
        }
        super.onDestroy();
    }
}