Loading app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java +10 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi MessageProvider.MessageColumns.PREVIEW, MessageProvider.MessageColumns.UNREAD, MessageProvider.MessageColumns.HAS_ATTACHMENTS, MessageProvider.MessageColumns.URI MessageProvider.MessageColumns.URI, MessageProvider.MessageColumns.ACCOUNT_COLOR, }; Loading Loading @@ -84,8 +85,9 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi boolean unread = toBoolean(cursor.getString(4)); boolean hasAttachment = toBoolean(cursor.getString(5)); Uri viewUri = Uri.parse(cursor.getString(6)); int color = cursor.getInt(7); mailItems.add(new MailItem(sender, date, subject, preview, unread, hasAttachment, viewUri)); mailItems.add(new MailItem(sender, date, subject, preview, unread, hasAttachment, viewUri, color)); } } finally { cursor.close(); Loading Loading @@ -135,6 +137,9 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi Intent intent = new Intent(); intent.setData(item.uri); remoteView.setOnClickFillInIntent(R.id.mail_list_item, intent); remoteView.setInt(R.id.chip, "setBackgroundColor", item.color); return remoteView; } Loading Loading @@ -180,10 +185,11 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi final boolean unread; final boolean hasAttachment; final Uri uri; final int color; MailItem(String sender, long date, String subject, String preview, boolean unread, boolean hasAttachment, Uri viewUri) { Uri viewUri, int color) { this.sender = sender; this.date = date; this.preview = preview; Loading @@ -191,6 +197,7 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi this.unread = unread; this.uri = viewUri; this.hasAttachment = hasAttachment; this.color = color; } int getTextColor() { Loading app/k9mail/src/main/res/layout/message_list_widget_list_item.xml +73 −59 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/mail_list_item" android:layout_width="match_parent" android:layout_height="wrap_content" tools:background="@color/md_white_1000"> <!-- A regular View breaks things for some reason, but a TextView does the job --> <TextView android:id="@+id/chip" android:layout_width="8dip" android:layout_height="match_parent" tools:background="@color/orange" android:visibility="visible" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/widget_padding"> Loading @@ -12,8 +25,8 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:layout_marginLeft="4dp" tools:text="25 May" /> <ImageView Loading @@ -22,10 +35,10 @@ android:layout_height="wrap_content" android:layout_alignBottom="@+id/mail_date" android:layout_centerInParent="true" android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:layout_toLeftOf="@+id/mail_date" android:layout_marginLeft="4dp" android:layout_toStartOf="@+id/mail_date" android:layout_toLeftOf="@+id/mail_date" android:src="@drawable/ic_email_attachment_small" android:visibility="gone" tools:visibility="visible" /> Loading @@ -34,14 +47,14 @@ android:id="@+id/sender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_gravity="start" android:layout_toLeftOf="@id/attachment" android:layout_toStartOf="@id/attachment" android:maxLines="1" android:layout_toLeftOf="@id/attachment" android:ellipsize="end" android:maxLines="1" android:textSize="16sp" tools:text="Kinda long subject that should be long enough to exceed the available display space" /> Loading @@ -49,11 +62,11 @@ android:id="@+id/mail_subject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/sender" android:maxLines="1" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:ellipsize="end" android:maxLines="1" android:paddingBottom="2dp" android:textSize="15sp" tools:text="Wikipedia" /> Loading @@ -62,11 +75,12 @@ android:id="@+id/mail_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/mail_subject" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:maxLines="1" android:textSize="13sp" tools:text="Towel Day is celebrated every year on 25 May as a tribute to the author Douglas Adams by his fans." /> </RelativeLayout> </LinearLayout> Loading
app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java +10 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi MessageProvider.MessageColumns.PREVIEW, MessageProvider.MessageColumns.UNREAD, MessageProvider.MessageColumns.HAS_ATTACHMENTS, MessageProvider.MessageColumns.URI MessageProvider.MessageColumns.URI, MessageProvider.MessageColumns.ACCOUNT_COLOR, }; Loading Loading @@ -84,8 +85,9 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi boolean unread = toBoolean(cursor.getString(4)); boolean hasAttachment = toBoolean(cursor.getString(5)); Uri viewUri = Uri.parse(cursor.getString(6)); int color = cursor.getInt(7); mailItems.add(new MailItem(sender, date, subject, preview, unread, hasAttachment, viewUri)); mailItems.add(new MailItem(sender, date, subject, preview, unread, hasAttachment, viewUri, color)); } } finally { cursor.close(); Loading Loading @@ -135,6 +137,9 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi Intent intent = new Intent(); intent.setData(item.uri); remoteView.setOnClickFillInIntent(R.id.mail_list_item, intent); remoteView.setInt(R.id.chip, "setBackgroundColor", item.color); return remoteView; } Loading Loading @@ -180,10 +185,11 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi final boolean unread; final boolean hasAttachment; final Uri uri; final int color; MailItem(String sender, long date, String subject, String preview, boolean unread, boolean hasAttachment, Uri viewUri) { Uri viewUri, int color) { this.sender = sender; this.date = date; this.preview = preview; Loading @@ -191,6 +197,7 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi this.unread = unread; this.uri = viewUri; this.hasAttachment = hasAttachment; this.color = color; } int getTextColor() { Loading
app/k9mail/src/main/res/layout/message_list_widget_list_item.xml +73 −59 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/mail_list_item" android:layout_width="match_parent" android:layout_height="wrap_content" tools:background="@color/md_white_1000"> <!-- A regular View breaks things for some reason, but a TextView does the job --> <TextView android:id="@+id/chip" android:layout_width="8dip" android:layout_height="match_parent" tools:background="@color/orange" android:visibility="visible" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/widget_padding"> Loading @@ -12,8 +25,8 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:layout_marginLeft="4dp" tools:text="25 May" /> <ImageView Loading @@ -22,10 +35,10 @@ android:layout_height="wrap_content" android:layout_alignBottom="@+id/mail_date" android:layout_centerInParent="true" android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:layout_toLeftOf="@+id/mail_date" android:layout_marginLeft="4dp" android:layout_toStartOf="@+id/mail_date" android:layout_toLeftOf="@+id/mail_date" android:src="@drawable/ic_email_attachment_small" android:visibility="gone" tools:visibility="visible" /> Loading @@ -34,14 +47,14 @@ android:id="@+id/sender" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_gravity="start" android:layout_toLeftOf="@id/attachment" android:layout_toStartOf="@id/attachment" android:maxLines="1" android:layout_toLeftOf="@id/attachment" android:ellipsize="end" android:maxLines="1" android:textSize="16sp" tools:text="Kinda long subject that should be long enough to exceed the available display space" /> Loading @@ -49,11 +62,11 @@ android:id="@+id/mail_subject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/sender" android:maxLines="1" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:ellipsize="end" android:maxLines="1" android:paddingBottom="2dp" android:textSize="15sp" tools:text="Wikipedia" /> Loading @@ -62,11 +75,12 @@ android:id="@+id/mail_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/mail_subject" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:maxLines="1" android:textSize="13sp" tools:text="Towel Day is celebrated every year on 25 May as a tribute to the author Douglas Adams by his fans." /> </RelativeLayout> </LinearLayout>