/**
   * 解析Intent获取数据源。
   *
   * @param intent
   */
  private void parseIntent(Intent intent) {
    Bundle bundle = intent.getExtras();
    if (bundle == null) {
      valid = false;
      return;
    }

    String path = bundle.getString(IntentData.PATH);
    if (path != null) {
      curStatus = STATUS_PREVIEW;
      filePath = path;

      File file = FileUtil.newFile(path);
      fileName = file.getName();
      totalSizeStr = FileUtil.makeUpSizeShow(file.length());
      return;
    }

    Object file = bundle.get(IntentData.GROUP_ZONE_FILE);
    if (file instanceof GroupFile) {
      curStatus = STATUS_GROUP_ZONE;
      groupFile = (GroupFile) file;
      fileName = groupFile.getFileName();
      totalSizeStr = FileUtil.makeUpSizeShow(groupFile.getFileSize());

      /*message = InstantMessageDao.getImById(groupFile.getInstantMessageId());
      if (message != null)
      {
          resource = message.getMediaRes();
          if (resource == null)
          {
              valid = false;
              return;
          }
      }*/

      return;
    }

    Object tag = bundle.get(IntentData.MEDIA_RESOURCE);
    Object tag1 = bundle.get(IntentData.IM);
    if (tag instanceof MediaResource && tag1 instanceof InstantMessage) {
      curStatus = STATUS_UM;

      message = (InstantMessage) tag1;
      resource = (MediaResource) tag;

      fileName = resource.getName();
      totalSizeStr = FileUtil.makeUpSizeShow(resource.getSize());

      if (ContactLogic.getIns().getAbility().isSupportGroupZone()) {
        int id = new GroupZoneFileRelationDao().query((int) message.getId(), false);
        groupFile = new GroupZoneFileDao().query(id);
      }

      return;
    }

    valid = false;
  }
  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);
  }
 private void handleGroupZoneBroadcast(String broadcastName, DownloadFileReceiverData data) {
   if (GroupZoneFunc.FILE_DOWNLOAD_FAIL.equals(broadcastName)) {
     handler.sendEmptyMessage(DOWNLOAD_FAIL);
   } else if (GroupZoneFunc.FILE_DOWNLOAD_SUCCESS.equals(broadcastName)) {
     groupFile.setStorePath(data.getFilePath());
     openFile(data.getFilePath());
   } else if (GroupZoneFunc.FILE_DOWNLOAD_PROGRESS.equals(broadcastName)) {
     updateProgress(data.getCurSize(), data.getTotalSize());
   }
 }