mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -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:
parent
6686c3a910
commit
267f02fc48
@ -2,10 +2,27 @@
|
|||||||
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!-- header area -->
|
<!-- 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
|
<RelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
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">
|
android:background="@android:color/transparent">
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/flagged"
|
android:id="@+id/flagged"
|
||||||
@ -131,6 +148,7 @@
|
|||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/show_pictures_section"
|
android:id="@+id/show_pictures_section"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -2866,12 +2866,6 @@ public class MessagingController implements Runnable
|
|||||||
message.setFlag(Flag.X_DOWNLOADED_FULL, true);
|
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))
|
if (listener != null && !getListeners().contains(listener))
|
||||||
{
|
{
|
||||||
listener.loadMessageForViewBodyAvailable(account, folder, uid, message);
|
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);
|
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())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
l.loadMessageForViewHeadersAvailable(account, folder, uid, message);
|
l.loadMessageForViewHeadersAvailable(account, folder, uid, message);
|
||||||
@ -2973,10 +2973,6 @@ public class MessagingController implements Runnable
|
|||||||
message
|
message
|
||||||
}, fp, null);
|
}, fp, null);
|
||||||
localFolder.close();
|
localFolder.close();
|
||||||
if (!message.isSet(Flag.SEEN))
|
|
||||||
{
|
|
||||||
setFlag(new Message[] { message }, Flag.SEEN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
private TextView mToView;
|
private TextView mToView;
|
||||||
private TextView mCcView;
|
private TextView mCcView;
|
||||||
private TextView mSubjectView;
|
private TextView mSubjectView;
|
||||||
|
public View chip;
|
||||||
private CheckBox mFlagged;
|
private CheckBox mFlagged;
|
||||||
private int defaultSubjectColor;
|
private int defaultSubjectColor;
|
||||||
private WebView mMessageContentView;
|
private WebView mMessageContentView;
|
||||||
@ -251,6 +252,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
final String time,
|
final String time,
|
||||||
final String to,
|
final String to,
|
||||||
final String cc,
|
final String cc,
|
||||||
|
final int accountColor,
|
||||||
|
final boolean unread,
|
||||||
final boolean hasAttachments,
|
final boolean hasAttachments,
|
||||||
final boolean isDownloading,
|
final boolean isDownloading,
|
||||||
final boolean flagged,
|
final boolean flagged,
|
||||||
@ -287,6 +290,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
}
|
}
|
||||||
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
|
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
|
||||||
|
|
||||||
|
chip.setBackgroundColor(accountColor);
|
||||||
|
chip.getBackground().setAlpha(unread ? 255 : 127);
|
||||||
|
|
||||||
if (answered)
|
if (answered)
|
||||||
{
|
{
|
||||||
@ -442,6 +447,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
mSubjectView = (TextView)findViewById(R.id.subject);
|
mSubjectView = (TextView)findViewById(R.id.subject);
|
||||||
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
||||||
|
|
||||||
|
chip = findViewById(R.id.chip);
|
||||||
|
|
||||||
mDateView = (TextView)findViewById(R.id.date);
|
mDateView = (TextView)findViewById(R.id.date);
|
||||||
mTimeView = (TextView)findViewById(R.id.time);
|
mTimeView = (TextView)findViewById(R.id.time);
|
||||||
mTopView = (ScrollView)findViewById(R.id.top_view);
|
mTopView = (ScrollView)findViewById(R.id.top_view);
|
||||||
@ -946,6 +953,15 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
new String[] { mMessage.getUid() },
|
new String[] { mMessage.getUid() },
|
||||||
Flag.SEEN,
|
Flag.SEEN,
|
||||||
false);
|
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 timeText = getTimeFormat().format(message.getSentDate());
|
||||||
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
|
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
|
||||||
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
|
String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC));
|
||||||
|
int color = mAccount.getChipColor();
|
||||||
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
|
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
|
||||||
boolean isDownloading = !message.isSet(Flag.X_DOWNLOADED_FULL);
|
boolean isDownloading = !message.isSet(Flag.X_DOWNLOADED_FULL);
|
||||||
|
boolean unread = !message.isSet(Flag.SEEN);
|
||||||
mHandler.setHeaders(subjectText,
|
mHandler.setHeaders(subjectText,
|
||||||
fromText,
|
fromText,
|
||||||
dateText,
|
dateText,
|
||||||
timeText,
|
timeText,
|
||||||
toText,
|
toText,
|
||||||
ccText,
|
ccText,
|
||||||
|
color,
|
||||||
|
unread,
|
||||||
hasAttachments,
|
hasAttachments,
|
||||||
isDownloading,
|
isDownloading,
|
||||||
message.isSet(Flag.FLAGGED),
|
message.isSet(Flag.FLAGGED),
|
||||||
@ -1346,10 +1366,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
}
|
}
|
||||||
catch (MessagingException me)
|
catch (MessagingException me)
|
||||||
{
|
{
|
||||||
if (Config.LOGV)
|
Log.e(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
|
||||||
{
|
|
||||||
Log.v(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user