/** * {@inheritDoc} * * <p>Mark the current as unread. */ @Override protected void onPostLoadBody() { onMarkMessageAsRead(true); // Initialize star content description for accessibility Message message = getMessage(); setStarContentDescription(message.mFlagFavorite); }
/** Toggle favorite status and write back to provider */ private void onClickFavorite() { if (!isMessageOpen()) return; Message message = getMessage(); // Update UI boolean newFavorite = !message.mFlagFavorite; mFavoriteIcon.setImageDrawable(newFavorite ? mFavoriteIconOn : mFavoriteIconOff); // Handle accessibility event setStarContentDescription(newFavorite); mFavoriteIcon.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); // Update provider message.mFlagFavorite = newFavorite; getController().setMessageFavorite(message.mId, newFavorite); }