mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-16 23:12:51 +00:00
Always take favorites into account when sorting the entry list
This commit is contained in:
parent
ef759eb15e
commit
9d318a0d54
1 changed files with 17 additions and 17 deletions
|
@ -208,17 +208,13 @@ public class EntryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
} else {
|
} else {
|
||||||
_shownEntries.set(position, newEntry);
|
_shownEntries.set(position, newEntry);
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
if (_sortCategory != null) {
|
}
|
||||||
Comparator<VaultEntry> comparator = _sortCategory.getComparator();
|
|
||||||
if (comparator != null) {
|
sortShownEntries();
|
||||||
Collections.sort(_shownEntries, comparator);
|
|
||||||
int newPosition = _shownEntries.indexOf(newEntry);
|
int newPosition = _shownEntries.indexOf(newEntry);
|
||||||
if (position != newPosition) {
|
if (position != newPosition) {
|
||||||
notifyItemMoved(position, newPosition);
|
notifyItemMoved(position, newPosition);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!isEntryFiltered(newEntry)) {
|
} else if (!isEntryFiltered(newEntry)) {
|
||||||
_shownEntries.add(newEntry);
|
_shownEntries.add(newEntry);
|
||||||
|
|
||||||
|
@ -305,17 +301,21 @@ public class EntryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the remaining list of entries
|
sortShownEntries();
|
||||||
|
_view.onListChange();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sortShownEntries() {
|
||||||
|
if (_sortCategory != null) {
|
||||||
Comparator<VaultEntry> comparator = _sortCategory.getComparator();
|
Comparator<VaultEntry> comparator = _sortCategory.getComparator();
|
||||||
if (comparator != null) {
|
if (comparator != null) {
|
||||||
Collections.sort(_shownEntries, comparator);
|
Collections.sort(_shownEntries, comparator);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Comparator<VaultEntry> favoriteComparator = new FavoriteComparator();
|
Comparator<VaultEntry> favoriteComparator = new FavoriteComparator();
|
||||||
Collections.sort(_shownEntries, favoriteComparator);
|
Collections.sort(_shownEntries, favoriteComparator);
|
||||||
|
|
||||||
_view.onListChange();
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewMode(ViewMode viewMode) {
|
public void setViewMode(ViewMode viewMode) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue