From 2df070af07bb9b7803ea1de244a6cc547a0167cc Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 8 Feb 2021 06:01:32 +0000 Subject: [PATCH] model: reorder account rows by their position it is stupid that this cannot be achieved in Room --- .../mobileledger/ui/templates/TemplateDetailsViewModel.java | 2 ++ 1 file changed, 2 insertions(+) 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)); } -- 2.39.5