X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Futils%2FColors.java;h=e648ca7d058ff167e8791e45c2c554a601527955;hb=4f910919819fbe8db070847cfbfba493a62c7c58;hp=80ec58ab82db1f642d10b1a76716a9362e1dc2e0;hpb=898bf5932a1bdb2a7b197d9e0981f722111295b6;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 80ec58ab..e648ca7d 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Damyan Ivanov. + * Copyright © 2020 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -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); @@ -216,7 +214,7 @@ public class Colors { } if (themeId < 0) { - themeId = R.style.AppTheme; + themeId = R.style.AppTheme_default; debug("profiles", String.format(Locale.ENGLISH, "Theme hue %d not supported, using the default", themeHue)); @@ -230,7 +228,6 @@ public class Colors { refreshColors(activity.getTheme()); } - public static @NonNull ColorStateList getColorStateList() { return getColorStateList(profileThemeId); @@ -243,8 +240,8 @@ public class Colors { return getSwipeCircleColors(profileThemeId); } public static int[] getSwipeCircleColors(int hue) { - int[] colors = new int[]{0, 0, 0, 0, 0, 0}; - for (int i = 0; i < 6; i++, hue = (hue + 60) % 360) { + 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())); }