| | |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityChangePasswordBinding; |
| | | import com.hdl.photovoltaic.enums.Languages; |
| | | import com.hdl.photovoltaic.enums.VerifyType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | |
| | | * 初始化界面 |
| | | */ |
| | | private void initView() { |
| | | if (UserConfigManage.getInstance().isZh()) { |
| | | if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(Languages.zh)) { |
| | | viewBinding.regionAccountTv.setText(getText(R.string.home_chinese_mainland)); |
| | | viewBinding.regionAccountNumberTv.setText("+86"); |
| | | } else { |
| | |
| | | viewBinding.regionAccountNumberTv.setText("+964"); |
| | | } |
| | | switchPhoneOrMailView(); |
| | | try { |
| | | Country.load(this); |
| | | Country country = null; |
| | | if (TextUtils.isEmpty(GPSManagerUtils.getInstance().getCountryCode(this))) { |
| | | //再根据系统语言 |
| | | country = Country.getCountryInfo(); |
| | | } else { |
| | | //先根据定位 |
| | | country = Country.getLocationCountryInfo(GPSManagerUtils.getInstance().getCountryCode(this)); |
| | | } |
| | | if (country != null) { |
| | | viewBinding.regionAccountTv.setText(country.translate); |
| | | viewBinding.regionAccountNumberTv.setText("+" + country.code); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // try { |
| | | // Country.load(this); |
| | | // Country country = null; |
| | | // if (TextUtils.isEmpty(GPSManagerUtils.getInstance().getCountryCode(this))) { |
| | | // //再根据系统语言 |
| | | // country = Country.getCountryInfo(); |
| | | // } else { |
| | | // //先根据定位 |
| | | // country = Country.getLocationCountryInfo(GPSManagerUtils.getInstance().getCountryCode(this)); |
| | | // } |
| | | // if (country != null) { |
| | | // viewBinding.regionAccountTv.setText(country.translate); |
| | | // viewBinding.regionAccountNumberTv.setText("+" + country.code); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | new Thread( |
| | | new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | final Country[] country = new Country[1]; |
| | | Country.load(_mActivity); |
| | | if (TextUtils.isEmpty(GPSManagerUtils.getInstance().getCountryCode(_mActivity))) { |
| | | //再根据系统语言 |
| | | country[0] = Country.getCountryInfo(); |
| | | } else { |
| | | //先根据定位 |
| | | country[0] = Country.getLocationCountryInfo(GPSManagerUtils.getInstance().getCountryCode(_mActivity)); |
| | | } |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (country != null) { |
| | | viewBinding.regionAccountTv.setText(country[0].translate); |
| | | viewBinding.regionAccountNumberTv.setText("+" + country[0].code); |
| | | } |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | ).start(); |
| | | HdlCommonLogic.getInstance().setSpan(viewBinding.changePhoneVerificationTv, viewBinding.changePhoneVerificationTv.getText().toString(), true, null); |
| | | HdlCommonLogic.getInstance().setSpan(viewBinding.changeMailVerificationTv, viewBinding.changeMailVerificationTv.getText().toString(), true, null); |
| | | if (UserConfigManage.getInstance().isArabicLanguage()) { |
| | | viewBinding.changeBackTv.setRotation(180); // 旋转180度 |
| | | } |
| | | } |
| | | |
| | | |