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();
|
mSelectedCount = getSelectionFromCheckboxes().size();
|
||||||
if (mSelectedCount > 0) {
|
if (mSelectedCount > 0) {
|
||||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||||
mActionMode.setTitle(String.format(
|
updateActionModeTitle();
|
||||||
getString(R.string.actionbar_selected),
|
|
||||||
mSelectedCount));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2457,7 +2455,11 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
computeSelectAllVisibility();
|
|
||||||
|
if (isSelected) {
|
||||||
|
updateActionModeTitle();
|
||||||
|
computeSelectAllVisibility();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2477,7 +2479,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
|||||||
if (newState) {
|
if (newState) {
|
||||||
mSelectedCount = mAdapter.getCount();
|
mSelectedCount = mAdapter.getCount();
|
||||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||||
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
updateActionModeTitle();
|
||||||
computeSelectAllVisibility();
|
computeSelectAllVisibility();
|
||||||
} else {
|
} else {
|
||||||
mSelectedCount = 0;
|
mSelectedCount = 0;
|
||||||
@ -2493,6 +2495,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
|
updateActionModeTitle();
|
||||||
computeSelectAllVisibility();
|
computeSelectAllVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2514,7 +2517,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
|||||||
mSelectedCount += 1;
|
mSelectedCount += 1;
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
updateActionModeTitle();
|
||||||
|
|
||||||
// make sure the onPrepareActionMode is called
|
// make sure the onPrepareActionMode is called
|
||||||
mActionMode.invalidate();
|
mActionMode.invalidate();
|
||||||
@ -2522,6 +2525,10 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
|||||||
computeSelectAllVisibility();
|
computeSelectAllVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateActionModeTitle() {
|
||||||
|
mActionMode.setTitle(String.format(getString(R.string.actionbar_selected), mSelectedCount));
|
||||||
|
}
|
||||||
|
|
||||||
private void computeSelectAllVisibility() {
|
private void computeSelectAllVisibility() {
|
||||||
mActionModeCallback.showSelectAll(mSelectedCount != mAdapter.getCount());
|
mActionModeCallback.showSelectAll(mSelectedCount != mAdapter.getCount());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user