新增通过后端获取国家地区信息接口在注册时自动填写号码编号
This commit is contained in:
parent
c43b581157
commit
192587f758
@ -22,15 +22,17 @@ import java.util.ArrayList;
|
|||||||
public class Country implements PyEntity {
|
public class Country implements PyEntity {
|
||||||
private static final String TAG = Country.class.getSimpleName();
|
private static final String TAG = Country.class.getSimpleName();
|
||||||
public int code;
|
public int code;
|
||||||
public String name, locale, pinyin;
|
public String name, locale, pinyin,chs,cht;
|
||||||
public int flag;
|
public int flag;
|
||||||
private static ArrayList<Country> countries = null;
|
private static ArrayList<Country> countries = null;
|
||||||
|
|
||||||
public Country(int code, String name, String locale, int flag) {
|
public Country(int code, String name, String locale, int flag,String chs,String cht) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
|
this.chs=chs;
|
||||||
|
this.cht=cht;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,7 +64,7 @@ public class Country implements PyEntity {
|
|||||||
if(!TextUtils.isEmpty(locale)) {
|
if(!TextUtils.isEmpty(locale)) {
|
||||||
flag = ctx.getResources().getIdentifier("flag_" + locale.toLowerCase(), "drawable", ctx.getPackageName());
|
flag = ctx.getResources().getIdentifier("flag_" + locale.toLowerCase(), "drawable", ctx.getPackageName());
|
||||||
}
|
}
|
||||||
countries.add(new Country(jo.getInt("code"), jo.getString(key), locale, flag));
|
countries.add(new Country(jo.getInt("code"), jo.getString(key), locale, flag,jo.getString("zh"),jo.getString("tw")));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(TAG, countries.toString());
|
Log.i(TAG, countries.toString());
|
||||||
@ -80,7 +82,7 @@ public class Country implements PyEntity {
|
|||||||
if(TextUtils.isEmpty(json)) return null;
|
if(TextUtils.isEmpty(json)) return null;
|
||||||
try {
|
try {
|
||||||
JSONObject jo = new JSONObject(json);
|
JSONObject jo = new JSONObject(json);
|
||||||
return new Country(jo.optInt("code") ,jo.optString("name"), jo.optString("locale"), jo.optInt("flag"));
|
return new Country(jo.optInt("code") ,jo.optString("name"), jo.optString("locale"), jo.optInt("flag"),jo.getString("zh"),jo.getString("tw"));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow {
|
|||||||
.setAnchorCallMe(mLiveUid, callMeModel, new HttpCallback<String>() {
|
.setAnchorCallMe(mLiveUid, callMeModel, new HttpCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String data) {
|
public void onSuccess(String data) {
|
||||||
ToastUtil.show(WordUtil.isZh() ? "成功" : "success");
|
ToastUtil.showDebug(WordUtil.isZh() ? "成功" : "success");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -194,10 +194,9 @@ public class RegisterActivity extends AbsActivity {
|
|||||||
|
|
||||||
//String ct = Locale.getDefault().getCountry();
|
//String ct = Locale.getDefault().getCountry();
|
||||||
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
|
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
|
||||||
ToastUtil.show("地区:"+ct);
|
ct = TextUtils.equals("中国", ct) ? "HK" : ct;
|
||||||
ct = TextUtils.equals("CN", ct) ? "HK" : ct;
|
|
||||||
for (int i = 0; i < allCountries.size(); i++) {
|
for (int i = 0; i < allCountries.size(); i++) {
|
||||||
if (allCountries.get(i).locale.equals(ct)) {
|
if (allCountries.get(i).chs.equals(ct)) {
|
||||||
String countryName = allCountries.get(i).name;
|
String countryName = allCountries.get(i).name;
|
||||||
countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName;
|
countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName;
|
||||||
mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName);
|
mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName);
|
||||||
|
Loading…
Reference in New Issue
Block a user