X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Futils%2FColors.java;h=7cf710ac0067b3b90319190c4f5524679beb38b6;hb=155258526411c608c27476f02fa095d67dc849c2;hp=adefa6f30e701d538b4f6c02a452f15a4873adff;hpb=87a1e58f79757bb0257c911e9bd77eb5d77a3e40;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java b/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java index adefa6f3..7cf710ac 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java @@ -28,12 +28,13 @@ import androidx.lifecycle.MutableLiveData; import net.ktnx.mobileledger.BuildConfig; import net.ktnx.mobileledger.R; -import net.ktnx.mobileledger.model.MobileLedgerProfile; +import net.ktnx.mobileledger.db.Profile; import net.ktnx.mobileledger.ui.HueRing; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Objects; @@ -67,7 +68,7 @@ public class Colors { }; private static final HashMap themePrimaryColor = new HashMap<>(); public static @ColorInt - int secondary; + int primary; @ColorInt public static int tableRowDarkBG; public static int profileThemeId = DEFAULT_HUE_DEG; @@ -75,8 +76,8 @@ public class Colors { TypedValue tv = new TypedValue(); theme.resolveAttribute(R.attr.table_row_dark_bg, tv, true); tableRowDarkBG = tv.data; - theme.resolveAttribute(R.attr.colorSecondary, tv, true); - secondary = tv.data; + theme.resolveAttribute(R.attr.colorPrimary, tv, true); + primary = tv.data; if (themePrimaryColor.size() == 0) { for (int themeId : themeIDs) { @@ -151,7 +152,7 @@ public class Colors { } return colors; } - public static int getNewProfileThemeHue(ArrayList profiles) { + public static int getNewProfileThemeHue(List profiles) { if ((profiles == null) || (profiles.size() == 0)) return DEFAULT_HUE_DEG; @@ -159,14 +160,14 @@ public class Colors { if (profiles.size() == 1) { int opposite = profiles.get(0) - .getThemeHue() + 180; + .getTheme() + 180; opposite %= 360; chosenHue = opposite; } else { ArrayList hues = new ArrayList<>(); - for (MobileLedgerProfile p : profiles) { - int hue = p.getThemeHue(); + for (Profile p : profiles) { + int hue = p.getTheme(); if (hue == -1) hue = DEFAULT_HUE_DEG; hues.add(hue);