com.amap.api.maps.offlinemap.OfflineMapCity Java Examples
The following examples show how to use
com.amap.api.maps.offlinemap.OfflineMapCity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OfflineMapActivity_Old.java From TraceByAmap with MIT License | 6 votes |
/** * 继续下载所有暂停中 */ private void startAllInPause() { if (amapManager == null) { return; } for (OfflineMapCity mapCity : amapManager.getDownloadingCityList()) { if (mapCity.getState() == OfflineMapStatus.PAUSE) { try { amapManager.downloadByCityName(mapCity.getCity()); } catch (AMapException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
Example #2
Source File: AmapDownloadMapFragment.java From BmapLite with Apache License 2.0 | 6 votes |
@Override public void onClickAmapDownloadOptions(String option, OfflineMapCity city) { if ("删除".equals(option)){ delCity(city); }else if ("更新".equals(option)){ updateCity(city); }else if ("开始".equals(option)){ try { amapManager.downloadByCityCode(city.getCode()); } catch (AMapException e) { e.printStackTrace(); onMessage("下载失败"); } }else if ("暂停".equals(option)){ amapManager.pause(); } }
Example #3
Source File: AmapDownloadMapFragment.java From BmapLite with Apache License 2.0 | 6 votes |
public void getList() { if (null != amapManager) { List<OfflineMapCity> list = new ArrayList<>(); list.addAll(amapManager.getDownloadOfflineMapCityList()); list.addAll(amapManager.getDownloadingCityList()); if (null == cityAdapter) { cityAdapter = new AmapDownloadCityAdapter(getActivity(), list); cityAdapter.setOnClickAmapDownloadOptionsListener(this); listOffline.setAdapter(cityAdapter); } else { cityAdapter.setList(list, true); cityAdapter.notifyDataSetChanged(); } } }
Example #4
Source File: OfflineDownloadedAdapter.java From TraceByAmap with MIT License | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView != null) { viewHolder = (ViewHolder) convertView.getTag(); } else { viewHolder = new ViewHolder(); currentOfflineChild = new OfflineChild(mContext, mOfflineMapManager); convertView = currentOfflineChild.getOffLineChildView(); viewHolder.mOfflineChild = currentOfflineChild; convertView.setTag(viewHolder); } OfflineMapCity offlineMapCity = (OfflineMapCity) getItem(position); viewHolder.mOfflineChild.setOffLineCity(offlineMapCity); return convertView; }
Example #5
Source File: AmapDownloadMapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
public void getList() { if (null != amapManager) { List<OfflineMapCity> list = new ArrayList<>(); list.addAll(amapManager.getDownloadOfflineMapCityList()); list.addAll(amapManager.getDownloadingCityList()); if (null == cityAdapter) { cityAdapter = new AmapDownloadCityAdapter(getActivity(), list); cityAdapter.setOnClickAmapDownloadOptionsListener(this); listOffline.setAdapter(cityAdapter); } else { cityAdapter.setList(list, true); cityAdapter.notifyDataSetChanged(); } } }
Example #6
Source File: AmapDownloadMapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
@Override public void onClickAmapDownloadOptions(String option, OfflineMapCity city) { if ("删除".equals(option)){ delCity(city); }else if ("更新".equals(option)){ updateCity(city); }else if ("开始".equals(option)){ try { amapManager.downloadByCityCode(city.getCode()); } catch (AMapException e) { e.printStackTrace(); onMessage("下载失败"); } }else if ("暂停".equals(option)){ amapManager.pause(); } }
Example #7
Source File: AmapDownloadMapFragment.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private void updateCity(OfflineMapCity city) { try { amapManager.downloadByCityCode(city.getCode()); } catch (AMapException e) { e.printStackTrace(); onMessage("更新失败"); } }
Example #8
Source File: OfflineMapActivity.java From Maps with GNU General Public License v2.0 | 5 votes |
/** * 把一个省的对象转化为一个市的对象 */ public OfflineMapCity getCicy(OfflineMapProvince aMapProvince) { OfflineMapCity aMapCity = new OfflineMapCity(); aMapCity.setCity(aMapProvince.getProvinceName()); aMapCity.setSize(aMapProvince.getSize()); aMapCity.setCompleteCode(aMapProvince.getcompleteCode()); aMapCity.setState(aMapProvince.getState()); aMapCity.setUrl(aMapProvince.getUrl()); return aMapCity; }
Example #9
Source File: AmapDownloadCityAdapter.java From BmapLite with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (null == convertView) { convertView = getInflater().inflate(R.layout.item_download_city, parent, false); } TextView textCity = ViewHolder.get(convertView, R.id.text_city); final Button btnOptions = ViewHolder.get(convertView, R.id.btn_options); final OfflineMapCity city = getList().get(position); textCity.setText(city.getCity() + ",大小:" + formatDataSize((int) city.getSize()) + ((city.getcompleteCode() != 100 && city.getState() != OfflineMapStatus.SUCCESS)? (" ("+ city.getcompleteCode() + "%)") : "") + ((city.getState() == OfflineMapStatus.NEW_VERSION) ? " [可更新]" : "") + (city.getState() == OfflineMapStatus.ERROR ? " [错误]" : "")); if (city.getState() == OfflineMapStatus.NEW_VERSION){ btnOptions.setText("更新"); }else if (city.getState() == OfflineMapStatus.PAUSE || city.getState() == OfflineMapStatus.STOP){ btnOptions.setText("开始"); }else if (city.getState() == OfflineMapStatus.LOADING){ btnOptions.setText("暂停"); }else { btnOptions.setText("删除"); } btnOptions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != onClickAmapDownloadOptionsListener){ onClickAmapDownloadOptionsListener.onClickAmapDownloadOptions(btnOptions.getText().toString().trim(), city); } } }); return convertView; }
Example #10
Source File: AmapDownloadMapFragment.java From BmapLite with Apache License 2.0 | 5 votes |
private void updateCity(OfflineMapCity city) { try { amapManager.downloadByCityCode(city.getCode()); } catch (AMapException e) { e.printStackTrace(); onMessage("更新失败"); } }
Example #11
Source File: AmapDownloadCityAdapter.java From BmapLite with GNU General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (null == convertView) { convertView = getInflater().inflate(R.layout.item_download_city, parent, false); } TextView textCity = ViewHolder.get(convertView, R.id.text_city); final Button btnOptions = ViewHolder.get(convertView, R.id.btn_options); final OfflineMapCity city = getList().get(position); textCity.setText(city.getCity() + ",大小:" + formatDataSize((int) city.getSize()) + ((city.getcompleteCode() != 100 && city.getState() != OfflineMapStatus.SUCCESS)? (" ("+ city.getcompleteCode() + "%)") : "") + ((city.getState() == OfflineMapStatus.NEW_VERSION) ? " [可更新]" : "") + (city.getState() == OfflineMapStatus.ERROR ? " [错误]" : "")); if (city.getState() == OfflineMapStatus.NEW_VERSION){ btnOptions.setText("更新"); }else if (city.getState() == OfflineMapStatus.PAUSE || city.getState() == OfflineMapStatus.STOP){ btnOptions.setText("开始"); }else if (city.getState() == OfflineMapStatus.LOADING){ btnOptions.setText("暂停"); }else { btnOptions.setText("删除"); } btnOptions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != onClickAmapDownloadOptionsListener){ onClickAmapDownloadOptionsListener.onClickAmapDownloadOptions(btnOptions.getText().toString().trim(), city); } } }); return convertView; }
Example #12
Source File: OfflineListAdapter.java From TraceByAmap with MIT License | 5 votes |
public OfflineListAdapter(List<OfflineMapProvince> provinceList, HashMap<Object, List<OfflineMapCity>> cityMap, OfflineMapManager amapManager, Context mContext) { this.provinceList = provinceList; // this.cityMap = cityMap; this.amapManager = amapManager; this.mContext = mContext; isOpen = new boolean[provinceList.size()]; }
Example #13
Source File: OfflineChild.java From TraceByAmap with MIT License | 5 votes |
public void setOffLineCity(OfflineMapCity mapCity) { if (mapCity != null) { mMapCity = mapCity; mOffLineCityName.setText(mapCity.getCity()); double size = ((int) (mapCity.getSize() / 1024.0 / 1024.0 * 100)) / 100.0; mOffLineCitySize.setText(String.valueOf(size) + " M"); notifyViewDisplay(mMapCity.getState(), mMapCity.getcompleteCode(), mIsDownloading); } }
Example #14
Source File: OfflineMapActivity_Old.java From TraceByAmap with MIT License | 5 votes |
/** * 取消所有<br> * 即:删除下载列表中除了已完成的所有<br> * 会在OfflineMapDownloadListener.onRemove接口中回调是否取消(删除)成功 */ private void cancelAll() { if (amapManager == null) { return; } for (OfflineMapCity mapCity : amapManager.getDownloadingCityList()) { if (mapCity.getState() == OfflineMapStatus.PAUSE) { amapManager.remove(mapCity.getCity()); } } }
Example #15
Source File: OfflineListAdapter.java From TraceByAmap with MIT License | 5 votes |
/** * 把一个省的对象转化为一个市的对象 */ public OfflineMapCity getCicy(OfflineMapProvince aMapProvince) { OfflineMapCity aMapCity = new OfflineMapCity(); aMapCity.setCity(aMapProvince.getProvinceName()); aMapCity.setSize(aMapProvince.getSize()); aMapCity.setCompleteCode(aMapProvince.getcompleteCode()); aMapCity.setState(aMapProvince.getState()); aMapCity.setUrl(aMapProvince.getUrl()); return aMapCity; }
Example #16
Source File: OfflineListAdapter.java From TraceByAmap with MIT License | 5 votes |
/** * 对一级标签下的二级标签进行设置 */ @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView != null) { viewHolder = (ViewHolder) convertView.getTag(); } else { viewHolder = new ViewHolder(); OfflineChild offLineChild = new OfflineChild(mContext, amapManager); convertView = offLineChild.getOffLineChildView(); viewHolder.mOfflineChild = offLineChild; convertView.setTag(viewHolder); } // OfflineMapCity mapCity = cityMap.get(groupPosition).get( // childPosition); OfflineMapCity mapCity = null; viewHolder.mOfflineChild.setProvince(false); if(isNormalProvinceGroup(groupPosition)) { if(isProvinceItem(groupPosition,childPosition)) { // 如果是省份,为了方便,进行一下处理 mapCity = getCicy(provinceList.get(groupPosition)); viewHolder.mOfflineChild.setProvince(true); } else { // 减1处理,第一个被放置了省份 mapCity = provinceList.get(groupPosition).getCityList().get(childPosition - 1); } } else { mapCity = provinceList.get(groupPosition).getCityList().get(childPosition); } viewHolder.mOfflineChild.setOffLineCity(mapCity); return convertView; }
Example #17
Source File: AmapDownloadCityAdapter.java From BmapLite with GNU General Public License v3.0 | 4 votes |
public AmapDownloadCityAdapter(Context context, List<OfflineMapCity> list) { super(context, list); }
Example #18
Source File: OfflineMapActivity_Old.java From TraceByAmap with MIT License | 4 votes |
/** * sdk内部存放形式为<br> * 省份 - 各自子城市<br> * 北京-北京<br> * ...<br> * 澳门-澳门<br> * 概要图-概要图<br> * <br> * 修改一下存放结构:<br> * 概要图-概要图<br> * 直辖市-四个直辖市<br> * 港澳-澳门香港<br> * 省份-各自子城市<br> */ private void initProvinceListAndCityMap() { List<OfflineMapProvince> lists = amapManager .getOfflineMapProvinceList(); provinceList.add(null); provinceList.add(null); provinceList.add(null); // 添加3个null 以防后面添加出现 index out of bounds ArrayList<OfflineMapCity> cityList = new ArrayList<OfflineMapCity>();// 以市格式保存直辖市、港澳、全国概要图 ArrayList<OfflineMapCity> gangaoList = new ArrayList<OfflineMapCity>();// 保存港澳城市 ArrayList<OfflineMapCity> gaiyaotuList = new ArrayList<OfflineMapCity>();// 保存概要图 for (int i = 0; i < lists.size(); i++) { OfflineMapProvince province = lists.get(i); if (province.getCityList().size() != 1) { // 普通省份 provinceList.add(i + 3, province); // cityMap.put(i + 3, cities); } else { String name = province.getProvinceName(); if (name.contains("香港")) { gangaoList.addAll(province.getCityList()); } else if (name.contains("澳门")) { gangaoList.addAll(province.getCityList()); } else if (name.contains("全国概要图")) { gaiyaotuList.addAll(province.getCityList()); } else { // 直辖市 cityList.addAll(province.getCityList()); } } } // 添加,概要图,直辖市,港口 OfflineMapProvince gaiyaotu = new OfflineMapProvince(); gaiyaotu.setProvinceName("概要图"); gaiyaotu.setCityList(gaiyaotuList); provinceList.set(0, gaiyaotu);// 使用set替换掉刚开始的null OfflineMapProvince zhixiashi = new OfflineMapProvince(); zhixiashi.setProvinceName("直辖市"); zhixiashi.setCityList(cityList); provinceList.set(1, zhixiashi); OfflineMapProvince gaogao = new OfflineMapProvince(); gaogao.setProvinceName("港澳"); gaogao.setCityList(gangaoList); provinceList.set(2, gaogao); // cityMap.put(0, gaiyaotuList);// 在HashMap中第0位置添加全国概要图 // cityMap.put(1, cityList);// 在HashMap中第1位置添加直辖市 // cityMap.put(2, gangaoList);// 在HashMap中第2位置添加港澳 }
Example #19
Source File: AmapDownloadCityAdapter.java From BmapLite with Apache License 2.0 | 4 votes |
public AmapDownloadCityAdapter(Context context, List<OfflineMapCity> list) { super(context, list); }
Example #20
Source File: AmapDownloadCityAdapter.java From BmapLite with GNU General Public License v3.0 | votes |
void onClickAmapDownloadOptions(String option, OfflineMapCity city);
Example #21
Source File: AmapDownloadCityAdapter.java From BmapLite with Apache License 2.0 | votes |
void onClickAmapDownloadOptions(String option, OfflineMapCity city);