X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Futils%2FColors.java;h=829d1622d93a1c16562a485168451659a2324705;hp=1316a8e584ecc06e1c7b69b8c73cb02a0e68464b;hb=ff27cd8c41424676ec046c58448d23cd4313d1dc;hpb=fbaaba448b36e6f43d357c7651acef6746670f6e 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 1316a8e5..829d1622 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java @@ -54,10 +54,11 @@ public class Colors { @ColorInt public static int tableRowDarkBG; @ColorInt - public static int primary, defaultTextColor, defaultTextColorDisabled; + public static int primary; public static int profileThemeId = -1; public static MutableLiveData themeWatch = new MutableLiveData<>(0); public static int errorTextColor; + private static int SWIPE_COLOR_COUNT = 6; private static int[] themeIDs = {R.style.AppTheme_000, R.style.AppTheme_005, R.style.AppTheme_010, R.style.AppTheme_015, @@ -104,9 +105,6 @@ public class Colors { tableRowLightBG = tv.data; theme.resolveAttribute(R.attr.colorPrimary, tv, true); primary = tv.data; - theme.resolveAttribute(R.attr.textColor, tv, true); - defaultTextColor = tv.data; - defaultTextColorDisabled = 0x7f000000 | 0x00ffffff & defaultTextColor; theme.resolveAttribute(R.attr.colorAccent, tv, true); accent = tv.data; theme.resolveAttribute(R.attr.errorTextColor, tv, true); @@ -202,7 +200,7 @@ public class Colors { int themeId = -1; if (themeHue == 360) themeHue = 0; - if ((themeHue >= 0) && (themeHue < 360)) { + if ((themeHue >= 0) && (themeHue < 360) && (themeHue != DEFAULT_HUE_DEG)) { int index; if ((themeHue % HueRing.hueStepDegrees) != 0) { Logger.warn("profiles", @@ -230,21 +228,20 @@ public class Colors { refreshColors(activity.getTheme()); } - public static @NonNull ColorStateList getColorStateList() { return getColorStateList(profileThemeId); } public static @NonNull ColorStateList getColorStateList(int hue) { - return new ColorStateList(EMPTY_STATES, getColors(hue)); + return new ColorStateList(EMPTY_STATES, getSwipeCircleColors(hue)); } - public static int[] getColors() { - return getColors(profileThemeId); + public static int[] getSwipeCircleColors() { + return getSwipeCircleColors(profileThemeId); } - public static int[] getColors(int hue) { - int[] colors = new int[]{0, 0, 0, 0, 0, 0}; - for (int i = 0; i < 6; i++, hue = (hue + 60) % 360) { + public static int[] getSwipeCircleColors(int hue) { + int[] colors = new int[SWIPE_COLOR_COUNT]; + for (int i = 0; i < SWIPE_COLOR_COUNT; i++, hue = (hue + 360 / SWIPE_COLOR_COUNT) % 360) { colors[i] = getPrimaryColorForHue(hue); } return colors; @@ -275,7 +272,7 @@ public class Colors { for (int h : hues) { if (huesSB.length() > 0) huesSB.append(", "); - huesSB.append(String.valueOf(h)); + huesSB.append(h); } debug("profiles", String.format("used hues: %s", huesSB.toString())); }