@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = super.onCreateView(inflater, container, savedInstanceState);

    mFavoriteIcon = (ImageView) UiUtilities.getView(view, R.id.favorite);
    mReplyButton = UiUtilities.getView(view, R.id.reply);
    mReplyAllButton = UiUtilities.getView(view, R.id.reply_all);
    mForwardButton = UiUtilities.getViewOrNull(view, R.id.forward);
    mMeetingYes = UiUtilities.getView(view, R.id.accept);
    mMeetingMaybe = UiUtilities.getView(view, R.id.maybe);
    mMeetingNo = UiUtilities.getView(view, R.id.decline);
    mMoreButton = UiUtilities.getViewOrNull(view, R.id.more);

    mFavoriteIcon.setOnClickListener(this);
    mReplyButton.setOnClickListener(this);
    mReplyAllButton.setOnClickListener(this);
    if (mMoreButton != null) {
      mMoreButton.setOnClickListener(this);
    }
    if (mForwardButton != null) {
      mForwardButton.setOnClickListener(this);
    }
    mMeetingYes.setOnClickListener(this);
    mMeetingMaybe.setOnClickListener(this);
    mMeetingNo.setOnClickListener(this);
    UiUtilities.getView(view, R.id.invite_link).setOnClickListener(this);

    enableReplyForwardButtons(false);

    return view;
  }
  @Override
  protected void onMessageShown(long messageId, Mailbox mailbox) {
    super.onMessageShown(messageId, mailbox);

    Account account = Account.restoreAccountWithId(mContext, getAccountId());
    boolean supportsMove = account.supportsMoveMessages(mContext) && mailbox.canHaveMessagesMoved();
    if (mSupportsMove != supportsMove) {
      mSupportsMove = supportsMove;
      Activity host = getActivity();
      if (host != null) {
        host.invalidateOptionsMenu();
      }
    }

    // Disable forward/reply buttons as necessary.
    enableReplyForwardButtons(Mailbox.isMailboxTypeReplyAndForwardable(mailbox.mType));
  }