Java Code Examples for com.amap.api.maps.offlinemap.OfflineMapStatus#PAUSE
The following examples show how to use
com.amap.api.maps.offlinemap.OfflineMapStatus#PAUSE .
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: 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 3
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 4
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 5
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 6
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 7
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()); } }