public void stopDownload(DownloadInfo downloadInfo) throws DbException { HttpHandler<File> handler = downloadInfo.getHandler(); if (handler != null && !handler.isCancelled()) { handler.cancel(); } else { downloadInfo.setState(HttpHandler.State.CANCELLED); } db.saveOrUpdate(downloadInfo); }
public void stopDownload(DownloadInfo downloadInfo) throws DbException { HttpHandler<File> handler = downloadInfo.getHandler(); if (handler != null && !handler.isStopped()) { handler.stop(); } else { downloadInfo.setState(HttpHandler.State.STOPPED); } db.saveOrUpdate(downloadInfo); }
public void resumeDownload(DownloadInfo downloadInfo, final RequestCallBack<File> callback) throws DbException { HttpUtils http = new HttpUtils(); http.configRequestThreadPoolSize(maxDownloadThread); HttpHandler<File> handler = http.download( downloadInfo.getDownloadUrl(), downloadInfo.getFileSavePath(), downloadInfo.isAutoResume(), downloadInfo.isAutoRename(), new ManagerCallBack(downloadInfo, callback)); downloadInfo.setHandler(handler); downloadInfo.setState(handler.getState()); db.saveOrUpdate(downloadInfo); }
// Quit Unity @Override protected void onDestroy() { System.out.println("---UnityonDestroy"); DbUtils dbUtils = DbUtils.create(this); LocalPlay localPlay = new LocalPlay(); localPlay.setNowplayUrl(""); localPlay.setQingxidu(""); localPlay.setSdurl(""); localPlay.setHdrul(""); localPlay.setUhdrul(""); localPlay.setType(""); localPlay.setUnityJump(true); try { dbUtils.saveOrUpdate(localPlay); } catch (DbException e) { e.printStackTrace(); } mUnityPlayer.quit(); super.onDestroy(); }