package com.tencent.mm.plugin.honey_pay.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.m;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.wallet_core.c.ae;
import com.tencent.mm.wallet_core.ui.e;
import com.tencent.mm.wallet_core.ui.formview.WalletFormView;
import java.math.RoundingMode;

public class HoneyPayModifyQuotaUI extends HoneyPayBaseUI {
    private long nrO;
    private long nrP;
    private String nra;
    private WalletFormView nsI;
    private Button nsJ;
    private TextView nsn;

    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        AppMethodBeat.at(this, z);
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(41916);
        super.onCreate(bundle);
        this.nrO = getIntent().getLongExtra("key_max_credit_line", 0);
        this.nrP = getIntent().getLongExtra("key_min_credit_line", 0);
        this.nra = getIntent().getStringExtra("key_card_no");
        initView();
        setMMTitle(2131300573);
        AppMethodBeat.o(41916);
    }

    public final void initView() {
        AppMethodBeat.i(41917);
        this.nsI = (WalletFormView) findViewById(2131824927);
        this.nsJ = (Button) findViewById(2131824928);
        this.nsn = (TextView) findViewById(2131824929);
        this.nsI.dOP();
        this.nsI.getTitleTv().setText(ae.dOd());
        e(this.nsI, 2, false);
        this.nsI.a(new 1(this));
        this.nsJ.setOnClickListener(new 2(this));
        this.nsI.postDelayed(new 3(this), 100);
        AppMethodBeat.o(41917);
    }

    public void onDestroy() {
        AppMethodBeat.i(41918);
        super.onDestroy();
        AppMethodBeat.o(41918);
    }

    public final boolean c(int i, int i2, String str, m mVar) {
        return false;
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        AppMethodBeat.i(41919);
        if (i == 1 && i2 == -1 && intent.getBooleanExtra("key_modify_create_line_succ", false)) {
            setResult(-1, intent);
            finish();
        }
        super.onActivityResult(i, i2, intent);
        AppMethodBeat.o(41919);
    }

    public final int getLayoutId() {
        return 2130969833;
    }

    private void hZ(boolean z) {
        AppMethodBeat.i(41920);
        if (!z || this.nsn.isShown()) {
            if (!z && this.nsn.isShown()) {
                this.nsn.startAnimation(AnimationUtils.loadAnimation(this, 2131034213));
                this.nsn.setVisibility(8);
            }
            AppMethodBeat.o(41920);
            return;
        }
        String str = ae.dOd() + e.a(this.nrP, "100", 2, RoundingMode.HALF_UP).toString();
        this.nsn.setText(getString(2131300572, new Object[]{str}));
        this.nsn.startAnimation(AnimationUtils.loadAnimation(this, 2131034193));
        this.nsn.setVisibility(0);
        AppMethodBeat.o(41920);
    }

    private void ia(boolean z) {
        AppMethodBeat.i(41921);
        if (!z || this.nsn.isShown()) {
            if (!z && this.nsn.isShown()) {
                this.nsn.startAnimation(AnimationUtils.loadAnimation(this, 2131034213));
                this.nsn.setVisibility(8);
            }
            AppMethodBeat.o(41921);
            return;
        }
        String str = ae.dOd() + e.a(this.nrO, "100", 2, RoundingMode.HALF_UP);
        this.nsn.setText(getString(2131300568, new Object[]{str}));
        this.nsn.startAnimation(AnimationUtils.loadAnimation(this, 2131034193));
        this.nsn.setVisibility(0);
        AppMethodBeat.o(41921);
    }

    private void ib(boolean z) {
        AppMethodBeat.i(41922);
        this.nsJ.setEnabled(z);
        AppMethodBeat.o(41922);
    }

    static /* synthetic */ boolean a(HoneyPayModifyQuotaUI honeyPayModifyQuotaUI) {
        AppMethodBeat.i(41923);
        if (bo.isNullOrNil(honeyPayModifyQuotaUI.nsI.getText())) {
            honeyPayModifyQuotaUI.ia(false);
            honeyPayModifyQuotaUI.hZ(false);
            honeyPayModifyQuotaUI.ib(false);
            AppMethodBeat.o(41923);
            return false;
        }
        int iy = e.iy(honeyPayModifyQuotaUI.nsI.getText(), "100");
        ab.d(honeyPayModifyQuotaUI.TAG, "current fen: %s", new Object[]{Integer.valueOf(iy)});
        if (((long) iy) < honeyPayModifyQuotaUI.nrP) {
            honeyPayModifyQuotaUI.hZ(true);
            honeyPayModifyQuotaUI.ib(false);
            AppMethodBeat.o(41923);
            return false;
        } else if (((long) iy) > honeyPayModifyQuotaUI.nrO) {
            honeyPayModifyQuotaUI.ia(true);
            honeyPayModifyQuotaUI.ib(false);
            AppMethodBeat.o(41923);
            return false;
        } else if (iy == 0) {
            honeyPayModifyQuotaUI.ib(false);
            AppMethodBeat.o(41923);
            return false;
        } else {
            honeyPayModifyQuotaUI.ia(false);
            honeyPayModifyQuotaUI.hZ(false);
            honeyPayModifyQuotaUI.ib(true);
            AppMethodBeat.o(41923);
            return true;
        }
    }

    static /* synthetic */ void b(HoneyPayModifyQuotaUI honeyPayModifyQuotaUI) {
        AppMethodBeat.i(41924);
        ab.i(honeyPayModifyQuotaUI.TAG, "go to check pwd ui");
        long iz = e.iz(honeyPayModifyQuotaUI.nsI.getText(), "100");
        Intent intent = new Intent(honeyPayModifyQuotaUI, HoneyPayCheckPwdUI.class);
        intent.putExtra("key_scene", 2);
        intent.putExtra("key_credit_line", iz);
        intent.putExtra("key_card_no", honeyPayModifyQuotaUI.nra);
        honeyPayModifyQuotaUI.startActivityForResult(intent, 1);
        AppMethodBeat.o(41924);
    }
}
