@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;
  }
 /** 初始化View */
 private void initView(ViewHolder holder, View v) {
   holder.image = (NetworkImageView) v.findViewById(R.id.niv_question);
   holder.title = (TextView) v.findViewById(R.id.itemTitle);
   holder.count = (TextView) v.findViewById(R.id.itemCount);
   holder.time = (TextView) v.findViewById(R.id.itemTime);
   holder.size = (TextView) v.findViewById(R.id.itemSize);
   holder.radio = (CheckBox) v.findViewById(R.id.itemChecked);
   holder.mTvItemRightSave = v.findViewById(R.id.tv_item_right_save);
   holder.mTvItemRightDel = v.findViewById(R.id.tv_item_right_del);
   holder.duration = (TextView) v.findViewById(R.id.itemLength);
   v.setTag(holder);
 }
 @Override
 public View newView(Context context, Cursor cursor, ViewGroup parent) {
   View v = super.newView(context, cursor, parent);
   ViewHolder vh = new ViewHolder();
   vh.line1 = (TextView) v.findViewById(R.id.line1);
   vh.line2 = (TextView) v.findViewById(R.id.line2);
   vh.play_indicator = (ImageView) v.findViewById(R.id.play_indicator);
   vh.icon = (ImageView) v.findViewById(R.id.icon);
   vh.duration = (TextView) v.findViewById(R.id.duration);
   v.setTag(vh);
   return v;
 }
Exemple #4
0
 @Override
 public View newView(Context context, Cursor cursor, ViewGroup parent) {
   View v = super.newView(context, cursor, parent);
   ViewHolder vh = new ViewHolder();
   vh.line1 = (TextView) v.findViewById(R.id.line1);
   vh.line2 = (TextView) v.findViewById(R.id.line2);
   vh.duration = (TextView) v.findViewById(R.id.duration);
   vh.radio = (RadioButton) v.findViewById(R.id.radio);
   vh.play_indicator = (ImageView) v.findViewById(R.id.play_indicator);
   vh.buffer1 = new CharArrayBuffer(100);
   vh.buffer2 = new char[200];
   v.setTag(vh);
   return v;
 }
Exemple #5
0
 public View newView(Context paramContext, Cursor paramCursor, ViewGroup paramViewGroup)
 {
   View localView1 = super.newView(paramContext, paramCursor, paramViewGroup);
   ViewHolder localViewHolder = new ViewHolder();
   Document localDocument = new Document();
   localViewHolder.document = localDocument;
   StatefulShadowTextView localStatefulShadowTextView1 = (StatefulShadowTextView)localView1.findViewById(2131296326);
   localViewHolder.title = localStatefulShadowTextView1;
   if (localViewHolder.title == null)
   {
     StatefulShadowTextView localStatefulShadowTextView2 = (StatefulShadowTextView)localView1.findViewById(2131296347);
     localViewHolder.title = localStatefulShadowTextView2;
   }
   View localView2 = localView1.findViewById(2131296412);
   localViewHolder.comboColumn = localView2;
   View localView3 = localView1.findViewById(2131296546);
   localViewHolder.contextMenu = localView3;
   View localView4 = localViewHolder.contextMenu;
   View.OnClickListener localOnClickListener = this.mContextClickListener;
   localView4.setOnClickListener(localOnClickListener);
   AsyncAlbumArtImageView localAsyncAlbumArtImageView = (AsyncAlbumArtImageView)localView1.findViewById(2131296325);
   localViewHolder.icon = localAsyncAlbumArtImageView;
   PlayingIndicator localPlayingIndicator = (PlayingIndicator)localView1.findViewById(2131296415);
   localViewHolder.play_indicator = localPlayingIndicator;
   CharArrayBuffer localCharArrayBuffer = new CharArrayBuffer(100);
   localViewHolder.titleBuffer = localCharArrayBuffer;
   StatefulShadowTextView localStatefulShadowTextView3 = (StatefulShadowTextView)localView1.findViewById(2131296545);
   localViewHolder.year = localStatefulShadowTextView3;
   StatefulShadowTextView localStatefulShadowTextView4 = (StatefulShadowTextView)localView1.findViewById(2131296399);
   localViewHolder.duration = localStatefulShadowTextView4;
   StatefulShadowTextView localStatefulShadowTextView5 = (StatefulShadowTextView)localView1.findViewById(2131296401);
   localViewHolder.album = localStatefulShadowTextView5;
   StatefulShadowTextView localStatefulShadowTextView6 = (StatefulShadowTextView)localView1.findViewById(2131296400);
   localViewHolder.artist = localStatefulShadowTextView6;
   if (localViewHolder.artist == null)
   {
     StatefulShadowTextView localStatefulShadowTextView7 = (StatefulShadowTextView)localView1.findViewById(2131296348);
     localViewHolder.artist = localStatefulShadowTextView7;
   }
   localView1.setTag(localViewHolder);
   localViewHolder.contextMenu.setTag(localViewHolder);
   return localView1;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    ViewHolder holder = null;

    if (view == null) {
      view = context.getLayoutInflater().inflate(R.layout.program_list_widget, null);
      holder = new ViewHolder();
      holder.title = (TextView) view.findViewById(R.id.title);
      holder.state = (ImageView) view.findViewById(R.id.state);
      holder.time = (TextView) view.findViewById(R.id.time);
      holder.date = (TextView) view.findViewById(R.id.date);
      holder.duration = (TextView) view.findViewById(R.id.duration);
      holder.progress = (TextView) view.findViewById(R.id.progress);
      holder.seriesInfo = (TextView) view.findViewById(R.id.series_info);
      holder.contentType = (TextView) view.findViewById(R.id.content_type);
      holder.summary = (TextView) view.findViewById(R.id.summary);
      holder.description = (TextView) view.findViewById(R.id.description);
      holder.genre = (TextView) view.findViewById(R.id.genre);
      view.setTag(holder);
    } else {
      holder = (ViewHolder) view.getTag();
    }

    // Get the program and assign all the values
    Program p = getItem(position);
    if (p != null) {
      holder.title.setText(p.title);
      Utils.setState(holder.state, p.recording);
      Utils.setDate(holder.date, p.start);
      Utils.setTime(holder.time, p.start, p.stop);
      Utils.setDuration(holder.duration, p.start, p.stop);
      Utils.setProgressText(holder.progress, p.start, p.stop);
      Utils.setDescription(null, holder.summary, p.summary);
      Utils.setDescription(null, holder.description, p.description);
      Utils.setContentType(null, holder.contentType, p.contentType);
      Utils.setSeriesInfo(null, holder.seriesInfo, p.seriesInfo);
      Utils.setGenreColor(context, holder.genre, p, TAG);
    }
    return view;
  }