From: Damyan Ivanov Date: Mon, 8 Feb 2021 06:01:32 +0000 (+0000) Subject: model: reorder account rows by their position X-Git-Tag: v0.17.0~97 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=2df070af07bb9b7803ea1de244a6cc547a0167cc;p=mobile-ledger.git model: reorder account rows by their position it is stupid that this cannot be achieved in Room --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsViewModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsViewModel.java index 9f87aa79..5d8ef18a 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsViewModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsViewModel.java @@ -173,6 +173,8 @@ public class TemplateDetailsViewModel extends ViewModel { TemplateDetailsItem header = TemplateDetailsItem.fromRoomObject(src.header); l.add(header); + Collections.sort(src.accounts, + (o1, o2) -> Long.compare(o1.getPosition(), o2.getPosition())); for (TemplateAccount acc : src.accounts) { l.add(TemplateDetailsItem.fromRoomObject(acc)); }