Rename Email to EmailStore to avoid collision with existing Email.java

This commit is contained in:
Andrew Stadler 2009-05-27 16:47:41 -07:00
parent c5f2a7af76
commit 2e758791d0
2 changed files with 42 additions and 42 deletions

View File

@ -16,12 +16,12 @@
package com.android.email.provider;
import com.android.email.provider.Email.Attachment;
import com.android.email.provider.Email.AttachmentColumns;
import com.android.email.provider.Email.Mailbox;
import com.android.email.provider.Email.MailboxColumns;
import com.android.email.provider.Email.Message;
import com.android.email.provider.Email.MessageColumns;
import com.android.email.provider.EmailStore.Attachment;
import com.android.email.provider.EmailStore.AttachmentColumns;
import com.android.email.provider.EmailStore.Mailbox;
import com.android.email.provider.EmailStore.MailboxColumns;
import com.android.email.provider.EmailStore.Message;
import com.android.email.provider.EmailStore.MessageColumns;
import android.content.ContentProvider;
import android.content.ContentUris;
@ -89,11 +89,11 @@ public class EmailProvider extends ContentProvider {
private static final int BASE_SHIFT = 12; // 12 bits to the base type: 0, 0x1000, 0x2000, etc.
private static final String[] TABLE_NAMES = {
Email.Account.TABLE_NAME,
Email.Mailbox.TABLE_NAME,
Email.Message.TABLE_NAME,
Email.Attachment.TABLE_NAME,
Email.HostAuth.TABLE_NAME
EmailStore.Account.TABLE_NAME,
EmailStore.Mailbox.TABLE_NAME,
EmailStore.Message.TABLE_NAME,
EmailStore.Attachment.TABLE_NAME,
EmailStore.HostAuth.TABLE_NAME
};
private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
@ -170,20 +170,20 @@ public class EmailProvider extends ContentProvider {
@Override
public void onCreate(SQLiteDatabase db) {
// Create all tables here; each class has its own method
Email.Message.createTable(db);
Email.Attachment.createTable(db);
Email.Mailbox.createTable(db);
Email.HostAuth.createTable(db);
Email.Account.createTable(db);
EmailStore.Message.createTable(db);
EmailStore.Attachment.createTable(db);
EmailStore.Mailbox.createTable(db);
EmailStore.HostAuth.createTable(db);
EmailStore.Account.createTable(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Email.Message.upgradeTable(db, oldVersion, newVersion);
Email.Attachment.upgradeTable(db, oldVersion, newVersion);
Email.Mailbox.upgradeTable(db, oldVersion, newVersion);
Email.HostAuth.upgradeTable(db, oldVersion, newVersion);
Email.Account.upgradeTable(db, oldVersion, newVersion);
EmailStore.Message.upgradeTable(db, oldVersion, newVersion);
EmailStore.Attachment.upgradeTable(db, oldVersion, newVersion);
EmailStore.Mailbox.upgradeTable(db, oldVersion, newVersion);
EmailStore.HostAuth.upgradeTable(db, oldVersion, newVersion);
EmailStore.Account.upgradeTable(db, oldVersion, newVersion);
}
@Override
@ -288,7 +288,7 @@ public class EmailProvider extends ContentProvider {
return insert(Mailbox.CONTENT_URI, values);
case MESSAGE_ATTACHMENTS:
id = db.insert(TABLE_NAMES[table], "foo", values);
return ContentUris.withAppendedId(Email.Attachment.CONTENT_URI, id);
return ContentUris.withAppendedId(EmailStore.Attachment.CONTENT_URI, id);
default:
throw new IllegalArgumentException("Unknown URL " + uri);
}
@ -304,7 +304,7 @@ public class EmailProvider extends ContentProvider {
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteDatabase db = getDatabase(getContext());
Cursor c = null;
Uri notificationUri = Email.CONTENT_URI;
Uri notificationUri = EmailStore.CONTENT_URI;
int match = sURIMatcher.match(uri);
int table = match >> BASE_SHIFT;
String id;

View File

@ -38,7 +38,7 @@ import android.net.Uri;
*
*/
public class Email {
public class EmailStore {
//private static final String TAG = "Email";
public static final String AUTHORITY = EmailProvider.EMAIL_AUTHORITY;
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
@ -46,7 +46,7 @@ public class Email {
/**
* no public constructor since this is a utility class
*/
private Email() {
private EmailStore() {
}
// All classes share this
@ -85,7 +85,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/body");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/body");
}
public interface MessageColumns {
@ -283,7 +283,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/message");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/message");
@Override
public ContentValues toContentValues() {
@ -394,8 +394,8 @@ public class Email {
@Override
@SuppressWarnings("unchecked")
public Email.Message restore(Cursor c) {
baseUri = Email.Message.CONTENT_URI;
public EmailStore.Message restore(Cursor c) {
baseUri = EmailStore.Message.CONTENT_URI;
displayName = c.getString(CONTENT_DISPLAY_NAME_COLUMN);
timeStamp = c.getLong(CONTENT_TIMESTAMP_COLUMN);
subject = c.getString(CONTENT_SUBJECT_COLUMN);
@ -542,7 +542,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/account");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/account");
static void createTable(SQLiteDatabase db) {
String s = " (" + RECORD_ID + " integer primary key autoincrement, "
@ -584,8 +584,8 @@ public class Email {
@Override
@SuppressWarnings("unchecked")
public Email.Account restore(Cursor cursor) {
baseUri = Email.Account.CONTENT_URI;
public EmailStore.Account restore(Cursor cursor) {
baseUri = EmailStore.Account.CONTENT_URI;
displayName = cursor.getString(CONTENT_DISPLAY_NAME_COLUMN);
protocol = cursor.getString(CONTENT_PROTOCOL_COLUMN);
emailAddress = cursor.getString(CONTENT_EMAIL_ADDRESS_COLUMN);
@ -669,7 +669,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/attachment");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/attachment");
static void createTable(SQLiteDatabase db) {
String s = " (" + RECORD_ID + " integer primary key autoincrement, "
@ -710,8 +710,8 @@ public class Email {
@Override
@SuppressWarnings("unchecked")
public Email.Attachment restore(Cursor cursor) {
baseUri = Email.Attachment.CONTENT_URI;
public EmailStore.Attachment restore(Cursor cursor) {
baseUri = EmailStore.Attachment.CONTENT_URI;
fileName= cursor.getString(CONTENT_FILENAME_COLUMN);
mimeType = cursor.getString(CONTENT_MIME_TYPE_COLUMN);
size = cursor.getLong(CONTENT_SIZE_COLUMN);
@ -821,7 +821,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/mailbox");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/mailbox");
// Types of mailboxes
// Holds mail (generic)
@ -895,8 +895,8 @@ public class Email {
@Override
@SuppressWarnings("unchecked")
public Email.Mailbox restore(Cursor cursor) {
baseUri = Email.Attachment.CONTENT_URI;
public EmailStore.Mailbox restore(Cursor cursor) {
baseUri = EmailStore.Attachment.CONTENT_URI;
displayName = cursor.getString(CONTENT_DISPLAY_NAME_COLUMN);
serverId = cursor.getString(CONTENT_SERVER_ID_COLUMN);
parentServerId = cursor.getString(CONTENT_PARENT_SERVER_ID_COLUMN);
@ -992,7 +992,7 @@ public class Email {
/**
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse(Email.CONTENT_URI + "/hostauth");
public static final Uri CONTENT_URI = Uri.parse(EmailStore.CONTENT_URI + "/hostauth");
static void createTable(SQLiteDatabase db) {
String s = " (" + RECORD_ID + " integer primary key autoincrement, "
@ -1017,7 +1017,7 @@ public class Email {
}
public static HostAuth restoreHostAuthWithId(Context context, long id) {
Uri u = ContentUris.withAppendedId(Email.HostAuth.CONTENT_URI, id);
Uri u = ContentUris.withAppendedId(EmailStore.HostAuth.CONTENT_URI, id);
Cursor c = context.getContentResolver().query(u, HostAuth.CONTENT_PROJECTION,
null, null, null);
@ -1033,8 +1033,8 @@ public class Email {
@Override
@SuppressWarnings("unchecked")
public Email.HostAuth restore(Cursor cursor) {
baseUri = Email.Attachment.CONTENT_URI;
public EmailStore.HostAuth restore(Cursor cursor) {
baseUri = EmailStore.Attachment.CONTENT_URI;
address = cursor.getString(CONTENT_ADDRESS_COLUMN);
port = cursor.getInt(CONTENT_PORT_COLUMN);
ssl = cursor.getInt(CONTENT_SSL_COLUMN) == 1;