【绑定账号】和【忘记密码】页面手机号码栏新增国家名字提示

This commit is contained in:
zlzw 2023-07-03 16:43:55 +08:00
parent 44b4b06592
commit b9f1474362
2 changed files with 45 additions and 2 deletions

View File

@ -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<Country> 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");

View File

@ -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<Country> 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");