public void start() {
   Log.w(TAG, "start");
   if (downloadInfos != null) {
     if (state == Download_State.Downloading) {
       return;
     }
     state = Download_State.Downloading;
     for (DownloadInfo info : downloadInfos) {
       Log.v(TAG, "startThread");
       new DownloadThread(
               info.getThreadId(),
               info.getStartPos(),
               info.getEndPos(),
               info.getCompeleteSize(),
               info.getUrl())
           .start();
     }
   }
 }
 // 在开始下载之前需要调用ready方法进行配置
 public void ready() {
   Log.w(TAG, "ready");
   globalCompelete = 0;
   downloadInfos = sqlTool.getInfos(urlstr);
   if (downloadInfos.size() == 0) {
     initFirst();
   } else {
     File file = new File(localPath + "/" + fileName);
     if (!file.exists()) {
       sqlTool.delete(urlstr);
       initFirst();
     } else {
       fileSize = downloadInfos.get(downloadInfos.size() - 1).getEndPos();
       for (DownloadInfo info : downloadInfos) {
         globalCompelete += info.getCompeleteSize();
       }
       Log.w(TAG, "globalCompelete:::" + globalCompelete);
     }
   }
 }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {

      convertView = mInflater.inflate(R.layout.item_download, null);
      holder = new ViewHolder();
      holder.resourceDownloadName = (TextView) convertView.findViewById(R.id.downloadfilename);
      holder.resouceDownloadState = (TextView) convertView.findViewById(R.id.download_state);
      holder.resourceImage = (ImageView) convertView.findViewById(R.id.movieImageview);
      holder.resourceDownProgress = (ProgressBar) convertView.findViewById(R.id.downloadprogress);
      holder.resourcePercentDown = (TextView) convertView.findViewById(R.id.precentDownload);
      holder.down_wait = (ImageView) convertView.findViewById(R.id.down_wait);
      holder.down_pause = (ImageView) convertView.findViewById(R.id.down_pause);
      holder.down_downing = (ImageView) convertView.findViewById(R.id.down_downing);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    aqtemp = new AQuery(convertView);
    if (position < data.size()) {
      DownloadInfo info = data.get(position);
      long completesize = info.getCompeleteSize();
      long filesize = info.getFileSize();
      long percent = 0;
      if (filesize == 0) {

      } else {
        percent = completesize * MAX / filesize;
      }
      String posterurl = info.getUrlposter();
      holder.resourceDownloadName.setText(info.getMy_name());
      if (info.getMy_index().contains("movie")) {
        if (info.getDownload_state().equalsIgnoreCase("wait")) {
          holder.resouceDownloadState.setText("等待下载");
          aqtemp.id(R.id.down_wait).visible();
          aqtemp.id(R.id.down_pause).gone();
          aqtemp.id(R.id.down_downing).gone();
        } else if (info.getDownload_state().equalsIgnoreCase("downloading")) {
          holder.resouceDownloadState.setText("正在下载");
          aqtemp.id(R.id.down_wait).gone();
          aqtemp.id(R.id.down_pause).gone();
          aqtemp.id(R.id.down_downing).visible();
        } else if (info.getDownload_state().equalsIgnoreCase("pause")) {
          holder.resouceDownloadState.setText("暂停下载");
          aqtemp.id(R.id.down_wait).gone();
          aqtemp.id(R.id.down_pause).visible();
          aqtemp.id(R.id.down_downing).gone();
        }
        holder.resourceDownProgress.setMax(MAX);
        if (filesize != 0) {
          holder.resourceDownProgress.setSecondaryProgress((int) (completesize * MAX / filesize));
        } else {
          holder.resourceDownProgress.setSecondaryProgress(0);
        }

        holder.resourcePercentDown.setText((percent) + "%");
        if (info.getCompeleteSize() == info.getFileSize()) {
          if (info.getFileSize() > 10) // 过滤掉文件长度为零的情况
          {
            holder.resouceDownloadState.setText("");
            holder.resourcePercentDown.setText("");
            aqtemp.id(R.id.downloadprogress).gone();

            aqtemp.id(R.id.down_wait).gone();
            aqtemp.id(R.id.down_pause).gone();
            aqtemp.id(R.id.down_downing).gone();
          }
        }
      } else {
        aqtemp.id(R.id.downloadprogress).gone();
        aqtemp.id(R.id.state_layer).gone();
      }
      aqtemp.id(R.id.movieImageview).image(posterurl, true, true);
    }
    return convertView;
  }