Added "replied to" and "forwarded" icons in message list

When a message has been replied to or forwarded by the user in
Exchange or IMAP, it now displays the appropriate symbol in the
message list view. (Right now it's just a test image based on the
reply/forward/replyall images until the assets come in.)

Bug: 4313491
Change-Id: I525e55179d62b6ab08df37cb9bfe9fdd9fefb908
This commit is contained in:
Jorge Lugo 2011-06-24 19:35:34 -07:00
parent 6fc2585327
commit e2f6f18396
9 changed files with 112 additions and 18 deletions

View File

@ -24,14 +24,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/checkmark"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:src="@drawable/btn_check_on_normal_holo_light" />
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:orientation="vertical" >
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_on_normal_holo_light" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/reply" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"

View File

@ -25,14 +25,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/checkmark"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:src="@drawable/btn_check_on_normal_holo_light" />
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:orientation="vertical" >
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_on_normal_holo_light" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/reply" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"

View File

@ -42,6 +42,14 @@
android:text="@string/long_string"
android:textSize="@dimen/wide_senders_font_size"
android:lines="1" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:layout_gravity="center_vertical"
android:src="@drawable/reply" />
<TextView
android:id="@+id/subject"
android:layout_width="0dip"

View File

@ -24,14 +24,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/checkmark"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:src="@drawable/btn_check_on_normal_holo_light" />
android:orientation="vertical" >
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_on_normal_holo_light" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/reply" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"

View File

@ -24,14 +24,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/checkmark"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:src="@drawable/btn_check_on_normal_holo_light" />
android:orientation="vertical" >
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_on_normal_holo_light" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/reply" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"

View File

@ -42,6 +42,14 @@
android:text="@string/long_string"
android:textSize="@dimen/wide_senders_font_size"
android:lines="1" />
<ImageView
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:layout_gravity="center_vertical"
android:src="@drawable/reply" />
<TextView
android:id="@+id/subject"
android:layout_width="0dip"

View File

@ -95,6 +95,9 @@ public class MessageListItem extends View {
private static Bitmap sFavoriteIconOn;
private static Bitmap sSelectedIconOn;
private static Bitmap sSelectedIconOff;
private static Bitmap sStateReplied;
private static Bitmap sStateForwarded;
private static Bitmap sStateRepliedAndForwarded;
private static String sSubjectSnippetDivider;
public String mSender;
@ -107,6 +110,8 @@ public class MessageListItem extends View {
public boolean mHasAttachment = false;
public boolean mHasInvite = true;
public boolean mIsFavorite = false;
public boolean mHasBeenRepliedTo = false;
public boolean mHasBeenForwarded = false;
/** {@link Paint} for account color chips. null if no chips should be drawn. */
public Paint mColorChipPaint;
@ -161,6 +166,14 @@ public class MessageListItem extends View {
sSelectedIconOn =
BitmapFactory.decodeResource(r, R.drawable.btn_check_on_normal_holo_light);
//TODO: put the actual drawables when they exist. these are temps for visibile testing.
sStateReplied =
BitmapFactory.decodeResource(r, R.drawable.reply);
sStateForwarded =
BitmapFactory.decodeResource(r, R.drawable.forward);
sStateRepliedAndForwarded =
BitmapFactory.decodeResource(r, R.drawable.reply_all);
sInit = true;
}
}
@ -342,6 +355,18 @@ public class MessageListItem extends View {
mCoordinates.sendersX, mCoordinates.sendersY - mCoordinates.sendersAscent,
mRead ? sDefaultPaint : sBoldPaint);
// Draw the reply state. Draw nothing if neither replied nor forwarded.
if (mHasBeenRepliedTo && mHasBeenForwarded) {
canvas.drawBitmap(sStateReplied,
mCoordinates.stateX, mCoordinates.stateY, sDefaultPaint);
} else if (mHasBeenRepliedTo) {
canvas.drawBitmap(sStateForwarded,
mCoordinates.stateX, mCoordinates.stateY, sDefaultPaint);
} else if (mHasBeenForwarded) {
canvas.drawBitmap(sStateRepliedAndForwarded,
mCoordinates.stateX, mCoordinates.stateY, sDefaultPaint);
}
// Subject and snippet.
sDefaultPaint.setTextSize(mCoordinates.subjectFontSize);
sDefaultPaint.setTypeface(Typeface.DEFAULT);

View File

@ -56,6 +56,12 @@ public class MessageListItemCoordinates {
int checkmarkWidthIncludingMargins;
int checkmarkHeightIncludingMargins;
// Reply and forward state.
int stateX;
int stateY;
int stateWidthIncludingMargins;
int stateHeightIncludingMargins;
// Star.
int starX;
int starY;
@ -269,6 +275,11 @@ public class MessageListItemCoordinates {
coordinates.starY = getY(star);
coordinates.starWidthIncludingMargins = getWidth(star, true);
View state = view.findViewById(R.id.reply_state);
coordinates.stateX = getX(state);
coordinates.stateY = getY(state);
coordinates.stateWidthIncludingMargins = getWidth(state, true);
TextView senders = (TextView) view.findViewById(R.id.senders);
coordinates.sendersX = getX(senders);
coordinates.sendersY = getY(senders);

View File

@ -192,8 +192,10 @@ import java.util.Set;
itemView.mAccountId = accountId;
itemView.mRead = cursor.getInt(COLUMN_READ) != 0;
itemView.mIsFavorite = cursor.getInt(COLUMN_FAVORITE) != 0;
itemView.mHasInvite =
(cursor.getInt(COLUMN_FLAGS) & Message.FLAG_INCOMING_MEETING_INVITE) != 0;
final int flags = cursor.getInt(COLUMN_FLAGS);
itemView.mHasInvite = (flags & Message.FLAG_INCOMING_MEETING_INVITE) != 0;
itemView.mHasBeenRepliedTo = (flags & Message.FLAG_REPLIED_TO) != 0;
itemView.mHasBeenForwarded = (flags & Message.FLAG_FORWARDED) != 0;
itemView.mHasAttachment = cursor.getInt(COLUMN_ATTACHMENTS) != 0;
itemView.mTimestamp = cursor.getLong(COLUMN_DATE);
itemView.mSender = cursor.getString(COLUMN_DISPLAY_NAME);