mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 22:15:15 -05:00
Update action mode title when necessary
This commit is contained in:
parent
d9fad383eb
commit
997943a521
@ -722,9 +722,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mSelectedCount = getSelectionFromCheckboxes().size();
|
||||
if (mSelectedCount > 0) {
|
||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||
mActionMode.setTitle(String.format(
|
||||
getString(R.string.actionbar_selected),
|
||||
mSelectedCount));
|
||||
updateActionModeTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2457,8 +2455,12 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
}
|
||||
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
if (isSelected) {
|
||||
updateActionModeTitle();
|
||||
computeSelectAllVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle all selected message states. Sort of. If anything selected, unselect everything. If nothing is
|
||||
@ -2477,7 +2479,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
if (newState) {
|
||||
mSelectedCount = mAdapter.getCount();
|
||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
||||
updateActionModeTitle();
|
||||
computeSelectAllVisibility();
|
||||
} else {
|
||||
mSelectedCount = 0;
|
||||
@ -2493,6 +2495,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
}
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
updateActionModeTitle();
|
||||
computeSelectAllVisibility();
|
||||
}
|
||||
|
||||
@ -2514,7 +2517,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mSelectedCount += 1;
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
||||
updateActionModeTitle();
|
||||
|
||||
// make sure the onPrepareActionMode is called
|
||||
mActionMode.invalidate();
|
||||
@ -2522,6 +2525,10 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
computeSelectAllVisibility();
|
||||
}
|
||||
|
||||
private void updateActionModeTitle() {
|
||||
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
||||
}
|
||||
|
||||
private void computeSelectAllVisibility() {
|
||||
mActionModeCallback.showSelectAll(mSelectedCount != mAdapter.getCount());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user