Use a constructor to create a provider object.
Some were using from(Cursor), and it was confusing.
Change-Id: I49655b4ed013fb4dd47cdefea0bfd850a3fa4517
diff --git a/src/com/android/mail/browse/ConversationItemViewModel.java b/src/com/android/mail/browse/ConversationItemViewModel.java
index 1701e40..ac93591 100644
--- a/src/com/android/mail/browse/ConversationItemViewModel.java
+++ b/src/com/android/mail/browse/ConversationItemViewModel.java
@@ -122,7 +122,7 @@
if (cursor != null) {
header.faded = false;
header.checkboxVisible = true;
- Conversation conv = Conversation.from(cursor);
+ Conversation conv = new Conversation(cursor);
header.conversation = conv;
header.starred = conv.starred;
header.unread = !conv.read;
diff --git a/src/com/android/mail/browse/MessageHeaderView.java b/src/com/android/mail/browse/MessageHeaderView.java
index 2986af4..3b3d305 100644
--- a/src/com/android/mail/browse/MessageHeaderView.java
+++ b/src/com/android/mail/browse/MessageHeaderView.java
@@ -325,7 +325,7 @@
Timer t = new Timer();
t.start(HEADER_RENDER_TAG);
- mMessage = Message.from(cursor);
+ mMessage = new Message(cursor);
mLocalMessageId = cursor.getLong(UIProvider.MESSAGE_ID_COLUMN);
mServerMessageId = cursor.getLong(UIProvider.MESSAGE_SERVER_ID_COLUMN);
mConversationId = cursor.getLong(UIProvider.MESSAGE_CONVERSATION_ID_COLUMN);
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index aad3903..f231a27 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -733,7 +733,7 @@
// Broadcast notification that a new message has
// been allocated
mSendOrSaveCallback.notifyMessageIdAllocated(sendOrSaveMessage,
- Message.from(messageCursor));
+ new Message(messageCursor));
}
}
}
diff --git a/src/com/android/mail/providers/Conversation.java b/src/com/android/mail/providers/Conversation.java
index 9bb2304..13d7e90 100644
--- a/src/com/android/mail/providers/Conversation.java
+++ b/src/com/android/mail/providers/Conversation.java
@@ -120,11 +120,7 @@
};
- public static Conversation from(Cursor cursor) {
- return new Conversation(cursor);
- }
-
- private Conversation(Cursor cursor) {
+ public Conversation(Cursor cursor) {
if (cursor != null) {
id = cursor.getLong(UIProvider.CONVERSATION_ID_COLUMN);
uri = Uri.parse(cursor.getString(UIProvider.CONVERSATION_URI_COLUMN));
diff --git a/src/com/android/mail/providers/Message.java b/src/com/android/mail/providers/Message.java
index 0153cda..d52363e 100644
--- a/src/com/android/mail/providers/Message.java
+++ b/src/com/android/mail/providers/Message.java
@@ -129,11 +129,7 @@
};
- public static Message from(Cursor cursor) {
- return new Message(cursor);
- }
-
- private Message(Cursor cursor) {
+ public Message(Cursor cursor) {
if (cursor != null) {
id = cursor.getLong(UIProvider.MESSAGE_ID_COLUMN);
serverId = cursor.getLong(UIProvider.MESSAGE_SERVER_ID_COLUMN);
diff --git a/src/com/android/mail/ui/AnimatedAdapter.java b/src/com/android/mail/ui/AnimatedAdapter.java
index 4964fff..292c6d9 100644
--- a/src/com/android/mail/ui/AnimatedAdapter.java
+++ b/src/com/android/mail/ui/AnimatedAdapter.java
@@ -143,7 +143,7 @@
*/
private View getAnimatingView(int position, View convertView, ViewGroup parent) {
assert (convertView instanceof AnimatingItemView);
- Conversation conversation = Conversation.from((ConversationCursor) getItem(position));
+ Conversation conversation = new Conversation((ConversationCursor) getItem(position));
conversation.position = position;
final AnimatingItemView view = (convertView == null) ? new AnimatingItemView(mContext)
: (AnimatingItemView) convertView;
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index 6315bb1..2c83a49 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -413,7 +413,7 @@
*/
private void viewConversation(int position) {
mConversationListCursor.moveToPosition(position);
- mCallbacks.onConversationSelected(Conversation.from(mConversationListCursor));
+ mCallbacks.onConversationSelected(new Conversation(mConversationListCursor));
}
@Override
diff --git a/src/com/android/mail/widget/WidgetService.java b/src/com/android/mail/widget/WidgetService.java
index aeabbe2..cb6f6c6 100644
--- a/src/com/android/mail/widget/WidgetService.java
+++ b/src/com/android/mail/widget/WidgetService.java
@@ -178,7 +178,7 @@
return getViewMoreConversationsView();
}
- Conversation conversation = Conversation.from(mConversationCursor);
+ Conversation conversation = new Conversation(mConversationCursor);
// Split the senders and status from the instructions.
SpannableStringBuilder senderBuilder = new SpannableStringBuilder();
SpannableStringBuilder statusBuilder = new SpannableStringBuilder();
diff --git a/tests/src/com/android/mail/compose/ComposeActivityTest.java b/tests/src/com/android/mail/compose/ComposeActivityTest.java
index 8d97bb2..638a5c9 100644
--- a/tests/src/com/android/mail/compose/ComposeActivityTest.java
+++ b/tests/src/com/android/mail/compose/ComposeActivityTest.java
@@ -74,7 +74,7 @@
if (msgCursor != null) {
msgCursor.moveToFirst();
}
- return Message.from(msgCursor);
+ return new Message(msgCursor);
}
public void setAccount(String accountName) {
@@ -198,7 +198,7 @@
messageValues[UIProvider.MESSAGE_CC_COLUMN] = "accountcc1@mock.com, accountcc2@mock.com";
cursor.addRow(messageValues);
cursor.moveToFirst();
- return Message.from(cursor);
+ return new Message(cursor);
}
public void testReplyAllWithCc() {