@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(getActivity()).inflate(R.layout.item_song, null);
        holder.mTvName = (TextView) convertView.findViewById(R.id.tv_name);
        holder.mTvArtist = (TextView) convertView.findViewById(R.id.tv_artist);
        holder.mTvDuration = (TextView) convertView.findViewById(R.id.tv_duration);
        holder.aboveView = convertView.findViewById(R.id.item_root);
        holder.behindView = convertView.findViewById(R.id.behind);
        convertView.setTag(holder);
        convertViewList.add((PullRightLayout) convertView);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (HideApplication.showListAnim) {
        startAnim(convertView);
      }

      SongInfo info = SongManager.with(getActivity()).getSongByIndex(position);
      holder.mTvName.setText(info.getTitle());
      holder.mTvArtist.setText(info.getArtist() + " - " + info.getAlbum());
      holder.mTvDuration.setText(
          CommonUtils.durationToString(info.getDuration())
              + " - "
              + CommonUtils.getFileSize(info.getPath()));

      setItemSelected(holder, info.getId() == playingId);

      convertView.setOnClickListener(new OnItemClick(position));
      holder.behindView.setOnClickListener(new OnBehindClick(position));

      return convertView;
    }
 public void bindView(View view, Context context, Cursor cursor)
 {
     Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationAdapter;->bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V");
     MtvReservation mtvreservation = MtvReservationManager.builder(cursor);
     view.setTag(mtvreservation);
     String s;
     String s1;
     if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext()))
         s = (new SimpleDateFormat("M/d (EEE) H:mm")).format(new Date(mtvreservation.mTimeStart));
     else
         s = (new SimpleDateFormat("M/d (EEE) h:mm a")).format(new Date(mtvreservation.mTimeStart));
     if(mtvreservation.mTimeEnd > 0L)
     {
         if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext()))
             s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("H:mm")).format(new Date(mtvreservation.mTimeEnd))).toString();
         else
             s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("h:mm a")).format(new Date(mtvreservation.mTimeEnd))).toString();
     } else
     {
         s1 = (new StringBuilder()).append(s).append(" -            ").toString();
     }
     ((ImageView)view.findViewById(0x7f0a0053)).setImageDrawable(mIcon[mtvreservation.mPgmType][selectStatusIconIndex(mtvreservation)]);
     ((TextView)view.findViewById(0x7f0a0113)).setText((new StringBuilder()).append(s1).append(" ").append("Ch ").append(mtvreservation.mPch).append(" ").toString());
     ((TextView)view.findViewById(0x7f0a0112)).setText(mtvreservation.mPgmName);
     view.findViewById(0x7f0a0048).setVisibility(8);
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      PhotoGridHolder holder = null;

      if (row == null) {
        LayoutInflater inflater = ((Activity) context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);
        holder = new PhotoGridHolder();
        holder.itemImageView = (ImageView) row.findViewById(R.id.galleryGridImage);
        row.setTag(holder);
      } else {
        holder = (PhotoGridHolder) row.getTag();
      }
      String filename = getItem(position);
      String path = context.getFilesDir().getAbsolutePath() + "/images/" + filename;

      holder.itemImageView.setImageURI(Uri.parse(path));
      return row;
    }
示例#4
0
  private ViewHolder getViewHolder(final View workingView) {
    final Object tag = workingView.getTag();
    ViewHolder viewHolder = null;

    if (null == tag || !(tag instanceof ViewHolder)) {
      viewHolder = new ViewHolder();

      viewHolder.nameView = (TextView) workingView.findViewById(R.id.name);
      viewHolder.dateView = (TextView) workingView.findViewById(R.id.date);
      viewHolder.sizeView = (TextView) workingView.findViewById(R.id.size);
      viewHolder.imageView = (ImageView) workingView.findViewById(R.id.image);

      workingView.setTag(viewHolder);

    } else {
      viewHolder = (ViewHolder) tag;
    }

    return viewHolder;
  }