Example #1
0
  /**
   * Shows the 'Reply to ...' editor.
   *
   * @param post
   */
  private void showPostEditor(final Post post) {
    final EditText view = new EditText(this);
    view.setSingleLine(false);
    view.setLines(4);
    view.setMinLines(4);
    view.setMaxLines(4);

    new AlertDialog.Builder(this)
        .setTitle(post == null ? "New Post" : "Reply to @" + post.getAuthor())
        .setView(view)
        .setMessage(post == null ? null : post.getText())
        .setPositiveButton(
            "Post",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();

                final String id = (post != null) ? post.getId() : null;
                new AddPostTask(id, myStreamPostsAdapter, accessToken)
                    .execute(view.getText().toString());
              }
            })
        .setNegativeButton(
            "Cancel",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
              }
            })
        .show();
  }
Example #2
0
 @Override
 public String toString() {
   return MessageFormat.format(type.getMessageFormat(), post.getAuthor());
 }