private void displayViews() { switch (mDisplayMode) { case MESSAGE_LIST: { showMessageList(); break; } case MESSAGE_VIEW: { showMessageView(); break; } case SPLIT_VIEW: { mMessageListWasDisplayed = true; if (mMessageViewFragment == null) { showMessageViewPlaceHolder(); } else { MessageReference activeMessage = mMessageViewFragment.getMessageReference(); if (activeMessage != null) { mMessageListFragment.setActiveMessage(activeMessage); } } break; } } }
@Override public void openMessage(MessageReference messageReference) { Preferences prefs = Preferences.getPreferences(getApplicationContext()); Account account = prefs.getAccount(messageReference.accountUuid); String folderName = messageReference.folderName; if (folderName.equals(account.getDraftsFolderName())) { MessageCompose.actionEditDraft(this, messageReference); } else { mMessageViewContainer.removeView(mMessageViewPlaceHolder); MessageViewFragment fragment = MessageViewFragment.newInstance(messageReference); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.message_view_container, fragment); mMessageViewFragment = fragment; ft.commit(); if (mDisplayMode == DisplayMode.SPLIT_VIEW) { mMessageListFragment.setActiveMessage(messageReference); } else { showMessageView(); } } invalidateOptionsMenu(); }
private void showMessageList() { mMessageListWasDisplayed = true; mDisplayMode = DisplayMode.MESSAGE_LIST; mViewSwitcher.showFirstView(); mMessageListFragment.setActiveMessage(null); showDefaultTitleView(); configureMenu(mMenu); }
private void showMessageViewPlaceHolder() { removeMessageViewFragment(); // Add placeholder view if necessary if (mMessageViewPlaceHolder.getParent() == null) { mMessageViewContainer.addView(mMessageViewPlaceHolder); } mMessageListFragment.setActiveMessage(null); }