mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 13:57:47 +00:00
Fix filtering when loosening query
This commit is contained in:
@@ -129,13 +129,15 @@ public class PasswordFragment extends Fragment{
|
|||||||
public void filterAdapter(String filter) {
|
public void filterAdapter(String filter) {
|
||||||
if (filter.isEmpty()) {
|
if (filter.isEmpty()) {
|
||||||
updateAdapter();
|
updateAdapter();
|
||||||
return;
|
} else {
|
||||||
}
|
for (PasswordItem item : PasswordRepository.getPasswords()) {
|
||||||
for (int i=0; i<recyclerAdapter.getItemCount(); i++) {
|
boolean matches = item.getName().toLowerCase().contains(filter);
|
||||||
PasswordItem item = recyclerAdapter.getValues().get(i);
|
boolean inAdapter = recyclerAdapter.getValues().contains(item);
|
||||||
boolean matches = item.getName().toLowerCase().contains(filter);
|
if (matches && !inAdapter) {
|
||||||
if (!matches) {
|
recyclerAdapter.add(item);
|
||||||
recyclerAdapter.remove(i);
|
} else if (!matches && inAdapter) {
|
||||||
|
recyclerAdapter.remove(recyclerAdapter.getValues().indexOf(item));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user