Exemple #1
0
 private void onDownloadRemainder() {
   if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
     return;
   }
   mMessageView.downloadRemainderButton().setEnabled(false);
   mController.loadMessageForViewRemote(
       mAccount, mMessageReference.folderName, mMessageReference.uid, mListener);
 }
Exemple #2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.message, container, false);

    mMessageView = (SingleMessageView) view.findViewById(R.id.message_view);

    // set a callback for the attachment view. With this callback the attachmentview
    // request the start of a filebrowser activity.
    mMessageView.setAttachmentCallback(
        new AttachmentFileDownloadCallback() {

          @Override
          public void showFileBrowser(final AttachmentView caller) {
            FileBrowserHelper.getInstance()
                .showFileBrowserActivity(
                    MessageViewFragment.this, null, ACTIVITY_CHOOSE_DIRECTORY, callback);
            attachmentTmpStore = caller;
          }

          FileBrowserFailOverCallback callback =
              new FileBrowserFailOverCallback() {

                @Override
                public void onPathEntered(String path) {
                  attachmentTmpStore.writeFile(new File(path));
                }

                @Override
                public void onCancel() {
                  // canceled, do nothing
                }
              };
        });

    mMessageView.initialize(this);
    mMessageView.downloadRemainderButton().setOnClickListener(this);

    mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());

    return view;
  }
Exemple #3
0
 // This REALLY should be in MessageCryptoView
 @Override
 public void onDecryptDone(PgpData pgpData) {
   Account account = mAccount;
   LocalMessage message = (LocalMessage) mMessage;
   MessagingController controller = mController;
   Listener listener = mListener;
   try {
     mMessageView.setMessage(account, message, pgpData, controller, listener);
   } catch (MessagingException e) {
     Log.e(K9.LOG_TAG, "displayMessageBody failed", e);
   }
 }
Exemple #4
0
 public void onFlag() {
   if (mMessage != null) {
     boolean newState = !mMessage.isSet(Flag.FLAGGED);
     mController.setFlag(
         mAccount,
         mMessage.getFolder().getName(),
         new Message[] {mMessage},
         Flag.FLAGGED,
         newState);
     mMessageView.setHeaders(mMessage, mAccount);
   }
 }
Exemple #5
0
  private void displayMessage(MessageReference ref, boolean resetPgpData) {
    mMessageReference = ref;
    if (K9.DEBUG) {
      Log.d(K9.LOG_TAG, "MessageView displaying message " + mMessageReference);
    }

    Context appContext = getActivity().getApplicationContext();
    mAccount = Preferences.getPreferences(appContext).getAccount(mMessageReference.accountUuid);

    if (resetPgpData) {
      // start with fresh, empty PGP data
      mPgpData = new PgpData();
    }

    // Clear previous message
    mMessageView.resetView();
    mMessageView.resetHeaderView();

    mController.loadMessageForView(
        mAccount, mMessageReference.folderName, mMessageReference.uid, mListener);
    configureMenu(mMenu);
  }
Exemple #6
0
 private void onToggleRead() {
   if (mMessage != null) {
     mController.setFlag(
         mAccount,
         mMessage.getFolder().getName(),
         new Message[] {mMessage},
         Flag.SEEN,
         !mMessage.isSet(Flag.SEEN));
     mMessageView.setHeaders(mMessage, mAccount);
     String subject = mMessage.getSubject();
     displayMessageSubject(subject);
     updateUnreadToggleTitle();
   }
 }
Exemple #7
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.delete:
       onDelete();
       break;
     case R.id.reply:
       onReply();
       break;
     case R.id.reply_all:
       onReplyAll();
       break;
     case R.id.forward:
       onForward();
       break;
     case R.id.share:
       onSendAlternate();
       break;
     case R.id.toggle_unread:
       onToggleRead();
       break;
     case R.id.archive:
       onRefile(mAccount.getArchiveFolderName());
       break;
     case R.id.spam:
       onRefile(mAccount.getSpamFolderName());
       break;
     case R.id.move:
       onMove();
       break;
     case R.id.copy:
       onCopy();
       break;
     case R.id.select_text:
       mMessageView.beginSelectingText();
       break;
     case R.id.toggle_message_view_theme:
       onToggleColors();
       break;
     default:
       return super.onOptionsItemSelected(item);
   }
   return true;
 }
Exemple #8
0
 public void zoom(KeyEvent event) {
   mMessageView.zoom(event);
 }