mac
2024-05-13 f2f8a06618f986ef4657687213334b6696ae6f1c
app/src/main/java/com/hdl/photovoltaic/ui/me/BindPhoneActivity.java
@@ -1,7 +1,6 @@
package com.hdl.photovoltaic.ui.me;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
@@ -16,6 +15,9 @@
import com.hdl.photovoltaic.other.HdlAccountLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.sahooz.library.countrypicker.Country;
import com.sahooz.library.countrypicker.CountryPickerFragment;
import com.sahooz.library.countrypicker.PickCountryCallback;
/**
 * 修改绑定手机号的界面
@@ -43,11 +45,17 @@
    private void initEvent() {
        viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setOnClickListener(new View.OnClickListener() {
        viewBinding.toolbarTopFragmentHouseListRl.topBackLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setResult(20);
                finish();
            }
        });
        viewBinding.bindAreaParentRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectArea();
            }
        });
@@ -75,7 +83,8 @@
                        public void onSuccess(Boolean obj) {
                            UserConfigManage.getInstance().setBingPhone(phoneStr);
                            UserConfigManage.getInstance().Save();
                            HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.set_bind_phone_succeed), 0);
                            setResult(20);
                            finish();
                        }
                        @Override
@@ -92,8 +101,30 @@
    private void initView() {
        viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.set_change_bind_phone_number);
        viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C, null));
        viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE);
        viewBinding.toolbarTopFragmentHouseListRl.topBackLl.setVisibility(View.VISIBLE);
        viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF, null));
        try {
            Country.load(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 国家手机号区号弹窗
     */
    private void selectArea() {
        CountryPickerFragment dialog = new CountryPickerFragment(this, new PickCountryCallback() {
            @Override
            public void onPick(Country country) {
                if (country.flag != 0)
                    viewBinding.bindAreaTv.setText(country.name);
                String code = "+" + country.code;
                viewBinding.bindAreaNumberTv.setText(code);
            }
        });
        dialog.show();
        dialog.setDialogSize();
    }
    /**
@@ -106,7 +137,7 @@
            HdlThreadLogic.tipFlashingBox(this, false, getString(R.string.home_login_phone_null), -1);
            return;
        }
        HdlAccountLogic.getInstance().sendVerifyCode(true, account, "86", 3, new CloudCallBeak<Boolean>() {
        HdlAccountLogic.getInstance().sendVerifyCode(true, account, viewBinding.bindAreaNumberTv.getText().toString(), 3, new CloudCallBeak<Boolean>() {
            @Override
            public void onSuccess(Boolean obj) {
                countDownTimer.start();
@@ -167,10 +198,20 @@
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Country.destroy();
        if (countDownTimer != null) {
            countDownTimer.cancel();
            countDownTimer = null;
        }
    }
    /**
     * 物理按键返回事件
     */
    @Override
    public void onBackPressed() {
        setResult(20);
        super.onBackPressed();
    }
}