com.amap.api.maps.offlinemap.OfflineMapStatus Java Examples
The following examples show how to use
com.amap.api.maps.offlinemap.OfflineMapStatus.
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: OfflineChild.java From TraceByAmap with MIT License | 6 votes |
public boolean onLongClick(View arg0) { // if (mMapCity.getState() == OfflineMapStatus.LOADING) { // amapManager.restart(); // return false; // } Log.d("amap-longclick", mMapCity.getCity() + " : " + mMapCity.getState()); if (mMapCity.getState() == OfflineMapStatus.SUCCESS) { showDeleteUpdateDialog(mMapCity.getCity()); } else if (mMapCity.getState() != OfflineMapStatus.CHECKUPDATES) { showDeleteDialog(mMapCity.getCity()); } return false; }
Example #3
Source File: OfflineMapDownloadService.java From Maps with GNU General Public License v2.0 | 6 votes |
@Override public void onDownload(int status, int completeCode, String name) { StringBuilder sb = new StringBuilder(""); if (status == OfflineMapStatus.SUCCESS) { isCurDownloading = false; sb.append(name).append(" 下载完成"); mNotificationBuilder.setOngoing(false); mHandler.sendEmptyMessage(OfflineMapStatus.SUCCESS); } else if (status == OfflineMapStatus.ERROR) { isCurDownloading = false; sb.append("下载失败"); mNotificationBuilder.setOngoing(false); } else if (status == OfflineMapStatus.LOADING) { sb.append("正在下载 ").append(name).append(" ").append(completeCode).append("%"); } else if (status == OfflineMapStatus.UNZIP) { sb.append("正在解压 ").append(name).append(" ").append(completeCode).append("%"); } mNotificationBuilder.setContentText(sb); mNotificationManager.notify(OFFLINEMAP_DOWNLOAD_NOTIFICATION_ID, mNotificationBuilder.build()); }
Example #4
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 #5
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 #6
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 #7
Source File: OfflineMapDownloadService.java From Maps with GNU General Public License v2.0 | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { intentLinkedList.add(intent); //如果当前没有正在下载的任务,则开始下载 if (!isCurDownloading) mHandler.sendEmptyMessage(OfflineMapStatus.SUCCESS); return START_NOT_STICKY; }
Example #8
Source File: OfflineMapDownloadService.java From Maps with GNU General Public License v2.0 | 5 votes |
@Override public void handleMessage(Message msg) { OfflineMapDownloadService b = a.get(); if (b != null) { if (msg.what == OfflineMapStatus.SUCCESS) { b.onHandleIntent(); } } super.handleMessage(msg); }
Example #9
Source File: OfflineMapActivity.java From Maps with GNU General Public License v2.0 | 5 votes |
/** * 对一级标签下的二级标签进行设置 */ @Override public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { if (convertView == null) { convertView = RelativeLayout.inflate( getBaseContext(), R.layout.offlinemap_child, null); } ViewHolder holder = new ViewHolder(convertView); holder.cityName.setText(cityMap.get(groupPosition) .get(childPosition).getCity()); holder.citySize.setText((cityMap.get(groupPosition).get( childPosition).getSize()) / (1024 * 1024f) + "MB"); if (cityMap.get(groupPosition).get(childPosition).getState() == OfflineMapStatus.SUCCESS) { holder.cityDown.setText("安装完成"); } else if (cityMap.get(groupPosition).get(childPosition).getState() == OfflineMapStatus.LOADING) { if (groupPosition == OfflineMapActivity.this.groupPosition && childPosition == OfflineMapActivity.this.childPosition) { holder.cityDown.setText("正在下载" + completeCode + "%"); } else { if (cityMap.get(groupPosition).get(childPosition).getcompleteCode() > 0) { holder.cityDown.setText("下载暂停" + cityMap.get(groupPosition).get(childPosition).getcompleteCode() + "%"); } else { holder.cityDown.setText(""); } } } else if (cityMap.get(groupPosition).get(childPosition).getState() == OfflineMapStatus.UNZIP) { holder.cityDown.setText("正在解压" + completeCode + "%"); } else if (cityMap.get(groupPosition).get(childPosition).getState() == OfflineMapStatus.LOADING) { holder.cityDown.setText("下载"); } return convertView; }
Example #10
Source File: OfflineMapActivity_Old.java From TraceByAmap with MIT License | 4 votes |
/** * 离线地图下载回调方法 */ @Override public void onDownload(int status, int completeCode, String downName) { switch (status) { case OfflineMapStatus.SUCCESS: // changeOfflineMapTitle(OfflineMapStatus.SUCCESS, downName); break; case OfflineMapStatus.LOADING: Log.d("amap-download", "download: " + completeCode + "%" + "," + downName); // changeOfflineMapTitle(OfflineMapStatus.LOADING, downName); break; case OfflineMapStatus.UNZIP: Log.d("amap-unzip", "unzip: " + completeCode + "%" + "," + downName); // changeOfflineMapTitle(OfflineMapStatus.UNZIP); // changeOfflineMapTitle(OfflineMapStatus.UNZIP, downName); break; case OfflineMapStatus.WAITING: Log.d("amap-waiting", "WAITING: " + completeCode + "%" + "," + downName); break; case OfflineMapStatus.PAUSE: Log.d("amap-pause", "pause: " + completeCode + "%" + "," + downName); break; case OfflineMapStatus.STOP: break; case OfflineMapStatus.ERROR: Log.e("amap-download", "download: " + " ERROR " + downName); break; case OfflineMapStatus.EXCEPTION_AMAP: Log.e("amap-download", "download: " + " EXCEPTION_AMAP " + downName); break; case OfflineMapStatus.EXCEPTION_NETWORK_LOADING: Log.e("amap-download", "download: " + " EXCEPTION_NETWORK_LOADING " + downName); Toast.makeText(OfflineMapActivity_Old.this, "网络异常", Toast.LENGTH_SHORT) .show(); amapManager.pause(); break; case OfflineMapStatus.EXCEPTION_SDCARD: Log.e("amap-download", "download: " + " EXCEPTION_SDCARD " + downName); break; default: break; } // changeOfflineMapTitle(status, downName); handler.sendEmptyMessage(UPDATE_LIST); }
Example #11
Source File: OfflineChild.java From TraceByAmap with MIT License | 4 votes |
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); int completeCode = (Integer) msg.obj; switch (msg.what) { case OfflineMapStatus.LOADING: displyaLoadingStatus(completeCode); break; case OfflineMapStatus.PAUSE: displayPauseStatus(completeCode); break; case OfflineMapStatus.STOP: break; case OfflineMapStatus.SUCCESS: displaySuccessStatus(); break; case OfflineMapStatus.UNZIP: displayUnZIPStatus(completeCode); break; case OfflineMapStatus.ERROR: displayExceptionStatus(); break; case OfflineMapStatus.WAITING: displayWaitingStatus(completeCode); break; case OfflineMapStatus.CHECKUPDATES: displayDefault(); break; case OfflineMapStatus.EXCEPTION_AMAP: case OfflineMapStatus.EXCEPTION_NETWORK_LOADING: case OfflineMapStatus.EXCEPTION_SDCARD: displayExceptionStatus(); break; case OfflineMapStatus.NEW_VERSION: displayHasNewVersion(); break; } }
Example #12
Source File: OfflineChild.java From TraceByAmap with MIT License | 4 votes |
public void onClick(View view) { // if(mMapCity.getCity() .equals( "北京")) { // new Thread(new Runnable() { // // @Override // public void run() { // // TODO Auto-generated method stub // for(int i =0; i< 100;i++) { // try { // amapManager.downloadByCityName("北京"); // TimeUnit.MILLISECONDS.sleep(500); // amapManager.downloadByCityName("上海"); // TimeUnit.MILLISECONDS.sleep(500); // } catch (AMapException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // // } // }).start(); // return; // } // // 避免频繁点击事件,避免不断从夫开始下载和暂停下载 // mOffLineChildView.setEnabled(false); // new Handler().postDelayed(new Runnable() { // // @Override // public void run() { // mOffLineChildView.setEnabled(true); // } // },100);// 这个时间段刚刚好 int completeCode = -1, status = -1; if (mMapCity != null) { status = mMapCity.getState(); completeCode = mMapCity.getcompleteCode(); switch (status) { case OfflineMapStatus.UNZIP: case OfflineMapStatus.SUCCESS: // 解压中何在成功啥不干 break; case OfflineMapStatus.LOADING: // case OfflineMapStatus.WAITING: pauseDownload(); // 在下载中的时候点击,表示要暂停 displayPauseStatus(completeCode); break; case OfflineMapStatus.PAUSE: case OfflineMapStatus.CHECKUPDATES: case OfflineMapStatus.ERROR: case OfflineMapStatus.WAITING: // case OfflineMapStatus.NEW_VERSION: default: if(startDownload()) displayWaitingStatus(completeCode); else displayExceptionStatus(); // Toast.makeText(mContext, "SD卡空间不多了", 1000).show(); // 在暂停中点击,表示要开始下载 // 在默认状态点击,表示开始下载 // 在等待中点击,表示要开始下载 // 要开始下载状态改为等待中,再回调中会自己修改 break; } Log.e("zxy-child", mMapCity.getCity() + " " + mMapCity.getState()); } }