/** * Create a new instance with initialization parameters. * * <p>This fragment should be created only with this method. (Arguments should always be set.) * * @param messageId ID of the message to open */ public static MessageViewFragment newInstance(long messageId) { if (messageId == Message.NO_MESSAGE) { throw new IllegalArgumentException(); } final MessageViewFragment instance = new MessageViewFragment(); final Bundle args = new Bundle(); args.putLong(ARG_MESSAGE_ID, messageId); instance.setArguments(args); return instance; }
@Override protected void installMessageViewFragment(MessageViewFragment fragment) { super.installMessageViewFragment(fragment); if (isMessageListInstalled()) { getMessageListFragment().setSelectedMessage(fragment.getMessageId()); } }
/** * Show a message on the message view. * * @param ft {@link FragmentTransaction} to use. * @param messageId ID of the mailbox to load. Must never be {@link Message#NO_MESSAGE}. */ private void updateMessageView(FragmentTransaction ft, long messageId) { if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { Log.d(Logging.LOG_TAG, this + " updateMessageView messageId=" + messageId); } if (messageId == Message.NO_MESSAGE) { throw new IllegalArgumentException(); } if (messageId == getMessageId()) { return; // nothing to do. } removeMessageViewFragment(ft); ft.add(mThreePane.getRightPaneId(), MessageViewFragment.newInstance(messageId)); }