示例#1
0
  /**
   * Get the download link of a content. Webservice does checking if account has the right to
   * download the requested content.
   *
   * @param executeAsync Execute webcall async.
   * @param callback Event called on response.
   */
  public static void getDownload(
      boolean executeAsync, Context context, BaseEntity content, OnDownloadResult callback) {
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair(PARA_CONTENTID, Long.toString(content.getContentId())));

    performDownload(context, content, params, callback);
  }
示例#2
0
  public static boolean isDownloading(Activity activity, BaseEntity content) {
    if (hasActiveDownloads()) {
      ListIterator<DownloadAsyncTask> li = activeDownloads.listIterator(activeDownloads.size());

      while (li.hasPrevious()) {
        DownloadAsyncTask task = li.previous();
        if (task.getContent().getContentId() == content.getContentId() && !task.isCancelled()) {
          return true;
        }
      }
    }
    return false;
  }