Restored show/more less indicator in the message header

This commit is contained in:
cketti 2012-03-06 04:26:18 +01:00
parent 8d12244a9c
commit faf9dc6e02
2 changed files with 69 additions and 4 deletions

View File

@ -30,6 +30,7 @@
<LinearLayout
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:layout_column="1"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -134,14 +135,56 @@
</LinearLayout>
<!-- Dummy column that is used to ensure the height of the table row is large
enough to fit the date/time column -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Date/Time + Icons -->
<!-- Fixed spacing -->
<View
android:layout_width="0dp"
android:layout_height="18dp"/>
<!-- We don't want to hardcode the height of the star. The minHeight
is that of 'answered'. -->
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:minHeight="22sp"
android:focusable="false"
style="?android:attr/starStyle"/>
<!-- Two text views that will be set to the same height as their
counterparts in the next colum -->
<TextView
android:id="@+id/dummy_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"/>
<TextView
android:id="@+id/dummy_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="10sp"
android:singleLine="true"/>
</LinearLayout>
<!-- Date/Time + Icons
The height of this column is 'fill_parent' so we can put the show more/less
indicator at the bottom. Unfortunately using 'fill_parent' also means that
the views in this column will be cut of if their combined height exceeds
that of the highest non-'fill_parent' column. That's why we need the dummy
column above. -->
<LinearLayout
android:id="@+id/topright_container"
android:layout_marginTop="2dip"
android:layout_marginRight="6dip"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="6dp"
android:gravity="right">
@ -188,6 +231,21 @@
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<!-- View that will take up all available space between the time and
the show more/less indicator -->
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<ImageView
android:id="@+id/show_additional_headers_icon"
android:src="@drawable/show_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginBottom="3dip"/>
</LinearLayout>
</TableRow>

View File

@ -59,6 +59,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
private Account mAccount;
private FontSizes mFontSizes = K9.getFontSizes();
private Contacts mContacts;
private ImageView mShowAdditionalHeadersIcon;
private SavedState mSavedState;
private OnLayoutChangedListener mOnLayoutChangedListener;
@ -98,6 +99,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
mDateView = (TextView) findViewById(R.id.date);
mTimeView = (TextView) findViewById(R.id.time);
mFlagged = (CheckBox) findViewById(R.id.flagged);
mShowAdditionalHeadersIcon = (ImageView) findViewById(R.id.show_additional_headers_icon);
defaultSubjectColor = mSubjectView.getCurrentTextColor();
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject());
@ -113,10 +115,13 @@ public class MessageHeader extends ScrollView implements OnClickListener {
((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());
mToView.setOnClickListener(this);
mCcView.setOnClickListener(this);
mFromView.setOnClickListener(this);
findViewById(R.id.top_container).setOnClickListener(this);
TextView dummyDateView = (TextView) findViewById(R.id.dummy_date);
TextView dummyTimeView = (TextView) findViewById(R.id.dummy_time);
dummyTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
dummyDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
}
@Override
@ -168,6 +173,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
private void hideAdditionalHeaders() {
mAdditionalHeadersView.setVisibility(View.GONE);
mAdditionalHeadersView.setText("");
mShowAdditionalHeadersIcon.setImageResource(R.drawable.show_more);
}
@ -186,6 +192,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
// Show the additional headers that we have got.
populateAdditionalHeadersView(additionalHeaders);
mAdditionalHeadersView.setVisibility(View.VISIBLE);
mShowAdditionalHeadersIcon.setImageResource(R.drawable.show_less);
}
if (!allHeadersDownloaded) {
/*