Add folder types, icons.
Change-Id: I43b3126b1f6e6bb4cd58763a3a17a357d4d1f9b5
diff --git a/src/com/android/mail/providers/Folder.java b/src/com/android/mail/providers/Folder.java
index 4a86187..8c730b7 100644
--- a/src/com/android/mail/providers/Folder.java
+++ b/src/com/android/mail/providers/Folder.java
@@ -109,6 +109,16 @@
public int lastSyncResult;
/**
+ * Folder type. 0 is default.
+ */
+ public int type;
+
+ /**
+ * Icon for this folder; 0 implies no icon.
+ */
+ public long iconResId;
+
+ /**
* Total number of members that comprise an instance of a folder. This is
* the number of members that need to be serialized or parceled.
*/
@@ -151,6 +161,8 @@
refreshUri = in.readParcelable(null);
syncStatus = in.readInt();
lastSyncResult = in.readInt();
+ type = in.readInt();
+ iconResId = in.readLong();
}
public Folder(Cursor cursor) {
@@ -171,6 +183,8 @@
refreshUri = !TextUtils.isEmpty(refresh) ? Uri.parse(refresh) : null;
syncStatus = cursor.getInt(UIProvider.FOLDER_SYNC_STATUS_COLUMN);
lastSyncResult = cursor.getInt(UIProvider.FOLDER_LAST_SYNC_RESULT_COLUMN);
+ type = cursor.getInt(UIProvider.FOLDER_TYPE_COLUMN);
+ iconResId = cursor.getLong(UIProvider.FOLDER_ICON_RES_ID_COLUMN);
}
@Override
@@ -189,6 +203,8 @@
dest.writeParcelable(refreshUri, 0);
dest.writeInt(syncStatus);
dest.writeInt(lastSyncResult);
+ dest.writeInt(type);
+ dest.writeLong(iconResId);
}
/**
@@ -208,7 +224,9 @@
out.append(totalCount).append(FOLDER_COMPONENT_SEPARATOR);
out.append(refreshUri).append(FOLDER_COMPONENT_SEPARATOR);
out.append(syncStatus).append(FOLDER_COMPONENT_SEPARATOR);
- out.append(lastSyncResult);
+ out.append(lastSyncResult).append(FOLDER_COMPONENT_SEPARATOR);
+ out.append(type).append(FOLDER_COMPONENT_SEPARATOR);
+ out.append(iconResId);
return out.toString();
}
@@ -237,6 +255,8 @@
refreshUri = Uri.parse(folderMembers[10]);
syncStatus = Integer.valueOf(folderMembers[11]);
lastSyncResult = Integer.valueOf(folderMembers[12]);
+ type = Integer.valueOf(folderMembers[13]);
+ iconResId = Long.valueOf(folderMembers[14]);
}
/**
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index 4687309..dec32f9 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -322,7 +322,9 @@
FolderColumns.TOTAL_COUNT,
FolderColumns.REFRESH_URI,
FolderColumns.SYNC_STATUS,
- FolderColumns.LAST_SYNC_RESULT
+ FolderColumns.LAST_SYNC_RESULT,
+ FolderColumns.TYPE,
+ FolderColumns.ICON_RES_ID
};
public static final int FOLDER_ID_COLUMN = 0;
@@ -338,6 +340,18 @@
public static final int FOLDER_REFRESH_URI_COLUMN = 10;
public static final int FOLDER_SYNC_STATUS_COLUMN = 11;
public static final int FOLDER_LAST_SYNC_RESULT_COLUMN = 12;
+ public static final int FOLDER_TYPE_COLUMN = 13;
+ public static final int FOLDER_ICON_RES_ID_COLUMN = 14;
+
+ public static final class FolderType {
+ public static final int DEFAULT = 0;
+ public static final int INBOX = 1;
+ public static final int DRAFT = 2;
+ public static final int OUTBOX = 3;
+ public static final int SENT = 4;
+ public static final int TRASH = 5;
+ public static final int SPAM = 6;
+ }
public static final class FolderCapabilities {
public static final int SYNCABLE = 0x0001;
@@ -412,7 +426,14 @@
* LastSyncStatus values defined above
*/
public static final String LAST_SYNC_RESULT = "lastSyncResult";
-
+ /**
+ * This long column contains the icon res id for this folder, or 0 if there is none.
+ */
+ public static final String ICON_RES_ID = "iconResId";
+ /**
+ * This int column contains the type of the folder. Zero is default.
+ */
+ public static final String TYPE = "type";
public FolderColumns() {}
}