public void download() { if (curStatus == STATUS_UM) { UmFunc.getIns().downloadFile(message, resource); } else if (curStatus == STATUS_GROUP_ZONE) { GroupZoneFunc.ins().downloadFile(groupFile); } else if (curStatus == STATUS_PREVIEW) { // do nothing Logger.error(LocalLog.APPTAG, "local file, don't download."); } }
private boolean checkZoneFileState() { if (GroupZoneFunc.ins().isDownloading(groupFile)) { // todo 获取进度。 return false; } String path = groupFile.getStorePath(); // UmUtil.createResPath(MediaResource.MEDIA_FILE, // groupFile.getFileName(), ""); return !checkFileExistAndOpen(path); }
public void cancelTransfer() { if (curStatus == STATUS_UM) { AutoCancelStack.getIns().cancelAuto(message.getMessageId()); UmFunc.getIns().cancelTransFile(message.getId(), resource.getMediaId(), false); } else if (curStatus == STATUS_GROUP_ZONE) { GroupZoneFunc.ins().cancelDownload(groupFile); } else if (curStatus == STATUS_PREVIEW) { // do nothing Logger.error(LocalLog.APPTAG, "local file, don't download."); } }
private void registerGroupZone() { zoneBroadcast = new String[] { GroupZoneFunc.FILE_DOWNLOAD_FAIL, GroupZoneFunc.FILE_DOWNLOAD_SUCCESS, GroupZoneFunc.FILE_DOWNLOAD_PROGRESS }; zoneReceiver = new BaseReceiver() { @Override public void onReceive(String broadcastName, BaseData d) { if (d instanceof DownloadFileReceiverData) { GroupFile mGroupFile = ((DownloadFileReceiverData) d).getGroupFile(); if (mGroupFile != null && mGroupFile.equals(groupFile)) { handleGroupZoneBroadcast(broadcastName, (DownloadFileReceiverData) d); } } } }; GroupZoneFunc.ins().registerBroadcast(zoneReceiver, zoneBroadcast); }
public void unRegister() { UmFunc.getIns().unRegisterBroadcast(umReceiver, mediaBroadcast); GroupZoneFunc.ins().unRegisterBroadcast(zoneReceiver, zoneBroadcast); }