コード例 #1
0
 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.");
   }
 }
コード例 #2
0
  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);
  }
コード例 #3
0
 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.");
   }
 }
コード例 #4
0
  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);
  }
コード例 #5
0
  public void unRegister() {
    UmFunc.getIns().unRegisterBroadcast(umReceiver, mediaBroadcast);

    GroupZoneFunc.ins().unRegisterBroadcast(zoneReceiver, zoneBroadcast);
  }