From f50e8e60e9da99e4f69d8ab76810dc7e5fb448bc Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 02 十二月 2024 10:29:09 +0800 Subject: [PATCH] 2024年12月02日10:29:05 --- app/src/main/java/com/hdl/photovoltaic/ui/me/BindPhoneActivity.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/BindPhoneActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/BindPhoneActivity.java index 2e3db38..c972828 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/me/BindPhoneActivity.java +++ b/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.toolbarTopRl.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 @@ -90,10 +99,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.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF, null)); + viewBinding.toolbarTopRl.topTitleTv.setText(R.string.set_change_bind_phone_number); + viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE); + 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 +135,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(); @@ -130,7 +159,6 @@ long time = (millisUntilFinished / 1000); String str = time + "s" + getString(R.string.home_login_psw_verification_repeater); viewBinding.bindPhoneVerificationTv.setText(str); - viewBinding.bindPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_25000000, null)); viewBinding.bindPhoneVerificationTv.setEnabled(false); } @@ -138,7 +166,6 @@ @Override public void onFinish() { viewBinding.bindPhoneVerificationTv.setText(getString(R.string.home_login_verification_regain)); - viewBinding.bindPhoneVerificationTv.setTextColor(getResources().getColor(R.color.text_245EC3, null)); viewBinding.bindPhoneVerificationTv.setEnabled(true); @@ -159,7 +186,6 @@ HdlThreadLogic.tipFlashingBox(this, false, getString(R.string.home_login_null_verification_code), -1); return false; } - return true; } @@ -167,10 +193,20 @@ @Override protected void onDestroy() { super.onDestroy(); + Country.destroy(); if (countDownTimer != null) { countDownTimer.cancel(); countDownTimer = null; } } + + /** + * 鐗╃悊鎸夐敭杩斿洖浜嬩欢 + */ + @Override + public void onBackPressed() { + setResult(20); + super.onBackPressed(); + } } \ No newline at end of file -- Gitblit v1.8.0