mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 22:35:17 +00:00
Ensure positions of passwords after deleted password are updated (attempt to fix #115)
This commit is contained in:
@@ -59,8 +59,7 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
|
|||||||
// create a new view
|
// create a new view
|
||||||
View v = LayoutInflater.from(parent.getContext())
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.password_row_layout, parent, false);
|
.inflate(R.layout.password_row_layout, parent, false);
|
||||||
ViewHolder vh = new ViewHolder(v);
|
return new ViewHolder(v);
|
||||||
return vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the contents of a view (invoked by the layout manager)
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
@@ -198,6 +197,12 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
|
|||||||
if (!selectedItems.remove(position)) {
|
if (!selectedItems.remove(position)) {
|
||||||
selectedItems.add(position);
|
selectedItems.add(position);
|
||||||
}
|
}
|
||||||
|
for (int selected : selectedItems) {
|
||||||
|
if (selected > position) {
|
||||||
|
selectedItems.remove(selected);
|
||||||
|
selectedItems.add(selected - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user