use of com.fsck.k9.Account in project k-9 by k9mail.
the class MessageList method showThread.
@Override
public void showThread(Account account, String folderName, long threadRootId) {
showMessageViewPlaceHolder();
LocalSearch tmpSearch = new LocalSearch();
tmpSearch.addAccountUuid(account.getUuid());
tmpSearch.and(SearchField.THREAD_ID, String.valueOf(threadRootId), Attribute.EQUALS);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, true, false);
addMessageListFragment(fragment, true);
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class MessageList method openMessage.
@Override
public void openMessage(MessageReference messageReference) {
Preferences prefs = Preferences.getPreferences(getApplicationContext());
Account account = prefs.getAccount(messageReference.getAccountUuid());
String folderName = messageReference.getFolderName();
if (folderName.equals(account.getDraftsFolderName())) {
MessageActions.actionEditDraft(this, messageReference);
} else {
mMessageViewContainer.removeView(mMessageViewPlaceHolder);
if (mMessageListFragment != null) {
mMessageListFragment.setActiveMessage(messageReference);
}
MessageViewFragment fragment = MessageViewFragment.newInstance(messageReference);
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.message_view_container, fragment);
mMessageViewFragment = fragment;
ft.commit();
if (mDisplayMode != DisplayMode.SPLIT_VIEW) {
showMessageView();
}
}
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class EditIdentity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mIdentity = (Identity) getIntent().getSerializableExtra(EXTRA_IDENTITY);
mIdentityIndex = getIntent().getIntExtra(EXTRA_IDENTITY_INDEX, -1);
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
if (mIdentityIndex == -1) {
mIdentity = new Identity();
}
setContentView(R.layout.edit_identity);
/*
* If we're being reloaded we override the original account with the one
* we saved
*/
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_IDENTITY)) {
mIdentity = (Identity) savedInstanceState.getSerializable(EXTRA_IDENTITY);
}
mDescriptionView = (EditText) findViewById(R.id.description);
mDescriptionView.setText(mIdentity.getDescription());
mNameView = (EditText) findViewById(R.id.name);
mNameView.setText(mIdentity.getName());
mEmailView = (EditText) findViewById(R.id.email);
mEmailView.setText(mIdentity.getEmail());
mReplyTo = (EditText) findViewById(R.id.reply_to);
mReplyTo.setText(mIdentity.getReplyTo());
// mAccountAlwaysBcc = (EditText)findViewById(R.id.bcc);
// mAccountAlwaysBcc.setText(mIdentity.getAlwaysBcc());
mSignatureLayout = (LinearLayout) findViewById(R.id.signature_layout);
mSignatureUse = (CheckBox) findViewById(R.id.signature_use);
mSignatureView = (EditText) findViewById(R.id.signature);
mSignatureUse.setChecked(mIdentity.getSignatureUse());
mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mSignatureLayout.setVisibility(View.VISIBLE);
mSignatureView.setText(mIdentity.getSignature());
} else {
mSignatureLayout.setVisibility(View.GONE);
}
}
});
if (mSignatureUse.isChecked()) {
mSignatureView.setText(mIdentity.getSignature());
} else {
mSignatureLayout.setVisibility(View.GONE);
}
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class EmailProviderTest method query_forThreadedMessages_showsThreadOfEmailWithSameSendTimeOnce.
@Test
public void query_forThreadedMessages_showsThreadOfEmailWithSameSendTimeOnce() throws MessagingException {
Account account = Preferences.getPreferences(getContext()).newAccount();
account.getUuid();
account.getLocalStore().getFolder("Inbox").appendMessages(Collections.singletonList(message));
account.getLocalStore().getFolder("Inbox").appendMessages(Collections.singletonList(replyAtSameTime));
Cursor cursor = getProvider().query(Uri.parse("content://" + EmailProvider.AUTHORITY + "/account/" + account.getUuid() + "/messages/threaded"), new String[] { EmailProvider.MessageColumns.ID, EmailProvider.MessageColumns.FOLDER_ID, EmailProvider.ThreadColumns.ROOT, EmailProvider.MessageColumns.SUBJECT, EmailProvider.MessageColumns.DATE, EmailProvider.SpecialColumns.THREAD_COUNT }, "", new String[] {}, EmailProvider.MessageColumns.DATE + " DESC");
assertNotNull(cursor);
assertTrue(cursor.moveToFirst());
assertEquals(2, cursor.getInt(5));
assertFalse(cursor.moveToNext());
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class EmailProviderTest method query_forMessagesWithAccountAndWithoutRequiredFields_throwsIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void query_forMessagesWithAccountAndWithoutRequiredFields_throwsIllegalArgumentException() {
Account account = Preferences.getPreferences(getContext()).newAccount();
account.getUuid();
Cursor cursor = getProvider().query(Uri.parse("content://" + EmailProvider.AUTHORITY + "/account/" + account.getUuid() + "/messages"), new String[] {}, "", new String[] {}, "");
assertNotNull(cursor);
assertTrue(cursor.isAfterLast());
}
Aggregations