mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-02 00:25:10 -04:00
Made the selectAll working again. This also got rid of the 2 settings options in the actionbar.
This commit is contained in:
parent
c7003ab028
commit
4a7a61bd08
@ -1499,6 +1499,8 @@ public class MessageList extends K9ListActivity implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.select_all:
|
case R.id.select_all:
|
||||||
|
toggleAllSelected();
|
||||||
|
return true;
|
||||||
case R.id.app_settings: {
|
case R.id.app_settings: {
|
||||||
onEditPrefs();
|
onEditPrefs();
|
||||||
return true;
|
return true;
|
||||||
@ -2363,6 +2365,32 @@ public class MessageList extends K9ListActivity implements
|
|||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toggleAllSelected() {
|
||||||
|
boolean newState = true;
|
||||||
|
|
||||||
|
synchronized (mAdapter.messages) {
|
||||||
|
if (mSelectedCount > 0) {
|
||||||
|
newState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mSelectedCount = 0;
|
||||||
|
|
||||||
|
for (MessageInfoHolder holder : mAdapter.messages) {
|
||||||
|
holder.selected = newState;
|
||||||
|
mSelectedCount += (newState ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newState) {
|
||||||
|
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||||
|
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
||||||
|
} else {
|
||||||
|
mActionMode.finish();
|
||||||
|
mSelectedCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private void setSelected(final List<MessageInfoHolder> holders, final boolean newState) {
|
private void setSelected(final List<MessageInfoHolder> holders, final boolean newState) {
|
||||||
for (final MessageInfoHolder holder : holders) {
|
for (final MessageInfoHolder holder : holders) {
|
||||||
if (holder.selected != newState) {
|
if (holder.selected != newState) {
|
||||||
|
Loading…
Reference in New Issue
Block a user