summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Ping Hu <yph@google.com>2013-08-09 17:59:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-08-09 17:59:09 -0700
commit285e57c7a2c8713e2b978cef1051ea4a99c2cd61 (patch)
tree7862f7165ce29c67e644f0dc5b846b1e486338b9
parent9cf070e767c11d7ac7f8979382cc8787937cd193 (diff)
parent2bafe9d90497f48aaf4009d8428f30bbe97e89ba (diff)
downloadandroid_packages_apps_Email-285e57c7a2c8713e2b978cef1051ea4a99c2cd61.tar.gz
android_packages_apps_Email-285e57c7a2c8713e2b978cef1051ea4a99c2cd61.tar.bz2
android_packages_apps_Email-285e57c7a2c8713e2b978cef1051ea4a99c2cd61.zip
am 2bafe9d9: Add a utility function to map mailbox type to authority.
* commit '2bafe9d90497f48aaf4009d8428f30bbe97e89ba': Add a utility function to map mailbox type to authority.
-rw-r--r--emailcommon/src/com/android/emailcommon/provider/Mailbox.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
index 48b65e592..5f21c9d21 100644
--- a/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
+++ b/emailcommon/src/com/android/emailcommon/provider/Mailbox.java
@@ -25,6 +25,8 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
+import android.provider.CalendarContract;
+import android.provider.ContactsContract;
import android.util.SparseBooleanArray;
import com.android.emailcommon.Logging;
@@ -801,4 +803,20 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
ACCOUNT_KEY_PROJECTION, null, null, null,
ACCOUNT_KEY_PROJECTION_ACCOUNT_KEY_COLUMN, Account.NO_ACCOUNT);
}
+
+ /**
+ * Gets the correct authority for a mailbox.
+ * @param mailboxType The type of the mailbox we're interested in.
+ * @return The authority for the mailbox we're interested in.
+ */
+ public static String getAuthority(final int mailboxType) {
+ switch (mailboxType) {
+ case Mailbox.TYPE_CALENDAR:
+ return CalendarContract.AUTHORITY;
+ case Mailbox.TYPE_CONTACTS:
+ return ContactsContract.AUTHORITY;
+ default:
+ return EmailContent.AUTHORITY;
+ }
+ }
}