/** Creates new feed post View. */ private View createPostView(FBPost post) { // Create default Feed Item view. View postView = getLayoutInflater().inflate(R.layout.view_post, null); // Set sender's name. String fromId = post.getFromId(); String fromName = post.getFromName(); TextView fromView = (TextView) postView.findViewById(R.id.view_post_from); StringUtils.setTextLink(fromView, fromName, PROTOCOL_SHOW_PROFILE + fromId, mSpanClickObserver); // Get message from feed item. Message is the one user can add as a // description to items posted. String message = post.getMessage(); TextView messageView = (TextView) postView.findViewById(R.id.view_post_message); if (message != null) { StringUtils.setTextLinks(messageView, message, null); } else { messageView.setVisibility(View.GONE); } // Get name from feed item. Name is shortish description like string // for feed item. String name = post.getName(); TextView nameView = (TextView) postView.findViewById(R.id.view_post_name); if (name != null) { if (post.getLink() != null) { StringUtils.setTextLink(nameView, name, post.getLink(), null); } else { nameView.setText(name); } } else { nameView.setVisibility(View.GONE); } String caption = post.getCaption(); TextView captionView = (TextView) postView.findViewById(R.id.view_post_caption); if (caption != null) { StringUtils.setTextLinks(captionView, caption, null); } else { captionView.setVisibility(View.GONE); } // Get description from feed item. This is longer description for // feed item. String description = post.getDescription(); TextView descriptionView = (TextView) postView.findViewById(R.id.view_post_description); if (description != null) { StringUtils.setTextLinks(descriptionView, description, null); } else { descriptionView.setVisibility(View.GONE); } // Convert created time to more readable format. String createdTime = post.getCreatedTime(); createdTime = StringUtils.convertFBTime(createdTime); TextView detailsView = (TextView) postView.findViewById(R.id.view_post_details); detailsView.setText( getResources() .getString( R.string.activity_feed_post_details, createdTime, post.getCommentsCount(), post.getLikesCount())); return postView; }