Пример #1
0
 /** Helper method to set the contents and visibility of each field */
 public synchronized void setFieldContentsAndVisibility(
     View view, UserActivity activity, User user, History history, String type) {
   // picture
   if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) {
     setupUserActivityRow(view, activity, user);
   } else if (NameMaps.TABLE_ID_HISTORY.equals(type)) {
     setupHistoryRow(view, history, user);
   }
 }
Пример #2
0
  /** Helper method to set the contents and visibility of each field */
  public synchronized void bindView(View view, NoteOrUpdate item) {
    // picture
    final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture);
    {
      pictureView.setDefaultImageDrawable(
          ResourceDrawableCache.getImageDrawableFromId(
              resources, R.drawable.icn_default_person_image));
      pictureView.setUrl(item.picture);
    }

    // name
    final TextView nameView = (TextView) view.findViewById(R.id.title);
    {
      nameView.setText(item.title);
      if (NameMaps.TABLE_ID_HISTORY.equals(item.type)) nameView.setTextColor(grayColor);
      else nameView.setTextColor(color);
      Linkify.addLinks(nameView, Linkify.ALL);
    }

    // date
    final TextView date = (TextView) view.findViewById(R.id.date);
    {
      CharSequence dateString =
          DateUtils.getRelativeTimeSpanString(
              item.createdAt,
              DateUtilities.now(),
              DateUtils.MINUTE_IN_MILLIS,
              DateUtils.FORMAT_ABBREV_RELATIVE);
      date.setText(dateString);
    }

    // picture
    final AsyncImageView commentPictureView =
        (AsyncImageView) view.findViewById(R.id.comment_picture);
    {
      UpdateAdapter.setupImagePopupForCommentView(
          view,
          commentPictureView,
          item.pictureThumb,
          item.pictureFull,
          item.commentBitmap,
          item.title.toString(),
          fragment,
          imageCache);
    }
  }