1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-12 14:18:02 -05:00

Visual cleanup of messageview. Clean up of icon display codepaths

This commit is contained in:
Jesse Vincent 2011-01-17 17:25:00 +00:00
parent 014e17d014
commit bd66315375
7 changed files with 26 additions and 20 deletions

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -6,6 +6,8 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="2dip"
android:paddingRight="2dip"
> >
<View <View
android:id="@+id/chip" android:id="@+id/chip"
@ -18,6 +20,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="2dip"
android:paddingLeft="4dip"
> >
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -119,12 +123,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right" android:gravity="right"
> >
<CheckBox android:id="@+id/flagged"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_alignParentRight="true"
style="?android:attr/starStyle" />
<TextView android:id="@+id/date" <TextView android:id="@+id/date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -147,11 +145,26 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:baselineAligned="true"> android:paddingTop="4dip"
>
<View android:id="@+id/answered"
android:layout_width="22sp"
android:layout_height="22sp"
android:layout_centerVertical="true"
android:paddingRight="4dip"
android:background="@drawable/ic_email_answered_small" />
<View android:id="@+id/attachment" <View android:id="@+id/attachment"
android:layout_width="22sp" android:layout_width="22sp"
android:layout_height="22sp" android:layout_height="22sp"
android:layout_centerVertical="true"
android:paddingRight="4dip"
android:background="@drawable/ic_email_attachment_small" /> android:background="@drawable/ic_email_attachment_small" />
<CheckBox android:id="@+id/flagged"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_alignParentRight="true"
style="?android:attr/starStyle" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -2331,8 +2331,8 @@ public class MessageList
MessageListAdapter() MessageListAdapter()
{ {
mAttachmentIcon = getResources().getDrawable(R.drawable.ic_mms_attachment_small); mAttachmentIcon = getResources().getDrawable(R.drawable.ic_email_attachment_small);
mAnsweredIcon = getResources().getDrawable(R.drawable.ic_mms_answered_small); mAnsweredIcon = getResources().getDrawable(R.drawable.ic_email_answered_small);
} }
public void markAllMessagesAsDirty() public void markAllMessagesAsDirty()

View File

@ -51,7 +51,7 @@ public class MessageHeader extends LinearLayout
private LinearLayout mCcContainerView; private LinearLayout mCcContainerView;
private TextView mAdditionalHeadersView; private TextView mAdditionalHeadersView;
private View mAttachmentIcon; private View mAttachmentIcon;
private static Drawable answeredIcon; private View mAnsweredIcon;
private Message mMessage; private Message mMessage;
private Account mAccount; private Account mAccount;
private FontSizes mFontSizes = K9.getFontSizes(); private FontSizes mFontSizes = K9.getFontSizes();
@ -85,6 +85,7 @@ public class MessageHeader extends LinearLayout
private void initializeLayout() private void initializeLayout()
{ {
mAttachmentIcon = findViewById(R.id.attachment); mAttachmentIcon = findViewById(R.id.attachment);
mAnsweredIcon = findViewById(R.id.answered);
mFromView = (TextView) findViewById(R.id.from); mFromView = (TextView) findViewById(R.id.from);
mToView = (TextView) findViewById(R.id.to); mToView = (TextView) findViewById(R.id.to);
mCcView = (TextView) findViewById(R.id.cc); mCcView = (TextView) findViewById(R.id.cc);
@ -98,13 +99,13 @@ public class MessageHeader extends LinearLayout
mFlagged = (CheckBox) findViewById(R.id.flagged); mFlagged = (CheckBox) findViewById(R.id.flagged);
defaultSubjectColor = mSubjectView.getCurrentTextColor(); defaultSubjectColor = mSubjectView.getCurrentTextColor();
answeredIcon = getResources().getDrawable(R.drawable.ic_mms_answered_small);
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject()); mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject());
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime()); mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate()); mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders()); mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
mAdditionalHeadersView.setVisibility(View.GONE); mAdditionalHeadersView.setVisibility(View.GONE);
mAttachmentIcon.setVisibility(View.GONE); mAttachmentIcon.setVisibility(View.GONE);
mAnsweredIcon.setVisibility(View.GONE);
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender()); mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender());
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo()); mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC()); mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
@ -263,18 +264,10 @@ public class MessageHeader extends LinearLayout
mCcContainerView.setVisibility((cc != null && cc.length() > 0) ? View.VISIBLE : View.GONE); mCcContainerView.setVisibility((cc != null && cc.length() > 0) ? View.VISIBLE : View.GONE);
mCcView.setText(cc); mCcView.setText(cc);
mAttachmentIcon.setVisibility(((LocalStore.LocalMessage) message).hasAttachments() ? View.VISIBLE : View.GONE); mAttachmentIcon.setVisibility(((LocalStore.LocalMessage) message).hasAttachments() ? View.VISIBLE : View.GONE);
mAnsweredIcon.setVisibility(message.isSet(Flag.ANSWERED) ? View.VISIBLE : View.GONE);
mFlagged.setChecked(message.isSet(Flag.FLAGGED)); mFlagged.setChecked(message.isSet(Flag.FLAGGED));
mChip.setBackgroundDrawable(mAccount.generateColorChip().drawable()); mChip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
mChip.getBackground().setAlpha(!message.isSet(Flag.SEEN) ? 255 : 127); mChip.getBackground().setAlpha(!message.isSet(Flag.SEEN) ? 255 : 127);
if (message.isSet(Flag.ANSWERED))
{
mSubjectView.setCompoundDrawablesWithIntrinsicBounds(answeredIcon, null, null, null);
}
else
{
mSubjectView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
setVisibility(View.VISIBLE); setVisibility(View.VISIBLE);
if (mAdditionalHeadersView.getVisibility() == View.VISIBLE) if (mAdditionalHeadersView.getVisibility() == View.VISIBLE)
{ {