mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-21 20:35:58 +03:00
Fix #1308 Crash when long pressing a note and swiping to the edge of the screen
Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
parent
119fced969
commit
a9fb6f12ba
3 changed files with 10 additions and 1 deletions
|
@ -170,6 +170,10 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> i
|
||||||
return itemList.get(notePosition);
|
return itemList.get(notePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasItemPosition(int notePosition) {
|
||||||
|
return notePosition >= 0 && notePosition < itemList.size();
|
||||||
|
}
|
||||||
|
|
||||||
public void remove(@NonNull Item item) {
|
public void remove(@NonNull Item item) {
|
||||||
itemList.remove(item);
|
itemList.remove(item);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
|
|
@ -31,7 +31,10 @@ public class ItemSelectionTracker {
|
||||||
@Override
|
@Override
|
||||||
public boolean canSetStateAtPosition(int position, boolean nextState) {
|
public boolean canSetStateAtPosition(int position, boolean nextState) {
|
||||||
@Nullable Integer swipedPosition = adapter.getSwipedPosition();
|
@Nullable Integer swipedPosition = adapter.getSwipedPosition();
|
||||||
return !adapter.getItem(position).isSection() && (swipedPosition == null || swipedPosition != position);
|
if (!adapter.hasItemPosition(position)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (swipedPosition == null || swipedPosition != position) && !adapter.getItem(position).isSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
2
fastlane/metadata/android/en-US/changelogs/3004013.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/3004013.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
- 🐞 Fix potential crash when rendering a note with a checkbox (#1326) - by @pbek
|
||||||
|
- 🐞 Fix crash when long pressing a note and swiping to the edge of the screen (#1308)
|
Loading…
Reference in a new issue