From 709907abf6ae18e4b85ae85f6cf1c558fed99bd3 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 24 Apr 2021 17:02:06 +0000 Subject: [PATCH] save profile's order when editing a profile --- .../net/ktnx/mobileledger/ui/profiles/ProfileDetailModel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailModel.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailModel.java index a00ec945..2460b2e0 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailModel.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailModel.java @@ -50,6 +50,7 @@ import static net.ktnx.mobileledger.db.Profile.NO_PROFILE_ID; public class ProfileDetailModel extends ViewModel { private static final String HTTPS_URL_START = "https://"; private final MutableLiveData profileName = new MutableLiveData<>(); + private final MutableLiveData orderNo = new MutableLiveData<>(); private final MutableLiveData postingPermitted = new MutableLiveData<>(true); private final MutableLiveData defaultCommodity = new MutableLiveData<>(null); private final MutableLiveData futureDates = @@ -231,6 +232,7 @@ public class ProfileDetailModel extends ViewModel { if (mProfile != null) { profileId.setValue(mProfile.getId()); profileName.setValue(mProfile.getName()); + orderNo.setValue(mProfile.getOrderNo()); postingPermitted.setValue(mProfile.permitPosting()); showCommentsByDefault.setValue(mProfile.getShowCommentsByDefault()); showCommodityByDefault.setValue(mProfile.getShowCommodityByDefault()); @@ -256,6 +258,7 @@ public class ProfileDetailModel extends ViewModel { } else { profileId.setValue(NO_PROFILE_ID); + orderNo.setValue(-1); profileName.setValue(null); url.setValue(HTTPS_URL_START); postingPermitted.setValue(true); @@ -273,6 +276,7 @@ public class ProfileDetailModel extends ViewModel { void updateProfile(Profile mProfile) { mProfile.setId(profileId.getValue()); mProfile.setName(profileName.getValue()); + mProfile.setOrderNo(orderNo.getValue()); mProfile.setUrl(url.getValue()); mProfile.setPermitPosting(postingPermitted.getValue()); mProfile.setShowCommentsByDefault(showCommentsByDefault.getValue()); -- 2.39.2