导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - WalletActivity.java 源代码

正在查看: bbinstant v6.24.0 应用的 WalletActivity.java JAVA 源代码文件

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


package com.bigbasket.bbinstant.ui.payments.wallet;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.Selection;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import com.adjetter.kapchatsdk.R;
import com.bigbasket.bbinstant.analytics.moengage.MoEventManager;
import com.bigbasket.bbinstant.core.settings.SettingEntity;
import com.bigbasket.bbinstant.labs.plower.events.Connection;
import com.bigbasket.bbinstant.ui.BaseActivity;
import com.bigbasket.bbinstant.ui.help.activity.FAQWebViewActivity;
import com.bigbasket.bbinstant.ui.payments.juspay.HyperServiceHolder;
import com.bigbasket.bbinstant.ui.payments.wallet.WalletActivity;
import com.google.android.material.snackbar.Snackbar;
import io.reactivex.functions.Consumer;
import java.util.Objects;

public class WalletActivity extends BaseActivity implements g {
    private a addMoneyBlock;
    private b availableBalanceBlock;
    private View loadingScreen;
    private d offersBlock;
    private e optionsBlock;
    private j presenter;
    private f tnCBlock;

    protected static class a extends c {
        protected Button addMoneyBtn;
        protected EditText amountEditText;
        protected View.OnClickListener listener;
        protected TextView rs_1;
        protected TextView rs_2;
        protected TextView rs_3;
        protected TextView rs_4;
        private String[] splitAmunts;
        protected TextView tvRechargeTip;

        protected a(View view) {
            super(view);
            this.listener = new View.OnClickListener() {
                @Override
                public final void onClick(View view2) {
                    WalletActivity.a.this.lambda$new$0(view2);
                }
            };
            this.addMoneyBtn = (Button) this.itemView.findViewById(2131361933);
            this.amountEditText = (EditText) this.itemView.findViewById(2131362087);
            this.tvRechargeTip = (TextView) this.itemView.findViewById(2131362765);
            this.rs_1 = (TextView) this.itemView.findViewById(2131362640);
            this.rs_2 = (TextView) this.itemView.findViewById(2131362641);
            this.rs_3 = (TextView) this.itemView.findViewById(2131362642);
            this.rs_4 = (TextView) this.itemView.findViewById(2131362643);
            setAmountsFromSettings();
            this.rs_1.setOnClickListener(this.listener);
            this.rs_2.setOnClickListener(this.listener);
            this.rs_3.setOnClickListener(this.listener);
            this.rs_4.setOnClickListener(this.listener);
            observeMobileNumberTextChangeListener();
        }

        public void lambda$new$0(View view) {
            switch (view.getId()) {
                case 2131362640:
                    this.amountEditText.setText(this.splitAmunts[0]);
                    break;
                case 2131362641:
                    this.amountEditText.setText(this.splitAmunts[1]);
                    break;
                case 2131362642:
                    this.amountEditText.setText(this.splitAmunts[2]);
                    break;
                case 2131362643:
                    this.amountEditText.setText(this.splitAmunts[3]);
                    break;
            }
        }

        public void lambda$observeMobileNumberTextChangeListener$1(CharSequence charSequence) throws Exception {
            int length = charSequence.toString().length();
            if (length == 2) {
                this.amountEditText.setText("");
                return;
            }
            if (length > 0) {
                Editable text = this.amountEditText.getText();
                Objects.requireNonNull(text);
                if (text.toString().contains("₹")) {
                    return;
                }
                this.amountEditText.setText("₹ " + charSequence.toString());
                Selection.setSelection(this.amountEditText.getText(), this.amountEditText.getText().length());
            }
        }

        private void observeMobileNumberTextChangeListener() {
            com.jakewharton.rxbinding3.widget.a.textChanges(this.amountEditText).subscribe(new Consumer() {
                public final void accept(Object obj) {
                    WalletActivity.a.this.lambda$observeMobileNumberTextChangeListener$1((CharSequence) obj);
                }
            });
        }

        private void setAmountsFromSettings() {
            SettingEntity settings = com.bigbasket.bbinstant.core.persistance.d.get().getSettings();
            this.tvRechargeTip.setText(settings.getBbiWalletRechargeTip());
            String bbiWalletRechargeDefaultAmounts = settings.getBbiWalletRechargeDefaultAmounts();
            if (bbiWalletRechargeDefaultAmounts == null || bbiWalletRechargeDefaultAmounts.isEmpty()) {
                bbiWalletRechargeDefaultAmounts = "100,300,500,1000";
            }
            this.splitAmunts = bbiWalletRechargeDefaultAmounts.split(",");
            TextView[] textViewArr = {this.rs_1, this.rs_2, this.rs_3, this.rs_4};
            for (int i = 0; i < 4; i++) {
                if (i < this.splitAmunts.length) {
                    textViewArr[i].setText("₹" + this.splitAmunts[i]);
                } else {
                    textViewArr[i].setVisibility(8);
                }
            }
        }

        public Button getAddMoneyBtn() {
            return this.addMoneyBtn;
        }

        public EditText getAmountEditText() {
            return this.amountEditText;
        }

        public TextView getRs_1() {
            return this.rs_1;
        }

        public TextView getRs_2() {
            return this.rs_2;
        }

