Esempio n. 1
0
 @Override
 public void onScrollStateChanged(AbsListView view, int scrollState) {
   // TODO Auto-generated method stub
   if (scrollState == OnScrollListener.SCROLL_STATE_FLING) {
     syncThumbExtractor.pause();
   } else {
     syncThumbExtractor.resume();
   }
 }
Esempio n. 2
0
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    ViewHolder holder = null;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = layoutInflater.inflate(R.layout.activity_local_video_item, null);
      holder.fileType = (ImageView) convertView.findViewById(R.id.video_image_thumb);
      holder.fileName = (TextView) convertView.findViewById(R.id.video_title);
      holder.size = (TextView) convertView.findViewById(R.id.video_size);
      holder.duration = (TextView) convertView.findViewById(R.id.video_duration);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    // 判断文件类型并设置图标
    if (position > listFiles.size()) {
      return null;
    }

    syncThumbExtractor.decodeThumbnail(holder.fileType, listFiles.get(position).getPath(), 0, -1);

    holder.fileName.setText(listFiles.get(position).getName());
    holder.size.setText(
        mContext.getString(R.string.video_size)
            + MultimediaUtil.showSize(listFiles.get(position).getSize()));
    holder.duration.setText(
        mContext.getString(R.string.video_duration)
            + MultimediaUtil.showTime(listFiles.get(position).getDuration()));

    return convertView;
  }