导航菜单

页面标题

页面副标题

星辰VPN v1.2.3 - MineFragment.java 源代码

正在查看: 星辰VPN v1.2.3 应用的 MineFragment.java JAVA 源代码文件

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


package com.moetor.ui.mine;

import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.view.View;
import androidx.core.os.BundleKt;
import androidx.fragment.app.FragmentActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.google.android.material.textview.MaterialTextView;
import com.gyf.immersionbar.ktx.ImmersionBarKt;
import com.lihang.ShadowLayout;
import com.moetor.R$color;
import com.moetor.R$id;
import com.moetor.R$layout;
import com.moetor.app.ENV;
import com.moetor.app.ExtKt;
import com.moetor.base.BaseFragment;
import com.moetor.base.BaseView;
import com.moetor.helper.ConfigHelper;
import com.moetor.helper.UserHelper;
import com.moetor.mvp.contract.MineContract;
import com.moetor.mvp.presenter.MinePresenter;
import com.moetor.mvp.request.OrderSaveRequest;
import com.moetor.mvp.response.ControlBean;
import com.moetor.mvp.response.InfoBean;
import com.moetor.mvp.response.PlanBean;
import com.moetor.mvp.response.SubBean;
import com.moetor.mvp.response.UserConfigBean;
import com.moetor.net.ApiException;
import com.moetor.ui.shop.OrderDetailActivity;
import com.moetor.ui.shop.PlanConfigActivity;
import com.moetor.utils.DateUtils;
import com.moetor.view.MyTextView;
import com.moetor.view.TipsDialog;
import im.crisp.client.ChatActivity;
import im.crisp.client.Crisp;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.text.StringsKt__StringsKt;

