2008-11-01 17:32:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.activity;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-07-04 13:46:55 -04:00
|
|
|
import android.app.AlertDialog;
|
|
|
|
import android.app.Dialog;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.ContentResolver;
|
|
|
|
import android.content.Context;
|
2010-07-04 13:46:55 -04:00
|
|
|
import android.content.DialogInterface;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Parcelable;
|
|
|
|
import android.provider.OpenableColumns;
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.text.util.Rfc822Tokenizer;
|
|
|
|
import android.util.Log;
|
2010-07-04 13:46:55 -04:00
|
|
|
import android.view.KeyEvent;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.view.View.OnFocusChangeListener;
|
2009-12-09 22:16:42 -05:00
|
|
|
import android.view.Window;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.widget.AutoCompleteTextView.Validator;
|
2009-12-09 22:16:42 -05:00
|
|
|
import android.widget.*;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.*;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.controller.MessagingController;
|
|
|
|
import com.fsck.k9.controller.MessagingListener;
|
|
|
|
import com.fsck.k9.helper.Utility;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.*;
|
|
|
|
import com.fsck.k9.mail.Message.RecipientType;
|
|
|
|
import com.fsck.k9.mail.internet.*;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBody;
|
2010-01-28 01:25:10 -05:00
|
|
|
import java.io.File;
|
2009-12-09 22:16:42 -05:00
|
|
|
import java.io.Serializable;
|
2010-01-28 01:25:10 -05:00
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.net.URLDecoder;
|
2009-12-09 22:16:42 -05:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
2010-01-28 01:25:10 -05:00
|
|
|
import java.util.List;
|
2009-12-09 22:16:42 -05:00
|
|
|
import java.util.StringTokenizer;
|
2010-05-11 11:05:50 -04:00
|
|
|
import org.apache.james.mime4j.codec.EncoderUtil;
|
2009-12-09 22:16:42 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener
|
|
|
|
{
|
2010-07-04 13:46:55 -04:00
|
|
|
private static final int DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE = 1;
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
private static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY";
|
|
|
|
private static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL";
|
|
|
|
private static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD";
|
|
|
|
private static final String ACTION_EDIT_DRAFT = "com.fsck.k9.intent.action.EDIT_DRAFT";
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String EXTRA_ACCOUNT = "account";
|
|
|
|
private static final String EXTRA_FOLDER = "folder";
|
|
|
|
private static final String EXTRA_MESSAGE = "message";
|
|
|
|
|
|
|
|
private static final String STATE_KEY_ATTACHMENTS =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.attachments";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String STATE_KEY_CC_SHOWN =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.ccShown";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String STATE_KEY_BCC_SHOWN =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.bccShown";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String STATE_KEY_QUOTED_TEXT_SHOWN =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.quotedTextShown";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String STATE_KEY_SOURCE_MESSAGE_PROCED =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.stateKeySourceMessageProced";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String STATE_KEY_DRAFT_UID =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.draftUid";
|
2009-06-08 23:11:35 -04:00
|
|
|
private static final String STATE_IDENTITY_CHANGED =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.identityChanged";
|
2009-06-08 23:11:35 -04:00
|
|
|
private static final String STATE_IDENTITY =
|
2009-12-14 21:50:53 -05:00
|
|
|
"com.fsck.k9.activity.MessageCompose.identity";
|
2010-07-02 17:17:06 -04:00
|
|
|
private static final String STATE_IN_REPLY_TO = "com.fsck.k9.activity.MessageCompose.inReplyTo";
|
|
|
|
private static final String STATE_REFERENCES = "com.fsck.k9.activity.MessageCompose.references";
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private static final int MSG_PROGRESS_ON = 1;
|
|
|
|
private static final int MSG_PROGRESS_OFF = 2;
|
|
|
|
private static final int MSG_UPDATE_TITLE = 3;
|
|
|
|
private static final int MSG_SKIPPED_ATTACHMENTS = 4;
|
|
|
|
private static final int MSG_SAVED_DRAFT = 5;
|
|
|
|
private static final int MSG_DISCARDED_DRAFT = 6;
|
|
|
|
|
|
|
|
private static final int ACTIVITY_REQUEST_PICK_ATTACHMENT = 1;
|
2009-06-08 23:11:35 -04:00
|
|
|
private static final int ACTIVITY_CHOOSE_IDENTITY = 2;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private Account mAccount;
|
2010-03-03 23:00:30 -05:00
|
|
|
private Identity mIdentity;
|
2009-06-08 23:11:35 -04:00
|
|
|
private boolean mIdentityChanged = false;
|
|
|
|
private boolean mSignatureChanged = false;
|
2008-11-01 17:32:06 -04:00
|
|
|
private String mFolder;
|
|
|
|
private String mSourceMessageUid;
|
|
|
|
private Message mSourceMessage;
|
|
|
|
/**
|
|
|
|
* Indicates that the source message has been processed at least once and should not
|
|
|
|
* be processed on any subsequent loads. This protects us from adding attachments that
|
|
|
|
* have already been added from the restore of the view state.
|
|
|
|
*/
|
|
|
|
private boolean mSourceMessageProcessed = false;
|
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
|
|
|
|
private TextView mFromView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private MultiAutoCompleteTextView mToView;
|
|
|
|
private MultiAutoCompleteTextView mCcView;
|
|
|
|
private MultiAutoCompleteTextView mBccView;
|
|
|
|
private EditText mSubjectView;
|
2009-06-08 23:11:35 -04:00
|
|
|
private EditText mSignatureView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private EditText mMessageContentView;
|
|
|
|
private LinearLayout mAttachments;
|
|
|
|
private View mQuotedTextBar;
|
|
|
|
private ImageButton mQuotedTextDelete;
|
2009-06-08 23:11:35 -04:00
|
|
|
private EditText mQuotedText;
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-17 16:13:29 -05:00
|
|
|
private String mReferences;
|
|
|
|
private String mInReplyTo;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private boolean mDraftNeedsSaving = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The draft uid of this message. This is used when saving drafts so that the same draft is
|
|
|
|
* overwritten instead of being created anew. This property is null until the first save.
|
|
|
|
*/
|
|
|
|
private String mDraftUid;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Handler mHandler = new Handler()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void handleMessage(android.os.Message msg)
|
|
|
|
{
|
|
|
|
switch (msg.what)
|
|
|
|
{
|
|
|
|
case MSG_PROGRESS_ON:
|
|
|
|
setProgressBarIndeterminateVisibility(true);
|
|
|
|
break;
|
|
|
|
case MSG_PROGRESS_OFF:
|
|
|
|
setProgressBarIndeterminateVisibility(false);
|
|
|
|
break;
|
|
|
|
case MSG_UPDATE_TITLE:
|
|
|
|
updateTitle();
|
|
|
|
break;
|
|
|
|
case MSG_SKIPPED_ATTACHMENTS:
|
|
|
|
Toast.makeText(
|
|
|
|
MessageCompose.this,
|
|
|
|
getString(R.string.message_compose_attachments_skipped_toast),
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
break;
|
|
|
|
case MSG_SAVED_DRAFT:
|
|
|
|
Toast.makeText(
|
|
|
|
MessageCompose.this,
|
|
|
|
getString(R.string.message_saved_toast),
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
break;
|
|
|
|
case MSG_DISCARDED_DRAFT:
|
|
|
|
Toast.makeText(
|
|
|
|
MessageCompose.this,
|
|
|
|
getString(R.string.message_discarded_toast),
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
super.handleMessage(msg);
|
|
|
|
break;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
private Listener mListener = new Listener();
|
|
|
|
private EmailAddressAdapter mAddressAdapter;
|
|
|
|
private Validator mAddressValidator;
|
|
|
|
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class Attachment implements Serializable
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
public String name;
|
|
|
|
public String contentType;
|
|
|
|
public long size;
|
|
|
|
public Uri uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compose a new message using the given account. If account is null the default account
|
|
|
|
* will be used.
|
|
|
|
* @param context
|
|
|
|
* @param account
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
public static void actionCompose(Context context, Account account)
|
|
|
|
{
|
2010-06-07 20:45:07 -04:00
|
|
|
if (account == null)
|
|
|
|
{
|
|
|
|
account = Preferences.getPreferences(context).getDefaultAccount();
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
Intent i = new Intent(context, MessageCompose.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
2009-11-21 17:45:39 -05:00
|
|
|
context.startActivity(i);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compose a new message as a reply to the given message. If replyAll is true the function
|
|
|
|
* is reply all instead of simply reply.
|
|
|
|
* @param context
|
|
|
|
* @param account
|
|
|
|
* @param message
|
|
|
|
* @param replyAll
|
|
|
|
*/
|
|
|
|
public static void actionReply(
|
2009-11-21 17:45:39 -05:00
|
|
|
Context context,
|
|
|
|
Account account,
|
|
|
|
Message message,
|
2009-11-24 19:40:29 -05:00
|
|
|
boolean replyAll)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(context, MessageCompose.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
2008-11-01 17:32:06 -04:00
|
|
|
i.putExtra(EXTRA_FOLDER, message.getFolder().getName());
|
|
|
|
i.putExtra(EXTRA_MESSAGE, message.getUid());
|
2009-11-24 19:40:29 -05:00
|
|
|
if (replyAll)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
i.setAction(ACTION_REPLY_ALL);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
i.setAction(ACTION_REPLY);
|
|
|
|
}
|
|
|
|
context.startActivity(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compose a new message as a forward of the given message.
|
|
|
|
* @param context
|
|
|
|
* @param account
|
|
|
|
* @param message
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
public static void actionForward(Context context, Account account, Message message)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(context, MessageCompose.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
2008-11-01 17:32:06 -04:00
|
|
|
i.putExtra(EXTRA_FOLDER, message.getFolder().getName());
|
|
|
|
i.putExtra(EXTRA_MESSAGE, message.getUid());
|
|
|
|
i.setAction(ACTION_FORWARD);
|
|
|
|
context.startActivity(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Continue composition of the given message. This action modifies the way this Activity
|
|
|
|
* handles certain actions.
|
|
|
|
* Save will attempt to replace the message in the given folder with the updated version.
|
|
|
|
* Discard will delete the message from the given folder.
|
|
|
|
* @param context
|
|
|
|
* @param account
|
|
|
|
* @param folder
|
|
|
|
* @param message
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
public static void actionEditDraft(Context context, Account account, Message message)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(context, MessageCompose.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
2008-11-01 17:32:06 -04:00
|
|
|
i.putExtra(EXTRA_FOLDER, message.getFolder().getName());
|
|
|
|
i.putExtra(EXTRA_MESSAGE, message.getUid());
|
|
|
|
i.setAction(ACTION_EDIT_DRAFT);
|
|
|
|
context.startActivity(i);
|
|
|
|
}
|
|
|
|
|
2009-10-17 23:22:17 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onCreate(Bundle savedInstanceState)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
|
|
|
|
|
|
|
setContentView(R.layout.message_compose);
|
|
|
|
|
2009-12-27 12:22:44 -05:00
|
|
|
Intent intent = getIntent();
|
2010-03-03 23:00:30 -05:00
|
|
|
String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT);
|
|
|
|
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
2009-12-27 12:22:44 -05:00
|
|
|
|
|
|
|
if (mAccount == null)
|
|
|
|
{
|
|
|
|
mAccount = Preferences.getPreferences(this).getDefaultAccount();
|
|
|
|
}
|
|
|
|
if (mAccount == null)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* There are no accounts set up. This should not have happened. Prompt the
|
|
|
|
* user to set up an account as an acceptable bailout.
|
|
|
|
*/
|
|
|
|
startActivity(new Intent(this, Accounts.class));
|
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-22 23:19:12 -04:00
|
|
|
mAddressAdapter = EmailAddressAdapter.getInstance(this);
|
2008-11-01 17:32:06 -04:00
|
|
|
mAddressValidator = new EmailAddressValidator();
|
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
mFromView = (TextView)findViewById(R.id.from);
|
2008-11-01 17:32:06 -04:00
|
|
|
mToView = (MultiAutoCompleteTextView)findViewById(R.id.to);
|
|
|
|
mCcView = (MultiAutoCompleteTextView)findViewById(R.id.cc);
|
|
|
|
mBccView = (MultiAutoCompleteTextView)findViewById(R.id.bcc);
|
|
|
|
mSubjectView = (EditText)findViewById(R.id.subject);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
EditText upperSignature = (EditText)findViewById(R.id.upper_signature);
|
|
|
|
EditText lowerSignature = (EditText)findViewById(R.id.lower_signature);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mMessageContentView = (EditText)findViewById(R.id.message_content);
|
|
|
|
mAttachments = (LinearLayout)findViewById(R.id.attachments);
|
|
|
|
mQuotedTextBar = findViewById(R.id.quoted_text_bar);
|
|
|
|
mQuotedTextDelete = (ImageButton)findViewById(R.id.quoted_text_delete);
|
2009-06-08 23:11:35 -04:00
|
|
|
mQuotedText = (EditText)findViewById(R.id.quoted_text);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
TextWatcher watcher = new TextWatcher()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
public void beforeTextChanged(CharSequence s, int start,
|
2009-11-21 17:45:39 -05:00
|
|
|
int before, int after) { }
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public void onTextChanged(CharSequence s, int start,
|
2009-11-24 19:40:29 -05:00
|
|
|
int before, int count)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void afterTextChanged(android.text.Editable s) { }
|
|
|
|
};
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
TextWatcher sigwatcher = new TextWatcher()
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
public void beforeTextChanged(CharSequence s, int start,
|
2009-11-21 17:45:39 -05:00
|
|
|
int before, int after) { }
|
2009-06-08 23:11:35 -04:00
|
|
|
|
|
|
|
public void onTextChanged(CharSequence s, int start,
|
2009-11-24 19:40:29 -05:00
|
|
|
int before, int count)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
mSignatureChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void afterTextChanged(android.text.Editable s) { }
|
|
|
|
};
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mToView.addTextChangedListener(watcher);
|
|
|
|
mCcView.addTextChangedListener(watcher);
|
|
|
|
mBccView.addTextChangedListener(watcher);
|
|
|
|
mSubjectView.addTextChangedListener(watcher);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mMessageContentView.addTextChangedListener(watcher);
|
2009-11-10 19:45:19 -05:00
|
|
|
mQuotedText.addTextChangedListener(watcher);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We set this to invisible by default. Other methods will turn it back on if it's
|
|
|
|
* needed.
|
|
|
|
*/
|
|
|
|
mQuotedTextBar.setVisibility(View.GONE);
|
|
|
|
mQuotedText.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
mQuotedTextDelete.setOnClickListener(this);
|
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
mFromView.setVisibility(View.GONE);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mToView.setAdapter(mAddressAdapter);
|
|
|
|
mToView.setTokenizer(new Rfc822Tokenizer());
|
|
|
|
mToView.setValidator(mAddressValidator);
|
|
|
|
|
|
|
|
mCcView.setAdapter(mAddressAdapter);
|
|
|
|
mCcView.setTokenizer(new Rfc822Tokenizer());
|
|
|
|
mCcView.setValidator(mAddressValidator);
|
|
|
|
|
|
|
|
mBccView.setAdapter(mAddressAdapter);
|
|
|
|
mBccView.setTokenizer(new Rfc822Tokenizer());
|
|
|
|
mBccView.setValidator(mAddressValidator);
|
|
|
|
|
|
|
|
|
|
|
|
mSubjectView.setOnFocusChangeListener(this);
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (savedInstanceState != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* This data gets used in onCreate, so grab it here instead of onRestoreIntstanceState
|
|
|
|
*/
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
mSourceMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String action = intent.getAction();
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* Someone has clicked a mailto: link. The address is in the URI.
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
if (intent.getData() != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Uri uri = intent.getData();
|
2010-01-28 01:25:10 -05:00
|
|
|
if ("mailto".equals(uri.getScheme()))
|
|
|
|
{
|
|
|
|
initializeFromMailTo(uri.toString());
|
2010-04-29 00:59:14 -04:00
|
|
|
}
|
2010-01-28 01:25:10 -05:00
|
|
|
else
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-28 01:25:10 -05:00
|
|
|
String toText = uri.getSchemeSpecificPart();
|
|
|
|
if (toText != null)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-01-28 01:25:10 -05:00
|
|
|
mToView.setText(toText);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
2010-04-01 21:43:56 -04:00
|
|
|
//TODO: Use constant Intent.ACTION_SEND_MULTIPLE once we drop Android 1.5 support
|
2010-05-20 07:08:40 -04:00
|
|
|
else if (Intent.ACTION_SEND.equals(action)
|
2010-05-30 00:17:00 -04:00
|
|
|
|| Intent.ACTION_SENDTO.equals(action)
|
|
|
|
|| "android.intent.action.SEND_MULTIPLE".equals(action))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* Someone is trying to compose an email with an attachment, probably Pictures.
|
|
|
|
* The Intent should contain an EXTRA_STREAM with the data to attach.
|
|
|
|
*/
|
|
|
|
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (text != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mMessageContentView.setText(text);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
|
|
|
String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (subject != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mSubjectView.setText(subject);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
String type = intent.getType();
|
2010-04-01 21:43:56 -04:00
|
|
|
//TODO: Use constant Intent.ACTION_SEND_MULTIPLE once we drop Android 1.5 support
|
|
|
|
if ("android.intent.action.SEND_MULTIPLE".equals(action))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-02-12 10:21:10 -05:00
|
|
|
ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
|
|
|
if (list != null)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-02-12 10:21:10 -05:00
|
|
|
for (Parcelable parcelable : list)
|
|
|
|
{
|
|
|
|
Uri stream = (Uri) parcelable;
|
|
|
|
if (stream != null && type != null)
|
|
|
|
{
|
|
|
|
if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES))
|
|
|
|
{
|
|
|
|
addAttachment(stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
|
|
|
if (stream != null && type != null)
|
|
|
|
{
|
|
|
|
if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES))
|
|
|
|
{
|
|
|
|
addAttachment(stream);
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
2009-05-02 18:30:08 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* There might be an EXTRA_SUBJECT, EXTRA_TEXT, EXTRA_EMAIL, EXTRA_BCC or EXTRA_CC
|
|
|
|
*/
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-05-02 18:30:08 -04:00
|
|
|
String extraSubject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
|
|
|
|
String extraText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
2009-11-13 03:14:10 -05:00
|
|
|
|
|
|
|
mSubjectView.setText(extraSubject);
|
|
|
|
mMessageContentView.setText(extraText);
|
|
|
|
|
2009-05-02 18:30:08 -04:00
|
|
|
String[] extraEmail = intent.getStringArrayExtra(Intent.EXTRA_EMAIL);
|
|
|
|
String[] extraCc = intent.getStringArrayExtra(Intent.EXTRA_CC);
|
2009-11-13 03:14:10 -05:00
|
|
|
String[] extraBcc = intent.getStringArrayExtra(Intent.EXTRA_BCC);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-13 03:14:10 -05:00
|
|
|
String addressList;
|
2009-05-02 18:30:08 -04:00
|
|
|
// Cache array size, as per Google's recommendations.
|
|
|
|
int arraySize;
|
|
|
|
int i;
|
|
|
|
|
2009-11-13 03:14:10 -05:00
|
|
|
addressList = "";
|
2009-11-24 19:40:29 -05:00
|
|
|
if (extraEmail != null)
|
|
|
|
{
|
2009-05-02 18:30:08 -04:00
|
|
|
arraySize = extraEmail.length;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (i=0; i < arraySize; i++)
|
|
|
|
{
|
2009-11-18 19:42:27 -05:00
|
|
|
addressList += extraEmail[i]+", ";
|
2009-05-02 18:30:08 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
mToView.setText(addressList);
|
|
|
|
|
|
|
|
addressList = "";
|
2009-11-24 19:40:29 -05:00
|
|
|
if (extraCc != null)
|
|
|
|
{
|
2009-05-02 18:30:08 -04:00
|
|
|
arraySize = extraCc.length;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (i=0; i < arraySize; i++)
|
|
|
|
{
|
2009-11-18 19:42:27 -05:00
|
|
|
addressList += extraCc[i]+", ";
|
2009-05-02 18:30:08 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
mCcView.setText(addressList);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-05-02 18:30:08 -04:00
|
|
|
addressList = "";
|
2009-11-24 19:40:29 -05:00
|
|
|
if (extraBcc != null)
|
|
|
|
{
|
2009-11-13 03:14:10 -05:00
|
|
|
arraySize = extraBcc.length;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (i=0; i < arraySize; i++)
|
|
|
|
{
|
2009-11-18 19:42:27 -05:00
|
|
|
addressList += extraBcc[i]+", ";
|
2009-11-13 03:14:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
mBccView.setText(addressList);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mFolder = (String) intent.getStringExtra(EXTRA_FOLDER);
|
|
|
|
mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mIdentity == null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mIdentity = mAccount.getIdentity(0);
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mAccount.isSignatureBeforeQuotedText())
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
mSignatureView = upperSignature;
|
|
|
|
lowerSignature.setVisibility(View.GONE);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
mSignatureView = lowerSignature;
|
|
|
|
upperSignature.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
mSignatureView.addTextChangedListener(sigwatcher);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-02-08 12:47:00 -05:00
|
|
|
if (!mIdentity.getSignatureUse())
|
|
|
|
{
|
|
|
|
mSignatureView.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!mSourceMessageProcessed)
|
|
|
|
{
|
2009-11-16 15:47:27 -05:00
|
|
|
updateFrom();
|
|
|
|
updateSignature();
|
2009-05-13 20:03:19 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) || ACTION_FORWARD.equals(action) || ACTION_EDIT_DRAFT.equals(action))
|
|
|
|
{
|
2009-11-16 15:47:27 -05:00
|
|
|
/*
|
|
|
|
* If we need to load the message we add ourself as a message listener here
|
|
|
|
* so we can kick it off. Normally we add in onResume but we don't
|
|
|
|
* want to reload the message every time the activity is resumed.
|
|
|
|
* There is no harm in adding twice.
|
|
|
|
*/
|
|
|
|
MessagingController.getInstance(getApplication()).addListener(mListener);
|
2009-11-24 19:40:29 -05:00
|
|
|
MessagingController.getInstance(getApplication()).loadMessageForView(mAccount, mFolder, mSourceMessageUid, null);
|
2009-10-17 23:22:17 -04:00
|
|
|
}
|
2009-10-21 20:41:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!ACTION_EDIT_DRAFT.equals(action))
|
|
|
|
{
|
2009-11-16 15:47:27 -05:00
|
|
|
String bccAddress = mAccount.getAlwaysBcc();
|
|
|
|
if (bccAddress!=null
|
2009-11-24 19:40:29 -05:00
|
|
|
&& !"".equals(bccAddress))
|
|
|
|
{
|
2009-11-16 15:47:27 -05:00
|
|
|
addAddress(mBccView, new Address(mAccount.getAlwaysBcc(), ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid);
|
2009-11-24 19:40:29 -05:00
|
|
|
if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null)
|
|
|
|
{
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "Setting message ANSWERED flag to true");
|
2009-11-21 17:45:39 -05:00
|
|
|
// TODO: Really, we should wait until we send the message, but that would require saving the original
|
|
|
|
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
|
2009-11-29 11:55:35 -05:00
|
|
|
MessagingController.getInstance(getApplication()).setFlag(mAccount, mFolder, new String[] { mSourceMessageUid }, Flag.ANSWERED, true);
|
2009-11-16 15:47:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
updateTitle();
|
|
|
|
}
|
2009-09-16 23:43:02 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) || ACTION_EDIT_DRAFT.equals(action))
|
|
|
|
{
|
2009-10-17 23:22:17 -04:00
|
|
|
//change focus to message body.
|
|
|
|
mMessageContentView.requestFocus();
|
|
|
|
}
|
2009-11-16 15:47:27 -05:00
|
|
|
|
|
|
|
mDraftNeedsSaving = false;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onResume()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onResume();
|
|
|
|
MessagingController.getInstance(getApplication()).addListener(mListener);
|
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onPause()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onPause();
|
|
|
|
MessagingController.getInstance(getApplication()).removeListener(mListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The framework handles most of the fields, but we need to handle stuff that we
|
|
|
|
* dynamically show and hide:
|
|
|
|
* Attachment list,
|
|
|
|
* Cc field,
|
|
|
|
* Bcc field,
|
|
|
|
* Quoted text,
|
|
|
|
*/
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
protected void onSaveInstanceState(Bundle outState)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
ArrayList<Uri> attachments = new ArrayList<Uri>();
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
View view = mAttachments.getChildAt(i);
|
|
|
|
Attachment attachment = (Attachment) view.getTag();
|
|
|
|
attachments.add(attachment.uri);
|
|
|
|
}
|
|
|
|
outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, attachments);
|
|
|
|
outState.putBoolean(STATE_KEY_CC_SHOWN, mCcView.getVisibility() == View.VISIBLE);
|
|
|
|
outState.putBoolean(STATE_KEY_BCC_SHOWN, mBccView.getVisibility() == View.VISIBLE);
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
outState.putBoolean(STATE_KEY_QUOTED_TEXT_SHOWN, mQuotedTextBar.getVisibility() == View.VISIBLE);
|
2008-11-01 17:32:06 -04:00
|
|
|
outState.putBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, mSourceMessageProcessed);
|
|
|
|
outState.putString(STATE_KEY_DRAFT_UID, mDraftUid);
|
2009-06-08 23:11:35 -04:00
|
|
|
outState.putSerializable(STATE_IDENTITY, mIdentity);
|
|
|
|
outState.putBoolean(STATE_IDENTITY_CHANGED, mIdentityChanged);
|
2010-07-02 17:17:06 -04:00
|
|
|
outState.putString(STATE_IN_REPLY_TO, mInReplyTo);
|
|
|
|
outState.putString(STATE_REFERENCES, mReferences);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onRestoreInstanceState(savedInstanceState);
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
ArrayList<Parcelable> attachments = (ArrayList<Parcelable>) savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS);
|
2008-11-01 17:32:06 -04:00
|
|
|
mAttachments.removeAllViews();
|
2009-11-24 19:40:29 -05:00
|
|
|
for (Parcelable p : attachments)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Uri uri = (Uri) p;
|
|
|
|
addAttachment(uri);
|
|
|
|
}
|
|
|
|
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
mCcView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_CC_SHOWN) ? View.VISIBLE : View.GONE);
|
|
|
|
mBccView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_BCC_SHOWN) ? View.VISIBLE : View.GONE);
|
|
|
|
mQuotedTextBar.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ? View.VISIBLE : View.GONE);
|
|
|
|
mQuotedText.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ? View.VISIBLE : View.GONE);
|
2008-11-01 17:32:06 -04:00
|
|
|
mDraftUid = savedInstanceState.getString(STATE_KEY_DRAFT_UID);
|
2010-03-03 23:00:30 -05:00
|
|
|
mIdentity = (Identity)savedInstanceState.getSerializable(STATE_IDENTITY);
|
2009-06-08 23:11:35 -04:00
|
|
|
mIdentityChanged = savedInstanceState.getBoolean(STATE_IDENTITY_CHANGED);
|
2010-07-02 17:17:06 -04:00
|
|
|
mInReplyTo = savedInstanceState.getString(STATE_IN_REPLY_TO);
|
|
|
|
mReferences = savedInstanceState.getString(STATE_REFERENCES);
|
2009-06-08 23:11:35 -04:00
|
|
|
updateFrom();
|
|
|
|
updateSignature();
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void updateTitle()
|
|
|
|
{
|
|
|
|
if (mSubjectView.getText().length() == 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
setTitle(R.string.compose_title);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
setTitle(mSubjectView.getText().toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onFocusChange(View view, boolean focused)
|
|
|
|
{
|
|
|
|
if (!focused)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
updateTitle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void addAddresses(MultiAutoCompleteTextView view, Address[] addresses)
|
|
|
|
{
|
|
|
|
if (addresses == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
for (Address address : addresses)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddress(view, address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void addAddress(MultiAutoCompleteTextView view, Address address)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
view.append(address + ", ");
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private Address[] getAddresses(MultiAutoCompleteTextView view)
|
|
|
|
{
|
2009-05-31 21:55:39 -04:00
|
|
|
Address[] addresses = Address.parseUnencoded(view.getText().toString().trim());
|
2008-11-01 17:32:06 -04:00
|
|
|
return addresses;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private MimeMessage createMessage(boolean appendSig) throws MessagingException
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
MimeMessage message = new MimeMessage();
|
2009-09-25 15:12:37 -04:00
|
|
|
message.addSentDate(new Date());
|
2009-06-08 23:11:35 -04:00
|
|
|
Address from = new Address(mIdentity.getEmail(), mIdentity.getName());
|
2008-11-01 17:32:06 -04:00
|
|
|
message.setFrom(from);
|
|
|
|
message.setRecipients(RecipientType.TO, getAddresses(mToView));
|
|
|
|
message.setRecipients(RecipientType.CC, getAddresses(mCcView));
|
|
|
|
message.setRecipients(RecipientType.BCC, getAddresses(mBccView));
|
|
|
|
message.setSubject(mSubjectView.getText().toString());
|
2009-11-17 16:13:29 -05:00
|
|
|
message.setHeader("X-User-Agent", getString(R.string.message_header_mua));
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-06-20 08:48:22 -04:00
|
|
|
final String replyTo = mIdentity.getReplyTo();
|
|
|
|
if (replyTo != null)
|
|
|
|
{
|
|
|
|
message.setReplyTo(new Address[] { new Address(replyTo) });
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mInReplyTo != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
message.setInReplyTo(mInReplyTo);
|
2009-11-17 16:13:29 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mReferences != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
message.setReferences(mReferences);
|
2009-11-17 16:13:29 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build the Body that will contain the text of the message. We'll decide where to
|
|
|
|
* include it later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
String text = mMessageContentView.getText().toString();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (appendSig && mAccount.isSignatureBeforeQuotedText())
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
text = appendSignature(text);
|
|
|
|
}
|
2009-05-13 20:03:19 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mQuotedTextBar.getVisibility() == View.VISIBLE)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
text += "\n" + mQuotedText.getText().toString();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (appendSig && mAccount.isSignatureBeforeQuotedText() == false)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
text = appendSignature(text);
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
TextBody body = new TextBody(text);
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mAttachments.getChildCount() > 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* The message has attachments that need to be included. First we add the part
|
|
|
|
* containing the text that will be sent and then we include each attachment.
|
|
|
|
*/
|
|
|
|
|
|
|
|
MimeMultipart mp;
|
|
|
|
|
|
|
|
mp = new MimeMultipart();
|
|
|
|
mp.addBodyPart(new MimeBodyPart(body, "text/plain"));
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
|
2010-05-11 11:05:50 -04:00
|
|
|
|
|
|
|
MimeBodyPart bp = new MimeBodyPart(
|
2010-05-11 22:51:59 -04:00
|
|
|
new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
|
2010-05-11 11:05:50 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Correctly encode the filename here. Otherwise the whole
|
|
|
|
* header value (all parameters at once) will be encoded by
|
|
|
|
* MimeHeader.writeTo().
|
|
|
|
*/
|
|
|
|
bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"",
|
2010-05-11 22:51:59 -04:00
|
|
|
attachment.contentType,
|
|
|
|
EncoderUtil.encodeIfNecessary(attachment.name,
|
|
|
|
EncoderUtil.Usage.WORD_ENTITY, 7)));
|
2010-05-11 11:05:50 -04:00
|
|
|
|
2009-09-26 18:47:13 -04:00
|
|
|
bp.addHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
2010-05-11 11:05:50 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: Oh the joys of MIME...
|
2010-05-11 22:51:59 -04:00
|
|
|
*
|
2010-05-11 11:05:50 -04:00
|
|
|
* From RFC 2183 (The Content-Disposition Header Field):
|
|
|
|
* "Parameter values longer than 78 characters, or which
|
|
|
|
* contain non-ASCII characters, MUST be encoded as specified
|
|
|
|
* in [RFC 2184]."
|
2010-05-11 22:51:59 -04:00
|
|
|
*
|
2010-05-11 11:05:50 -04:00
|
|
|
* Example:
|
2010-05-11 22:51:59 -04:00
|
|
|
*
|
2010-05-11 11:05:50 -04:00
|
|
|
* Content-Type: application/x-stuff
|
|
|
|
* title*1*=us-ascii'en'This%20is%20even%20more%20
|
|
|
|
* title*2*=%2A%2A%2Afun%2A%2A%2A%20
|
|
|
|
* title*3="isn't it!"
|
|
|
|
*/
|
|
|
|
bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format(
|
2010-05-11 22:51:59 -04:00
|
|
|
"attachment;\n filename=\"%s\";\n size=%d",
|
|
|
|
attachment.name, attachment.size));
|
2010-05-11 11:05:50 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mp.addBodyPart(bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
message.setBody(mp);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* No attachments to include, just stick the text body in the message and call
|
|
|
|
* it good.
|
|
|
|
*/
|
|
|
|
message.setBody(body);
|
|
|
|
}
|
|
|
|
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private String appendSignature(String text)
|
|
|
|
{
|
2010-02-08 12:47:00 -05:00
|
|
|
if (mIdentity.getSignatureUse())
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2010-02-08 12:47:00 -05:00
|
|
|
String signature = mSignatureView.getText().toString();
|
|
|
|
|
|
|
|
if (signature != null && !signature.contentEquals(""))
|
|
|
|
{
|
|
|
|
text += "\n" + signature;
|
|
|
|
}
|
2009-05-13 20:03:19 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
return text;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void sendOrSaveMessage(boolean save)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* Create the message from all the data the user has entered.
|
|
|
|
*/
|
|
|
|
MimeMessage message;
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
message = createMessage(!save); // Only append sig on save
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Failed to create new message for send or save.", me);
|
2008-11-01 17:32:06 -04:00
|
|
|
throw new RuntimeException("Failed to create a new message for send or save.", me);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (save)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* Save a draft
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mDraftUid != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
message.setUid(mDraftUid);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (ACTION_EDIT_DRAFT.equals(getIntent().getAction()))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* We're saving a previously saved draft, so update the new message's uid
|
|
|
|
* to the old message's uid.
|
|
|
|
*/
|
|
|
|
message.setUid(mSourceMessageUid);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
String k9identity = Utility.base64Encode("" + mMessageContentView.getText().toString().length());
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mIdentityChanged || mSignatureChanged)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
String signature = mSignatureView.getText().toString();
|
2010-03-03 23:00:30 -05:00
|
|
|
k9identity += ":" + Utility.base64Encode(signature);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mIdentityChanged)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
|
|
|
|
String name = mIdentity.getName();
|
|
|
|
String email = mIdentity.getEmail();
|
|
|
|
|
|
|
|
k9identity += ":" + Utility.base64Encode(name) + ":" + Utility.base64Encode(email);
|
|
|
|
}
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "Saving identity: " + k9identity);
|
2009-12-14 21:50:53 -05:00
|
|
|
message.addHeader(K9.K9MAIL_IDENTITY, k9identity);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-03-03 23:00:30 -05:00
|
|
|
Message draftMessage = MessagingController.getInstance(getApplication()).saveDraft(mAccount, message);
|
|
|
|
mDraftUid = draftMessage.getUid();
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
// Don't display the toast if the user is just changing the orientation
|
2009-11-24 19:40:29 -05:00
|
|
|
if ((getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_SAVED_DRAFT);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
MessagingController.getInstance(getApplication()).sendMessage(mAccount, message, null);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mDraftUid != null)
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, mDraftUid);
|
|
|
|
mDraftUid = null;
|
2009-10-17 23:34:54 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void saveIfNeeded()
|
|
|
|
{
|
|
|
|
if (!mDraftNeedsSaving)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
sendOrSaveMessage(true);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onSend()
|
|
|
|
{
|
|
|
|
if (getAddresses(mToView).length == 0 && getAddresses(mCcView).length == 0 && getAddresses(mBccView).length == 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mToView.setError(getString(R.string.message_compose_error_no_recipients));
|
r62972@17h: jesse | 2009-05-07 10:49:32 -0400
First stab at a folderlist that doesn't know or care about messages
r62973@17h: jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h: jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h: jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h: jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h: jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h: jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h: jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h: jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h: jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h: jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h: jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h: jesse | 2009-05-07 15:18:04 -0400
move step 1
r62985@17h: jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h: jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h: jesse | 2009-05-07 17:38:02 -0400
checkpoint to move
r62988@17h: jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h: jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h: jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h: jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta"
r62992@17h: jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h: jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h: jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions
r62995@17h: jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h: jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h: jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h: jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h: jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h: jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h: jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h: jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h: jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h: jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h: jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h: jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h: jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h: jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml
r63071@17h: jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h: jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h: jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h: jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h: jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h: jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h: jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h: jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h: jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h: jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync
r63087@17h: jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h: jesse | 2009-05-11 02:58:31 -0400
now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h: jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h: jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h: jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h: jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header
r63184@17h: jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h: jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h: jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages" widget. it still needs an overhaul
r63296@17h: jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h: jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h: jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h: jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h: jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList
r63328@17h: jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h: jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h: jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h: jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h: jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h: jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h: jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h: jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h: jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h: jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h: jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h: jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h: jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h: jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h: jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h: jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h: jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h: jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h: jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h: jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h: jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h: jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h: jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message
r63558@17h: jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h: jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black
r63567@17h: jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h: jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h: jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h: jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h: jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h: jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h: jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h: jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h: jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h: jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h: jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h: jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h: jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h: jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h: jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h: jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h: jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h: jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h: jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h: jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h: jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h: jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
2009-05-31 21:35:05 -04:00
|
|
|
Toast.makeText(this, getString(R.string.message_compose_error_no_recipients), Toast.LENGTH_LONG).show();
|
2008-11-01 17:32:06 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
sendOrSaveMessage(false);
|
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onDiscard()
|
|
|
|
{
|
|
|
|
if (mDraftUid != null)
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
MessagingController.getInstance(getApplication()).deleteDraft(mAccount, mDraftUid);
|
|
|
|
mDraftUid = null;
|
2009-10-17 23:34:54 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_DISCARDED_DRAFT);
|
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onSave()
|
|
|
|
{
|
2009-11-16 15:47:27 -05:00
|
|
|
mDraftNeedsSaving = true;
|
2008-11-01 17:32:06 -04:00
|
|
|
saveIfNeeded();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onAddCcBcc()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mCcView.setVisibility(View.VISIBLE);
|
|
|
|
mBccView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Kick off a picker for whatever kind of MIME types we'll accept and let Android take over.
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onAddAttachment()
|
2010-05-02 14:24:33 -04:00
|
|
|
{
|
|
|
|
if (K9.isGalleryBuggy())
|
|
|
|
{
|
|
|
|
if (K9.useGalleryBugWorkaround())
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageCompose.this,
|
2010-05-11 22:51:59 -04:00
|
|
|
getString(R.string.message_compose_use_workaround),
|
|
|
|
Toast.LENGTH_LONG).show();
|
2010-05-02 14:24:33 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Toast.makeText(MessageCompose.this,
|
2010-05-11 22:51:59 -04:00
|
|
|
getString(R.string.message_compose_buggy_gallery),
|
|
|
|
Toast.LENGTH_LONG).show();
|
2010-05-02 14:24:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onAddAttachment2(K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Kick off a picker for the specified MIME type and let Android take over.
|
|
|
|
*/
|
|
|
|
private void onAddAttachment2(final String mime_type)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
|
|
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
2010-05-02 14:24:33 -04:00
|
|
|
i.setType(mime_type);
|
2008-11-01 17:32:06 -04:00
|
|
|
startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_ATTACHMENT);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void addAttachment(Uri uri)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAttachment(uri, -1, null);
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void addAttachment(Uri uri, int size, String name)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
ContentResolver contentResolver = getContentResolver();
|
|
|
|
|
|
|
|
Attachment attachment = new Attachment();
|
|
|
|
attachment.name = name;
|
|
|
|
attachment.size = size;
|
|
|
|
attachment.uri = uri;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (attachment.size == -1 || attachment.name == null)
|
|
|
|
{
|
|
|
|
Cursor metadataCursor = contentResolver.query(uri, new String[] { OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE }, null, null, null);
|
|
|
|
if (metadataCursor != null)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (metadataCursor.moveToFirst())
|
|
|
|
{
|
|
|
|
if (attachment.name == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachment.name = metadataCursor.getString(0);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (attachment.size == -1)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachment.size = metadataCursor.getInt(1);
|
2010-01-28 01:25:10 -05:00
|
|
|
Log.v(K9.LOG_TAG, "size: " + attachment.size);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
metadataCursor.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (attachment.name == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
attachment.name = uri.getLastPathSegment();
|
|
|
|
}
|
|
|
|
|
2009-11-16 15:51:34 -05:00
|
|
|
String contentType = contentResolver.getType(uri);
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (contentType == null)
|
|
|
|
{
|
2010-01-11 21:06:46 -05:00
|
|
|
contentType = MimeUtility.getMimeTypeByExtension(attachment.name);
|
2009-11-16 15:51:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
attachment.contentType = contentType;
|
|
|
|
|
2010-01-28 01:25:10 -05:00
|
|
|
if (attachment.size<=0)
|
|
|
|
{
|
|
|
|
String uriString = uri.toString();
|
|
|
|
if (uriString.startsWith("file://"))
|
|
|
|
{
|
|
|
|
Log.v(K9.LOG_TAG, uriString.substring("file://".length()));
|
|
|
|
File f = new File(uriString.substring("file://".length()));
|
|
|
|
attachment.size = f.length();
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
else
|
|
|
|
{
|
2010-01-28 01:25:10 -05:00
|
|
|
Log.v(K9.LOG_TAG, "Not a file: " + uriString);
|
|
|
|
}
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
else
|
|
|
|
{
|
2010-01-28 01:25:10 -05:00
|
|
|
Log.v(K9.LOG_TAG, "old attachment.size: " + attachment.size);
|
|
|
|
}
|
|
|
|
Log.v(K9.LOG_TAG, "new attachment.size: " + attachment.size);
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
View view = getLayoutInflater().inflate(R.layout.message_compose_attachment, mAttachments, false);
|
2008-11-01 17:32:06 -04:00
|
|
|
TextView nameView = (TextView)view.findViewById(R.id.attachment_name);
|
|
|
|
ImageButton delete = (ImageButton)view.findViewById(R.id.attachment_delete);
|
|
|
|
nameView.setText(attachment.name);
|
|
|
|
delete.setOnClickListener(this);
|
|
|
|
delete.setTag(view);
|
|
|
|
view.setTag(attachment);
|
|
|
|
mAttachments.addView(view);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
if (resultCode != RESULT_OK)
|
|
|
|
return;
|
2009-11-24 19:40:29 -05:00
|
|
|
if (data == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
switch (requestCode)
|
|
|
|
{
|
|
|
|
case ACTIVITY_REQUEST_PICK_ATTACHMENT:
|
|
|
|
|
|
|
|
addAttachment(data.getData());
|
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
break;
|
|
|
|
case ACTIVITY_CHOOSE_IDENTITY:
|
|
|
|
onIdentityChosen(data);
|
|
|
|
break;
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onIdentityChosen(Intent intent)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
Bundle bundle = intent.getExtras();;
|
2010-03-03 23:00:30 -05:00
|
|
|
switchToIdentity((Identity)bundle.getSerializable(ChooseIdentity.EXTRA_IDENTITY));
|
2009-08-29 18:40:52 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-03-03 23:00:30 -05:00
|
|
|
private void switchToIdentity(Identity identity)
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
2009-08-29 18:40:52 -04:00
|
|
|
mIdentity = identity;
|
|
|
|
mIdentityChanged = true;
|
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
updateFrom();
|
2009-11-21 17:45:39 -05:00
|
|
|
updateSignature();
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void updateFrom()
|
|
|
|
{
|
|
|
|
if (mIdentityChanged)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mFromView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
mFromView.setText(getString(R.string.message_view_from_format, mIdentity.getName(), mIdentity.getEmail()));
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void updateSignature()
|
|
|
|
{
|
2010-02-08 12:47:00 -05:00
|
|
|
if (mIdentity.getSignatureUse())
|
|
|
|
{
|
|
|
|
mSignatureView.setText(mIdentity.getSignature());
|
|
|
|
mSignatureView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mSignatureView.setVisibility(View.GONE);
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
public void onClick(View view)
|
|
|
|
{
|
|
|
|
switch (view.getId())
|
|
|
|
{
|
|
|
|
case R.id.attachment_delete:
|
|
|
|
/*
|
|
|
|
* The view is the delete button, and we have previously set the tag of
|
|
|
|
* the delete button to the view that owns it. We don't use parent because the
|
|
|
|
* view is very complex and could change in the future.
|
|
|
|
*/
|
|
|
|
mAttachments.removeView((View) view.getTag());
|
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
break;
|
|
|
|
case R.id.quoted_text_delete:
|
|
|
|
mQuotedTextBar.setVisibility(View.GONE);
|
|
|
|
mQuotedText.setVisibility(View.GONE);
|
|
|
|
mDraftNeedsSaving = true;
|
|
|
|
break;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onOptionsItemSelected(MenuItem item)
|
|
|
|
{
|
|
|
|
switch (item.getItemId())
|
|
|
|
{
|
|
|
|
case R.id.send:
|
|
|
|
onSend();
|
|
|
|
break;
|
|
|
|
case R.id.save:
|
|
|
|
onSave();
|
|
|
|
break;
|
|
|
|
case R.id.discard:
|
|
|
|
onDiscard();
|
|
|
|
break;
|
|
|
|
case R.id.add_cc_bcc:
|
|
|
|
onAddCcBcc();
|
|
|
|
break;
|
|
|
|
case R.id.add_attachment:
|
|
|
|
onAddAttachment();
|
|
|
|
break;
|
2010-05-02 14:24:33 -04:00
|
|
|
case R.id.add_attachment_image:
|
|
|
|
onAddAttachment2("image/*");
|
|
|
|
break;
|
|
|
|
case R.id.add_attachment_video:
|
|
|
|
onAddAttachment2("video/*");
|
|
|
|
break;
|
2009-11-24 19:40:29 -05:00
|
|
|
case R.id.choose_identity:
|
|
|
|
onChooseIdentity();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private void onChooseIdentity()
|
|
|
|
{
|
|
|
|
if (mAccount.getIdentities().size() > 1)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
Intent intent = new Intent(this, ChooseIdentity.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
intent.putExtra(ChooseIdentity.EXTRA_ACCOUNT, mAccount.getUuid());
|
2009-11-21 17:45:39 -05:00
|
|
|
startActivityForResult(intent, ACTIVITY_CHOOSE_IDENTITY);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
Toast.makeText(this, getString(R.string.no_identities),
|
2009-11-21 17:45:39 -05:00
|
|
|
Toast.LENGTH_LONG).show();
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public boolean onCreateOptionsMenu(Menu menu)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onCreateOptionsMenu(menu);
|
|
|
|
getMenuInflater().inflate(R.menu.message_compose_option, menu);
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-05-02 14:24:33 -04:00
|
|
|
/*
|
|
|
|
* Show the menu items "Add attachment (Image)" and "Add attachment (Video)"
|
2010-05-11 22:51:59 -04:00
|
|
|
* if the work-around for the Gallery bug is enabled (see Issue 1186).
|
2010-05-02 14:24:33 -04:00
|
|
|
*/
|
|
|
|
int found = 0;
|
|
|
|
for (int i = menu.size() - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
MenuItem item = menu.getItem(i);
|
|
|
|
int id = item.getItemId();
|
|
|
|
if ((id == R.id.add_attachment_image) ||
|
2010-05-11 22:51:59 -04:00
|
|
|
(id == R.id.add_attachment_video))
|
2010-05-02 14:24:33 -04:00
|
|
|
{
|
|
|
|
item.setVisible(K9.useGalleryBugWorkaround());
|
|
|
|
found++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We found all the menu items we were looking for. So stop here.
|
|
|
|
if (found == 2) break;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-04 13:46:55 -04:00
|
|
|
public void onBackPressed()
|
|
|
|
{
|
|
|
|
// This will be called either automatically for you on 2.0
|
|
|
|
// or later, or by the code above on earlier versions of the
|
|
|
|
// platform.
|
|
|
|
showDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Dialog onCreateDialog(int id)
|
|
|
|
{
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE:
|
|
|
|
return new AlertDialog.Builder(this)
|
2010-07-06 06:29:26 -04:00
|
|
|
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
|
|
|
|
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
|
|
|
|
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener()
|
|
|
|
{
|
|
|
|
public void onClick(DialogInterface dialog, int whichButton)
|
2010-07-04 13:46:55 -04:00
|
|
|
{
|
2010-07-06 06:29:26 -04:00
|
|
|
dismissDialog(1);
|
|
|
|
onSave();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener()
|
|
|
|
{
|
|
|
|
public void onClick(DialogInterface dialog, int whichButton)
|
2010-07-04 13:46:55 -04:00
|
|
|
{
|
2010-07-06 06:29:26 -04:00
|
|
|
dismissDialog(1);
|
|
|
|
onDiscard();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.create();
|
2010-07-04 13:46:55 -04:00
|
|
|
}
|
|
|
|
return super.onCreateDialog(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
|
|
{
|
|
|
|
if (
|
|
|
|
// TODO - when we move to android 2.0, uncomment this.
|
|
|
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
|
|
|
|
|
|
|
keyCode == KeyEvent.KEYCODE_BACK
|
|
|
|
&& event.getRepeatCount() == 0
|
|
|
|
&& K9.manageBack())
|
|
|
|
{
|
|
|
|
// Take care of calling this method on earlier versions of
|
|
|
|
// the platform where it doesn't exist.
|
|
|
|
onBackPressed();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
/**
|
|
|
|
* Returns true if all attachments were able to be attached, otherwise returns false.
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
private boolean loadAttachments(Part part, int depth) throws MessagingException
|
|
|
|
{
|
|
|
|
if (part.getBody() instanceof Multipart)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Multipart mp = (Multipart) part.getBody();
|
|
|
|
boolean ret = true;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (int i = 0, count = mp.getCount(); i < count; i++)
|
|
|
|
{
|
|
|
|
if (!loadAttachments(mp.getBodyPart(i), depth + 1))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
String contentType = MimeUtility.unfoldAndDecode(part.getContentType());
|
|
|
|
String name = MimeUtility.getHeaderParameter(contentType, "name");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (name != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
Body body = part.getBody();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (body != null && body instanceof LocalAttachmentBody)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
final Uri uri = ((LocalAttachmentBody) body).getContentUri();
|
2009-11-24 19:40:29 -05:00
|
|
|
mHandler.post(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAttachment(uri);
|
|
|
|
}
|
|
|
|
});
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pull out the parts of the now loaded source message and apply them to the new message
|
|
|
|
* depending on the type of message being composed.
|
|
|
|
* @param message
|
|
|
|
*/
|
2009-11-24 19:40:29 -05:00
|
|
|
private void processSourceMessage(Message message)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
String action = getIntent().getAction();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("re:"))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView.setText("Re: " + message.getSubject());
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView.setText(message.getSubject());
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If a reply-to was included with the message use that, otherwise use the from
|
|
|
|
* or sender address.
|
|
|
|
*/
|
|
|
|
Address[] replyToAddresses;
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getReplyTo().length > 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddresses(mToView, replyToAddresses = message.getReplyTo());
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddresses(mToView, replyToAddresses = message.getFrom());
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getMessageId() != null && message.getMessageId().length() > 0)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
String messageId = message.getMessageId();
|
|
|
|
mInReplyTo = messageId;
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getReferences() != null && message.getReferences().length > 0)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
StringBuffer buffy = new StringBuffer();
|
|
|
|
for (int i=0; i < message.getReferences().length; i++)
|
|
|
|
buffy.append(message.getReferences()[i]);
|
|
|
|
|
|
|
|
mReferences = buffy.toString() + " " + mInReplyTo;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mReferences = mInReplyTo;
|
2009-11-17 16:13:29 -05:00
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "could not get Message-ID.");
|
2009-11-17 16:13:29 -05:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
Part part = MimeUtility.findFirstPartByMimeType(mSourceMessage,
|
2009-11-21 17:45:39 -05:00
|
|
|
"text/plain");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part != null)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
String quotedText = String.format(
|
2009-11-21 17:45:39 -05:00
|
|
|
getString(R.string.message_compose_reply_header_fmt),
|
|
|
|
Address.toString(mSourceMessage.getFrom()));
|
|
|
|
|
2010-06-20 10:07:03 -04:00
|
|
|
final String prefix = mAccount.getQuotePrefix();
|
|
|
|
// "$" and "\" in the quote prefix have to be escaped for
|
|
|
|
// the replaceAll() invocation.
|
|
|
|
final String escapedPrefix = prefix.replaceAll("(\\\\|\\$)", "\\\\$1");
|
|
|
|
quotedText += MimeUtility.getTextFromPart(part).replaceAll(
|
2010-07-06 06:29:26 -04:00
|
|
|
"(?m)^", escapedPrefix);
|
2010-06-20 10:07:03 -04:00
|
|
|
|
2010-01-07 23:27:58 -05:00
|
|
|
quotedText = quotedText.replaceAll("\\\r", "");
|
2009-06-08 23:11:35 -04:00
|
|
|
mQuotedText.setText(quotedText);
|
|
|
|
|
|
|
|
mQuotedTextBar.setVisibility(View.VISIBLE);
|
|
|
|
mQuotedText.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ACTION_REPLY_ALL.equals(action) || ACTION_REPLY.equals(action))
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
Identity useIdentity = null;
|
2009-11-24 19:40:29 -05:00
|
|
|
for (Address address : message.getRecipients(RecipientType.TO))
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
Identity identity = mAccount.findIdentity(address);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (identity != null)
|
|
|
|
{
|
2009-08-29 18:40:52 -04:00
|
|
|
useIdentity = identity;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (useIdentity == null)
|
|
|
|
{
|
|
|
|
if (message.getRecipients(RecipientType.CC).length > 0)
|
|
|
|
{
|
|
|
|
for (Address address : message.getRecipients(RecipientType.CC))
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
Identity identity = mAccount.findIdentity(address);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (identity != null)
|
|
|
|
{
|
2009-08-29 18:40:52 -04:00
|
|
|
useIdentity = identity;
|
|
|
|
break;
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-08-29 18:40:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (useIdentity != null)
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
Identity defaultIdentity = mAccount.getIdentity(0);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (useIdentity != defaultIdentity)
|
|
|
|
{
|
2009-08-29 18:40:52 -04:00
|
|
|
switchToIdentity(useIdentity);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-08-29 18:40:52 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (ACTION_REPLY_ALL.equals(action))
|
|
|
|
{
|
|
|
|
for (Address address : message.getRecipients(RecipientType.TO))
|
|
|
|
{
|
|
|
|
if (!mAccount.isAnIdentity(address))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddress(mToView, address);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getRecipients(RecipientType.CC).length > 0)
|
|
|
|
{
|
|
|
|
for (Address address : message.getRecipients(RecipientType.CC))
|
|
|
|
{
|
|
|
|
if (!mAccount.isAnIdentity(address) && !Utility.arrayContains(replyToAddresses, address))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddress(mCcView, address);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
mCcView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* This really should not happen at this point but if it does it's okay.
|
|
|
|
* The user can continue composing their message.
|
|
|
|
*/
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (ACTION_FORWARD.equals(action))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("fwd:"))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView.setText("Fwd: " + message.getSubject());
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView.setText(message.getSubject());
|
|
|
|
}
|
|
|
|
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part == null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part != null)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
String quotedText = MimeUtility.getTextFromPart(part);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (quotedText != null)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
String text = String.format(
|
2009-11-21 17:45:39 -05:00
|
|
|
getString(R.string.message_compose_fwd_header_fmt),
|
|
|
|
mSourceMessage.getSubject(),
|
|
|
|
Address.toString(mSourceMessage.getFrom()),
|
|
|
|
Address.toString(
|
|
|
|
mSourceMessage.getRecipients(RecipientType.TO)),
|
|
|
|
Address.toString(
|
|
|
|
mSourceMessage.getRecipients(RecipientType.CC)));
|
2010-01-07 23:27:58 -05:00
|
|
|
quotedText = quotedText.replaceAll("\\\r", "");
|
2009-06-08 23:11:35 -04:00
|
|
|
text += quotedText;
|
|
|
|
mQuotedText.setText(text);
|
2008-11-01 17:32:06 -04:00
|
|
|
mQuotedTextBar.setVisibility(View.VISIBLE);
|
|
|
|
mQuotedText.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!mSourceMessageProcessed)
|
|
|
|
{
|
|
|
|
if (!loadAttachments(message, 0))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_SKIPPED_ATTACHMENTS);
|
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* This really should not happen at this point but if it does it's okay.
|
|
|
|
* The user can continue composing their message.
|
|
|
|
*/
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else if (ACTION_EDIT_DRAFT.equals(action))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
mDraftUid = message.getUid();
|
2008-11-01 17:32:06 -04:00
|
|
|
mSubjectView.setText(message.getSubject());
|
|
|
|
addAddresses(mToView, message.getRecipients(RecipientType.TO));
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getRecipients(RecipientType.CC).length > 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddresses(mCcView, message.getRecipients(RecipientType.CC));
|
|
|
|
mCcView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (message.getRecipients(RecipientType.BCC).length > 0)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
addAddresses(mBccView, message.getRecipients(RecipientType.BCC));
|
|
|
|
mBccView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-06-02 12:29:59 -04:00
|
|
|
// Read In-Reply-To header from draft
|
|
|
|
final String[] inReplyTo = message.getHeader("In-Reply-To");
|
|
|
|
if ((inReplyTo != null) && (inReplyTo.length >= 1))
|
|
|
|
{
|
|
|
|
mInReplyTo = inReplyTo[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read References header from draft
|
|
|
|
final String[] references = message.getHeader("References");
|
|
|
|
if ((references != null) && (references.length >= 1))
|
|
|
|
{
|
|
|
|
mReferences = references[0];
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (!mSourceMessageProcessed)
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
loadAttachments(message, 0);
|
|
|
|
}
|
|
|
|
Integer bodyLength = null;
|
2009-12-14 21:50:53 -05:00
|
|
|
String[] k9identities = message.getHeader(K9.K9MAIL_IDENTITY);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (k9identities != null && k9identities.length > 0)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
String k9identity = k9identities[0];
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (k9identity != null)
|
|
|
|
{
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "Got a saved identity: " + k9identity);
|
2009-11-21 17:45:39 -05:00
|
|
|
StringTokenizer tokens = new StringTokenizer(k9identity, ":", false);
|
|
|
|
|
|
|
|
String bodyLengthS = null;
|
|
|
|
String name = null;
|
|
|
|
String email = null;
|
|
|
|
String signature = null;
|
2010-03-03 23:00:30 -05:00
|
|
|
boolean signatureUse = message.getFolder().getAccount().getSignatureUse();
|
2009-11-24 19:40:29 -05:00
|
|
|
if (tokens.hasMoreTokens())
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
bodyLengthS = Utility.base64Decode(tokens.nextToken());
|
2009-11-24 19:40:29 -05:00
|
|
|
try
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
bodyLength = Integer.parseInt(bodyLengthS);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Unable to parse bodyLength '" + bodyLengthS + "'");
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (tokens.hasMoreTokens())
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
signatureUse = true;
|
2009-11-21 17:45:39 -05:00
|
|
|
signature = Utility.base64Decode(tokens.nextToken());
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (tokens.hasMoreTokens())
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
name = Utility.base64Decode(tokens.nextToken());
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (tokens.hasMoreTokens())
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
email = Utility.base64Decode(tokens.nextToken());
|
|
|
|
}
|
|
|
|
|
2010-03-03 23:00:30 -05:00
|
|
|
Identity newIdentity = new Identity();
|
|
|
|
newIdentity.setSignatureUse(signatureUse);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (signature != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setSignature(signature);
|
|
|
|
mSignatureChanged = true;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setSignature(mIdentity.getSignature());
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (name != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setName(name);
|
|
|
|
mIdentityChanged = true;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setName(mIdentity.getName());
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
if (email != null)
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setEmail(email);
|
|
|
|
mIdentityChanged = true;
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
newIdentity.setEmail(mIdentity.getEmail());
|
|
|
|
}
|
|
|
|
|
|
|
|
mIdentity = newIdentity;
|
|
|
|
|
|
|
|
updateSignature();
|
|
|
|
updateFrom();
|
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
2009-11-24 19:40:29 -05:00
|
|
|
if (part != null)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
String text = MimeUtility.getTextFromPart(part);
|
2009-11-24 19:40:29 -05:00
|
|
|
if (bodyLength != null && bodyLength + 1 < text.length()) // + 1 to get rid of the newline we added when saving the draft
|
|
|
|
{
|
2009-06-08 23:11:35 -04:00
|
|
|
String bodyText = text.substring(0, bodyLength);
|
|
|
|
String quotedText = text.substring(bodyLength + 1, text.length());
|
|
|
|
|
|
|
|
mMessageContentView.setText(bodyText);
|
|
|
|
mQuotedText.setText(quotedText);
|
|
|
|
|
|
|
|
mQuotedTextBar.setVisibility(View.VISIBLE);
|
|
|
|
mQuotedText.setVisibility(View.VISIBLE);
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-21 17:45:39 -05:00
|
|
|
mMessageContentView.setText(text);
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
}
|
|
|
|
catch (MessagingException me)
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mSourceMessageProcessed = true;
|
|
|
|
mDraftNeedsSaving = false;
|
|
|
|
}
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
class Listener extends MessagingListener
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void loadMessageForViewStarted(Account account, String folder, String uid)
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
if (mSourceMessageUid==null
|
2009-11-24 19:40:29 -05:00
|
|
|
|| !mSourceMessageUid.equals(uid))
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_PROGRESS_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void loadMessageForViewFinished(Account account, String folder, String uid, Message message)
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
if (mSourceMessageUid==null
|
2009-11-24 19:40:29 -05:00
|
|
|
|| !mSourceMessageUid.equals(uid))
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, final Message message)
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
if (mSourceMessageUid==null
|
2009-11-24 19:40:29 -05:00
|
|
|
|| !mSourceMessageUid.equals(uid))
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mSourceMessage = message;
|
2009-11-24 19:40:29 -05:00
|
|
|
runOnUiThread(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
processSourceMessage(message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void loadMessageForViewFailed(Account account, String folder, String uid, Throwable t)
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
if (mSourceMessageUid==null
|
2009-11-24 19:40:29 -05:00
|
|
|
|| !mSourceMessageUid.equals(uid))
|
|
|
|
{
|
2009-10-17 23:30:42 -04:00
|
|
|
return;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
|
|
|
|
// TODO show network error
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2009-11-24 19:40:29 -05:00
|
|
|
public void messageUidChanged(Account account, String folder, String oldUid, String newUid)
|
|
|
|
{
|
2010-03-03 23:00:30 -05:00
|
|
|
if (account.equals(mAccount) && folder.equals(mAccount.getDraftsFolderName()))
|
2009-11-24 19:40:29 -05:00
|
|
|
{
|
|
|
|
if (oldUid.equals(mDraftUid))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mDraftUid = newUid;
|
|
|
|
}
|
2010-03-03 23:00:30 -05:00
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-03-03 23:00:30 -05:00
|
|
|
if (account.equals(mAccount) && (folder.equals(mFolder)))
|
|
|
|
{
|
2009-11-24 19:40:29 -05:00
|
|
|
if (oldUid.equals(mSourceMessageUid))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSourceMessageUid = newUid;
|
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
if (mSourceMessage != null && (oldUid.equals(mSourceMessage.getUid())))
|
|
|
|
{
|
2008-11-01 17:32:06 -04:00
|
|
|
mSourceMessage.setUid(newUid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-01-28 01:25:10 -05:00
|
|
|
|
|
|
|
private String decode(String s)
|
2010-04-29 00:59:14 -04:00
|
|
|
throws UnsupportedEncodingException
|
2010-01-28 01:25:10 -05:00
|
|
|
{
|
|
|
|
return URLDecoder.decode(s, "UTF-8");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When we are launched with an intent that includes a mailto: URI, we can actually
|
|
|
|
* gather quite a few of our message fields from it.
|
2010-04-29 00:59:14 -04:00
|
|
|
*
|
2010-01-28 01:25:10 -05:00
|
|
|
* @mailToString the href (which must start with "mailto:").
|
|
|
|
*/
|
2010-04-29 00:59:14 -04:00
|
|
|
private void initializeFromMailTo(String mailToString)
|
|
|
|
{
|
|
|
|
|
2010-01-28 01:25:10 -05:00
|
|
|
// Chop up everything between mailto: and ? to find recipients
|
|
|
|
int index = mailToString.indexOf("?");
|
2010-04-29 00:59:14 -04:00
|
|
|
int length = "mailto".length() + 1;
|
2010-01-28 01:25:10 -05:00
|
|
|
String to;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Extract the recipient after mailto:
|
|
|
|
if (index == -1)
|
|
|
|
{
|
|
|
|
to = decode(mailToString.substring(length));
|
2010-04-29 00:59:14 -04:00
|
|
|
}
|
2010-01-28 01:25:10 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
to = decode(mailToString.substring(length, index));
|
|
|
|
}
|
|
|
|
mToView.setText(to);
|
2010-04-29 00:59:14 -04:00
|
|
|
}
|
2010-01-28 01:25:10 -05:00
|
|
|
catch (UnsupportedEncodingException e)
|
|
|
|
{
|
|
|
|
Log.e(K9.LOG_TAG, e.getMessage() + " while decoding '" + mailToString + "'");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extract the other parameters
|
|
|
|
|
|
|
|
// We need to disguise this string as a URI in order to parse it
|
|
|
|
Uri uri = Uri.parse("foo://" + mailToString);
|
|
|
|
|
|
|
|
String addressList;
|
|
|
|
|
|
|
|
addressList = "";
|
|
|
|
List<String> cc = uri.getQueryParameters("cc");
|
|
|
|
for (String address : cc)
|
|
|
|
{
|
|
|
|
addressList += address + ",";
|
|
|
|
}
|
|
|
|
mCcView.setText(addressList);
|
|
|
|
|
|
|
|
addressList = "";
|
|
|
|
List<String> bcc = uri.getQueryParameters("bcc");
|
|
|
|
for (String address : bcc)
|
|
|
|
{
|
|
|
|
addressList += address + ",";
|
|
|
|
}
|
|
|
|
mBccView.setText(addressList);
|
|
|
|
|
|
|
|
List<String> subject = uri.getQueryParameters("subject");
|
|
|
|
if (subject.size() > 0)
|
|
|
|
{
|
|
|
|
mSubjectView.setText(subject.get(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> body = uri.getQueryParameters("body");
|
|
|
|
if (body.size() > 0)
|
|
|
|
{
|
|
|
|
mMessageContentView.setText(body.get(0));
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|