        public TextView getRs_3() {
            return this.rs_3;
        }

        public TextView getRs_4() {
            return this.rs_4;
        }
    }

    protected static class b extends c {
        protected TextView balanceText;

        protected b(View view) {
            super(view);
            this.balanceText = (TextView) this.itemView.findViewById(2131362604);
        }

        public TextView getBalanceText() {
            return this.balanceText;
        }
    }

    protected static abstract class c {
        protected View itemView;

        protected c(View view) {
            this.itemView = view;
        }

        public void hide(boolean z) {
            if (z) {
                this.itemView.setVisibility(8);
            } else {
                this.itemView.setVisibility(0);
            }
        }
    }

    protected static class d extends c {
        protected LinearLayout container;

        protected d(View view) {
            super(view);
            this.container = (LinearLayout) this.itemView.findViewById(2131362399);
        }

        public LinearLayout getContainer() {
            return this.container;
        }
    }

    protected static class e extends c {
        protected LinearLayout container;
        protected TextView header;

        protected e(View view) {
            super(view);
            this.container = (LinearLayout) this.itemView.findViewById(2131362407);
            this.header = (TextView) this.itemView.findViewById(2131362786);
        }

        public LinearLayout getContainer() {
            return this.container;
        }

        public TextView getHeader() {
            return this.header;
        }
    }

    protected static class f extends c {
        protected LinearLayout container;

        protected f(View view) {
            super(view);
            this.container = (LinearLayout) this.itemView.findViewById(2131362666);
        }

        public LinearLayout getContainer() {
            return this.container;
        }
    }

    public void lambda$onCreate$0(View view) {
        onBackPressed();
    }

    public void lambda$onCreate$1(kotlin.e0 e0Var) throws Exception {
        navigateToFAQ();
    }

    private void navigateToFAQ() {
        startActivity(new Intent(this, (Class<?>) FAQWebViewActivity.class));
    }

    @Override
    public Activity getActivity() {
        return this;
    }

    @Override
    public <T extends c> T getBlock(int i) {
        if (i == 0) {
            return this.availableBalanceBlock;
        }
        if (i == 1) {
            return this.addMoneyBlock;
        }
        if (i == 2) {
            return this.offersBlock;
        }
        if (i == 3) {
            return this.optionsBlock;
        }
        if (i != 4) {
            return null;
        }
        return this.tnCBlock;
    }

    @Override
    public Context getContext() {
        return this;
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        this.presenter.onActivityResult(i, i2, intent);
    }

    @Override
    public void onBackPressed() {
        HyperServiceHolder hyperServiceHolder = this.presenter.hyperServicesHolder;
        if (hyperServiceHolder == null) {
            super.onBackPressed();
        } else if (hyperServiceHolder.handleBackPress()) {
            super.onBackPressed();
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558455);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowTitleEnabled(true);
            toolbar.setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    WalletActivity.this.lambda$onCreate$0(view);
                }
            });
        }
        this.loadingScreen = findViewById(2131362288);
        this.availableBalanceBlock = new b(findViewById(2131361898));
        this.addMoneyBlock = new a(findViewById(2131361869));
        this.tnCBlock = new f(findViewById(2131362667));
        this.offersBlock = new d(findViewById(2131362405));
        this.optionsBlock = new e(findViewById(2131362408));
        LinearLayout linearLayout = (LinearLayout) findViewById(2131362245);
        com.jakewharton.rxbinding3.view.a.clicks(findViewById(2131362154)).mergeWith(com.jakewharton.rxbinding3.view.a.clicks(findViewById(2131362153))).subscribe(new Consumer() {
            public final void accept(Object obj) {
                WalletActivity.this.lambda$onCreate$1((kotlin.e0) obj);
            }
        });
        com.bigbasket.bbinstant.core.payments.newiml.q from = com.bigbasket.bbinstant.core.payments.newiml.q.from(getIntent().getStringExtra(Connection.Key.DATA));
        if (from != null && from.value().equals("employerwallet")) {
            this.optionsBlock.header.setVisibility(8);
        }
        String displayName = from.displayName().toLowerCase().endsWith("wallet") ? from.displayName() : from.displayName().concat(" Wallet");
        if (displayName.toLowerCase().contains("bbinstant")) {
            linearLayout.setVisibility(0);
        } else {
            linearLayout.setVisibility(8);
        }
        if (from == com.bigbasket.bbinstant.core.payments.newiml.q.AMAZONPAY) {
            displayName = getString(2131886478);
        }
        setTitle(displayName);
        this.presenter = j.ofType(this, from);
        MoEventManager.trackViewWalletLoadPage("NA");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.presenter.onDestroy();
    }

    @Override
    public void setScreen(int i) {
        if (i == 0) {
            this.loadingScreen.setVisibility(8);
        } else {
            if (i != 1) {
                return;
            }
            this.loadingScreen.setVisibility(0);
        }
    }

    @Override
    public void setTitle(CharSequence charSequence) {
        super.setTitle("");
        ((TextView) findViewById(2131362672)).setText(charSequence);
    }

    @Override
    public void showToast(String str) {
        super.showToast(str);
    }

    @Override
    public void toast(Snackbar snackbar) {
        try {
            snackbar.show();
        } catch (Exception unused) {
        }
    }
}