package com.lljjcoder.citywheel;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.lljjcoder.Constant;
import com.lljjcoder.bean.CityBean;
import com.lljjcoder.bean.DistrictBean;
import com.lljjcoder.bean.ProvinceBean;
import com.lljjcoder.utils.utils;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*/
public class CityParseHelper {
/**
* 省份数据
*/
private ArrayList<ProvinceBean> mProvinceBeanArrayList = new ArrayList<>();
mProvinceBeanArrayList = new Gson().fromJson(cityJson, type);
if (mProvinceBeanArrayList == null || mProvinceBeanArrayList.isEmpty()) {
return;
}
mCityBeanArrayList = new ArrayList<>(mProvinceBeanArrayList.size());
mDistrictBeanArrayList = new ArrayList<>(mProvinceBeanArrayList.size());
//*/ 初始化默认选中的省、市、区,默认选中第一个省份的第一个市区中的第一个区县
/* |||õœèÛçßœ´œ凢坷œ¦œíâßèáÈÛçßœ´ÕõœãÞœ´«¦œèÛçßœ´œ洭发睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ熠俖œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©««¯«¬¬«œ÷¦õœãÞœ´¬¦œèÛçßœ´œ酋幘œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©««¯®²ª«œ÷¦õœãÞœ´¦œèÛçßœ´œ昪仛œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œ尃隭œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷¦õœãÞœ´¬¦œèÛçßœ´œ滐厑睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ毠泃œ¦œêÛî✴œâîîêí´©©ãåèéñ§êãݨÝÞè¨ÜÝßÜéí¨Ýé穲«ªÛ«³Þ²ÜÝßÜ«¯²«®¯°²¬Ü®«ßÛ²ÞàÝ«à®®ÛÝœ÷×÷¦õœãÞœ´¦œèÛçßœ´œ滐发睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ闹洓œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œ睄隭œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷×÷¦õœãÞœ´®¦œèÛçßœ´œ廹亖睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ廹幘œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œäãÛèäãÛè裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷¦õœãÞœ´¦œèÛçßœ´œÝâßèáÝâßèá裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œÝâïÝâï裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷¦õœãÞœ´¯¦œèÛçßœ´œ廹觹睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ发寻œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œäãÛèäãÛè裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷¦õœãÞœ´¦œèÛçßœ´œÝâßèáÝâßèá裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œÝâïÝâï裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷¦õœãÞœ´°¦œèÛçßœ´œ泙草睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ发伦œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œäãÛèäãÛè裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷¦õœãÞœ´¦œèÛçßœ´œÝâßèáÝâßèá裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œÝâïÝâï裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷¦õœãÞœ´±¦œèÛçßœ´œ淓泙睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ柧幘œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œäãÛèäãÛè裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷¦õœãÞœ´¦œèÛçßœ´œÝâßèáÝâßèá裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œÝâïÝâï裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷¦õœãÞœ´²¦œèÛçßœ´œ尃怷睻œ¦œêÛî✴ÕõœãÞœ´«¦œèÛçßœ´œ咂脟œ¦œêÛî✴œâîîêí´©©Üæéá¨ÝíÞè¨èßî©Û¯«²°«²±«²©ÛìîãÝæß©ÞßîÛãæí©«ª³ª¯®«œ÷¦õœãÞœ´¬¦œèÛçßœ´œäãÛèäãÛè裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèįªçÃÑÓÔ°»È¾òݪàËÔ¿»»áôĻþ²Îñ»ªÊÁƲ¯±¨äêáœ÷¦õœãÞœ´¦œèÛçßœ´œÝâßèáÝâßèá裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÛÃÞÁ¾â»ÈÈîÄÊï»áæí»»áôÅá½Ý±ìñ»ª¬ª²°³¨äêáœ÷¦õœãÞœ´®¦œèÛçßœ´œÝâïÝâï裟腈œ¦œêÛî✴œâîîêí´©©Þßíå§àÞ¨ôéæ§ãçá¨Ýéç¨Ýè©îÙí³°ªò°ªªÝ¯©á¯©Çªª©ª¿©ª«©½âÇåÄæèÄ°ÀÉÃÓé¾ä»ÄôïêÆæÑó«Ã»»áôÅá»»»»»»èÉ°²°¯³¨äêáœ÷×÷×÷|||*/
if (mProvinceBeanArrayList != null && !mProvinceBeanArrayList.isEmpty()) {
mProvinceBean = mProvinceBeanArrayList.get(0);
List<CityBean> cityList = mProvinceBean.getCityList();
if (cityList != null && !cityList.isEmpty() && cityList.size() > 0) {
mCityBean = cityList.get(0);
List<DistrictBean> districtList = mCityBean.getCityList();
if (districtList != null && !districtList.isEmpty() && districtList.size() > 0) {
mDistrictBean = districtList.get(0);
}
}
}
//省份数据
mProvinceBeenArray = new ArrayList<ProvinceBean>();
for (int p = 0; p < mProvinceBeanArrayList.size(); p++) {
//遍历每个省份
ProvinceBean itemProvince = mProvinceBeanArrayList.get(p);
//每个省份对应下面的市
ArrayList<CityBean> cityList = itemProvince.getCityList();
//当前省份下面的所有城市
// List<CityBean> cityNames = new ArrayList<>();
//遍历当前省份下面城市的所有数据
mi全国各省 的path数据——保存到mCitisDatasMap只有显示三级联动,才会执行
于 2023-07-03 11:11:41 首次发布