Ejemplo n.º 1
0
 public int getSeleteCount() { // 被选中即将删除的个数
   if (list == null || list.size() == 0) return 0;
   int num = 0;
   for (DownLoadInfo movieInfo : list) {
     if (movieInfo.isDelete()) num++;
   }
   return num;
 }
Ejemplo n.º 2
0
 public boolean changeDeleteVisible() {
   this.deleteVisible = !deleteVisible;
   if (!deleteVisible) { //// 重置多选框状态
     for (DownLoadInfo downInfo : list) {
       if (downInfo.isDelete()) downInfo.setDelete(false);
     }
   }
   notifyDataSetChanged();
   return deleteVisible;
 }
Ejemplo n.º 3
0
 public boolean getNotSelete() { // 是否含有未被选中的
   boolean delete = false;
   if (list == null || list.size() == 0) return delete;
   for (DownLoadInfo downInfo : list) {
     if (!downInfo.isDelete()) {
       delete = true;
       break;
     }
   }
   return delete;
 }
Ejemplo n.º 4
0
 public void DeleteList() { // 删除数据
   if (list == null || list.size() == 0) return;
   for (int i = list.size() - 1; i > -1; i--) { // 倒序删除,避免循环错误
     DownLoadInfo movie = list.get(i);
     if (movie.isDelete()) {
       list.remove(movie);
       dao.delSingleSmovieSave(movie.getDownID());
     }
   }
   notifyDataSetChanged();
   setDeleteInVisible();
 }
Ejemplo n.º 5
0
  public View getView(final int position, View convertView, ViewGroup vg) {
    // TODO Auto-generated method stub
    ViewHolder holder;

    if (convertView != null) {
      holder = (ViewHolder) convertView.getTag();
      holder.moive_img.setImageResource(R.drawable.item_moive_list); // 设置默认图片,避免�?成图片看起来混乱
    } else {
      holder = new ViewHolder();
      convertView = inflate.inflate(R.layout.item_play_history, null);
      holder.title = (TextView) convertView.findViewById(R.id.moive_title);
      holder.moive_img = (ImageView) convertView.findViewById(R.id.moive_img);
      holder.delete = (CheckBox) convertView.findViewById(R.id.delete);
      convertView.setTag(holder);
    }
    holder.moive_img.setImageResource(R.drawable.item_moive_list); // 设置默认图片,避免造成图片看起来混乱
    if (list == null || list.size() == 0 || position < 0 || position >= list.size())
      return convertView;
    final DownLoadInfo downInfo = list.get(position);
    holder.title.setText(downInfo.getDownName());

    bmpManager.loadBitmap(downInfo.getDownImg(), holder.moive_img);

    // 删除按钮
    if (!deleteVisible) holder.delete.setVisibility(8);
    else {
      holder.delete.setVisibility(0);
      holder.delete.setChecked(downInfo.isDelete()); //
      holder.delete.setOnClickListener(
          new OnClickListener() {
            public void onClick(View v) {
              // TODO Auto-generated method stub
              downInfo.setDelete(!downInfo.isDelete());

              Message message = new Message();
              message.what = DELETElAYOUT;
              message.obj = getSeleteCount();
              handler.sendMessage(message);
            }
          });
    }

    return convertView;
  }