Add rawFolders column to conversation.
Can be left null if the provider does not wish a conversation to display
its associated folder(s)
otherwise this is a list of serialzied folder information
Change-Id: I0cc1dc168efea578a51ef4eefb3f0149eca08806
diff --git a/src/com/android/mail/providers/Conversation.java b/src/com/android/mail/providers/Conversation.java
index cfada1f..bd38135 100644
--- a/src/com/android/mail/providers/Conversation.java
+++ b/src/com/android/mail/providers/Conversation.java
@@ -49,6 +49,7 @@
public boolean read;
public boolean starred;
public String folderList;
+ public String rawFolders;
// Used within the UI to indicate the adapter position of this conversation
public transient int position;
// Used within the UI to indicate that a Conversation should be removed from the
@@ -78,6 +79,7 @@
dest.writeByte(read ? (byte) 1 : 0);
dest.writeByte(starred ? (byte) 1 : 0);
dest.writeString(folderList);
+ dest.writeString(rawFolders);
}
private Conversation(Parcel in) {
@@ -96,6 +98,7 @@
read = (in.readByte() != 0);
starred = (in.readByte() != 0);
folderList = in.readString();
+ rawFolders = in.readString();
position = NO_POSITION;
localDeleteOnUpdate = false;
}
@@ -142,6 +145,7 @@
read = cursor.getInt(UIProvider.CONVERSATION_READ_COLUMN) == 1;
starred = cursor.getInt(UIProvider.CONVERSATION_STARRED_COLUMN) == 1;
folderList = cursor.getString(UIProvider.CONVERSATION_FOLDER_LIST_COLUMN);
+ rawFolders = cursor.getString(UIProvider.CONVERSATION_RAW_FOLDERS_COLUMN);
position = NO_POSITION;
localDeleteOnUpdate = false;
}
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index fc23f16..211f458 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -508,7 +508,8 @@
ConversationColumns.PRIORITY,
ConversationColumns.READ,
ConversationColumns.STARRED,
- ConversationColumns.FOLDER_LIST
+ ConversationColumns.FOLDER_LIST,
+ ConversationColumns.RAW_FOLDERS
};
// These column indexes only work when the caller uses the
@@ -528,6 +529,7 @@
public static final int CONVERSATION_READ_COLUMN = 12;
public static final int CONVERSATION_STARRED_COLUMN = 13;
public static final int CONVERSATION_FOLDER_LIST_COLUMN = 14;
+ public static final int CONVERSATION_RAW_FOLDERS_COLUMN = 15;
public static final class ConversationSendingState {
public static final int OTHER = 0;
@@ -616,11 +618,18 @@
public static String STARRED = "starred";
/**
- * This string column contains a csv of all folders associated with this
+ * This string column contains a csv of all folder uris associated with this
* conversation
*/
public static final String FOLDER_LIST = "folderList";
+ /**
+ * This string column contains a serialized list of all folders
+ * separated by a "," that are associated with this conversation. The
+ * folders should be only those that the provider wants to have
+ * displayed.
+ */
+ public static final String RAW_FOLDERS = null;
private ConversationColumns() {
}
}
diff --git a/src/com/android/mail/providers/protos/mock/MockUiProvider.java b/src/com/android/mail/providers/protos/mock/MockUiProvider.java
index 6a9603d..063b356 100644
--- a/src/com/android/mail/providers/protos/mock/MockUiProvider.java
+++ b/src/com/android/mail/providers/protos/mock/MockUiProvider.java
@@ -27,6 +27,7 @@
import com.android.mail.providers.AccountCacheProvider;
import com.android.mail.providers.Account;
+import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider.AccountCapabilities;
import com.android.mail.providers.UIProvider.AccountColumns;
import com.android.mail.providers.UIProvider.AttachmentColumns;
@@ -197,6 +198,34 @@
conversationMap.put(ConversationColumns.SENDING_STATE, 1);
conversationMap.put(ConversationColumns.READ, 0);
conversationMap.put(ConversationColumns.STARRED, 0);
+ Folder[] folders = new Folder[3];
+ StringBuilder foldersString = new StringBuilder();
+ for (int i = 0; i < folders.length; i++) {
+ folders[i] = new Folder();
+ folders[i].name = "folder" + i;
+ switch (i) {
+ case 0:
+ folders[i].bgColor = "#fff000";
+ break;
+ case 1:
+ folders[i].bgColor = "#0000FF";
+ break;
+ case 2:
+ folders[i].bgColor = "#FFFF00";
+ break;
+ default:
+ folders[i].bgColor = null;
+ break;
+ }
+
+ }
+ for (int i = 0; i < folders.length; i++) {
+ foldersString.append(folders[i].serialize());
+ if (i < folders.length - 1) {
+ foldersString.append(",");
+ }
+ }
+ conversationMap.put(ConversationColumns.RAW_FOLDERS, foldersString.toString());
return conversationMap;
}