1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 17:18:50 -05:00

Refactored intent constant classes

This commit is contained in:
Bao-Long Nguyen-Trong 2009-10-20 05:27:06 +00:00
parent 7323fe67fd
commit 4ffe75fa85
3 changed files with 26 additions and 23 deletions

View File

@ -166,6 +166,22 @@ public class Email extends Application {
public static final int FLAGGED_COLOR = 0xff4444;
public class Intents {
public class EmailReceived {
public static final String ACTION_EMAIL_RECEIVED = "com.android.email.intent.action.EMAIL_RECEIVED";
public static final String EXTRA_ACCOUNT = "com.android.email.intent.extra.ACCOUNT";
public static final String EXTRA_FOLDER = "com.android.email.intent.extra.FOLDER";
public static final String EXTRA_SENT_DATE = "com.android.email.intent.extra.SENT_DATE";
public static final String EXTRA_FROM = "com.android.email.intent.extra.FROM";
public static final String EXTRA_TO = "com.android.email.intent.extra.TO";
public static final String EXTRA_CC = "com.android.email.intent.extra.CC";
public static final String EXTRA_BCC = "com.android.email.intent.extra.BCC";
public static final String EXTRA_SUBJECT = "com.android.email.intent.extra.SUBJECT";
}
}
/**
* Called throughout the application when the number of accounts has changed. This method
* enables or disables the Compose activity, the boot receiver and the service based on

View File

@ -1,14 +0,0 @@
package com.android.email;
public class Intent {
public static final String ACTION_EMAIL_RECEIVED = "com.android.email.intent.action.EMAIL_RECEIVED";
public static final String EXTRA_ACCOUNT = "com.android.email.intent.extra.ACCOUNT";
public static final String EXTRA_FOLDER = "com.android.email.intent.extra.FOLDER";
public static final String EXTRA_SENT_DATE = "com.android.email.intent.extra.SENT_DATE";
public static final String EXTRA_FROM = "com.android.email.intent.extra.FROM";
public static final String EXTRA_TO = "com.android.email.intent.extra.TO";
public static final String EXTRA_CC = "com.android.email.intent.extra.CC";
public static final String EXTRA_BCC = "com.android.email.intent.extra.BCC";
public static final String EXTRA_SUBJECT = "com.android.email.intent.extra.SUBJECT";
}

View File

@ -1,6 +1,7 @@
package com.android.email;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import com.android.email.mail.Address;
@ -14,15 +15,15 @@ public class IntentBroadcastingMessagingListener
public void synchronizeMailboxNewMessage(Context context, Account account, String folder, Message message) {
try {
Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid()));
android.content.Intent intent = new android.content.Intent(Intent.ACTION_EMAIL_RECEIVED, uri);
intent.putExtra(Intent.EXTRA_ACCOUNT, account.getDescription());
intent.putExtra(Intent.EXTRA_FOLDER, folder);
intent.putExtra(Intent.EXTRA_SENT_DATE, message.getSentDate());
intent.putExtra(Intent.EXTRA_FROM, Address.toString(message.getFrom()));
intent.putExtra(Intent.EXTRA_TO, Address.toString(message.getRecipients(Message.RecipientType.TO)));
intent.putExtra(Intent.EXTRA_CC, Address.toString(message.getRecipients(Message.RecipientType.CC)));
intent.putExtra(Intent.EXTRA_BCC, Address.toString(message.getRecipients(Message.RecipientType.BCC)));
intent.putExtra(Intent.EXTRA_SUBJECT, message.getSubject());
Intent intent = new Intent(Email.Intents.EmailReceived.ACTION_EMAIL_RECEIVED, uri);
intent.putExtra(Email.Intents.EmailReceived.EXTRA_ACCOUNT, account.getDescription());
intent.putExtra(Email.Intents.EmailReceived.EXTRA_FOLDER, folder);
intent.putExtra(Email.Intents.EmailReceived.EXTRA_SENT_DATE, message.getSentDate());
intent.putExtra(Email.Intents.EmailReceived.EXTRA_FROM, Address.toString(message.getFrom()));
intent.putExtra(Email.Intents.EmailReceived.EXTRA_TO, Address.toString(message.getRecipients(Message.RecipientType.TO)));
intent.putExtra(Email.Intents.EmailReceived.EXTRA_CC, Address.toString(message.getRecipients(Message.RecipientType.CC)));
intent.putExtra(Email.Intents.EmailReceived.EXTRA_BCC, Address.toString(message.getRecipients(Message.RecipientType.BCC)));
intent.putExtra(Email.Intents.EmailReceived.EXTRA_SUBJECT, message.getSubject());
context.sendBroadcast(intent);
Log.d(Email.LOG_TAG, "Broadcasted intent: " + message.getSubject());
}