Fix #715 Multiselect broken

Signed-off-by: stefan-niedermann <info@niedermann.it>
This commit is contained in:
stefan-niedermann 2020-02-04 18:14:11 +01:00
parent edfb60f588
commit 4fa0329c91
2 changed files with 7 additions and 19 deletions

View file

@ -738,7 +738,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
@Override
public void onNoteClick(int position, View v) {
if (mActionMode != null) {
boolean hasCheckedItems = adapter.getSelected().size() > 0;
if (hasCheckedItems) {
if (!adapter.select(position)) {
v.setSelected(false);
adapter.deselect(position);
@ -746,23 +747,9 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
v.setSelected(true);
}
int size = adapter.getSelected().size();
mActionMode.setTitle(getResources().getQuantityString(R.plurals.ab_selected, size, size));
int checkedItemCount = adapter.getSelected().size();
boolean hasCheckedItems = checkedItemCount > 0;
if (hasCheckedItems && mActionMode == null) {
// TODO differ if one or more items are selected
// if (checkedItemCount == 1) {
// mActionMode = startActionMode(new
// SingleSelectedActionModeCallback());
// } else {
// there are some selected items, start the actionMode
mActionMode = startSupportActionMode(new MultiSelectedActionModeCallback(
this, this, db, mActionMode, adapter, listView, this::refreshLists, getSupportFragmentManager(), searchView
));
// }
} else if (!hasCheckedItems && mActionMode != null) {
// there no selected items, finish the actionMode
if (size > 0) {
mActionMode.setTitle(getResources().getQuantityString(R.plurals.ab_selected, size, size));
} else {
mActionMode.finish();
}
} else {

View file

@ -1,7 +1,8 @@
- 🌓 Make background of dark theme darker (#557)
- 🌓 Change the font color for Markdown (#716)
- 🐞 Fix jumping cursor when handle code blocks (#558)
- 💡 Lots of empty notes are created if the server is full (#679)
- 🐞 Fix jumping cursor when handle code blocks (#558)
- 🐞 Multiselect broken (#715)
Requires at least Files app¹ version 3.9.0
¹ https://github.com/nextcloud/android