From b9f14743624dad638f19b1acad15719f30e1acae Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 3 Jul 2023 16:43:55 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BB=91=E5=AE=9A=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E3=80=91=E5=92=8C=E3=80=90=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E3=80=91=E9=A1=B5=E9=9D=A2=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=A0=81?= =?UTF-8?q?=E6=A0=8F=E6=96=B0=E5=A2=9E=E5=9B=BD=E5=AE=B6=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/activity/BindUserActivity.java | 23 +++++++++++++++++- .../yunbao/main/activity/FindPwdActivity.java | 24 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/activity/BindUserActivity.java b/main/src/main/java/com/yunbao/main/activity/BindUserActivity.java index 6e9e513ef..4b6267a74 100644 --- a/main/src/main/java/com/yunbao/main/activity/BindUserActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/BindUserActivity.java @@ -34,6 +34,7 @@ import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.ToastUtil; @@ -47,6 +48,8 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.util.ArrayList; + /** * 綁定手機號 */ @@ -79,6 +82,7 @@ public class BindUserActivity extends AbsActivity { private String isBind = "0", mobile = ""; private WebView webview; private WebSettings webSettings; + private ArrayList allCountries = new ArrayList<>(); @Override protected int getLayoutId() { @@ -201,6 +205,21 @@ public class BindUserActivity extends AbsActivity { webview.addJavascriptInterface(new JsBridge(), "jsBridge"); // 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html")) webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html"); + + allCountries.clear(); + allCountries.addAll(Country.getAll(mContext, null)); + + String ct = IMLoginManager.get(mContext).getString("sys_user_area"); + ct = TextUtils.equals("中国", ct) ? "中国香港" : ct; + for (int i = 0; i < allCountries.size(); i++) { + if (allCountries.get(i).chs.equals(ct)) { + String countryName = allCountries.get(i).name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName; + mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName); + mCountryCode = allCountries.get(i).code; + return; + } + } } private void mTvCountryCodeClick() { @@ -230,7 +249,9 @@ public class BindUserActivity extends AbsActivity { CountryPicker.newInstance(null, new OnPick() { @Override public void onPick(Country country) { - mTvCountryCode.setText("+" + country.code); + String countryName = country.name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName; + mTvCountryCode.setText(" +" + country.code + " " + countryName); mCountryCode = country.code; } }).show(getSupportFragmentManager(), "country"); diff --git a/main/src/main/java/com/yunbao/main/activity/FindPwdActivity.java b/main/src/main/java/com/yunbao/main/activity/FindPwdActivity.java index 83b762f15..9d6938a61 100644 --- a/main/src/main/java/com/yunbao/main/activity/FindPwdActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/FindPwdActivity.java @@ -29,6 +29,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ValidatePhoneUtil; @@ -42,6 +43,8 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.util.ArrayList; + /** * Created by cxf on 2018/9/25. */ @@ -66,6 +69,7 @@ public class FindPwdActivity extends AbsActivity { private TextView mTvCountryCode; private WebView webview; private WebSettings webSettings; + private ArrayList allCountries = new ArrayList<>(); @Override protected int getLayoutId() { @@ -149,6 +153,22 @@ public class FindPwdActivity extends AbsActivity { }; mDialog = DialogUitl.loadingDialog(mContext); EventBus.getDefault().register(this); + + + allCountries.clear(); + allCountries.addAll(Country.getAll(mContext, null)); + + String ct = IMLoginManager.get(mContext).getString("sys_user_area"); + ct = TextUtils.equals("中国", ct) ? "中国香港" : ct; + for (int i = 0; i < allCountries.size(); i++) { + if (allCountries.get(i).chs.equals(ct)) { + String countryName = allCountries.get(i).name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName; + mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName); + mCountryCode = allCountries.get(i).code; + return; + } + } } private void mTvCountryCodeClick() { @@ -208,7 +228,9 @@ public class FindPwdActivity extends AbsActivity { CountryPicker.newInstance(null, new OnPick() { @Override public void onPick(Country country) { - mTvCountryCode.setText("+"+country.code); + String countryName = country.name; + countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName; + mTvCountryCode.setText(" +" + country.code + " " + countryName); mCountryCode=country.code; } }).show(getSupportFragmentManager(), "country");