private void setData(Map<String, Object> map) {
   if (map == null) {
     return;
   }
   String[] a; // 分隔整个url
   String[] b; // 分隔标题和文件类型
   String url = StringUtil.Object2String(map.get("URL"));
   if (!StringUtil.isBlank(url)) {
     a = url.split("/");
     url = a[a.length - 1];
   } else {
     return;
   }
   b = url.replace(".", "!").split("!");
   textTitle.setText(StringUtil.Object2String(url));
   if ("".equals(StringUtil.Object2String(map.get("Size")))) {
     textSize.setText("0B");
   } else {
     textSize.setText(
         FileUtils.FormetFileSize(Long.parseLong(StringUtil.Object2String(map.get("Size")))));
   }
   if ("".equals(StringUtil.Object2String(b)) || b.length == 0) {
     leftIcon.setText("");
   } else {
     leftIcon.setText(StringUtil.Object2String(b[b.length - 1]));
   }
 }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    final Map<String, Object> map = list.get(position);
    // 先确保view存在
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.activity_learningmaterials_item_attach, null);
    }

    // 获得holder

    Object tag = convertView.getTag();
    final AttachListHolder holder;
    if (tag == null) {
      holder = new AttachListHolder(convertView);
    } else {
      holder = (AttachListHolder) tag;
    }
    holder.setData(map);
    // 设置tag
    convertView.setTag(holder);

    if (!"".equals(StringUtil.Object2String(map.get("URL")))) {
      final String serverUrl =
          CommandConstants.URL_ROOT + StringUtil.Object2String(map.get("URL")).replace(" ", "_");
      final String localUrl = CacheSupport.staticServerUrlConvertToCachePath(serverUrl);
      if (FileUtils.isExisitFile(localUrl)) {
        // 存在,已经下载
        holder.rightBtn.setText(DOWN_OK_SEE);
      }

      holder.rightBtn.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(final View v) {
              if (((Button) v).getText().equals(DOWN_ON)) { // 点击下载开始下载
                holder.progressBar.setVisibility(View.VISIBLE);
                holder.rightBtn.setText(DOWN_ING);
                new Thread() {
                  public void run() {
                    if (downloadFile(serverUrl, localUrl, mHandler, holder)) {
                      Message msg = new Message();
                      msg.what = 1;
                      msg.obj = holder;
                      Bundle bundle = new Bundle();
                      bundle.putString("localUrl", localUrl);
                      msg.setData(bundle);
                      mHandler.sendMessage(msg);
                    } else {

                      Message msg = new Message();
                      msg.what = 2;
                      msg.obj = holder;
                      Bundle bundle = new Bundle();
                      bundle.putString("localUrl", localUrl);
                      msg.setData(bundle);
                      mHandler.sendMessage(msg);
                    }
                  };
                }.start();
              } else if (((Button) v).getText().equals(DOWN_OK_SEE)) { // 点击查看附件
                // TODO
                File file = new File(localUrl);
                if (file != null && file.exists()) {
                  new CallOtherOpeanFile().openFile(context, file);
                } else {
                  Toast.makeText(context, "没有找到查看的文件!", Toast.LENGTH_SHORT).show();
                }
              }
            }
          });
    } else {
      holder.rightBtn.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(final View v) {
              Toast.makeText(context, "附件路径不正确!", Toast.LENGTH_SHORT).show();
            }
          });
    }

    return convertView;
  }