mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Simplify and improve message view header layout.
The star was displayed partially off-screen before.
This commit is contained in:
parent
a8917d60c9
commit
f51f675021
@ -2,276 +2,197 @@
|
|||||||
<com.fsck.k9.view.MessageHeader
|
<com.fsck.k9.view.MessageHeader
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/header_container"
|
android:id="@+id/header_container"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- Message header area -->
|
<LinearLayout
|
||||||
<TableLayout
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/top_container"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:stretchColumns="1"
|
|
||||||
android:shrinkColumns="1"
|
|
||||||
android:background="@color/message_view_header_background">
|
android:background="@color/message_view_header_background">
|
||||||
|
|
||||||
<TableRow>
|
<!-- Color chip -->
|
||||||
|
<View
|
||||||
|
android:id="@+id/chip"
|
||||||
|
android:layout_width="6dip"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginRight="6dip"/>
|
||||||
|
|
||||||
<!-- Color chip -->
|
<LinearLayout
|
||||||
<View
|
android:layout_width="wrap_content"
|
||||||
android:id="@+id/chip"
|
android:layout_weight="1"
|
||||||
android:layout_marginRight="6dip"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="6dip"
|
android:layout_marginRight="6dip"
|
||||||
android:layout_height="fill_parent"/>
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:paddingTop="2dip"
|
android:layout_width="match_parent"
|
||||||
android:layout_column="1"
|
android:layout_height="wrap_content">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<!-- Subject -->
|
<!-- Subject -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subject"
|
android:id="@+id/subject"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_toLeftOf="@+id/state_container"
|
||||||
android:maxLines="3"
|
android:maxLines="3"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textSize="10sp"
|
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
<!-- From -->
|
<!-- From -->
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/from_container"
|
android:id="@+id/from"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/subject"
|
||||||
<TextView
|
android:layout_alignParentLeft="true"
|
||||||
android:id="@+id/from"
|
android:layout_toLeftOf="@+id/state_container"
|
||||||
android:layout_width="wrap_content"
|
android:paddingRight="6dip"
|
||||||
android:layout_height="wrap_content"
|
android:singleLine="true"
|
||||||
android:paddingRight="6dip"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:ellipsize="end"
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- To -->
|
<!-- To -->
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/to_container"
|
android:id="@+id/to"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="true">
|
android:layout_below="@id/from"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
<TextView
|
android:layout_toLeftOf="@+id/state_container"
|
||||||
android:id="@+id/to_label"
|
android:maxLines="2"
|
||||||
android:layout_width="wrap_content"
|
android:ellipsize="end"
|
||||||
android:layout_height="wrap_content"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:paddingRight="4dip"
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
android:text="@string/message_to_label"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/to"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- CC -->
|
<!-- CC -->
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/cc_container"
|
android:id="@+id/cc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="true">
|
android:layout_below="@id/to"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/cc_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingRight="4dip"
|
|
||||||
android:text="@string/message_view_cc_label"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/cc"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Date/Time + Icons -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/topright_container"
|
|
||||||
android:layout_marginTop="6dip"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="6dp"
|
|
||||||
android:layout_gravity="right">
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/date_time_container"
|
android:id="@+id/state_container"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="6dip"
|
android:layout_alignParentTop="true"
|
||||||
android:paddingRight="5dip"
|
android:layout_alignParentRight="true"
|
||||||
android:gravity="right"
|
android:orientation="vertical">
|
||||||
>
|
|
||||||
|
|
||||||
|
<!-- Date -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="none"
|
android:ellipsize="none"
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
|
<!-- Time -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="10sp"
|
android:layout_gravity="right"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="none"
|
android:ellipsize="none"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- State icons -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/icon_container"
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/icons_container"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical|right">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/answered"
|
|
||||||
android:layout_width="22sp"
|
|
||||||
android:layout_height="22sp"
|
|
||||||
android:paddingRight="4dip"
|
|
||||||
android:background="@drawable/ic_email_answered_small"/>
|
|
||||||
<View
|
|
||||||
android:id="@+id/forwarded"
|
|
||||||
android:layout_width="22sp"
|
|
||||||
android:layout_height="22sp"
|
|
||||||
android:paddingRight="4dip"
|
|
||||||
android:background="@drawable/ic_email_forwarded_small"/>
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/flagged"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="false"
|
android:layout_marginTop="2dip"
|
||||||
android:button="@drawable/star"
|
android:layout_marginBottom="2dip"
|
||||||
/>
|
android:layout_gravity="center_vertical|right"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/answered"
|
||||||
|
android:layout_width="22sp"
|
||||||
|
android:layout_height="22sp"
|
||||||
|
android:paddingRight="4dip"
|
||||||
|
android:background="@drawable/ic_email_answered_small"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/forwarded"
|
||||||
|
android:layout_width="22sp"
|
||||||
|
android:layout_height="22sp"
|
||||||
|
android:paddingRight="4dip"
|
||||||
|
android:background="@drawable/ic_email_forwarded_small"/>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/flagged"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
|
android:button="@drawable/star"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</TableRow>
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TableRow
|
<!-- Show more/less indicator -->
|
||||||
android:id="@+id/additional_headers_row">
|
<ImageView
|
||||||
|
android:id="@+id/show_additional_headers_icon"
|
||||||
|
android:src="@drawable/show_more"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingRight="12dp"
|
||||||
|
android:scaleType="fitEnd"/>
|
||||||
|
|
||||||
<!-- Color chip 2 -->
|
<TextView
|
||||||
<View
|
android:id="@+id/additional_headers_view"
|
||||||
android:id="@+id/chip2"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginRight="6dip"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="6dip"
|
android:layout_below="@id/show_additional_headers_icon"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_marginRight="10dp"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:ellipsize="none"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
<!-- Additional headers -->
|
</RelativeLayout>
|
||||||
<TextView
|
|
||||||
android:layout_span="2"
|
|
||||||
android:id="@+id/additional_headers_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="10dp"
|
|
||||||
android:singleLine="false"
|
|
||||||
android:ellipsize="none"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
|
||||||
|
|
||||||
</TableRow>
|
</LinearLayout>
|
||||||
|
|
||||||
</TableLayout>
|
|
||||||
|
|
||||||
<!-- Separator -->
|
|
||||||
<!-- This layout has an explicit height because otherwise there will be strange
|
|
||||||
display issues when the additional headers are shown. -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/show_additional_headers_area"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="21dp"
|
|
||||||
android:focusable="true"
|
|
||||||
android:clickable="true"
|
|
||||||
android:background="@drawable/message_view_header_background">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="20dp">
|
|
||||||
|
|
||||||
<!-- Color chip 3 -->
|
|
||||||
<View
|
|
||||||
android:id="@+id/chip3"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_width="6dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentLeft="true"/>
|
|
||||||
|
|
||||||
<!-- Show more/less indicator -->
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/show_additional_headers_icon"
|
|
||||||
android:src="@drawable/show_more"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:layout_marginRight="12dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="1dip"
|
|
||||||
android:background="@drawable/divider_horizontal_email" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_height="1dip"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_below="@id/additional_headers_view"
|
||||||
|
android:background="@drawable/divider_horizontal_email" />
|
||||||
|
|
||||||
<!-- Button area -->
|
<!-- Button area -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@ -16,7 +17,6 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.fsck.k9.FontSizes;
|
import com.fsck.k9.FontSizes;
|
||||||
@ -50,12 +50,8 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
private DateFormat mTimeFormat;
|
private DateFormat mTimeFormat;
|
||||||
|
|
||||||
private View mChip;
|
private View mChip;
|
||||||
private View mChip2;
|
|
||||||
private View mChip3;
|
|
||||||
private CheckBox mFlagged;
|
private CheckBox mFlagged;
|
||||||
private int defaultSubjectColor;
|
private int defaultSubjectColor;
|
||||||
private LinearLayout mToContainerView;
|
|
||||||
private LinearLayout mCcContainerView;
|
|
||||||
private TextView mAdditionalHeadersView;
|
private TextView mAdditionalHeadersView;
|
||||||
private View mAnsweredIcon;
|
private View mAnsweredIcon;
|
||||||
private View mForwardedIcon;
|
private View mForwardedIcon;
|
||||||
@ -96,13 +92,9 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
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);
|
||||||
mToContainerView = (LinearLayout) findViewById(R.id.to_container);
|
|
||||||
mCcContainerView = (LinearLayout) findViewById(R.id.cc_container);
|
|
||||||
mSubjectView = (TextView) findViewById(R.id.subject);
|
mSubjectView = (TextView) findViewById(R.id.subject);
|
||||||
mAdditionalHeadersView = (TextView) findViewById(R.id.additional_headers_view);
|
mAdditionalHeadersView = (TextView) findViewById(R.id.additional_headers_view);
|
||||||
mChip = findViewById(R.id.chip);
|
mChip = findViewById(R.id.chip);
|
||||||
mChip2 = findViewById(R.id.chip2);
|
|
||||||
mChip3 = findViewById(R.id.chip3);
|
|
||||||
mDateView = (TextView) findViewById(R.id.date);
|
mDateView = (TextView) findViewById(R.id.date);
|
||||||
mTimeView = (TextView) findViewById(R.id.time);
|
mTimeView = (TextView) findViewById(R.id.time);
|
||||||
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
||||||
@ -121,11 +113,8 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
||||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
||||||
((TextView) findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
|
||||||
((TextView) findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
|
||||||
|
|
||||||
findViewById(R.id.show_additional_headers_area).setOnClickListener(this);
|
mShowAdditionalHeadersIcon.setOnClickListener(this);
|
||||||
findViewById(R.id.additional_headers_row).setOnClickListener(this);
|
|
||||||
mFromView.setOnClickListener(this);
|
mFromView.setOnClickListener(this);
|
||||||
mToView.setOnClickListener(this);
|
mToView.setOnClickListener(this);
|
||||||
mCcView.setOnClickListener(this);
|
mCcView.setOnClickListener(this);
|
||||||
@ -134,8 +123,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.additional_headers_row:
|
case R.id.show_additional_headers_icon: {
|
||||||
case R.id.show_additional_headers_area: {
|
|
||||||
onShowAdditionalHeaders();
|
onShowAdditionalHeaders();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -256,10 +244,8 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mDateView.setVisibility(View.GONE);
|
mDateView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
mTimeView.setText(time);
|
mTimeView.setText(time);
|
||||||
mToContainerView.setVisibility((to != null && to.length() > 0) ? View.VISIBLE : View.GONE);
|
updateAddressField(mToView, to, R.string.message_to_label);
|
||||||
mToView.setText(to);
|
updateAddressField(mCcView, cc, R.string.message_view_cc_label);
|
||||||
mCcContainerView.setVisibility((cc != null && cc.length() > 0) ? View.VISIBLE : View.GONE);
|
|
||||||
mCcView.setText(cc);
|
|
||||||
mAnsweredIcon.setVisibility(message.isSet(Flag.ANSWERED) ? View.VISIBLE : View.GONE);
|
mAnsweredIcon.setVisibility(message.isSet(Flag.ANSWERED) ? View.VISIBLE : View.GONE);
|
||||||
mForwardedIcon.setVisibility(message.isSet(Flag.FORWARDED) ? View.VISIBLE : View.GONE);
|
mForwardedIcon.setVisibility(message.isSet(Flag.FORWARDED) ? View.VISIBLE : View.GONE);
|
||||||
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
|
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
|
||||||
@ -268,10 +254,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
int chipColorAlpha = (!message.isSet(Flag.SEEN)) ? 255 : 127;
|
int chipColorAlpha = (!message.isSet(Flag.SEEN)) ? 255 : 127;
|
||||||
mChip.setBackgroundColor(chipColor);
|
mChip.setBackgroundColor(chipColor);
|
||||||
mChip.getBackground().setAlpha(chipColorAlpha);
|
mChip.getBackground().setAlpha(chipColorAlpha);
|
||||||
mChip2.setBackgroundColor(chipColor);
|
|
||||||
mChip2.getBackground().setAlpha(chipColorAlpha);
|
|
||||||
mChip3.setBackgroundColor(chipColor);
|
|
||||||
mChip3.getBackground().setAlpha(chipColorAlpha);
|
|
||||||
|
|
||||||
setVisibility(View.VISIBLE);
|
setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -299,6 +281,26 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
layoutChanged();
|
layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final StyleSpan sBoldSpan = new StyleSpan(Typeface.BOLD);
|
||||||
|
|
||||||
|
private void updateAddressField(TextView v, CharSequence address, int prefixId) {
|
||||||
|
if (TextUtils.isEmpty(address)) {
|
||||||
|
v.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SpannableStringBuilder text = new SpannableStringBuilder();
|
||||||
|
final String prefix = mContext.getString(prefixId);
|
||||||
|
|
||||||
|
text.append(prefix);
|
||||||
|
text.append(" ");
|
||||||
|
text.append(address);
|
||||||
|
text.setSpan(sBoldSpan, 0, prefix.length(), 0);
|
||||||
|
|
||||||
|
v.setText(text);
|
||||||
|
v.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand or collapse a TextView by removing or adding the 2 lines limitation
|
* Expand or collapse a TextView by removing or adding the 2 lines limitation
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user