1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Add "Mark all as read" action to message list

This commit is contained in:
cketti 2013-04-02 19:17:58 +02:00
parent 002e3dd538
commit 0c5bdf2c97
4 changed files with 25 additions and 0 deletions

View File

@ -175,6 +175,12 @@
android:showAsAction="never"
android:title="@string/batch_select_all"/>
<!-- MessageList -->
<item
android:id="@+id/mark_all_as_read"
android:showAsAction="never"
android:title="@string/mark_all_as_read"/>
<!-- MessageList -->
<item
android:id="@+id/send_messages"

View File

@ -1145,4 +1145,6 @@ Please submit bug reports, contribute new features and ask questions at
<string name="last_refresh_time_format">Refreshed <xliff:g id="formatted_time">%s</xliff:g></string>
<string name="last_refresh_time_format_with_push">Refreshed <xliff:g id="time_with_preposition">%s</xliff:g> (Push active)</string>
<string name="preposition_for_date">on <xliff:g id="date">%s</xliff:g></string>
<string name="mark_all_as_read">Mark all as read</string>
</resources>

View File

@ -805,6 +805,10 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
mMessageListFragment.onRemoteSearch();
return true;
}
case R.id.mark_all_as_read: {
mMessageListFragment.markAllAsRead();
return true;
}
// MessageView
case R.id.next_message: {
showNextMessage();
@ -1032,9 +1036,12 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
menu.findItem(R.id.select_all).setVisible(false);
menu.findItem(R.id.send_messages).setVisible(false);
menu.findItem(R.id.expunge).setVisible(false);
menu.findItem(R.id.mark_all_as_read).setVisible(false);
} else {
menu.findItem(R.id.set_sort).setVisible(true);
menu.findItem(R.id.select_all).setVisible(true);
menu.findItem(R.id.mark_all_as_read).setVisible(
mMessageListFragment.isMarkAllAsReadSupported());
if (!mMessageListFragment.isSingleAccountMode()) {
menu.findItem(R.id.expunge).setVisible(false);

View File

@ -3442,4 +3442,14 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
public boolean isInitialized() {
return mInitialized;
}
public boolean isMarkAllAsReadSupported() {
return (isSingleAccountMode() && isSingleFolderMode());
}
public void markAllAsRead() {
if (isMarkAllAsReadSupported()) {
mController.markAllMessagesRead(mAccount, mFolderName);
}
}
}