导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - PulsaOldActivity.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 PulsaOldActivity.java JAVA 源代码文件

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


package com.bm.sc.bebasbayar.ui.activity.ubp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bm.sc.auth.ui.BottomNavigationActivity;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.adapter.BaseAdapter;
import com.bm.sc.bebasbayar.adapter.entity.DialogPlusOption;
import com.bm.sc.bebasbayar.adapter.entity.ProdukListEntity;
import com.bm.sc.bebasbayar.adapter.entity.PulsaEntity;
import com.bm.sc.bebasbayar.adapter.entity.SelfNumberEntity;
import com.bm.sc.bebasbayar.adapter.entity.VoucherEntity;
import com.bm.sc.bebasbayar.adapter.list.HistoryPulsaAdapter;
import com.bm.sc.bebasbayar.adapter.list.PulsaAdapter;
import com.bm.sc.bebasbayar.adapter.list.PulsaCarouselAdapter;
import com.bm.sc.bebasbayar.adapter.list.UBPPromoVoucherAdapter;
import com.bm.sc.bebasbayar.handler.FirebaseProcessor;
import com.bm.sc.bebasbayar.handler.MessageComposer;
import com.bm.sc.bebasbayar.handler.MessageSender;
import com.bm.sc.bebasbayar.handler.QRISO;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.helper.MessageParser;
import com.bm.sc.bebasbayar.helper.ShowcaseHelper;
import com.bm.sc.bebasbayar.helper.UBPHelper;
import com.bm.sc.bebasbayar.helper.WidgetHelper;
import com.bm.sc.bebasbayar.iface.AdapterInvoker;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.MessageProcess;
import com.bm.sc.bebasbayar.message.BaseMessage;
import com.bm.sc.bebasbayar.message.BusMessage;
import com.bm.sc.bebasbayar.message.MPMessage;
import com.bm.sc.bebasbayar.message.api.APIMessageWrapper;
import com.bm.sc.bebasbayar.message.api.ListPulsaGameMessage;
import com.bm.sc.bebasbayar.message.mp.ApiMpMessageWrapper;
import com.bm.sc.bebasbayar.message.mp.PulsaPaketanGameMessage;
import com.bm.sc.bebasbayar.message.qr.DataMessage;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.setting.session.ConfigSession;
import com.bm.sc.bebasbayar.setting.session.DataSession;
import com.bm.sc.bebasbayar.ui.activity.OtherHomeMenuActivity;
import com.bm.sc.bebasbayar.ui.activity.TransactionActivity;
import com.bm.sc.bebasbayar.ui.activity.cash.Deposit2Activity;
import com.bm.sc.bebasbayar.ui.activity.list.OptionVoucherListActivity;
import com.bm.sc.bebasbayar.ui.activity.ubp.PulsaOldActivity;
import com.bm.sc.bebasbayar.ui.fragment.dialog.OptionListFragment;
import com.bm.sc.bebasbayar.ui.fragment.dialog.OptionListFragment1;
import com.bm.sc.bebasbayar.ui.fragment.dialog.OptionListFragment2;
import com.bm.sc.bebasbayar.ui.fragment.dialog.UbpHistoryFragment;
import com.bm.sc.bebasbayar.ui.widget.AutoCompleteSerialEditText;
import com.bm.sc.bebasbayar.ui.widget.InvoiceTextView;
import com.bm.sc.util.android.Compat;
import com.bm.sc.util.android.Device;
import com.bm.sc.util.common.Var;
import com.bm.sc.util.format.Locales;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.google.android.material.tabs.TabLayout;
import com.orhanobut.dialogplus.DialogPlus;
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import nl.dionsegijn.konfetti.core.PartyFactory;
import nl.dionsegijn.konfetti.core.emitter.Emitter;
import nl.dionsegijn.konfetti.xml.KonfettiView;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class PulsaOldActivity extends TransactionActivity implements AdapterInvoker<PulsaEntity>, UbpHistoryFragment.UbpHistoryListener, UBPHelper.CrossSellingListener, PulsaCarouselAdapter.Callback, UBPPromoVoucherAdapter.Callback, HistoryPulsaAdapter.Callback {
    public static final String MODE_TAG = "mode:tag";
    public static final String PHONE_PREFIX = "phone:prx";
    public static Comparator<PulsaEntity> SORT_BY_CODE = new Comparator() {
        @Override
        public final int compare(Object obj, Object obj2) {
            int o1;
            o1 = PulsaOldActivity.o1((PulsaEntity) obj, (PulsaEntity) obj2);
            return o1;
        }
    };
    public static final int VOUCHER_REQUEST_CODE_PULSA = 12991;
    public DialogPlus A;
    public ImageView C;
    public TextView D;
    public TextView E;
    public TextView F;
    public Timer G;
    public int I;
    public MessageSender J;
    public View K;
    public View L;
    public View M;
    public String O;
    public double P;
    public UBPPromoVoucherAdapter T;
    public RecyclerView W;
    public RecyclerView X;
    public PulsaAdapter Y;
    public Group Z;
    public Group a0;
    public AppCompatImageView b0;
    public ArrayList<PulsaEntity> c0;
    public TabLayout d0;
    public String e0;
    public ArrayList<String> f0;
    public HistoryPulsaAdapter g0;
    public NestedScrollView l;
    public double n;
    public KonfettiView o;
    public String q;
    public double r;
    public AutoCompleteSerialEditText t;
    public String v;
    public final HashMap<String, Integer> i = UBPHelper.getProductIconList();
    public final ArrayList<VoucherEntity> j = new ArrayList<>();
    public final int k = R.id.menu_item_pulsa_reg;
    public boolean m = false;
    public boolean p = false;
    public ArrayList<ProdukListEntity> s = new ArrayList<>();
    public String u = null;
    public String w = "0";
    public String x = "";
    public String y = "";
    public String z = "";
    public DialogPlus B = null;
    public boolean H = true;
    public View N = null;
    public double Q = 0.0d;
    public double R = 0.0d;
    public double S = 0.0d;
    public boolean U = false;
    public boolean V = false;

    public class a implements AdapterInvoker<VoucherEntity> {
        public a() {
        }

        @Override
        public void adapterResult(BaseAdapter baseAdapter, VoucherEntity voucherEntity, int i) {
        }

        @Override
        public Activity getInvokerActivity() {
            return PulsaOldActivity.this;
        }
    }

    public class b implements MessageProcess {
        public b() {
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            PulsaOldActivity.this.onTransactionDone(false, baseMessage);
            if (PulsaOldActivity.this.t.getText() == null || PulsaOldActivity.this.t.getText().toString().isEmpty() || PulsaOldActivity.this.t.getText().toString().length() <= 11 || !PulsaOldActivity.this.H) {
                return;
            }
            PulsaOldActivity.this.closeKeyboard();
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
            if (PulsaOldActivity.this.t.getText() != null && !PulsaOldActivity.this.t.getText().toString().isEmpty() && PulsaOldActivity.this.t.getText().toString().length() > 11 && PulsaOldActivity.this.H) {
                PulsaOldActivity.this.hideKeyboard();
            }
            PulsaOldActivity.this.onTransactionPrepare(false);
        }
    }

    public class c implements TextWatcher {

        public class a extends TimerTask {
            public a() {
            }

            public void b() {
                String R0 = PulsaOldActivity.this.R0();
                if (!R0.isEmpty() && R0.length() > 5 && R0.length() < 17 && PulsaOldActivity.this.V) {
                    PulsaOldActivity.this.a0.setVisibility(0);
                    PulsaOldActivity.this.H = false;
                    PulsaOldActivity.this.findViewById(R.id.btn_inquiry).performClick();
                    PulsaOldActivity.this.findViewById(R.id.layout_product_not_found).setVisibility(8);
                    PulsaOldActivity.this.L.setVisibility(8);
                    PulsaOldActivity.this.Z.setVisibility(8);
                    return;
                }
                if (R0.length() <= 16) {
                    if (R0.length() < 5) {
                        PulsaOldActivity.this.resetForm(false);
                    }
                } else {
                    InputMethodManager inputMethodManager = (InputMethodManager) PulsaOldActivity.this.getSystemService("input_method");
                    Objects.requireNonNull(inputMethodManager);
                    inputMethodManager.hideSoftInputFromWindow(PulsaOldActivity.this.t.getWindowToken(), 0);
                    PulsaOldActivity.this.Z.setVisibility(8);
                    PulsaOldActivity.this.t.clearFocus();
                }
            }

            @Override
            public void run() {
                PulsaOldActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        PulsaOldActivity.c.a.this.b();
                    }
                });
            }
        }

        public c() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.length() == 0) {
                PulsaOldActivity.this.q1();
            } else if (editable.length() > 0) {
                PulsaOldActivity.this.r1();
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (PulsaOldActivity.this.G != null) {
                PulsaOldActivity.this.G.cancel();
            }
            PulsaOldActivity.this.G = new Timer();
            PulsaOldActivity.this.G.schedule(new a(), 1500L);
        }
    }

    public class d implements MessageProcess {
        public final PulsaEntity a;

        public d(PulsaEntity pulsaEntity) {
            this.a = pulsaEntity;
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            APIMessageWrapper aPIMessageWrapper = new APIMessageWrapper(baseMessage);
            if (aPIMessageWrapper.isOK()) {
                aPIMessageWrapper.getData();
                HashMap<String, Object> hashMap = aPIMessageWrapper.getData().get(0);
                HashMap hashMap2 = Var.toHashMap(hashMap.get("detail_voucher"));
                PulsaOldActivity.this.x = Var.toString(hashMap2.get("kode_voucher"), "");
                PulsaOldActivity.this.R = Var.toDouble(hashMap.get("nominal_voucher"), 0.0d);
                PulsaOldActivity.this.y = Var.toString(hashMap2.get("kode_voucher"), "");
                PulsaOldActivity.this.S = Var.toDouble(hashMap.get("nominal_voucher"), 0.0d);
            } else {
                PulsaOldActivity.this.L.setVisibility(8);
            }
            PulsaOldActivity.this.M0(this.a);
            PulsaOldActivity.this.L.setVisibility(8);
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
        }
    }

    public class e implements View.OnClickListener {
        public final PulsaEntity a;

        public e(PulsaEntity pulsaEntity) {
            this.a = pulsaEntity;
        }

        @Override
        public void onClick(View view) {
            Bundle bundle = new Bundle();
            bundle.putString("idProduk", this.a.getIdproduk());
            bundle.putString("group", "pulsa");
            bundle.putDouble("harga", this.a.getHargajual());
            bundle.putInt("requestCode", 12991);
            Affinity.listen(PulsaOldActivity.this, OptionVoucherListActivity.class, 0, bundle);
        }
    }

    public class f implements TabLayout.OnTabSelectedListener {
        public f() {
        }

        public void onTabReselected(TabLayout.Tab tab) {
        }

        public void onTabSelected(TabLayout.Tab tab) {
            PulsaOldActivity.this.p1(tab.getText());
        }

        public void onTabUnselected(TabLayout.Tab tab) {
        }
    }

    public class g implements MessageProcess {
        public g() {
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            APIMessageWrapper aPIMessageWrapper = new APIMessageWrapper(baseMessage);
            ArrayList arrayList = new ArrayList();
            if (!aPIMessageWrapper.isOK()) {
                if (aPIMessageWrapper.getData().isEmpty()) {
                    return;
                }
                HashMap<String, Object> hashMap = aPIMessageWrapper.getData().get(0);
                String var = Var.toString(hashMap.get("id_pelanggan"), "");
                String var2 = Var.toString(hashMap.get(FirebaseProcessor.KEY_IMAGE_URL), "");
                PulsaOldActivity.this.F.setText("Nomor Saya");
                PulsaOldActivity.this.D.setText(var);
                PulsaOldActivity.this.Z.setVisibility(8);
                if (PulsaOldActivity.this.U) {
                    Glide.with(PulsaOldActivity.this).load(var2).apply(new RequestOptions().placeholder(R.drawable.bb_splash_hexagon).error(R.drawable.bb_splash_hexagon)).into(PulsaOldActivity.this.C);
                    return;
                }
                return;
            }
            ArrayList<HashMap<String, Object>> data = aPIMessageWrapper.getData();
            HashMap<String, Object> hashMap2 = aPIMessageWrapper.getData().get(0);
            String var3 = Var.toString(hashMap2.get("id_pelanggan"), "");
            PulsaOldActivity.this.F.setText("Transaksi Terakhir");
            PulsaOldActivity.this.E.setVisibility(0);
            PulsaOldActivity.this.M.setVisibility(0);
            if (!var3.isEmpty()) {
                PulsaOldActivity.this.Z.setVisibility(0);
                String var4 = Var.toString(hashMap2.get("produk"), "");
                String var5 = Var.toString(hashMap2.get(FirebaseProcessor.KEY_IMAGE_URL), "");
                PulsaOldActivity.this.D.setText(var3);
                PulsaOldActivity.this.E.setText(var4);
                if (PulsaOldActivity.this.U) {
                    Glide.with(PulsaOldActivity.this.getApplicationContext()).load(var5).apply(new RequestOptions().placeholder(R.drawable.bb_splash_hexagon).error(R.drawable.bb_splash_hexagon)).into(PulsaOldActivity.this.C);
                }
            }
            Iterator<HashMap<String, Object>> it = data.iterator();
            while (it.hasNext()) {
                HashMap<String, Object> next = it.next();
                ProdukListEntity produkListEntity = new ProdukListEntity();
                produkListEntity.setIdPel1(Var.toString(next.get("id_pelanggan"), ""));
                produkListEntity.setProduk(Var.toString(next.get("produk"), ""));
                produkListEntity.setTime(Var.toString(next.get("tanggal"), ""));
                produkListEntity.setDrawable_url(Var.toString(next.get(FirebaseProcessor.KEY_IMAGE_URL), ""));
                produkListEntity.setName(Var.toString(next.get("nama_pelanggan"), ""));
                arrayList.add(produkListEntity);
            }
            PulsaOldActivity.this.s = arrayList;
            PulsaOldActivity.this.g0.updateList(PulsaOldActivity.this.s);
            PulsaOldActivity.this.X.setAdapter(PulsaOldActivity.this.g0);
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
        }
    }

    public void T0(PulsaEntity pulsaEntity, int i, Boolean bool) {
        bool.booleanValue();
        S0(pulsaEntity);
    }

    public void U0(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void V0(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void W0(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void X0(PulsaEntity pulsaEntity, View view) {
        this.y = "";
        this.S = 0.0d;
        this.B.dismiss();
        AppCompatAutoCompleteTextView appCompatAutoCompleteTextView = this.t;
        String idproduk = pulsaEntity.getIdproduk();
        String value = this.t.getValue();
        Objects.requireNonNull(value);
        WidgetHelper.setProductIdTag(appCompatAutoCompleteTextView, idproduk, value);
        doTransaction(true, null);
    }

    public void Y0(View view) {
        this.B.dismiss();
        Affinity.launch(this, Deposit2Activity.class);
    }

    public void Z0(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void a1(SwitchMaterial switchMaterial, PulsaEntity pulsaEntity, TextView textView, ConstraintLayout constraintLayout, ConstraintLayout constraintLayout2, TextView textView2, LinearLayout linearLayout, TextView textView3, TextView textView4, int i, Boolean bool) {
        if (bool.booleanValue()) {
            this.N.findViewById(R.id.voucher_container).setVisibility(8);
            this.N.findViewById(R.id.voucher_add_container).setVisibility(8);
            this.N.findViewById(R.id.btn_list_voucher).setVisibility(0);
            this.N.findViewById(R.id.switch_poin).setEnabled(true);
            switchMaterial.setEnabled(true);
            this.P = Var.toDouble(pulsaEntity.getNominalUp(), 0.0d);
            this.I = Var.toInt(Integer.valueOf(pulsaEntity.getHargajual()), 0);
            ((TextView) this.N.findViewById(R.id.pulsa_price)).setText(Locales.moneyNoFraction(Var.toString(Integer.valueOf(this.I), "")));
            ((TextView) this.N.findViewById(R.id.pulsa_price_nett)).setText(Locales.moneyNoFraction(Var.toString(Integer.valueOf(this.I), "")));
            textView.setText(Locales.moneyNoFraction(Var.toString(Integer.valueOf(this.I), "")));
            String.format(Locale.getDefault(), "- %1$s", Locales.moneyNoFraction(Var.toString(Integer.valueOf((int) this.P), "0")));
            if (this.P > 0.0d) {
                this.N.findViewById(R.id.tv_label_discount).setVisibility(8);
                this.N.findViewById(R.id.pulsa_discount).setVisibility(8);
                ((TextView) this.N.findViewById(R.id.pulsa_discount)).setText(String.format(Locale.getDefault(), "- %1$s", Locales.moneyNoFraction(Var.toString(Integer.valueOf((int) this.P), "0"))));
            } else {
                this.N.findViewById(R.id.tv_label_discount).setVisibility(8);
                this.N.findViewById(R.id.pulsa_discount).setVisibility(8);
            }
            this.z = "";
            this.x = "";
            this.R = 0.0d;
            this.Q = 0.0d;
            setKode_voucher("");
            if (!this.y.equals("")) {
                String str = this.y;
                this.x = str;
                setKode_voucher(str);
                this.R = this.S;
                this.o.start(new PartyFactory(new Emitter(5L, TimeUnit.SECONDS).perSecond(50)).angle(270).spread(90).setSpeedBetween(1.0f, 5.0f).timeToLive(2000L).position(0.0d, 0.0d, 1.0d, 0.0d).build());
                constraintLayout.setVisibility(8);
                constraintLayout2.setVisibility(0);
            }
            if (Var.toDouble(this.q, 0.0d) >= this.I) {
                this.N.findViewById(R.id.btn_pay).setVisibility(0);
                this.N.findViewById(R.id.btn_topup).setVisibility(8);
                textView2.setVisibility(8);
                linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.bb_background_transparent_white));
                textView3.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                textView4.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                return;
            }
            if (this.p) {
                this.N.findViewById(R.id.btn_pay).setVisibility(0);
                this.N.findViewById(R.id.btn_topup).setVisibility(8);
                textView2.setVisibility(8);
                linearLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground));
                ((TextView) this.N.findViewById(R.id.sc_label_balance)).setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                ((TextView) this.N.findViewById(R.id.sc_balance)).setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                return;
            }
            this.N.findViewById(R.id.btn_pay).setVisibility(8);
            this.N.findViewById(R.id.btn_topup).setVisibility(0);
            textView2.setVisibility(0);
            textView3.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            textView4.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            ((TextView) this.N.findViewById(R.id.tv_balance_insufficient)).setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_rounded10dp_pink));
        }
    }

    public void b1(final SwitchMaterial switchMaterial, final PulsaEntity pulsaEntity, final TextView textView, final ConstraintLayout constraintLayout, final ConstraintLayout constraintLayout2, final TextView textView2, final LinearLayout linearLayout, final TextView textView3, final TextView textView4, View view) {
        Affinity.confirm(this, "Konfirmasi Hapus Voucher", "Anda yakin akan menghapus voucher?", new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                PulsaOldActivity.this.a1(switchMaterial, pulsaEntity, textView, constraintLayout, constraintLayout2, textView2, linearLayout, textView3, textView4, i, (Boolean) obj);
            }
        });
    }

    public void c1(ConstraintLayout constraintLayout, ConstraintLayout constraintLayout2, TextView textView, ImageView imageView, ImageView imageView2, ImageView imageView3, ImageView imageView4, TextView textView2, TextView textView3, ConstraintLayout constraintLayout3, double d2, TextView textView4, TextView textView5, TextView textView6, boolean z, View view, TextView textView7, LinearLayout linearLayout, TextView textView8, TextView textView9, CompoundButton compoundButton, boolean z2) {
        int i;
        double d3;
        if (!z2) {
            ((TextView) this.N.findViewById(R.id.label_poin_voucher)).setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryAlt));
            ((TextView) this.N.findViewById(R.id.label_poin_voucher2)).setTextColor(ContextCompat.getColor(this, R.color.Black));
            constraintLayout.setEnabled(true);
            constraintLayout2.setEnabled(true);
            this.N.findViewById(R.id.poin_voucher_arrowRIght).setEnabled(true);
            this.m = false;
            textView.setTextColor(ContextCompat.getColor(this, R.color.Black));
            imageView.setImageResource(R.drawable.ic_persen_poin);
            imageView2.setImageResource(R.drawable.ic_cek_list_blue);
            imageView3.setImageResource(R.drawable.ic_arrow_right_poin);
            imageView4.setImageResource(R.drawable.ic_arrow_right_poin);
            constraintLayout.setBackgroundResource(R.drawable.bb_background_transparent_blue_rounded_16);
            constraintLayout2.setBackgroundResource(R.drawable.bb_background_transparent_blue_rounded_16);
            textView2.setVisibility(8);
            textView3.setVisibility(8);
            textView3.setText("- Rp0");
            textView4.setText(Locales.moneyNoFraction(String.valueOf(this.I)));
            constraintLayout3.setVisibility(8);
            constraintLayout.setVisibility(8);
            constraintLayout2.setVisibility(0);
            textView6.setText(Locales.moneyNoFraction(Var.toString(Integer.valueOf(this.I), "")));
            imageView3.setEnabled(true);
            imageView.setEnabled(true);
            imageView.setEnabled(true);
            if (this.y.equals("")) {
                i = 0;
            } else {
                String str = this.y;
                this.x = str;
                this.R = this.S;
                setKode_voucher(str);
                this.o.start(new PartyFactory(new Emitter(5L, TimeUnit.SECONDS).perSecond(50)).angle(270).spread(90).setSpeedBetween(1.0f, 5.0f).timeToLive(2000L).position(0.0d, 0.0d, 1.0d, 0.0d).build());
                constraintLayout2.setVisibility(8);
                i = 0;
                constraintLayout.setVisibility(0);
            }
            if (Var.toDouble(this.q, 0.0d) >= this.I) {
                view.findViewById(R.id.btn_pay).setVisibility(0);
                view.findViewById(R.id.btn_topup).setVisibility(8);
                textView7.setVisibility(8);
                linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.bb_background_transparent_white));
                textView8.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                textView9.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                return;
            }
            if (z) {
                view.findViewById(R.id.btn_pay).setVisibility(i);
                view.findViewById(R.id.btn_topup).setVisibility(8);
                textView7.setVisibility(8);
                linearLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground));
                textView8.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                textView9.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                return;
            }
            view.findViewById(R.id.btn_pay).setVisibility(8);
            view.findViewById(R.id.btn_topup).setVisibility(0);
            textView7.setVisibility(0);
            textView8.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            textView9.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            textView7.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
            linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_rounded10dp_pink));
            return;
        }
        ((TextView) this.N.findViewById(R.id.label_poin_voucher)).setTextColor(ContextCompat.getColor(this, R.color.Gray));
        ((TextView) this.N.findViewById(R.id.label_poin_voucher2)).setTextColor(ContextCompat.getColor(this, R.color.Gray));
        constraintLayout.setEnabled(false);
        constraintLayout2.setEnabled(false);
        this.N.findViewById(R.id.poin_voucher_arrowRIght).setEnabled(false);
        this.m = true;
        textView.setTextColor(ContextCompat.getColor(this, R.color.Gray));
        imageView.setImageResource(R.drawable.ic_poin_persen_disable);
        imageView2.setImageResource(R.drawable.ic_cek_list_disable);
        imageView3.setImageResource(R.drawable.ic_arrow_right_poin_disable);
        imageView4.setImageResource(R.drawable.ic_arrow_right_poin_disable);
        constraintLayout.setBackgroundResource(R.drawable.bb_background_transparent_grey);
        constraintLayout2.setBackgroundResource(R.drawable.bb_background_transparent_grey);
        textView2.setVisibility(0);
        textView3.setVisibility(0);
        constraintLayout3.setVisibility(0);
        if (d2 > this.I) {
            textView3.setText("- " + Locales.moneyNoFraction(String.valueOf(this.I)));
        } else {
            textView3.setText("- " + Locales.moneyNoFraction(this.appSession.retrieve(AppSession.PROPERTY_POIN)));
        }
        int i2 = this.I;
        if (d2 > i2) {
            textView4.setText("Gratis");
        } else {
            textView4.setText(Locales.moneyNoFraction(String.valueOf(i2 - d2)));
        }
        if (d2 > this.I) {
            textView5.setText("Yeay! kamu hemat " + Locales.moneyNoFraction(String.valueOf(this.I)));
        } else {
            textView5.setText("Yeay! kamu hemat " + Locales.moneyNoFraction(this.appSession.retrieve(AppSession.PROPERTY_POIN)));
        }
        this.z = "";
        this.x = "";
        this.R = 0.0d;
        this.Q = 0.0d;
        setKode_voucher("");
        constraintLayout.setVisibility(8);
        constraintLayout2.setVisibility(0);
        int i3 = this.I;
        if (d2 > i3) {
            d3 = 0.0d;
            textView6.setText("Gratis");
        } else {
            d3 = 0.0d;
            textView6.setText(Locales.moneyNoFraction(String.valueOf(i3 - d2)));
        }
        imageView3.setEnabled(false);
        imageView.setEnabled(false);
        if (Var.toDouble(this.q, d3) + d2 >= this.I) {
            view.findViewById(R.id.btn_pay).setVisibility(0);
            view.findViewById(R.id.btn_topup).setVisibility(8);
            textView7.setVisibility(8);
            linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.bb_background_transparent_white));
            textView8.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            textView9.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            return;
        }
        if (z) {
            view.findViewById(R.id.btn_pay).setVisibility(0);
            view.findViewById(R.id.btn_topup).setVisibility(8);
            textView7.setVisibility(8);
            linearLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground));
            textView8.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            textView9.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            return;
        }
        view.findViewById(R.id.btn_pay).setVisibility(8);
        view.findViewById(R.id.btn_topup).setVisibility(0);
        textView7.setVisibility(0);
        textView8.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
        textView9.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
        textView7.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
        linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_rounded10dp_pink));
    }

    public void d1(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void e1(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void f1(PulsaEntity pulsaEntity, View view) {
        Bundle bundle = new Bundle();
        bundle.putString("idProduk", pulsaEntity.getIdproduk());
        bundle.putString("group", "pulsa");
        bundle.putDouble("harga", pulsaEntity.getHargajual());
        bundle.putInt("requestCode", 12991);
        Affinity.listen(this, OptionVoucherListActivity.class, 0, bundle);
    }

    public void g1(int i, Boolean bool) {
        this.V = bool.booleanValue();
    }

    public static Bundle getPulsaBundle(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("phone:init", str);
        return bundle;
    }

    public void h1(View view) {
        WidgetHelper.setProductIdTag(this.t, "", this.D.getText().toString());
    }

    public void i1(View view) {
        if (getIntent().getExtras() != null ? Var.toBoolean(Boolean.valueOf(getIntent().getExtras().getBoolean(AppSession.IS_FROM_NEW_HOME)), false) : false) {
            Affinity.purge(this, OtherHomeMenuActivity.class);
        } else {
            Affinity.purge(this, BottomNavigationActivity.class);
        }
    }

    public void j1(ArrayList arrayList) {
        this.A = Affinity.option(this, R.string.pulsa_choose_provider, arrayList, this);
    }

    public boolean k1(TextView textView, int i, KeyEvent keyEvent) {
        if (i != 0 && i != 5 && (keyEvent == null || keyEvent.getAction() != 0 || R0().length() < 5)) {
            return true;
        }
        findViewById(R.id.btn_inquiry).performClick();
        return true;
    }

    public static boolean l1(String str, PulsaEntity pulsaEntity) {
        return pulsaEntity.getJenis().equalsIgnoreCase(str);
    }

    public void m1(CharSequence charSequence) {
        if (charSequence.equals("Semua") || charSequence.length() == 0) {
            this.Y.updatePulsaListItems(this.c0);
            this.K.setVisibility(8);
            return;
        }
        ArrayList arrayList = new ArrayList(this.c0);
        final String trim = charSequence.toString().toLowerCase().trim();
        CollectionUtils.filter(arrayList, new Predicate() {
            public final boolean evaluate(Object obj) {
                boolean l1;
                l1 = PulsaOldActivity.l1(trim, (PulsaEntity) obj);
                return l1;
            }
        });
        this.Y.updatePulsaListItems(arrayList);
        this.K.setVisibility(8);
    }

    public void n1(final CharSequence charSequence) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                PulsaOldActivity.this.m1(charSequence);
            }
        });
    }

    public static int o1(PulsaEntity pulsaEntity, PulsaEntity pulsaEntity2) {
        String var = Var.toString(pulsaEntity.getIs_gangguan(), "");
        if (var.equals("1")) {
            return 1;
        }
        return var.compareTo(Var.toString(pulsaEntity2.getIs_gangguan(), ""));
    }

    public final ArrayList<PulsaEntity> K0(ArrayList<HashMap<String, Object>> arrayList) {
        ArrayList<PulsaEntity> arrayList2 = new ArrayList<>();
        LinkedHashSet linkedHashSet = new LinkedHashSet();
        Iterator<HashMap<String, Object>> it = arrayList.iterator();
        while (it.hasNext()) {
            HashMap<String, Object> next = it.next();
            Object obj = next.get("provider");
            Objects.requireNonNull(obj);
            String obj2 = obj.toString();
            this.e0 = null;
            if (!obj2.isEmpty() || !obj2.equals("")) {
                Object obj3 = next.get("image");
                Objects.requireNonNull(obj3);
                this.e0 = obj3.toString();
                Glide.with(getApplicationContext()).load(this.e0).apply(new RequestOptions().placeholder(R.drawable.bb_splash_hexagon).error(R.drawable.bb_splash_hexagon)).into(this.b0);
            }
            ArrayList arrayList3 = (ArrayList) next.get("products");
            Objects.requireNonNull(arrayList3);
            Iterator it2 = arrayList3.iterator();
            while (it2.hasNext()) {
                HashMap hashMap = (HashMap) it2.next();
                int i = Var.toInt(hashMap.get("statuspay"), 0);
                if (i >= 0) {
                    PulsaEntity pulsaEntity = new PulsaEntity((String) hashMap.get("idproduk"), (String) hashMap.get("namaproduk"), (int) Var.toDouble(hashMap.get("hargajual"), 0.0d), (String) hashMap.get("denom"));
                    if (hashMap.get(MPMessage.IncludeMessage.CASHBACK) != null) {
                        pulsaEntity.setCashback((String) hashMap.get(MPMessage.IncludeMessage.CASHBACK));
                    }
                    if (hashMap.get("nominalUp") != null) {
                        pulsaEntity.setNominalUp((String) hashMap.get("nominalUp"));
                    }
                    pulsaEntity.setDescription(Var.toString(hashMap.get(MPMessage.INDEX_DESC), ""));
                    pulsaEntity.setIs_gangguan(Var.toString(hashMap.get("is_gangguan"), ""));
                    pulsaEntity.setResid(Integer.valueOf(Var.toInt(this.i.get(obj2), getMainProductLogoResId())));
                    pulsaEntity.setStatus(i);
                    pulsaEntity.setJenis(Var.toString(hashMap.get("jenis"), "Empty"));
                    pulsaEntity.setImgUrl(this.e0);
                    if (Var.toString(hashMap.get("is_gangguan"), "").equalsIgnoreCase("0")) {
                        arrayList2.add(pulsaEntity);
                    }
                    if (!Var.toString(hashMap.get("jenis"), "").isEmpty()) {
                        linkedHashSet.add(pulsaEntity.getJenis());
                    }
                }
            }
        }
        Collections.sort(arrayList2, SORT_BY_CODE);
        PulsaAdapter pulsaAdapter = new PulsaAdapter(this, 1);
        this.Y = pulsaAdapter;
        pulsaAdapter.setCollectionFilterOriginal(arrayList2);
        L0(linkedHashSet);
        return arrayList2;
    }

    public final void L0(LinkedHashSet<String> linkedHashSet) {
        this.d0.removeAllTabs();
        TabLayout tabLayout = this.d0;
        tabLayout.addTab(tabLayout.newTab().setText("Semua"));
        Iterator<String> it = linkedHashSet.iterator();
        while (it.hasNext()) {
            String next = it.next();
            TabLayout tabLayout2 = this.d0;
            tabLayout2.addTab(tabLayout2.newTab().setText(next));
        }
        this.d0.addOnTabSelectedListener(new f());
    }

    @android.annotation.SuppressLint({"SetTextI18n"})
    public final void M0(final com.bm.sc.bebasbayar.adapter.entity.PulsaEntity r60) {
        throw new UnsupportedOperationException("Method not decompiled: com.bm.sc.bebasbayar.ui.activity.ubp.PulsaOldActivity.M0(com.bm.sc.bebasbayar.adapter.entity.PulsaEntity):void");
    }

    public final String N0() {
        Bundle extras = getIntent().getExtras();
        return extras != null ? extras.getString("phone:prx", "") : "";
    }

    @IdRes
    public final int O0() {
        Bundle extras = getIntent().getExtras();
        return extras != null ? extras.getInt("mode:tag", R.id.menu_item_pulsa_reg) : R.id.menu_item_pulsa_reg;
    }

    public final void P0() {
        UbpHistoryFragment ubpHistoryFragment = new UbpHistoryFragment();
        ubpHistoryFragment.setArguments(ubpHistoryFragment.setupDefaultBundle(11275, "Riwayat Transaksi", this.s));
        ubpHistoryFragment.show(getSupportFragmentManager(), "pulsa_history_option");
    }

    public final void Q0() {
        MessageComposer messageComposer = new MessageComposer(7, "ro/customer/history_billinfo");
        messageComposer.setRequest_method(MessageComposer.GET);
        messageComposer.setData_type(2);
        messageComposer.addMessage("user_id", this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID));
        messageComposer.addMessage("user_uuid", Device.getDeviceUUID(this).toString());
        messageComposer.addMessage(BaseMessage.INDEX_VIA, "BB ANDROID");
        messageComposer.addMessage("id_group_produk", "pulsa");
        messageComposer.addMessage("is_pulsa", 1);
        messageComposer.setShowProgressRegular(false);
        messageComposer.setIs_encrypted(false);
        messageComposer.setMessageProcess(new g());
        new MessageSender(this, messageComposer).execute();
    }

    public final String R0() {
        String value = this.t.getValue();
        if (!value.startsWith(QRISO.ID_ADD_DATA)) {
            return value;
        }
        return "0" + value.substring(2);
    }

    public final void S0(PulsaEntity pulsaEntity) {
        this.x = "";
        this.R = 0.0d;
        this.y = "";
        this.S = 0.0d;
        APIMessageWrapper aPIMessageWrapper = new APIMessageWrapper();
        aPIMessageWrapper.setItem(DataMessage.ID_OUTLET, this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID));
        aPIMessageWrapper.setItem("user_id", this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID));
        aPIMessageWrapper.setItem("user_uuid", Device.getDeviceUUID(this));
        aPIMessageWrapper.setItem("nominal", Integer.valueOf(pulsaEntity.getHargajual()));
        aPIMessageWrapper.setItem("channel", pulsaEntity.getIdproduk());
        MessageComposer messageComposer = new MessageComposer(7, "ro/activity/voucher_applied");
        messageComposer.setShowProgressRegular(true);
        messageComposer.setIs_encrypted(false);
        messageComposer.setMessageProcess(new d(pulsaEntity));
        MessageSender messageSender = new MessageSender(this, messageComposer);
        messageSender.setRequestMessage(aPIMessageWrapper);
        messageSender.execute();
    }

    @Override
    public String getClassSimpleName() {
        return "pulsa";
    }

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

    @Override
    public int getMainProductLogoResId() {
        return R.drawable.ic_bb_pulsa;
    }

    @Override
    public String getPageGroupName() {
        return "pulsa";
    }

    @Override
    public String getProductName() {
        return this.O;
    }

    @Override
    public String getSelectedProductCode() {
        String str = this.u;
        if (str == null) {
            return WidgetHelper.getProductIdTag(this.t);
        }
        this.u = null;
        return str;
    }

    @Override
    public BaseMessage getTransactionMessage(boolean z) {
        if (this.t.getValue().isEmpty()) {
            Affinity.info(this, false, getString(R.string.error_required_field, "Nomor Handphone"));
            return null;
        }
        if (this.t.getValue().length() < 8) {
            Affinity.info(this, false, "Nomor handphone minimal 8 digit");
            return null;
        }
        if (z && getSelectedProductCode().isEmpty()) {
            Affinity.info(this, false, getString(R.string.error_invalid_payment_info));
            return null;
        }
        String retrieve = this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID);
        if (!z) {
            return new ListPulsaGameMessage(retrieve, R0());
        }
        PulsaPaketanGameMessage pulsaPaketanGameMessage = new PulsaPaketanGameMessage(retrieve, this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_PIN), this.appSession.retrieve(AppSession.PROPERTY_AUTH_TOKEN), getSelectedProductCode());
        pulsaPaketanGameMessage.setAdditional_dataValue(0, R0());
        Device.getAddressLocation(this);
        pulsaPaketanGameMessage.setAdditional_dataValue(109, Device.getLogDevice(this));
        pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.CUSTOMER_ID_1, R0());
        pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.AMOUNT, String.valueOf(this.I));
        pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.PRODUCT_NAME, this.O);
        pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.DISCOUNT, Var.toString(Integer.valueOf((int) this.P), "0"));
        if (this.m) {
            pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.PAYMENT_METHOD_PRIORITY, "POIN");
        }
        if (getKode_voucher() != null) {
            pulsaPaketanGameMessage.setIncludesValue(MPMessage.IncludeMessage.JENIS_STRUK, getKode_voucher());
        }
        setIsIdPelSaved(((CheckBox) findViewById(R.id.cb_save_id_pel_pulsa)).isChecked());
        return pulsaPaketanGameMessage;
    }

    @Override
    public int getViewResource() {
        return R.layout.activity_pulsa;
    }

    @Override
    public String getWikiNameSpace() {
        return null;
    }

    public boolean isAssignedAsData() {
        return O0() == 2131364831;
    }

    @Override
    public boolean isEnabledVoucher() {
        return true;
    }

    @Override
    public boolean isMainSubscriberId() {
        return true;
    }

    @Override
    public boolean isNeedToDisplayShowcase() {
        return false;
    }

    @Override
    public boolean isPulsaPage() {
        return true;
    }

    @Override
    public boolean isSearchVisible() {
        return false;
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        View view;
        super.onActivityResult(i, i2, intent);
        StringBuilder sb = new StringBuilder();
        sb.append("onActivityResult: ");
        sb.append(i2);
        if (i2 == 12991) {
            TextView textView = (TextView) this.N.findViewById(R.id.tv_label_discount);
            TextView textView2 = (TextView) this.N.findViewById(R.id.pulsa_discount);
            TextView textView3 = (TextView) this.N.findViewById(R.id.pulsa_price_nett);
            ConstraintLayout findViewById = this.N.findViewById(R.id.voucher_add_container);
            View view2 = (ConstraintLayout) this.N.findViewById(R.id.btn_voucher);
            RelativeLayout relativeLayout = (RelativeLayout) this.N.findViewById(R.id.voucher_container);
            SwitchMaterial findViewById2 = this.N.findViewById(R.id.switch_poin);
            TextView textView4 = (TextView) this.N.findViewById(R.id.sc_balance);
            String var = Var.toString(this.appSession.retrieve(AppSession.PROPERTY_BALANCE), "0");
            TextView textView5 = (TextView) this.N.findViewById(R.id.btn_pay_nominal);
            findViewById.setVisibility(8);
            view2.setVisibility(8);
            this.z = intent.getStringExtra("desc_voucher");
            this.x = intent.getStringExtra("kode_voucher");
            this.R = intent.getDoubleExtra("nominal_voucher", 0.0d);
            String stringExtra = intent.getStringExtra("satuan_voucher");
            setKode_voucher(this.x);
            if (this.z.isEmpty() && this.x.isEmpty()) {
                findViewById.setVisibility(8);
                view = view2;
                view.setVisibility(8);
                this.N.findViewById(R.id.btn_list_voucher).setVisibility(8);
            } else {
                view = view2;
                relativeLayout.setVisibility(8);
                findViewById.setVisibility(0);
                view.setVisibility(8);
                this.N.findViewById(R.id.btn_list_voucher).setVisibility(8);
                if (this.z.isEmpty()) {
                    this.N.findViewById(R.id.voucher_desc).setVisibility(8);
                    this.N.findViewById(R.id.voucher_divider).setVisibility(8);
                } else {
                    this.N.findViewById(R.id.voucher_desc).setVisibility(0);
                    this.N.findViewById(R.id.voucher_divider).setVisibility(0);
                    ((TextView) this.N.findViewById(R.id.voucher_desc)).setText(Compat.Html_fromHtml(this.z));
                }
                ((TextView) this.N.findViewById(R.id.voucher_code)).setText(Compat.Html_fromHtml(getString(R.string.voucher_code_info, this.x)));
            }
            if (this.R == 0.0d) {
                textView.setVisibility(8);
                textView2.setVisibility(8);
                return;
            }
            ((TextView) this.N.findViewById(R.id.voucher_code2)).setText("Dapat voucher " + Locales.moneyNoFraction(Var.toString(Double.valueOf(this.R), "")));
            if (stringExtra == null || !stringExtra.equals("saldo")) {
                return;
            }
            double d2 = this.P;
            double d3 = this.R;
            this.P = d2 + d3;
            this.n = this.I - d3;
            textView.setVisibility(0);
            textView2.setVisibility(0);
            textView2.setText(String.format(Locale.getDefault(), "- %1$s", Locales.moneyNoFraction(Var.toString(Integer.valueOf((int) this.P), "0"))));
            textView3.setText(Locales.moneyNoFraction(Var.toString(Double.valueOf(this.n), "")));
            findViewById2.setEnabled(false);
            view.setVisibility(8);
            findViewById.setVisibility(0);
            this.N.findViewById(R.id.voucher_add_container).setVisibility(0);
            LinearLayout linearLayout = (LinearLayout) this.N.findViewById(R.id.balance_container);
            TextView textView6 = (TextView) this.N.findViewById(R.id.tv_balance_insufficient);
            TextView textView7 = (TextView) this.N.findViewById(R.id.sc_label_balance);
            if (Var.toDouble(var, 0.0d) >= this.n) {
                this.N.findViewById(R.id.btn_pay).setVisibility(0);
                this.N.findViewById(R.id.btn_topup).setVisibility(8);
                textView6.setVisibility(8);
                linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.bb_background_transparent_white));
                textView7.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                textView4.setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            } else if (this.p) {
                this.N.findViewById(R.id.btn_pay).setVisibility(0);
                this.N.findViewById(R.id.btn_topup).setVisibility(8);
                textView6.setVisibility(8);
                linearLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground));
                ((TextView) this.N.findViewById(R.id.sc_label_balance)).setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
                ((TextView) this.N.findViewById(R.id.sc_balance)).setTextColor(ContextCompat.getColor(this, R.color.colorInvoice));
            } else {
                this.N.findViewById(R.id.btn_pay).setVisibility(8);
                this.N.findViewById(R.id.btn_topup).setVisibility(0);
                textView6.setVisibility(0);
                textView7.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
                textView4.setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
                ((TextView) this.N.findViewById(R.id.tv_balance_insufficient)).setTextColor(ContextCompat.getColor(this, R.color.colorLevelPremium));
                linearLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_rounded10dp_pink));
            }
            textView5.setText(Locales.moneyNoFraction(Var.toString(Double.valueOf(this.n), "")));
        }
    }

    public void onAttachedToWindow() {
        this.U = true;
        super/*android.app.Activity*/.onAttachedToWindow();
    }

    @Override
    public void onBackPressed() {
        if (getIntent().getExtras() != null ? Var.toBoolean(Boolean.valueOf(getIntent().getExtras().getBoolean(AppSession.IS_FROM_NEW_HOME)), false) : false) {
            Affinity.purge(this, OtherHomeMenuActivity.class);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() != 2131362353) {
            if (view.getId() == 2131362395) {
                Affinity.download_struk(this, this.v);
                return;
            } else if (view.getId() == 2131365281) {
                P0();
                return;
            } else {
                super.onClick(view);
                return;
            }
        }
        ListPulsaGameMessage listPulsaGameMessage = new ListPulsaGameMessage(this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID), R0());
        listPulsaGameMessage.setItem("type", "PULSA");
        MessageComposer messageComposer = new MessageComposer(2, listPulsaGameMessage.getPath());
        messageComposer.setShowProgressRegular(this.H);
        messageComposer.setIs_credential(false);
        messageComposer.setMessageProcess(new b());
        MessageSender messageSender = this.J;
        if (messageSender != null) {
            messageSender.cancel();
        }
        MessageSender messageSender2 = new MessageSender(this, messageComposer);
        this.J = messageSender2;
        messageSender2.setRequestMessage(listPulsaGameMessage);
        this.J.execute();
    }

    @Override
    public void onClickData(ProdukListEntity produkListEntity) {
        this.t.setText(produkListEntity.getIdPel1());
    }

    @Override
    public void onClickedData(int i, PulsaEntity pulsaEntity) {
        S0(pulsaEntity);
    }

    @Override
    public void onCopyVoucherCode(int i, String str) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        SelfNumberEntity selfNumberEntity;
        super.onCreate(bundle);
        this.K = findViewById(R.id.loading_pulsa);
        findViewById(R.id.btn_inquiry).setVisibility(8);
        findViewById(R.id.btn_inquiry).setOnClickListener(this);
        findViewById(R.id.pulsa_carousel_more_btn).setOnClickListener(this);
        this.l = findViewById(R.id.nested_scroll_view);
        this.d0 = findViewById(R.id.tab_layout_data);
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_pulsa_list);
        this.W = recyclerView;
        recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(this, 1, false));
        this.W.setNestedScrollingEnabled(false);
        AutoCompleteSerialEditText autoCompleteSerialEditText = (AutoCompleteSerialEditText) findViewById(R.id.pulsa_field_nohp);
        this.t = autoCompleteSerialEditText;
        WidgetHelper.setAutoComplete(autoCompleteSerialEditText, this, this.appSession, "PULSA", 5, new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                PulsaOldActivity.this.g1(i, (Boolean) obj);
            }
        });
        this.C = (ImageView) findViewById(R.id.pulsa_carousel_logo);
        this.D = (TextView) findViewById(R.id.pulsa_carousel_phone);
        this.E = (TextView) findViewById(R.id.pulsa_carousel_nama_produk);
        this.L = findViewById(R.id.voucher_container);
        this.Z = findViewById(R.id.group_pulsa_last_trx_container);
        this.F = (TextView) findViewById(R.id.label_history_trx);
        this.Z.setOnClickListener(this);
        this.b0 = findViewById(R.id.img_provider);
        for (int i : this.Z.getReferencedIds()) {
            if (i != 2131365281) {
                findViewById(i).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        PulsaOldActivity.this.h1(view);
                    }
                });
            }
        }
        View findViewById = findViewById(R.id.pulsa_carousel_more_btn);
        this.M = findViewById;
        findViewById.setOnClickListener(this);
        this.a0 = findViewById(R.id.group_save_id);
        findViewById(R.id.btn_print).setOnClickListener(this);
        attachUIHandler(null);
        if (!ShowcaseHelper.transactionShowCase(this, true)) {
            onShowcaseFinished();
        }
        RecyclerView recyclerView2 = (RecyclerView) findViewById(R.id.pulsa_voucher_promo_rv);
        this.T = new UBPPromoVoucherAdapter(new a());
        recyclerView2.setLayoutManager(new LinearLayoutManager(this, 1, false));
        recyclerView2.setItemAnimator(new DefaultItemAnimator());
        recyclerView2.setAdapter(this.T);
        this.T.setCallback(this);
        this.t.requestFocus();
        String var = Var.toString(new AppSession(this).retrieve(AppSession.PROPERTY_BALANCE), "0");
        if (var == null) {
            this.balance_insufficient_container.setVisibility(8);
        } else if (var.equals("0") || var.isEmpty()) {
            this.balance_insufficient_container.setVisibility(0);
        } else {
            this.balance_insufficient_container.setVisibility(8);
        }
        this.L.setVisibility(8);
        this.F.setText("Nomor Saya");
        this.D.setText(this.appSession.retrieve(AppSession.PROPERTY_HANDPHONE));
        this.E.setVisibility(8);
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            String string = extras.getString("phone:init", "");
            if (string.isEmpty()) {
                Q0();
            } else {
                this.t.setText(string);
                findViewById(R.id.btn_inquiry).performClick();
                this.Z.setVisibility(8);
            }
        } else {
            Q0();
        }
        WidgetHelper.setUBPWebView((WebView) findViewById(R.id.wv_content_pulsa), findViewById(R.id.divider_wv_content), "PULSA", this.appSession, this);
        Bundle extras2 = getIntent().getExtras();
        if (extras2 != null && (selfNumberEntity = (SelfNumberEntity) extras2.getParcelable("self_number_entity")) != null) {
            this.t.setText(selfNumberEntity.getIdPel());
        }
        this.l.setNestedScrollingEnabled(false);
        this.l.scrollTo(0, 0);
        this.l.fullScroll(33);
        if (extras2 != null) {
            String string2 = extras2.getString("tittle");
            if (getToolbar() != null && string2 != null) {
                ActionBar supportActionBar = getSupportActionBar();
                Objects.requireNonNull(supportActionBar);
                supportActionBar.setTitle(string2);
            }
        }
        if (getToolbar() != null) {
            getToolbar().setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    PulsaOldActivity.this.i1(view);
                }
            });
        }
        ArrayList arrayList = new ArrayList(this.configSession.retrieveSet(ConfigSession.PROPERTY_WHITE_LIST_ID));
        this.f0 = new ArrayList<>();
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            Object obj = ((HashMap) arrayList.get(i2)).get(DataMessage.ID_OUTLET);
            Objects.requireNonNull(obj);
            if (!obj.toString().equals("")) {
                ArrayList<String> arrayList2 = this.f0;
                Object obj2 = ((HashMap) arrayList.get(i2)).get(DataMessage.ID_OUTLET);
                Objects.requireNonNull(obj2);
                arrayList2.add(obj2.toString());
            }
        }
        RecyclerView recyclerView3 = (RecyclerView) findViewById(R.id.rv_history);
        this.X = recyclerView3;
        recyclerView3.setFocusable(false);
        HistoryPulsaAdapter historyPulsaAdapter = new HistoryPulsaAdapter(this);
        this.g0 = historyPulsaAdapter;
        historyPulsaAdapter.setCallback(this);
        ArrayList<String> arrayList3 = this.f0;
        if (arrayList3 == null || arrayList3.size() <= 0) {
            return;
        }
        for (int i3 = 0; i3 < this.f0.size(); i3++) {
            if (this.f0.get(i3).equals(this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID))) {
                this.p = true;
            }
        }
    }

    @Override
    public void onCrossSellProduct(ProdukListEntity produkListEntity) {
        HashMap hashMap = Var.toHashMap(produkListEntity.getAria_data());
        PulsaEntity pulsaEntity = new PulsaEntity(produkListEntity.getCode(), produkListEntity.getName(), (int) Var.toDouble(hashMap.get("harga_jual"), 0.0d), String.valueOf(produkListEntity.getPrice()));
        pulsaEntity.setCashback(Var.toString(hashMap.get(MPMessage.IncludeMessage.CASHBACK), ""));
        pulsaEntity.setNominalUp(Var.toString(hashMap.get("nominalUp"), ""));
        pulsaEntity.setResid(Integer.valueOf(getMainProductLogoResId()));
        S0(pulsaEntity);
    }

    public void onDetachedFromWindow() {
        this.U = false;
        super/*android.app.Activity*/.onDetachedFromWindow();
    }

    @Override
    public void onItemClick(DialogPlus dialogPlus, Object obj, View view, int i) {
        if (!(obj instanceof DialogPlusOption)) {
            super.onItemClick(dialogPlus, obj, view, i);
            return;
        }
        DialogPlusOption dialogPlusOption = (DialogPlusOption) obj;
        if (dialogPlusOption.getText().startsWith("Provider")) {
            this.u = Var.toString(dialogPlusOption.getObject(), "");
            super.onItemClick(dialogPlus, obj, view, 0);
            DialogPlus dialogPlus2 = this.A;
            if (dialogPlus2 == null || !dialogPlus2.isShowing()) {
                return;
            }
            this.A.dismiss();
            return;
        }
        if (i != 0) {
            super.onItemClick(dialogPlus, obj, view, i);
            return;
        }
        DialogPlus dialogPlus3 = this.transactionIdPelDialog;
        if (dialogPlus3 != null && dialogPlus3.isShowing()) {
            this.transactionIdPelDialog.dismiss();
        }
        HashMap<String, HashMap<String, HashMap<String, String>>> parseProduk = MessageParser.PulsaGame.parseProduk(this.dataSession.retrieve(DataSession.PROPERTY_LIST_PULSA_NEW));
        final ArrayList arrayList = new ArrayList();
        for (String str : parseProduk.keySet()) {
            HashMap<String, HashMap<String, String>> hashMap = parseProduk.get(str);
            Objects.requireNonNull(hashMap);
            ArrayList arrayList2 = new ArrayList(hashMap.keySet());
            DialogPlusOption dialogPlusOption2 = new DialogPlusOption("Provider " + str, Var.toInt(this.i.get(str), getMainProductLogoResId()));
            dialogPlusOption2.setObject(arrayList2.get(0));
            arrayList.add(dialogPlusOption2);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                PulsaOldActivity.this.j1(arrayList);
            }
        }, 500L);
    }

    @Override
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(BusMessage busMessage) {
        if (busMessage.getEventType() == 1) {
            this.appSession.store(AppSession.PROPERTY_BALANCE, Var.toString(Double.valueOf(busMessage.getBalance()), "0"));
            View view = this.N;
            if (view != null) {
                ((TextView) view.findViewById(R.id.sc_balance)).setText(Locales.moneyNoFraction(this.appSession.retrieve(AppSession.PROPERTY_BALANCE)));
            }
        }
    }

    @Override
    public void onOptionChoosen(OptionListFragment optionListFragment, int i, ProdukListEntity produkListEntity) {
        CharSequence code = produkListEntity.getCode();
        if (i == 39791 || i == 57345) {
            this.t.setText(code);
            if (i == 39791) {
                findViewById(R.id.btn_inquiry).performClick();
            }
        }
    }

    public void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        EventBus.getDefault().unregister(this);
    }

    @Override
    public void onResume() {
        super.onResume();
        View view = this.N;
        if (view != null) {
            ((TextView) view.findViewById(R.id.sc_balance)).setText(Locales.moneyNoFraction(this.appSession.retrieve(AppSession.PROPERTY_BALANCE)));
        }
    }

    @Override
    public void onShowcaseFinished() {
        String N0 = N0();
        if (!N0.isEmpty()) {
            this.t.setText(N0);
            findViewById(R.id.btn_inquiry).performClick();
        }
        this.t.addTextChangedListener(new c());
        this.t.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                boolean k1;
                k1 = PulsaOldActivity.this.k1(textView, i, keyEvent);
                return k1;
            }
        });
    }

    @Override
    public void onStart() {
        super.onStart();
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }
        resetForm(false);
    }

    @Override
    public MPMessage onTransactionDone(boolean z, BaseMessage baseMessage) {
        this.H = true;
        findViewById(R.id.layout_product_not_found).setVisibility(8);
        this.K.setVisibility(8);
        if (z) {
            findViewById(R.id.btn_inquiry).setVisibility(8);
            PulsaPaketanGameMessage pulsaPaketanGameMessage = new PulsaPaketanGameMessage(baseMessage);
            if (pulsaPaketanGameMessage.isOK()) {
                ?? r6 = (InvoiceTextView) findViewById(R.id.pulsa_invoice);
                r6.setVisibility(0);
                r6.setInvoice(pulsaPaketanGameMessage.getStruks());
                this.v = Var.toString(pulsaPaketanGameMessage.getIncludes().get(MPMessage.IncludeMessage.REFF_ID), "");
                pulsaPaketanGameMessage.getStruks();
            }
            this.W.setVisibility(8);
            this.d0.setVisibility(8);
            this.l.setNestedScrollingEnabled(false);
            return pulsaPaketanGameMessage;
        }
        ApiMpMessageWrapper apiMpMessageWrapper = new ApiMpMessageWrapper(baseMessage);
        if (apiMpMessageWrapper.isApiOK()) {
            ArrayList<PulsaEntity> K0 = K0(apiMpMessageWrapper.getData());
            this.c0 = K0;
            this.l.setNestedScrollingEnabled(K0.size() > 0);
            this.W.setAdapter(this.Y);
            this.Y.updateList(this.c0);
            this.W.setVisibility(0);
            this.b0.setVisibility(0);
            this.d0.setVisibility(0);
        } else {
            findViewById(R.id.layout_product_not_found).setVisibility(0);
        }
        return apiMpMessageWrapper;
    }

    @Override
    public void onTransactionPrepare(boolean z) {
        findViewById(R.id.btn_inquiry).setVisibility(8);
        findViewById(R.id.pulsa_invoice).setVisibility(8);
        findViewById(R.id.btn_print).setVisibility(8);
        findViewById(R.id.layout_product_not_found).setVisibility(8);
        this.W.setVisibility(8);
        this.d0.setVisibility(8);
        this.K.setVisibility(0);
    }

    @Override
    public void onUbpHistoryChoosen(UbpHistoryFragment ubpHistoryFragment, int i, ProdukListEntity produkListEntity) {
        String idPel1 = produkListEntity.getIdPel1();
        if (i == 11275) {
            WidgetHelper.setProductIdTag(this.t, idPel1, idPel1);
        }
    }

    @Override
    public void optionChoosen(OptionListFragment1 optionListFragment1, int i, ProdukListEntity produkListEntity) {
        String code = produkListEntity.getCode();
        if (i == 39791 || i == 57345) {
            WidgetHelper.setProductIdTag(this.t, code, code);
            if (i == 39791) {
                findViewById(R.id.btn_inquiry).performClick();
            }
            this.dialog.dismiss();
        }
    }

    @Override
    public void optionChoosen1(OptionListFragment2 optionListFragment2, int i, ProdukListEntity produkListEntity) {
        String code = produkListEntity.getCode();
        if (i == 11275) {
            WidgetHelper.setProductIdTag(this.t, code, code);
            findViewById(R.id.btn_inquiry).performClick();
            this.dialog.dismiss();
        }
    }

    public final void p1(final CharSequence charSequence) {
        this.K.setVisibility(0);
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                PulsaOldActivity.this.n1(charSequence);
            }
        }, 0L);
    }

    public final void q1() {
        this.t.setTextAppearance(R.style.form_bold);
    }

    public final void r1() {
        this.t.setTextAppearance(R.style.input_product_code);
    }

    @Override
    public void resetForm(boolean z) {
        if (z) {
            WidgetHelper.removeProductIdTag(this.t);
        }
        if (this.j.isEmpty()) {
            this.L.setVisibility(8);
        }
        this.a0.setVisibility(8);
        this.W.setVisibility(8);
        this.d0.setVisibility(8);
        this.b0.setVisibility(8);
        this.Z.setVisibility(0);
        this.l.scrollTo(0, 0);
        this.l.fullScroll(33);
        this.l.setNestedScrollingEnabled(false);
    }

    @Override
    public void adapterResult(BaseAdapter baseAdapter, final PulsaEntity pulsaEntity, int i) {
        Affinity.refreshBalance(this, new BBCallback() {
            @Override
            public final void do_callback(int i2, Object obj) {
                PulsaOldActivity.this.T0(pulsaEntity, i2, (Boolean) obj);
            }
        });
    }
}