Merge "Show a calendar invitation icon on message list."
This commit is contained in:
commit
95492af7a1
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 324 B |
Binary file not shown.
After Width: | Height: | Size: 797 B |
Binary file not shown.
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 256 B |
|
@ -29,6 +29,7 @@ import com.android.email.provider.EmailContent.Account;
|
|||
import com.android.email.provider.EmailContent.AccountColumns;
|
||||
import com.android.email.provider.EmailContent.Mailbox;
|
||||
import com.android.email.provider.EmailContent.MailboxColumns;
|
||||
import com.android.email.provider.EmailContent.Message;
|
||||
import com.android.email.provider.EmailContent.MessageColumns;
|
||||
import com.android.email.service.MailService;
|
||||
|
||||
|
@ -152,6 +153,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
|||
EmailContent.RECORD_ID, MessageColumns.MAILBOX_KEY, MessageColumns.ACCOUNT_KEY,
|
||||
MessageColumns.DISPLAY_NAME, MessageColumns.SUBJECT, MessageColumns.TIMESTAMP,
|
||||
MessageColumns.FLAG_READ, MessageColumns.FLAG_FAVORITE, MessageColumns.FLAG_ATTACHMENT,
|
||||
MessageColumns.FLAGS,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1493,10 +1495,12 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
|||
public static final int COLUMN_READ = 6;
|
||||
public static final int COLUMN_FAVORITE = 7;
|
||||
public static final int COLUMN_ATTACHMENTS = 8;
|
||||
public static final int COLUMN_FLAGS = 9;
|
||||
|
||||
Context mContext;
|
||||
private LayoutInflater mInflater;
|
||||
private Drawable mAttachmentIcon;
|
||||
private Drawable mInvitationIcon;
|
||||
private Drawable mFavoriteIconOn;
|
||||
private Drawable mFavoriteIconOff;
|
||||
private Drawable mSelectedIconOn;
|
||||
|
@ -1525,6 +1529,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
|||
|
||||
Resources resources = context.getResources();
|
||||
mAttachmentIcon = resources.getDrawable(R.drawable.ic_mms_attachment_small);
|
||||
mInvitationIcon = resources.getDrawable(R.drawable.ic_calendar_event_small);
|
||||
mFavoriteIconOn = resources.getDrawable(R.drawable.btn_star_big_buttonless_dark_on);
|
||||
mFavoriteIconOff = resources.getDrawable(R.drawable.btn_star_big_buttonless_dark_off);
|
||||
mSelectedIconOn = resources.getDrawable(R.drawable.btn_check_buttonless_dark_on);
|
||||
|
@ -1632,9 +1637,13 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
|||
text = cursor.getString(COLUMN_SUBJECT);
|
||||
subjectView.setText(text);
|
||||
|
||||
boolean hasInvitation =
|
||||
(cursor.getInt(COLUMN_FLAGS) & Message.FLAG_INCOMING_MEETING_INVITE) != 0;
|
||||
boolean hasAttachments = cursor.getInt(COLUMN_ATTACHMENTS) != 0;
|
||||
subjectView.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||
hasAttachments ? mAttachmentIcon : null, null);
|
||||
Drawable icon =
|
||||
hasInvitation ? mInvitationIcon
|
||||
: hasAttachments ? mAttachmentIcon : null;
|
||||
subjectView.setCompoundDrawablesWithIntrinsicBounds(null, null, icon, null);
|
||||
|
||||
// TODO ui spec suggests "time", "day", "date" - implement "day"
|
||||
TextView dateView = (TextView) view.findViewById(R.id.date);
|
||||
|
|
|
@ -18,6 +18,7 @@ package com.android.email.activity;
|
|||
|
||||
import com.android.email.Email;
|
||||
import com.android.email.provider.EmailContent;
|
||||
import com.android.email.provider.EmailContent.Message;
|
||||
import com.android.email.provider.EmailContent.MessageColumns;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -78,7 +79,8 @@ public class MessageListUnitTests
|
|||
* Add a dummy message to the data map
|
||||
*/
|
||||
private void addElement(long id, long mailboxKey, long accountKey, String displayName,
|
||||
String subject, long timestamp, int flagRead, int flagFavorite, int flagAttachment) {
|
||||
String subject, long timestamp, int flagRead, int flagFavorite, int flagAttachment,
|
||||
int flags) {
|
||||
HashMap<String, Object> emap = new HashMap<String, Object>();
|
||||
emap.put(EmailContent.RECORD_ID, id);
|
||||
emap.put(MessageColumns.MAILBOX_KEY, mailboxKey);
|
||||
|
@ -89,6 +91,7 @@ public class MessageListUnitTests
|
|||
emap.put(MessageColumns.FLAG_READ, flagRead);
|
||||
emap.put(MessageColumns.FLAG_FAVORITE, flagFavorite);
|
||||
emap.put(MessageColumns.FLAG_ATTACHMENT, flagAttachment);
|
||||
emap.put(MessageColumns.FLAGS, flags);
|
||||
mRowsMap.put(id, emap);
|
||||
mIDarray.add(id);
|
||||
}
|
||||
|
@ -102,16 +105,17 @@ public class MessageListUnitTests
|
|||
mListAdapter = (CursorAdapter)mMessageList.getListAdapter();
|
||||
mRowsMap = new HashMap<Long, Map<String, Object>>(0);
|
||||
mIDarray = new ArrayList<Long>(0);
|
||||
addElement(0, Long.MIN_VALUE, Long.MIN_VALUE, "a", "A", 0, 0, 0, 0);
|
||||
addElement(1, Long.MIN_VALUE, Long.MIN_VALUE, "b", "B", 0, 0, 0, 0);
|
||||
addElement(2, Long.MIN_VALUE, Long.MIN_VALUE, "c", "C", 0, 0, 0, 0);
|
||||
addElement(3, Long.MIN_VALUE, Long.MIN_VALUE, "d", "D", 0, 0, 0, 0);
|
||||
addElement(4, Long.MIN_VALUE, Long.MIN_VALUE, "e", "E", 0, 0, 0, 0);
|
||||
addElement(5, Long.MIN_VALUE, Long.MIN_VALUE, "f", "F", 0, 0, 0, 0);
|
||||
addElement(6, Long.MIN_VALUE, Long.MIN_VALUE, "g", "G", 0, 0, 0, 0);
|
||||
addElement(7, Long.MIN_VALUE, Long.MIN_VALUE, "h", "H", 0, 0, 0, 0);
|
||||
addElement(8, Long.MIN_VALUE, Long.MIN_VALUE, "i", "I", 0, 0, 0, 0);
|
||||
addElement(9, Long.MIN_VALUE, Long.MIN_VALUE, "j", "J", 0, 0, 0, 0);
|
||||
final int FIMI = Message.FLAG_INCOMING_MEETING_INVITE;
|
||||
addElement(0, Long.MIN_VALUE, Long.MIN_VALUE, "a", "A", 0, 0, 0, 0, 0);
|
||||
addElement(1, Long.MIN_VALUE, Long.MIN_VALUE, "b", "B", 0, 0, 0, 0, 0);
|
||||
addElement(2, Long.MIN_VALUE, Long.MIN_VALUE, "c", "C", 0, 0, 0, 0, 0);
|
||||
addElement(3, Long.MIN_VALUE, Long.MIN_VALUE, "d", "D", 0, 0, 0, 0, FIMI);
|
||||
addElement(4, Long.MIN_VALUE, Long.MIN_VALUE, "e", "E", 0, 0, 0, 0, 0);
|
||||
addElement(5, Long.MIN_VALUE, Long.MIN_VALUE, "f", "F", 0, 0, 0, 0, 0);
|
||||
addElement(6, Long.MIN_VALUE, Long.MIN_VALUE, "g", "G", 0, 0, 0, 0, 0);
|
||||
addElement(7, Long.MIN_VALUE, Long.MIN_VALUE, "h", "H", 0, 0, 0, 0, 0);
|
||||
addElement(8, Long.MIN_VALUE, Long.MIN_VALUE, "i", "I", 0, 0, 0, 0, 0);
|
||||
addElement(9, Long.MIN_VALUE, Long.MIN_VALUE, "j", "J", 0, 0, 0, 0, 0);
|
||||
CustomCursor cc = new CustomCursor(mIDarray, MessageList.MESSAGE_PROJECTION,
|
||||
mRowsMap);
|
||||
mListAdapter.changeCursor(cc);
|
||||
|
|
Loading…
Reference in New Issue