1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -05:00

Add a color chip to the left side of the message headers so that it is

possible to tell in which account the message is located.  Especially
useful when traversing search results in the MessageView.
This commit is contained in:
Daniel Applebaum 2010-04-25 16:33:32 +00:00
parent 6686c3a910
commit 267f02fc48
3 changed files with 47 additions and 16 deletions

View File

@ -2,10 +2,27 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- header area -->
<LinearLayout
android:id="@+id/header_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true">
<View
android:id="@+id/chip"
android:layout_width="6dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dip"
android:paddingLeft="6dip"
android:paddingRight="2dip"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:background="@android:color/transparent">
<CheckBox
android:id="@+id/flagged"
@ -131,6 +148,7 @@
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/show_pictures_section"
android:layout_width="fill_parent"

View File

@ -2866,12 +2866,6 @@ public class MessagingController implements Runnable
message.setFlag(Flag.X_DOWNLOADED_FULL, true);
}
// This is a view message request, so mark it read
if (!message.isSet(Flag.SEEN))
{
setFlag(new Message[] { message }, Flag.SEEN, true);
}
if (listener != null && !getListeners().contains(listener))
{
listener.loadMessageForViewBodyAvailable(account, folder, uid, message);
@ -2946,6 +2940,12 @@ public class MessagingController implements Runnable
{
throw new IllegalArgumentException("Message not found: folder=" + folder + ", uid=" + uid);
}
if (!message.isSet(Flag.SEEN))
{
message.setFlag(Flag.SEEN, true);
setFlag(new Message[] { message }, Flag.SEEN, true);
}
for (MessagingListener l : getListeners())
{
l.loadMessageForViewHeadersAvailable(account, folder, uid, message);
@ -2973,11 +2973,7 @@ public class MessagingController implements Runnable
message
}, fp, null);
localFolder.close();
if (!message.isSet(Flag.SEEN))
{
setFlag(new Message[] { message }, Flag.SEEN, true);
}
for (MessagingListener l : getListeners())
{
l.loadMessageForViewBodyAvailable(account, folder, uid, message);

View File

@ -55,6 +55,7 @@ public class MessageView extends K9Activity implements OnClickListener
private TextView mToView;
private TextView mCcView;
private TextView mSubjectView;
public View chip;
private CheckBox mFlagged;
private int defaultSubjectColor;
private WebView mMessageContentView;
@ -251,6 +252,8 @@ public class MessageView extends K9Activity implements OnClickListener
final String time,
final String to,
final String cc,
final int accountColor,
final boolean unread,
final boolean hasAttachments,
final boolean isDownloading,
final boolean flagged,
@ -287,6 +290,8 @@ public class MessageView extends K9Activity implements OnClickListener
}
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
chip.setBackgroundColor(accountColor);
chip.getBackground().setAlpha(unread ? 255 : 127);
if (answered)
{
@ -441,6 +446,8 @@ public class MessageView extends K9Activity implements OnClickListener
mCcView = (TextView)findViewById(R.id.cc);
mSubjectView = (TextView)findViewById(R.id.subject);
defaultSubjectColor = mSubjectView.getCurrentTextColor();
chip = findViewById(R.id.chip);
mDateView = (TextView)findViewById(R.id.date);
mTimeView = (TextView)findViewById(R.id.time);
@ -946,6 +953,15 @@ public class MessageView extends K9Activity implements OnClickListener
new String[] { mMessage.getUid() },
Flag.SEEN,
false);
try
{
mMessage.setFlag(Flag.SEEN, false);
setHeaders(mAccount, mMessage.getFolder().getName(), mMessage.getUid(), mMessage);
}
catch (Exception e)
{
Log.e(K9.LOG_TAG, "Unable to unset SEEN flag on message", e);
}
}
}
@ -1301,14 +1317,18 @@ public class MessageView extends K9Activity implements OnClickListener
String timeText = getTimeFormat().format(message.getSentDate());
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
int color = mAccount.getChipColor();
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
boolean isDownloading = !message.isSet(Flag.X_DOWNLOADED_FULL);
boolean unread = !message.isSet(Flag.SEEN);
mHandler.setHeaders(subjectText,
fromText,
dateText,
timeText,
toText,
ccText,
color,
unread,
hasAttachments,
isDownloading,
message.isSet(Flag.FLAGGED),
@ -1346,10 +1366,7 @@ public class MessageView extends K9Activity implements OnClickListener
}
catch (MessagingException me)
{
if (Config.LOGV)
{
Log.v(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
}
Log.e(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
}
}