@Override
  public void onResume() {
    super.onResume();
    if (mMoreButton != null) {
      mDefaultReplyAll =
          Preferences.getSharedPreferences(mContext)
              .getBoolean(Preferences.REPLY_ALL, Preferences.REPLY_ALL_DEFAULT);

      int replyVisibility = View.GONE;
      int replyAllVisibility = View.GONE;
      if (mEnableReplyForwardButtons) {
        replyVisibility = mDefaultReplyAll ? View.GONE : View.VISIBLE;
        replyAllVisibility = mDefaultReplyAll ? View.VISIBLE : View.GONE;
      }
      mReplyButton.setVisibility(replyVisibility);
      mReplyAllButton.setVisibility(replyAllVisibility);
    }
  }
  /**
   * Apply the auto-advance policy upon initation of a batch command that could potentially affect
   * the currently selected conversation.
   */
  @Override
  public void onAdvancingOpAccepted(Set<Long> affectedMessages) {
    if (!isMessageViewInstalled()) {
      // Do nothing if message view is not visible.
      return;
    }

    final MessageOrderManager orderManager = getMessageOrderManager();
    int autoAdvanceDir = Preferences.getPreferences(mActivity).getAutoAdvanceDirection();
    if ((autoAdvanceDir == Preferences.AUTO_ADVANCE_MESSAGE_LIST) || (orderManager == null)) {
      if (affectedMessages.contains(getMessageId())) {
        goBackToMailbox();
      }
      return;
    }

    // Navigate to the first unselected item in the appropriate direction.
    switch (autoAdvanceDir) {
      case Preferences.AUTO_ADVANCE_NEWER:
        while (affectedMessages.contains(orderManager.getCurrentMessageId())) {
          if (!orderManager.moveToNewer()) {
            goBackToMailbox();
            return;
          }
        }
        navigateToMessage(orderManager.getCurrentMessageId());
        break;

      case Preferences.AUTO_ADVANCE_OLDER:
        while (affectedMessages.contains(orderManager.getCurrentMessageId())) {
          if (!orderManager.moveToOlder()) {
            goBackToMailbox();
            return;
          }
        }
        navigateToMessage(orderManager.getCurrentMessageId());
        break;
    }
  }