protected void onConversationSeen() {
    LogUtils.d(LOG_TAG, "AbstractConversationViewFragment#onConversationSeen()");

    // Ignore unsafe calls made after a fragment is detached from an activity
    final ControllableActivity activity = (ControllableActivity) getActivity();
    if (activity == null) {
      LogUtils.w(LOG_TAG, "ignoring onConversationSeen for conv=%s", mConversation.id);
      return;
    }

    mViewState.setInfoForConversation(mConversation);

    LogUtils.d(
        LOG_TAG, "onConversationSeen() - mSuppressMarkingViewed = %b", mSuppressMarkingViewed);
    // In most circumstances we want to mark the conversation as viewed and read, since the
    // user has read it.  However, if the user has already marked the conversation unread, we
    // do not want a  later mark-read operation to undo this.  So we check this variable which
    // is set in #markUnread() which suppresses automatic mark-read.
    if (!mSuppressMarkingViewed) {
      // mark viewed/read if not previously marked viewed by this conversation view,
      // or if unread messages still exist in the message list cursor
      // we don't want to keep marking viewed on rotation or restore
      // but we do want future re-renders to mark read (e.g. "New message from X" case)
      final MessageCursor cursor = getMessageCursor();
      LogUtils.d(
          LOG_TAG,
          "onConversationSeen() - mConversation.isViewed() = %b, "
              + "cursor null = %b, cursor.isConversationRead() = %b",
          mConversation.isViewed(),
          cursor == null,
          cursor != null && cursor.isConversationRead());
      if (!mConversation.isViewed() || (cursor != null && !cursor.isConversationRead())) {
        // Mark the conversation viewed and read.
        activity
            .getConversationUpdater()
            .markConversationsRead(Arrays.asList(mConversation), true, true);

        // and update the Message objects in the cursor so the next time a cursor update
        // happens with these messages marked read, we know to ignore it
        if (cursor != null && !cursor.isClosed()) {
          cursor.markMessagesRead();
        }
      }
    }
    activity.getListHandler().onConversationSeen();
  }
  /*
   * Return the full View
   */
  public RemoteViews getStyledView(
      final CharSequence date,
      final Conversation conversation,
      final FolderUri folderUri,
      final int ignoreFolderType,
      final SpannableStringBuilder senders,
      final String filteredSubject) {

    final boolean isUnread = !conversation.read;
    final String snippet = conversation.getSnippet();
    final boolean hasAttachments = conversation.hasAttachments;

    // Add style to date
    final CharSequence styledDate = addStyle(date, DATE_FONT_SIZE, DATE_TEXT_COLOR);

    // Add style to subject
    final int subjectColor = isUnread ? SUBJECT_TEXT_COLOR_UNREAD : SUBJECT_TEXT_COLOR_READ;
    final SpannableStringBuilder subjectAndSnippet =
        new SpannableStringBuilder(
            Conversation.getSubjectAndSnippetForDisplay(mContext, filteredSubject, snippet));
    if (isUnread) {
      subjectAndSnippet.setSpan(
          new StyleSpan(Typeface.BOLD),
          0,
          filteredSubject.length(),
          Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    subjectAndSnippet.setSpan(
        new ForegroundColorSpan(subjectColor),
        0,
        subjectAndSnippet.length(),
        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    final CharSequence styledSubject = addStyle(subjectAndSnippet, SUBJECT_FONT_SIZE, 0);

    // Paper clip for attachment
    Bitmap paperclipBitmap = null;
    if (hasAttachments) {
      paperclipBitmap = ATTACHMENT;
    }

    // Inflate and fill out the remote view
    final RemoteViews remoteViews =
        new RemoteViews(mContext.getPackageName(), R.layout.widget_conversation_list_item);
    remoteViews.setTextViewText(R.id.widget_senders, senders);
    remoteViews.setTextViewText(R.id.widget_date, styledDate);
    remoteViews.setTextViewText(R.id.widget_subject, styledSubject);
    if (paperclipBitmap != null) {
      remoteViews.setViewVisibility(R.id.widget_attachment, View.VISIBLE);
      remoteViews.setImageViewBitmap(R.id.widget_attachment, paperclipBitmap);
    } else {
      remoteViews.setViewVisibility(R.id.widget_attachment, View.GONE);
    }
    if (isUnread) {
      remoteViews.setViewVisibility(R.id.widget_unread_background, View.VISIBLE);
      remoteViews.setViewVisibility(R.id.widget_read_background, View.GONE);
    } else {
      remoteViews.setViewVisibility(R.id.widget_unread_background, View.GONE);
      remoteViews.setViewVisibility(R.id.widget_read_background, View.VISIBLE);
    }
    if (mContext.getResources().getBoolean(R.bool.display_folder_colors_in_widget)) {
      mFolderDisplayer = new WidgetFolderDisplayer(mContext);
      mFolderDisplayer.loadConversationFolders(conversation, folderUri, ignoreFolderType);
      mFolderDisplayer.displayFolders(remoteViews);
    }

    return remoteViews;
  }
  // We need to do this here instead of in the fragment
  public void setConversationModeOptions(Menu menu) {
    if (mCurrentConversation == null) {
      return;
    }
    final boolean showMarkImportant = !mCurrentConversation.isImportant();
    Utils.setMenuItemVisibility(
        menu,
        R.id.mark_important,
        showMarkImportant
            && mAccount.supportsCapability(UIProvider.AccountCapabilities.MARK_IMPORTANT));
    Utils.setMenuItemVisibility(
        menu,
        R.id.mark_not_important,
        !showMarkImportant
            && mAccount.supportsCapability(UIProvider.AccountCapabilities.MARK_IMPORTANT));
    final boolean showDelete =
        mFolder != null && mFolder.supportsCapability(UIProvider.FolderCapabilities.DELETE);
    Utils.setMenuItemVisibility(menu, R.id.delete, showDelete);
    // We only want to show the discard drafts menu item if we are not showing the delete menu
    // item, and the current folder is a draft folder and the account supports discarding
    // drafts for a conversation
    final boolean showDiscardDrafts =
        !showDelete
            && mFolder != null
            && mFolder.isDraft()
            && mAccount.supportsCapability(AccountCapabilities.DISCARD_CONVERSATION_DRAFTS);
    Utils.setMenuItemVisibility(menu, R.id.discard_drafts, showDiscardDrafts);
    final boolean archiveVisible =
        mAccount.supportsCapability(AccountCapabilities.ARCHIVE)
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.ARCHIVE)
            && !mFolder.isTrash();
    Utils.setMenuItemVisibility(menu, R.id.archive, archiveVisible);
    Utils.setMenuItemVisibility(
        menu,
        R.id.remove_folder,
        !archiveVisible
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES)
            && !mFolder.isProviderFolder()
            && mAccount.supportsCapability(AccountCapabilities.ARCHIVE));
    Utils.setMenuItemVisibility(
        menu,
        R.id.move_to,
        mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.ALLOWS_REMOVE_CONVERSATION));
    Utils.setMenuItemVisibility(
        menu,
        R.id.move_to_inbox,
        mFolder != null && mFolder.supportsCapability(FolderCapabilities.ALLOWS_MOVE_TO_INBOX));

    final MenuItem removeFolder = menu.findItem(R.id.remove_folder);
    if (mFolder != null && removeFolder != null) {
      removeFolder.setTitle(
          mActivity.getApplicationContext().getString(R.string.remove_folder, mFolder.name));
    }
    Utils.setMenuItemVisibility(
        menu,
        R.id.report_spam,
        mAccount.supportsCapability(AccountCapabilities.REPORT_SPAM)
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.REPORT_SPAM)
            && !mCurrentConversation.spam);
    Utils.setMenuItemVisibility(
        menu,
        R.id.mark_not_spam,
        mAccount.supportsCapability(AccountCapabilities.REPORT_SPAM)
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.MARK_NOT_SPAM)
            && mCurrentConversation.spam);
    Utils.setMenuItemVisibility(
        menu,
        R.id.report_phishing,
        mAccount.supportsCapability(AccountCapabilities.REPORT_PHISHING)
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.REPORT_PHISHING)
            && !mCurrentConversation.phishing);
    Utils.setMenuItemVisibility(
        menu,
        R.id.mute,
        mAccount.supportsCapability(AccountCapabilities.MUTE)
            && mFolder != null
            && mFolder.supportsCapability(FolderCapabilities.DESTRUCTIVE_MUTE)
            && !mCurrentConversation.muted);
  }