mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -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,177 +2,129 @@
|
|||||||
<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 -->
|
<!-- Color chip -->
|
||||||
<View
|
<View
|
||||||
android:id="@+id/chip"
|
android:id="@+id/chip"
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_width="6dip"
|
android:layout_width="6dip"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginRight="6dip"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:paddingTop="2dip"
|
android:layout_width="wrap_content"
|
||||||
android:layout_column="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="6dip"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<!-- 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
|
|
||||||
android:id="@+id/from_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/from"
|
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"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_toLeftOf="@+id/state_container"
|
||||||
android:paddingRight="6dip"
|
android:paddingRight="6dip"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- To -->
|
<!-- To -->
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/to_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:baselineAligned="true">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/to_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingRight="4dip"
|
|
||||||
android:text="@string/message_to_label"
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/to"
|
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:layout_below="@id/from"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_toLeftOf="@+id/state_container"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- CC -->
|
<!-- CC -->
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/cc_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:baselineAligned="true">
|
|
||||||
|
|
||||||
<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
|
<TextView
|
||||||
android:id="@+id/cc"
|
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:layout_below="@id/to"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textSize="10sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Date/Time + Icons -->
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/topright_container"
|
android:id="@+id/state_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
|
|
||||||
android:id="@+id/date_time_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
|
<LinearLayout
|
||||||
android:id="@+id/icons_container"
|
android:id="@+id/icon_container"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical|right">
|
android:layout_marginTop="2dip"
|
||||||
|
android:layout_marginBottom="2dip"
|
||||||
|
android:layout_gravity="center_vertical|right"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/answered"
|
android:id="@+id/answered"
|
||||||
@ -180,98 +132,67 @@
|
|||||||
android:layout_height="22sp"
|
android:layout_height="22sp"
|
||||||
android:paddingRight="4dip"
|
android:paddingRight="4dip"
|
||||||
android:background="@drawable/ic_email_answered_small"/>
|
android:background="@drawable/ic_email_answered_small"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/forwarded"
|
android:id="@+id/forwarded"
|
||||||
android:layout_width="22sp"
|
android:layout_width="22sp"
|
||||||
android:layout_height="22sp"
|
android:layout_height="22sp"
|
||||||
android:paddingRight="4dip"
|
android:paddingRight="4dip"
|
||||||
android:background="@drawable/ic_email_forwarded_small"/>
|
android:background="@drawable/ic_email_forwarded_small"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/flagged"
|
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:focusable="false"
|
||||||
android:button="@drawable/star"
|
android:button="@drawable/star"/>
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</TableRow>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:id="@+id/additional_headers_row">
|
|
||||||
|
|
||||||
<!-- Color chip 2 -->
|
|
||||||
<View
|
|
||||||
android:id="@+id/chip2"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_width="6dip"
|
|
||||||
android:layout_height="fill_parent"/>
|
|
||||||
|
|
||||||
<!-- Additional headers -->
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</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
|
<RelativeLayout
|
||||||
android:orientation="horizontal"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content">
|
||||||
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 -->
|
<!-- Show more/less indicator -->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/show_additional_headers_icon"
|
android:id="@+id/show_additional_headers_icon"
|
||||||
android:src="@drawable/show_more"
|
android:src="@drawable/show_more"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="4dp"
|
android:paddingTop="8dp"
|
||||||
android:layout_marginRight="12dp"/>
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingRight="12dp"
|
||||||
|
android:scaleType="fitEnd"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/additional_headers_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/show_additional_headers_icon"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:ellipsize="none"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<View
|
</LinearLayout>
|
||||||
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