X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fprofiles%2FProfilesRecyclerViewAdapter.java;h=b2b5cb7fe18f9ee86867b041ad134c1625c6270e;hb=0ce370cea3c5c980b6eeb14acf965188ae951f51;hp=6f533b01d3abffab5ef4d0a2e1afec955a278bea;hpb=df9ebf3fc3ca1730afbdc5e6de248e51cc41ba80;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java index 6f533b01..b2b5cb7f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java @@ -136,6 +136,8 @@ public class ProfilesRecyclerViewAdapter if (profile == null) throw new IllegalStateException("Profile row without associated profile"); debug("profiles", "Setting profile to " + profile.getName()); + if (Data.getProfile() != profile) + Data.drawerOpen.setValue(false); Data.setCurrentProfile(profile); } @NonNull @@ -175,12 +177,12 @@ public class ProfilesRecyclerViewAdapter final ArrayList profiles = Data.profiles.getValue(); if (profiles == null) throw new AssertionError(); final MobileLedgerProfile profile = profiles.get(position); - final MobileLedgerProfile currentProfile = Data.profile.getValue(); + final MobileLedgerProfile currentProfile = Data.getProfile(); debug("profiles", String.format(Locale.ENGLISH, "pos %d: %s, current: %s", position, - profile.getUuid(), (currentProfile == null) ? "" : currentProfile.getUuid())); + profile.getUuid(), currentProfile.getUuid())); holder.itemView.setTag(profile); - int hue = profile.getThemeId(); + int hue = profile.getThemeHue(); if (hue == -1) holder.mColorTag .setBackgroundColor(Colors.getPrimaryColorForHue(Colors.DEFAULT_HUE_DEG)); else holder.mColorTag.setBackgroundColor(Colors.getPrimaryColorForHue(hue)); @@ -190,7 +192,7 @@ public class ProfilesRecyclerViewAdapter holder.mEditButton.setOnClickListener(mOnClickListener); - final boolean sameProfile = (currentProfile != null) && currentProfile.equals(profile); + final boolean sameProfile = currentProfile.equals(profile); holder.itemView .setBackground(sameProfile ? new ColorDrawable(Colors.tableRowDarkBG) : null); if (editingProfiles.getValue()) {