mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 22:12:55 +00:00
Merge pull request #910 from CristianAUnisa/sort-on-replace
Sort list after editing entry
This commit is contained in:
commit
98de86b53e
1 changed files with 8 additions and 2 deletions
|
@ -192,15 +192,21 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
} else {
|
} else {
|
||||||
_shownEntries.set(position, newEntry);
|
_shownEntries.set(position, newEntry);
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
|
if (_sortCategory != null) {
|
||||||
|
Comparator<VaultEntry> comparator = _sortCategory.getComparator();
|
||||||
|
Collections.sort(_shownEntries, comparator);
|
||||||
|
int newPosition = Collections.binarySearch(_shownEntries, newEntry, comparator);
|
||||||
|
if (position != newPosition) {
|
||||||
|
notifyItemMoved(position, newPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!isEntryFiltered(newEntry)) {
|
} else if (!isEntryFiltered(newEntry)) {
|
||||||
// TODO: preserve order
|
|
||||||
_shownEntries.add(newEntry);
|
_shownEntries.add(newEntry);
|
||||||
|
|
||||||
int position = getItemCount() - 1;
|
int position = getItemCount() - 1;
|
||||||
notifyItemInserted(position);
|
notifyItemInserted(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkPeriodUniformity();
|
checkPeriodUniformity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue