Merge pull request #4010 from ByteHamster/attachment-icon
Flat icons in message list
|
@ -39,7 +39,7 @@
|
|||
android:layout_marginLeft="4dp"
|
||||
android:layout_toStartOf="@+id/mail_date"
|
||||
android:layout_toLeftOf="@+id/mail_date"
|
||||
android:src="@drawable/ic_email_attachment_small"
|
||||
android:src="?attr/messageListAttachment"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.fsck.k9.fragment;
|
|||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
|
@ -14,7 +16,6 @@ import android.text.style.ForegroundColorSpan;
|
|||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -46,7 +47,6 @@ import static com.fsck.k9.fragment.MLFProjectionInfo.UID_COLUMN;
|
|||
public class MessageListAdapter extends CursorAdapter {
|
||||
|
||||
private final MessageListFragment fragment;
|
||||
private Drawable mAttachmentIcon;
|
||||
private Drawable mForwardedIcon;
|
||||
private Drawable mAnsweredIcon;
|
||||
private Drawable mForwardedAnsweredIcon;
|
||||
|
@ -55,10 +55,18 @@ public class MessageListAdapter extends CursorAdapter {
|
|||
MessageListAdapter(MessageListFragment fragment) {
|
||||
super(fragment.getActivity(), null, 0);
|
||||
this.fragment = fragment;
|
||||
mAttachmentIcon = fragment.getResources().getDrawable(R.drawable.ic_email_attachment_small);
|
||||
mAnsweredIcon = fragment.getResources().getDrawable(R.drawable.ic_email_answered_small);
|
||||
mForwardedIcon = fragment.getResources().getDrawable(R.drawable.ic_email_forwarded_small);
|
||||
mForwardedAnsweredIcon = fragment.getResources().getDrawable(R.drawable.ic_email_forwarded_answered_small);
|
||||
|
||||
int[] attributes = new int[] {
|
||||
R.attr.messageListAnswered,
|
||||
R.attr.messageListForwarded,
|
||||
R.attr.messageListAnsweredForwarded };
|
||||
TypedValue typedValue = new TypedValue();
|
||||
TypedArray array = fragment.getContext().obtainStyledAttributes(typedValue.data, attributes);
|
||||
|
||||
Resources res = fragment.getResources();
|
||||
mAnsweredIcon = res.getDrawable(array.getResourceId(0, R.drawable.ic_messagelist_answered_dark));
|
||||
mForwardedIcon = res.getDrawable(array.getResourceId(1, R.drawable.ic_messagelist_forwarded_dark));
|
||||
mForwardedAnsweredIcon = res.getDrawable(array.getResourceId(2, R.drawable.ic_messagelist_answered_forwarded_dark));
|
||||
}
|
||||
|
||||
private String recipientSigil(boolean toMe, boolean ccMe) {
|
||||
|
@ -78,6 +86,8 @@ public class MessageListAdapter extends CursorAdapter {
|
|||
MessageViewHolder holder = new MessageViewHolder(fragment);
|
||||
holder.date = view.findViewById(R.id.date);
|
||||
holder.chip = view.findViewById(R.id.chip);
|
||||
holder.attachment = view.findViewById(R.id.attachment);
|
||||
holder.status = view.findViewById(R.id.status);
|
||||
|
||||
|
||||
if (fragment.previewLines == 0 && fragment.contactsPictureLoader == null) {
|
||||
|
@ -203,35 +213,28 @@ public class MessageListAdapter extends CursorAdapter {
|
|||
|
||||
formatPreviewText(holder.preview, beforePreviewText, sigil);
|
||||
|
||||
Drawable statusHolder = buildStatusHolder(forwarded, answered);
|
||||
|
||||
if (holder.from != null ) {
|
||||
holder.from.setTypeface(Typeface.create(holder.from.getTypeface(), maybeBoldTypeface));
|
||||
if (fragment.senderAboveSubject) {
|
||||
holder.from.setCompoundDrawablesWithIntrinsicBounds(
|
||||
statusHolder, // left
|
||||
null, // top
|
||||
hasAttachments ? mAttachmentIcon : null, // right
|
||||
null); // bottom
|
||||
|
||||
holder.from.setText(displayName);
|
||||
} else {
|
||||
holder.from.setText(new SpannableStringBuilder(sigil).append(displayName));
|
||||
}
|
||||
}
|
||||
if (holder.subject != null ) {
|
||||
if (!fragment.senderAboveSubject) {
|
||||
holder.subject.setCompoundDrawablesWithIntrinsicBounds(
|
||||
statusHolder, // left
|
||||
null, // top
|
||||
hasAttachments ? mAttachmentIcon : null, // right
|
||||
null); // bottom
|
||||
}
|
||||
|
||||
holder.subject.setTypeface(Typeface.create(holder.subject.getTypeface(), maybeBoldTypeface));
|
||||
holder.subject.setText(subject);
|
||||
}
|
||||
holder.date.setText(displayDate);
|
||||
holder.attachment.setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
|
||||
|
||||
Drawable statusHolder = buildStatusHolder(forwarded, answered);
|
||||
if (statusHolder != null) {
|
||||
holder.status.setImageDrawable(statusHolder);
|
||||
holder.status.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.status.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void formatPreviewText(TextView preview, CharSequence beforePreviewText, String sigil) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.fsck.k9.fragment;
|
|||
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.fsck.k9.ui.R;
|
||||
|
@ -22,6 +23,8 @@ public class MessageViewHolder implements View.OnClickListener {
|
|||
public CheckBox selected;
|
||||
public int position = -1;
|
||||
public ContactBadge contactBadge;
|
||||
public ImageView attachment;
|
||||
public ImageView status;
|
||||
|
||||
public MessageViewHolder(MessageListFragment fragment) {
|
||||
this.fragment = fragment;
|
||||
|
|
Before Width: | Height: | Size: 844 B |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 906 B |
Before Width: | Height: | Size: 798 B |
Before Width: | Height: | Size: 713 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 900 B |
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#777777"
|
||||
android:pathData="M3,12 L10,19 L10,15 C17,14,20,9,21,4 C18.5,7.5,15,9.1,10,9.1 L10,5 Z" />
|
||||
</vector>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#777777"
|
||||
android:strokeWidth="0.866171"
|
||||
android:pathData="M8.20553,7.94632 L14.2687,14.0095 L14.2687,10.5448 C20.3319,9.67866,22.9304,5.3478,23.7966,1.01695 C21.6312,4.04855,18.5996,5.43442,14.2687,5.43442 L14.2687,1.88312 Z" />
|
||||
<path
|
||||
android:fillColor="#777777"
|
||||
android:strokeWidth="0.866171"
|
||||
android:pathData="M15.6928,17.3127 L9.62958,23.3759 L9.62958,19.9112 C3.56638,19.0451,0.967866,14.7142,0.101695,10.3833 C2.26712,13.4149,5.29872,14.8008,9.62958,14.8008 L9.62958,11.2495 Z" />
|
||||
</vector>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#bbbbbb"
|
||||
android:strokeWidth="0.866171"
|
||||
android:pathData="M8.20553,7.94632 L14.2687,14.0095 L14.2687,10.5448 C20.3319,9.67866,22.9304,5.3478,23.7966,1.01695 C21.6312,4.04855,18.5996,5.43442,14.2687,5.43442 L14.2687,1.88312 Z" />
|
||||
<path
|
||||
android:fillColor="#bbbbbb"
|
||||
android:strokeWidth="0.866171"
|
||||
android:pathData="M15.6928,17.3127 L9.62958,23.3759 L9.62958,19.9112 C3.56638,19.0451,0.967866,14.7142,0.101695,10.3833 C2.26712,13.4149,5.29872,14.8008,9.62958,14.8008 L9.62958,11.2495 Z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#bbbbbb"
|
||||
android:pathData="M3,12 L10,19 L10,15 C17,14,20,9,21,4 C18.5,7.5,15,9.1,10,9.1 L10,5 Z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#777777"
|
||||
android:pathData="M2,12.5C2,9.46 4.46,7 7.5,7H18c2.21,0 4,1.79 4,4s-1.79,4 -4,4H9.5C8.12,15 7,13.88 7,12.5S8.12,10 9.5,10H17v2H9.41c-0.55,0 -0.55,1 0,1H18c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H7.5C5.57,9 4,10.57 4,12.5S5.57,16 7.5,16H17v2H7.5C4.46,18 2,15.54 2,12.5z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:width="24dp">
|
||||
<path
|
||||
android:fillColor="#bbbbbb"
|
||||
android:pathData="M2,12.5C2,9.46 4.46,7 7.5,7H18c2.21,0 4,1.79 4,4s-1.79,4 -4,4H9.5C8.12,15 7,13.88 7,12.5S8.12,10 9.5,10H17v2H9.41c-0.55,0 -0.55,1 0,1H18c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2H7.5C5.57,9 4,10.57 4,12.5S5.57,16 7.5,16H17v2H7.5C4.46,18 2,15.54 2,12.5z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#777777"
|
||||
android:pathData="M21,12 L14,19 L14,15 C7,14,4,9,3,4 C5.5,7.5,9,9.1,14,9.1 L14,5 Z" />
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#bbbbbb"
|
||||
android:pathData="M21,12 L14,19 L14,15 C7,14,4,9,3,4 C5.5,7.5,9,9.1,14,9.1 L14,5 Z" />
|
||||
</vector>
|
|
@ -82,16 +82,22 @@
|
|||
android:gravity="top"
|
||||
android:layout_alignParentBottom="false"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/subject_wrapper"
|
||||
android:layout_alignBottom="@+id/subject_wrapper"
|
||||
android:src="?attr/messageListAnswered"
|
||||
android:layout_alignWithParentIfMissing="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/subject_wrapper"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="false"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_alignParentLeft="false"
|
||||
android:layout_toLeftOf="@+id/date">
|
||||
android:layout_toLeftOf="@+id/attachment"
|
||||
android:layout_toRightOf="@+id/status">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sender_compact"
|
||||
|
@ -148,6 +154,16 @@
|
|||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/attachment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/date"
|
||||
android:layout_alignBottom="@+id/date"
|
||||
android:src="?attr/messageListAttachment"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toStartOf="@+id/date" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -102,14 +102,14 @@
|
|||
android:layout_width="32sp"
|
||||
android:layout_height="32sp"
|
||||
android:paddingRight="2dip"
|
||||
android:background="@drawable/ic_email_answered_small" />
|
||||
android:background="?attr/messageListAnswered" />
|
||||
|
||||
<View
|
||||
android:id="@+id/forwarded"
|
||||
android:layout_width="22sp"
|
||||
android:layout_height="22sp"
|
||||
android:paddingRight="4dip"
|
||||
android:background="@drawable/ic_email_forwarded_small" />
|
||||
android:background="?attr/messageListForwarded" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageListDividerColor" format="reference|color"/>
|
||||
<attr name="messageListCheckbox" format="reference"/>
|
||||
<attr name="messageListAttachment" format="reference"/>
|
||||
<attr name="messageListAnswered" format="reference"/>
|
||||
<attr name="messageListForwarded" format="reference"/>
|
||||
<attr name="messageListAnsweredForwarded" format="reference"/>
|
||||
<attr name="messageViewBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageViewAttachmentBackground" format="reference"/>
|
||||
<attr name="messageComposeAddContactImage" format="reference"/>
|
||||
|
|
|
@ -99,6 +99,10 @@
|
|||
<item name="messageListActiveItemBackgroundColor">#ff2ea7d1</item>
|
||||
<item name="messageListDividerColor">#ffcccccc</item>
|
||||
<item name="messageListCheckbox">@drawable/btn_check_message_list_light</item>
|
||||
<item name="messageListAttachment">@drawable/ic_messagelist_attachment_light</item>
|
||||
<item name="messageListAnswered">@drawable/ic_messagelist_answered_light</item>
|
||||
<item name="messageListForwarded">@drawable/ic_messagelist_forwarded_light</item>
|
||||
<item name="messageListAnsweredForwarded">@drawable/ic_messagelist_answered_forwarded_light</item>
|
||||
<item name="messageViewBackgroundColor">#ffffffff</item>
|
||||
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_light</item>
|
||||
<item name="messageComposeAddContactImage">@drawable/ic_person_plus_light</item>
|
||||
|
@ -211,6 +215,10 @@
|
|||
<item name="messageListActiveItemBackgroundColor">#ff33b5e5</item>
|
||||
<item name="messageListDividerColor">#ff333333</item>
|
||||
<item name="messageListCheckbox">@drawable/btn_check_message_list_dark</item>
|
||||
<item name="messageListAttachment">@drawable/ic_messagelist_attachment_dark</item>
|
||||
<item name="messageListAnswered">@drawable/ic_messagelist_answered_dark</item>
|
||||
<item name="messageListForwarded">@drawable/ic_messagelist_forwarded_dark</item>
|
||||
<item name="messageListAnsweredForwarded">@drawable/ic_messagelist_answered_forwarded_dark</item>
|
||||
<item name="messageViewBackgroundColor">#000000</item>
|
||||
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_dark</item>
|
||||
<item name="messageComposeAddContactImage">@drawable/ic_person_plus_dark</item>
|
||||
|
|