@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0003\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u00032\u00020\u0004B\u0007\b\u0007¢\u0006\u0002\u0010\u0005J\b\u0010\u0017\u001a\u00020\u0002H\u0014J\b\u0010\u0018\u001a\u00020\u0012H\u0016J\b\u0010\u0019\u001a\u00020\nH\u0014J\b\u0010\u001a\u001a\u00020\u0012H\u0014J\u0012\u0010\u001b\u001a\u00020\u00122\b\u0010\u001c\u001a\u0004\u0018\u00010\u001dH\u0016J\u0018\u0010\u001e\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020\"H\u0016J\u0010\u0010#\u001a\u00020\u00122\u0006\u0010$\u001a\u00020\u0007H\u0016J\b\u0010%\u001a\u00020\u0012H\u0016J\u0016\u0010&\u001a\u00020\u00122\f\u0010'\u001a\b\u0012\u0004\u0012\u00020\n0(H\u0016J\u0010\u0010)\u001a\u00020\u00122\u0006\u0010*\u001a\u00020\rH\u0016R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\"\u0010\u0010\u001a\n\u0012\u0004\u0012\u00020\u0012\u0018\u00010\u0011X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016¨\u0006+"}, d2 = {"Lcom/moetor/ui/mine/MineFragment;", "Lcom/moetor/base/BaseFragment;", "Lcom/moetor/mvp/presenter/MinePresenter;", "Lcom/moetor/mvp/contract/MineContract$View;", "Landroid/view/View$OnClickListener;", "()V", "mBalance", "", "mCurrency", "mRemindExpire", "", "mRemindTraffic", "mSubBean", "Lcom/moetor/mvp/response/SubBean;", "mSymbol", "mTgGroup", "toShop", "Lkotlin/Function0;", "", "getToShop", "()Lkotlin/jvm/functions/Function0;", "setToShop", "(Lkotlin/jvm/functions/Function0;)V", "createPresenter", "fetchData", "initLayoutId", "initView", "onClick", "v", "Landroid/view/View;", "onInfo", ENV.MMKV.INFO, "Lcom/moetor/mvp/response/InfoBean;", "config", "Lcom/moetor/mvp/response/UserConfigBean;", "onOrderSave", "tradeNo", "onResume", "onStat", "list", "", "onSub", "bean", "app_maomaoRelease"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class MineFragment extends BaseFragment<MinePresenter> implements MineContract.View, View.OnClickListener {
    private int mRemindExpire;
    private int mRemindTraffic;
    private SubBean mSubBean;
    private Function0<Unit> toShop;
    public Map<Integer, View> _$_findViewCache = new LinkedHashMap();
    private String mBalance = "0.00";
    private String mCurrency = "CNY";
    private String mSymbol = "¥";
    private String mTgGroup = "";

    @Override
    public void _$_clearFindViewByIdCache() {
        this._$_findViewCache.clear();
    }

    @Override
    public View _$_findCachedViewById(int i) {
        View findViewById;
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null || (findViewById = view2.findViewById(i)) == null) {
            return null;
        }
        map.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override
    public void fetchData() {
        MinePresenter mPresenter = getMPresenter();
        if (mPresenter != null) {
            mPresenter.userConfig();
        }
    }

    public final Function0<Unit> getToShop() {
        return this.toShop;
    }

    @Override
    public int initLayoutId() {
        return R$layout.fragment_mine;
    }

    @Override
    public void initView() {
        Boolean trafficLogShow;
        View status_bar_view = _$_findCachedViewById(R$id.status_bar_view);
        kotlin.jvm.internal.b.h(status_bar_view, "status_bar_view");
        boolean z = true;
        ExtKt.setParams$default(status_bar_view, null, Integer.valueOf(ImmersionBarKt.getStatusBarHeight(this)), 1, null);
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_plan_none)).setOnClickListener(this);
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_renew)).setOnClickListener(this);
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_reset_traffic)).setOnClickListener(this);
        _$_findCachedViewById(R$id.ll_order).setOnClickListener(this);
        _$_findCachedViewById(R$id.ll_purse).setOnClickListener(this);
        _$_findCachedViewById(R$id.ll_invite).setOnClickListener(this);
        int i = R$id.ll_kefu;
        _$_findCachedViewById(i).setOnClickListener(this);
        _$_findCachedViewById(R$id.ll_ticket).setOnClickListener(this);
        int i2 = R$id.ll_flow;
        _$_findCachedViewById(i2).setOnClickListener(this);
        _$_findCachedViewById(R$id.ll_setting).setOnClickListener(this);
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_logout)).setOnClickListener(this);
        int i5 = R$id.refresh_layout;
        SwipeRefreshLayout refresh_layout = (SwipeRefreshLayout) _$_findCachedViewById(i5);
        kotlin.jvm.internal.b.h(refresh_layout, "refresh_layout");
        initRefreshLayout(refresh_layout);
        _$_findCachedViewById(i5).setRefreshing(true);
        ConfigHelper.Companion companion = ConfigHelper.INSTANCE;
        ControlBean controlData = companion.getInstance().getControlData();
        String crispId = controlData != null ? controlData.getCrispId() : null;
        _$_findCachedViewById(i).setVisibility(!(crispId == null || crispId.length() == 0) ? 0 : 8);
        ControlBean controlData2 = companion.getInstance().getControlData();
        if (controlData2 != null && (trafficLogShow = controlData2.getTrafficLogShow()) != null) {
            z = trafficLogShow.booleanValue();
        }
        _$_findCachedViewById(i2).setVisibility(z ? 0 : 8);
        SubBean sub = UserHelper.INSTANCE.getInstance().getSub();
        if (sub != null) {
            onSub(sub);
        }
    }

    @Override
    public void onClick(View v) {
        if (kotlin.jvm.internal.b.d(v, (ShadowLayout) _$_findCachedViewById(R$id.sl_plan_none))) {
            Function0<Unit> function0 = this.toShop;
            if (function0 != null) {
                function0.invoke();
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, (ShadowLayout) _$_findCachedViewById(R$id.sl_renew))) {
            FragmentActivity mActivity = getMActivity();
            if (mActivity != null) {
                Pair[] pairArr = new Pair[1];
                SubBean subBean = this.mSubBean;
                pairArr[0] = TuplesKt.to("id", subBean != null ? subBean.getPlan_id() : null);
                Pair[] pairArr2 = (Pair[]) Arrays.copyOf(pairArr, 1);
                Intent putExtras = new Intent((Context) mActivity, (Class<?>) PlanConfigActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr2, pairArr2.length)));
                kotlin.jvm.internal.b.h(putExtras, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity.startActivity(putExtras);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, (ShadowLayout) _$_findCachedViewById(R$id.sl_reset_traffic))) {
            FragmentActivity mActivity2 = getMActivity();
            kotlin.jvm.internal.b.f(mActivity2);
            new TipsDialog(mActivity2).show(new Function1<TipsDialog, Unit>() {
                {
                    super(1);
                }

                @Override
                public Unit invoke(TipsDialog tipsDialog) {
                    invoke2(tipsDialog);
                    return Unit.INSTANCE;
                }

                public final void invoke2(TipsDialog show) {
                    kotlin.jvm.internal.b.i(show, "$this$show");
                    show.title("确认重置当前已用流量?");
                    show.content("点击「确认」将会跳转到收银台,支付订单后系统将会清空您当月已使用流量。");
                    final MineFragment mineFragment = MineFragment.this;
                    TipsDialog.positive$default(show, "确认", false, new Function1<TipsDialog, Unit>() {
                        {
                            super(1);
                        }

                        @Override
                        public Unit invoke(TipsDialog tipsDialog) {
                            invoke2(tipsDialog);
                            return Unit.INSTANCE;
                        }

                        public final void invoke2(TipsDialog it) {
                            MinePresenter mPresenter;
                            SubBean subBean2;
                            kotlin.jvm.internal.b.i(it, "it");
                            mPresenter = MineFragment.this.getMPresenter();
                            if (mPresenter != null) {
                                OrderSaveRequest orderSaveRequest = new OrderSaveRequest();
                                MineFragment mineFragment2 = MineFragment.this;
                                orderSaveRequest.setPeriod(ENV.DICT.RESET_PRICE_KEY);
                                subBean2 = mineFragment2.mSubBean;
                                orderSaveRequest.setPlan_id(subBean2 != null ? subBean2.getPlan_id() : null);
                                mPresenter.orderSave(orderSaveRequest);
                            }
                        }
                    }, 2, null);
                }
            });
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_order))) {
            FragmentActivity mActivity3 = getMActivity();
            if (mActivity3 != null) {
                Pair[] pairArr3 = (Pair[]) Arrays.copyOf(new Pair[0], 0);
                Intent putExtras2 = new Intent((Context) mActivity3, (Class<?>) OrderListActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr3, pairArr3.length)));
                kotlin.jvm.internal.b.h(putExtras2, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity3.startActivity(putExtras2);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_purse))) {
            FragmentActivity mActivity4 = getMActivity();
            if (mActivity4 != null) {
                Pair[] pairArr4 = (Pair[]) Arrays.copyOf(new Pair[]{TuplesKt.to("balance", this.mBalance), TuplesKt.to("balance_unit", this.mCurrency)}, 2);
                Intent putExtras3 = new Intent((Context) mActivity4, (Class<?>) WalletActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr4, pairArr4.length)));
                kotlin.jvm.internal.b.h(putExtras3, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity4.startActivity(putExtras3);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_invite))) {
            FragmentActivity mActivity5 = getMActivity();
            if (mActivity5 != null) {
                Pair[] pairArr5 = (Pair[]) Arrays.copyOf(new Pair[]{TuplesKt.to("balance_unit", this.mCurrency)}, 1);
                Intent putExtras4 = new Intent((Context) mActivity5, (Class<?>) InviteActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr5, pairArr5.length)));
                kotlin.jvm.internal.b.h(putExtras4, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity5.startActivity(putExtras4);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_kefu))) {
            FragmentActivity mActivity6 = getMActivity();
            if (mActivity6 != null) {
                Pair[] pairArr6 = (Pair[]) Arrays.copyOf(new Pair[0], 0);
                Intent putExtras5 = new Intent((Context) mActivity6, (Class<?>) ChatActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr6, pairArr6.length)));
                kotlin.jvm.internal.b.h(putExtras5, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity6.startActivity(putExtras5);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_ticket))) {
            FragmentActivity mActivity7 = getMActivity();
            if (mActivity7 != null) {
                Pair[] pairArr7 = (Pair[]) Arrays.copyOf(new Pair[0], 0);
                Intent putExtras6 = new Intent((Context) mActivity7, (Class<?>) TicketActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr7, pairArr7.length)));
                kotlin.jvm.internal.b.h(putExtras6, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity7.startActivity(putExtras6);
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_flow))) {
            FragmentActivity mActivity8 = getMActivity();
            if (mActivity8 != null) {
                Pair[] pairArr8 = (Pair[]) Arrays.copyOf(new Pair[0], 0);
                Intent putExtras7 = new Intent((Context) mActivity8, (Class<?>) TrafficLogActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr8, pairArr8.length)));
                kotlin.jvm.internal.b.h(putExtras7, "Intent(this, T::class.java).putExtras(bundle)");
                mActivity8.startActivity(putExtras7);
                return;
            }
            return;
        }
        if (!kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_setting))) {
            if (kotlin.jvm.internal.b.d(v, (ShadowLayout) _$_findCachedViewById(R$id.sl_logout))) {
                FragmentActivity mActivity9 = getMActivity();
                kotlin.jvm.internal.b.f(mActivity9);
                new TipsDialog(mActivity9).show(new Function1<TipsDialog, Unit>() {
                    @Override
                    public Unit invoke(TipsDialog tipsDialog) {
                        invoke2(tipsDialog);
                        return Unit.INSTANCE;
                    }

                    public final void invoke2(final TipsDialog show) {
                        kotlin.jvm.internal.b.i(show, "$this$show");
                        show.title("温馨提示");
                        show.content("是否确认退出登录?");
                        TipsDialog.positive$default(show, null, false, new Function1<TipsDialog, Unit>() {
                            {
                                super(1);
                            }

                            @Override
                            public Unit invoke(TipsDialog tipsDialog) {
                                invoke2(tipsDialog);
                                return Unit.INSTANCE;
                            }

                            public final void invoke2(TipsDialog it) {
                                kotlin.jvm.internal.b.i(it, "it");
                                BaseView.DefaultImpls.toLogin$default(TipsDialog.this, null, 1, null);
                            }
                        }, 3, null);
                    }
                });
                return;
            }
            return;
        }
        FragmentActivity mActivity10 = getMActivity();
        if (mActivity10 != null) {
            Pair[] pairArr9 = (Pair[]) Arrays.copyOf(new Pair[]{TuplesKt.to("remind_expire", Integer.valueOf(this.mRemindExpire)), TuplesKt.to("remind_traffic", Integer.valueOf(this.mRemindTraffic)), TuplesKt.to("tg_group", this.mTgGroup)}, 3);
            Intent putExtras8 = new Intent((Context) mActivity10, (Class<?>) SettingActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr9, pairArr9.length)));
            kotlin.jvm.internal.b.h(putExtras8, "Intent(this, T::class.java).putExtras(bundle)");
            mActivity10.startActivity(putExtras8);
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        _$_clearFindViewByIdCache();
    }

    @Override
    public void onInfo(InfoBean info, UserConfigBean config) {
        kotlin.jvm.internal.b.i(info, "info");
        kotlin.jvm.internal.b.i(config, "config");
        String priceShow = ExtKt.toPriceShow(Integer.valueOf(info.getBalance()));
        String priceShow2 = ExtKt.toPriceShow(Integer.valueOf(info.getCommission_balance()));
        this.mBalance = priceShow;
        String currency = config.getCurrency();
        if (currency == null) {
            currency = "CNY";
        }
        this.mCurrency = currency;
        String currency_symbol = config.getCurrency_symbol();
        if (currency_symbol == null) {
            currency_symbol = "¥";
        }
        this.mSymbol = currency_symbol;
        Integer remind_expire = info.getRemind_expire();
        this.mRemindExpire = remind_expire != null ? remind_expire.intValue() : 0;
        Integer remind_traffic = info.getRemind_traffic();
        this.mRemindTraffic = remind_traffic != null ? remind_traffic.intValue() : 0;
        String telegram_discuss_link = config.getTelegram_discuss_link();
        if (telegram_discuss_link == null) {
            telegram_discuss_link = "";
        }
        this.mTgGroup = telegram_discuss_link;
        MaterialTextView materialTextView = (MyTextView) _$_findCachedViewById(R$id.tv_purse);
        StringBuilder n = android.support.v4.media.b.n("余额 ");
        n.append(this.mSymbol);
        n.append(' ');
        n.append(priceShow);
        materialTextView.setText(n.toString());
        MaterialTextView materialTextView2 = (MyTextView) _$_findCachedViewById(R$id.tv_invite);
        StringBuilder n2 = android.support.v4.media.b.n("佣金 ");
        n2.append(this.mSymbol);
        n2.append(' ');
        n2.append(priceShow2);
        materialTextView2.setText(n2.toString());
        ControlBean controlData = ConfigHelper.INSTANCE.getInstance().getControlData();
        String crispId = controlData != null ? controlData.getCrispId() : null;
        if (crispId == null || crispId.length() == 0) {
            return;
        }
        Crisp.setSessionString("Balance", ExtKt.toPriceShow(Integer.valueOf(info.getBalance())));
    }

    @Override
    public void onOrderSave(String tradeNo) {
        kotlin.jvm.internal.b.i(tradeNo, "tradeNo");
        FragmentActivity mActivity = getMActivity();
        if (mActivity != null) {
            Pair[] pairArr = (Pair[]) Arrays.copyOf(new Pair[]{TuplesKt.to("trade_no", tradeNo)}, 1);
            Intent putExtras = new Intent((Context) mActivity, (Class<?>) OrderDetailActivity.class).putExtras(BundleKt.bundleOf((Pair[]) Arrays.copyOf(pairArr, pairArr.length)));
            kotlin.jvm.internal.b.h(putExtras, "Intent(this, T::class.java).putExtras(bundle)");
            mActivity.startActivity(putExtras);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        MinePresenter mPresenter = getMPresenter();
        if (mPresenter != null) {
            mPresenter.stat();
        }
        MinePresenter mPresenter2 = getMPresenter();
        if (mPresenter2 != null) {
            mPresenter2.userConfig();
        }
        MinePresenter mPresenter3 = getMPresenter();
        if (mPresenter3 != null) {
            mPresenter3.getSub();
        }
    }

    @Override
    public void onStat(List<Integer> list) {
        kotlin.jvm.internal.b.i(list, "list");
        int i = R$id.view_order_badge;
        _$_findCachedViewById(i).setVisibility(8);
        int i2 = R$id.view_ticket_badge;
        _$_findCachedViewById(i2).setVisibility(8);
        if (list.size() == 3) {
            if (list.get(0).intValue() > 0) {
                _$_findCachedViewById(i).setVisibility(0);
            }
            if (list.get(1).intValue() > 0) {
                _$_findCachedViewById(i2).setVisibility(0);
            }
        }
    }

    @Override
    public void onSub(SubBean bean) {
        CharSequence charSequence;
        String str;
        long j;
        long j2;
        long j5;
        String sb;
        long j6;
        Integer renew;
        boolean z;
        String substringBefore$default;
        int i;
        long j7;
        kotlin.jvm.internal.b.i(bean, "bean");
        this.mSubBean = bean;
        ((MyTextView) _$_findCachedViewById(R$id.tv_email)).setText(bean.getEmail());
        if (bean.getPlan_id() == null) {
            ((ShadowLayout) _$_findCachedViewById(R$id.sl_plan)).setVisibility(8);
            ((ShadowLayout) _$_findCachedViewById(R$id.sl_plan_none)).setVisibility(0);
            return;
        }
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_plan)).setVisibility(0);
        ((ShadowLayout) _$_findCachedViewById(R$id.sl_plan_none)).setVisibility(8);
        int i2 = R$id.sl_renew;
        ((ShadowLayout) _$_findCachedViewById(i2)).setVisibility(8);
        int i5 = R$id.sl_reset_traffic;
        ((ShadowLayout) _$_findCachedViewById(i5)).setVisibility(8);
        MaterialTextView materialTextView = (MyTextView) _$_findCachedViewById(R$id.tv_plan_name);
        PlanBean plan = bean.getPlan();
        if (plan == null || (charSequence = plan.getName()) == null) {
            charSequence = "";
        }
        materialTextView.setText(charSequence);
        Long transfer_enable = bean.getTransfer_enable();
        long longValue = transfer_enable != null ? transfer_enable.longValue() : 0L;
        Long d = bean.getD();
        long longValue2 = d != null ? d.longValue() : 0L;
        Long u = bean.getU();
        long longValue3 = longValue2 + (u != null ? u.longValue() : 0L);
        int i6 = (int) ((100 * longValue3) / longValue);
        if (bean.getExpired_at() == null) {
            ((MyTextView) _$_findCachedViewById(R$id.tv_plan_expire)).setText("该订阅长期有效");
            j6 = longValue;
            str = "";
            j = longValue3;
        } else {
            DateUtils dateUtils = DateUtils.INSTANCE;
            long longValue4 = bean.getExpired_at().longValue();
            str = "";
            j = longValue3;
            long j8 = ApiException.Error.UNKNOWN;
            String format = dateUtils.format(longValue4 * j8, DateUtils.FORMAT_TYPE_12);
            long longValue5 = (bean.getExpired_at().longValue() * j8) - dateUtils.currentTimeMillis();
            Long reset_day = bean.getReset_day();
            if (reset_day != null) {
                j5 = reset_day.longValue();
                j2 = 0;
            } else {
                j2 = 0;
                j5 = 0;
            }
            if (j5 <= j2) {
                sb = "已在今日";
            } else {
                StringBuilder n = android.support.v4.media.b.n("将在 ");
                n.append(bean.getReset_day());
                n.append(" 日后");
                sb = n.toString();
            }
            String o = bean.getReset_day() != null ? android.support.v4.media.a.o("已用流量", sb, "重置") : str;
            j6 = longValue;
            int i7 = ((int) (longValue5 / DateUtils.DAY_OF_MILLISECOND)) + 1;
            if (longValue5 > 0) {
                int i8 = R$id.tv_plan_expire;
                ((MyTextView) _$_findCachedViewById(i8)).setText("于 " + format + " 到期,距离到期还有 " + i7 + " 天。" + o);
                ((MyTextView) _$_findCachedViewById(i8)).setTextColor(ExtKt.getAsColor(R$color.black_6));
                ((MyTextView) _$_findCachedViewById(i8)).setTypeface(Typeface.DEFAULT);
                if (i6 >= 80) {
                    PlanBean plan2 = bean.getPlan();
                    if ((plan2 != null ? plan2.getReset_price() : null) != null) {
                        ((ShadowLayout) _$_findCachedViewById(i5)).setVisibility(0);
                    }
                }
            } else {
                int i9 = R$id.tv_plan_expire;
                ((MyTextView) _$_findCachedViewById(i9)).setText("已过期");
                ((MyTextView) _$_findCachedViewById(i9)).setTextColor(-65536);
                ((MyTextView) _$_findCachedViewById(i9)).setTypeface(Typeface.DEFAULT_BOLD);
                PlanBean plan3 = bean.getPlan();
                if ((plan3 == null || (renew = plan3.getRenew()) == null || renew.intValue() != 1) ? false : true) {
                    ((ShadowLayout) _$_findCachedViewById(i2)).setVisibility(0);
                }
            }
        }
        StringBuilder n2 = android.support.v4.media.b.n("总计 ");
        double d2 = j6;
        n2.append(ExtKt.flowAutoShow(d2));
        String sb2 = n2.toString();
        ConfigHelper.Companion companion = ConfigHelper.INSTANCE;
        ControlBean controlData = companion.getInstance().getControlData();
        ControlBean.TrafficUnlimited trafficUnlimited = controlData != null ? controlData.getTrafficUnlimited() : null;
        PlanBean plan4 = bean.getPlan();
        if (kotlin.jvm.internal.b.d(plan4 != null ? plan4.getTransfer_enable() : null, trafficUnlimited != null ? trafficUnlimited.getValue() : null)) {
            sb2 = "∞";
        }
        MaterialTextView materialTextView2 = (MyTextView) _$_findCachedViewById(R$id.tv_flow);
        StringBuilder n3 = android.support.v4.media.b.n("已用 ");
        double d5 = j;
        n3.append(ExtKt.flowAutoShow(d5));
        n3.append(" / ");
        n3.append(sb2);
        materialTextView2.setText(n3.toString());
        if (i6 < 80) {
            z = false;
            _$_findCachedViewById(R$id.progress).setIndicatorColor(new int[]{ExtKt.getAsColor(R$color.greed_82b)});
        } else {
            z = false;
            if (i6 < 100) {
                _$_findCachedViewById(R$id.progress).setIndicatorColor(new int[]{ExtKt.getAsColor(R$color.yellow_fb1)});
            } else {
                _$_findCachedViewById(R$id.progress).setIndicatorColor(new int[]{ExtKt.getAsColor(R$color.red_e04)});
            }
        }
        _$_findCachedViewById(R$id.progress).setProgressCompat(i6, true);
        ControlBean controlData2 = companion.getInstance().getControlData();
        String crispId = controlData2 != null ? controlData2.getCrispId() : null;
        if (crispId == null || crispId.length() == 0) {
            z = true;
        }
        if (z) {
            return;
        }
        String email = bean.getEmail();
        if (email == null) {
            email = str;
        }
        Crisp.setTokenID(email);
        String email2 = bean.getEmail();
        if (email2 == null) {
            email2 = str;
        }
        Crisp.setUserEmail(email2);
        String email3 = bean.getEmail();
        if (email3 == null) {
            email3 = str;
        }
        substringBefore$default = StringsKt__StringsKt.substringBefore$default(email3, "@", (String) null, 2, (Object) null);
        Crisp.setUserNickname(substringBefore$default);
        String email4 = bean.getEmail();
        Crisp.setUserAvatar(ExtKt.avatarUrl(email4 == null ? str : email4));
        PlanBean plan5 = bean.getPlan();
        Crisp.setSessionString("Plan", String.valueOf(plan5 != null ? plan5.getName() : null));
        Long expired_at = bean.getExpired_at();
        if (expired_at != null) {
            j7 = expired_at.longValue();
            i = ApiException.Error.UNKNOWN;
        } else {
            i = ApiException.Error.UNKNOWN;
            j7 = 0;
        }
        Crisp.setSessionString("ExpireTime", ExtKt.dateFormat$default(Long.valueOf(j7 * i), null, 1, null));
        Crisp.setSessionString("UsedTraffic", ExtKt.flowAutoShow(d5));
        Crisp.setSessionString("AllTraffic", ExtKt.flowAutoShow(d2));
    }

    public final void setToShop(Function0<Unit> function0) {
        this.toShop = function0;
    }

    @Override
    public MinePresenter createPresenter() {
        return new MinePresenter(this);
    }
}