Example #1
0
 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;
       }
   }
 }
Example #2
0
  @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();
  }
Example #3
0
  private void showMessageList() {
    mMessageListWasDisplayed = true;
    mDisplayMode = DisplayMode.MESSAGE_LIST;
    mViewSwitcher.showFirstView();

    mMessageListFragment.setActiveMessage(null);

    showDefaultTitleView();
    configureMenu(mMenu);
  }
Example #4
0
  private void showMessageViewPlaceHolder() {
    removeMessageViewFragment();

    // Add placeholder view if necessary
    if (mMessageViewPlaceHolder.getParent() == null) {
      mMessageViewContainer.addView(mMessageViewPlaceHolder);
    }

    mMessageListFragment.setActiveMessage(null);
  }