1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-17 21:32:26 -05:00

Move "show all headers" into the menu (and out of the UI)

This commit is contained in:
Jesse Vincent 2013-02-07 15:27:22 -05:00
parent eff9e8c97a
commit 7714bc3cfa
6 changed files with 33 additions and 27 deletions

View File

@ -153,34 +153,16 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Show more/less indicator -->
<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"/>
<TextView <TextView
android:id="@+id/additional_headers_view" android:id="@+id/additional_headers_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/show_additional_headers_icon"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:singleLine="false" android:singleLine="false"
android:ellipsize="none" android:ellipsize="none"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -112,6 +112,14 @@
android:showAsAction="never" android:showAsAction="never"
android:title="@string/mark_as_unread_action"/> android:title="@string/mark_as_unread_action"/>
<item android:id="@+id/show_headers"
android:showAsAction="never"
android:title="@string/show_headers_action"/>
<item android:id="@+id/hide_headers"
android:showAsAction="never"
android:title="@string/hide_headers_action"/>
<!-- MessageList --> <!-- MessageList -->
<item <item
android:id="@+id/set_sort" android:id="@+id/set_sort"

View File

@ -165,6 +165,8 @@ Please submit bug reports, contribute new features and ask questions at
<string name="unflag_action">Remove star</string> <string name="unflag_action">Remove star</string>
<string name="copy_action">Copy</string> <string name="copy_action">Copy</string>
<string name="select_text_action">Select text</string> <string name="select_text_action">Select text</string>
<string name="show_headers_action">Show headers</string>
<string name="hide_headers_action">Hide headers</string>
<string name="message_view_theme_action_dark">Switch to dark theme</string> <string name="message_view_theme_action_dark">Switch to dark theme</string>
<string name="message_view_theme_action_light">Switch to light theme</string> <string name="message_view_theme_action_light">Switch to light theme</string>

View File

@ -838,6 +838,12 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
mMessageViewFragment.onSelectText(); mMessageViewFragment.onSelectText();
return true; return true;
} }
case R.id.show_headers:
case R.id.hide_headers: {
mMessageViewFragment.onToggleAllHeadersView();
updateMenu();
return true;
}
} }
if (!mSingleFolderMode) { if (!mSingleFolderMode) {
@ -927,6 +933,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
menu.findItem(R.id.toggle_unread).setVisible(false); menu.findItem(R.id.toggle_unread).setVisible(false);
menu.findItem(R.id.select_text).setVisible(false); menu.findItem(R.id.select_text).setVisible(false);
menu.findItem(R.id.toggle_message_view_theme).setVisible(false); menu.findItem(R.id.toggle_message_view_theme).setVisible(false);
menu.findItem(R.id.show_headers).setVisible(false);
menu.findItem(R.id.hide_headers).setVisible(false);
} else { } else {
// hide prev/next buttons in split mode // hide prev/next buttons in split mode
if (mDisplayMode != DisplayMode.MESSAGE_VIEW) { if (mDisplayMode != DisplayMode.MESSAGE_VIEW) {
@ -974,6 +982,13 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }
if (mMessageViewFragment.allHeadersVisible()) {
menu.findItem(R.id.show_headers).setVisible(false);
} else {
menu.findItem(R.id.hide_headers).setVisible(false);
}
} }

View File

@ -276,6 +276,14 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
} }
} }
public void onToggleAllHeadersView() {
mMessageView.getMessageHeaderView().onShowAdditionalHeaders();
}
public boolean allHeadersVisible() {
return mMessageView.getMessageHeaderView().additionalHeadersVisible();
}
private void delete() { private void delete() {
if (mMessage != null) { if (mMessage != null) {
// Disable the delete button after it's tapped (to try to prevent // Disable the delete button after it's tapped (to try to prevent

View File

@ -59,7 +59,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
private Account mAccount; private Account mAccount;
private FontSizes mFontSizes = K9.getFontSizes(); private FontSizes mFontSizes = K9.getFontSizes();
private Contacts mContacts; private Contacts mContacts;
private ImageView mShowAdditionalHeadersIcon;
private SavedState mSavedState; private SavedState mSavedState;
private OnLayoutChangedListener mOnLayoutChangedListener; private OnLayoutChangedListener mOnLayoutChangedListener;
@ -99,7 +98,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
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);
mShowAdditionalHeadersIcon = (ImageView) findViewById(R.id.show_additional_headers_icon);
defaultSubjectColor = mSubjectView.getCurrentTextColor(); defaultSubjectColor = mSubjectView.getCurrentTextColor();
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject()); mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject());
@ -111,7 +109,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
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());
mShowAdditionalHeadersIcon.setOnClickListener(this);
mFromView.setOnClickListener(this); mFromView.setOnClickListener(this);
mToView.setOnClickListener(this); mToView.setOnClickListener(this);
mCcView.setOnClickListener(this); mCcView.setOnClickListener(this);
@ -127,10 +124,6 @@ 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.show_additional_headers_icon: {
onShowAdditionalHeaders();
break;
}
case R.id.from: { case R.id.from: {
onAddSenderToContacts(); onAddSenderToContacts();
break; break;
@ -173,7 +166,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
private void hideAdditionalHeaders() { private void hideAdditionalHeaders() {
mAdditionalHeadersView.setVisibility(View.GONE); mAdditionalHeadersView.setVisibility(View.GONE);
mAdditionalHeadersView.setText(""); mAdditionalHeadersView.setText("");
mShowAdditionalHeadersIcon.setImageResource(R.drawable.show_more);
} }
@ -192,7 +184,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
// Show the additional headers that we have got. // Show the additional headers that we have got.
populateAdditionalHeadersView(additionalHeaders); populateAdditionalHeadersView(additionalHeaders);
mAdditionalHeadersView.setVisibility(View.VISIBLE); mAdditionalHeadersView.setVisibility(View.VISIBLE);
mShowAdditionalHeadersIcon.setImageResource(R.drawable.show_less);
} }
if (!allHeadersDownloaded) { if (!allHeadersDownloaded) {
/* /*