@Override
        public void onClick(View v) {
          if (v instanceof PrefixVideoChildItem) {
            PrefixVideoChildItem item = (PrefixVideoChildItem) v;
            if (item.data.state != PrefixVideo.STATE_COMPLETE) return;

            synchronized (adapter.dataSource) {
              PrefixVideo lastSelected = null;
              for (PrefixVideoGroup i : adapter.dataSource) {
                for (PrefixVideo j : i.items) {
                  if (j.selected) {
                    lastSelected = j;
                  }
                }
              }

              if (lastSelected == item.data) {
                selected = null;
                item.data.selected = false;
              } else {
                if (lastSelected != null) {
                  lastSelected.selected = false;
                }
                item.data.selected = true;
                selected = item.data;
              }
              adapter.notifyDataSetChanged();
            }
          } else if (v.getId() == R.id.action_container) {
            PrefixVideo info = (PrefixVideo) v.getTag();
            switch (info.state) {
              case PrefixVideo.STATE_DESCRIPTION:
                ELog.i("STATE_DOWNLOAD");
                info.state = PrefixVideo.STATE_DOWNLOAD;
                break;

              case PrefixVideo.STATE_DOWNLOAD:
              case PrefixVideo.STATE_DOWNLOADING:
                ELog.i("STATE_DOWNLOADING");
                info.state = PrefixVideo.STATE_DOWNLOADING;
                download(info);
                break;
            }
            adapter.notifyDataSetChanged();
          } else if (v.getId() == R.id.progress) {
            PrefixVideo info = (PrefixVideo) v.getTag();
            ELog.e("State:" + info.state);
            if (info.state == PrefixVideo.STATE_DOWNLOADING) {
              if (info.downloadTask.isDownloading()) {
                disconnect(info);
              } else {
                download(info);
              }
            }
          }
        }
  private void processData(String res, boolean isCache) throws JSONException {
    JSONObject root = new JSONObject(res);
    JSONArray array = root.getJSONArray("data");
    LinkedHashMap<String, List<PrefixVideo>> tmp = new LinkedHashMap<String, List<PrefixVideo>>();
    for (int i = 0; i < array.length(); i++) {
      JSONObject group = array.getJSONObject(i);
      String title = group.getString("title");
      JSONArray data = group.getJSONArray("data");
      for (int j = 0; j < data.length(); j++) {
        final PrefixVideo info = new PrefixVideo(data.getJSONObject(j), title);
        info.downloadListener = this;
        if (!isCache) {
          PrefixVideo p = PrefixVideo.query(info.id);
          if (p == null) {
            PrefixVideo.insert(info);
          } else {
            info.total = p.total;
          }
        }
        info.initialize();
        List<PrefixVideo> items = tmp.get(title);
        if (items == null) {
          items = new LinkedList<PrefixVideo>();
          tmp.put(title, items);
        }
        items.add(info);

        if (!info.coverFile.exists()) {
          App.THREAD.execute(
              new Runnable() {

                @Override
                public void run() {
                  info.downloadCoverImage();
                  handler.sendEmptyMessage(HANDLER_UPDATE);
                }
              });
        }
      }
    }

    List<PrefixVideoGroup> groups = new LinkedList<PrefixVideoGroup>();
    Set<Entry<String, List<PrefixVideo>>> entrys = tmp.entrySet();
    for (Entry<String, List<PrefixVideo>> i : entrys) {
      PrefixVideoGroup group = new PrefixVideoGroup(i.getValue().get(0).type, i.getKey());
      group.items.addAll(i.getValue());
      groups.add(group);
    }
    synchronized (adapter.dataSource) {
      adapter.dataSource.clear();
      adapter.dataSource.addAll(groups);
    }
    handler.sendEmptyMessage(HANDLER_UPDATE);
  }
 private void download(PrefixVideo info) {
   info.state = PrefixVideo.STATE_DOWNLOADING;
   adapter.notifyDataSetChanged();
   App.THREAD.execute(info.downloadTask);
 }