/** Displays the per-Post context menu. Typically triggered by a long click on a post. */ private void showPostContextMenu(final Post post) { final ArrayAdapter<PostAction> actions = new ArrayAdapter<PostAction>(this, android.R.layout.simple_list_item_1); for (PostActionType actionType : PostActionType.values()) { if (actionType.appearsInContextMenuFor(post)) { actions.add(new PostAction(actionType, post)); } } new AlertDialog.Builder(this) .setAdapter(actions, new OnLongClickPostMenuListener(actions)) .show(); }
@Override public String toString() { return MessageFormat.format(type.getMessageFormat(), post.getAuthor()); }