From: Damyan Ivanov Date: Mon, 4 May 2020 18:35:43 +0000 (+0300) Subject: remove unused code X-Git-Tag: v0.12.0~6 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9829a44a3f6146aa6e2ed23a0a54ccabdcde0f36;p=mobile-ledger.git remove unused code --- 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 7635ef3c..d820f244 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Colors.java @@ -109,62 +109,11 @@ public class Colors { // trigger theme observers themeWatch.postValue(themeWatch.getValue() + 1); } - public static @ColorLong - long hsvaColor(float hue, float saturation, float value, float alpha) { - if (alpha < 0 || alpha > 1) - throw new IllegalArgumentException("alpha must be between 0 and 1"); - - @ColorLong long rgb = hsvTriplet(hue, saturation, value); - - long a_bits = Math.round(255 * alpha); - return (a_bits << 24) | rgb; - } - public static @ColorInt - int hsvColor(float hue, float saturation, float value) { - return 0xff000000 | hsvTriplet(hue, saturation, value); - } public static @ColorInt int hslColor(float hueRatio, float saturation, float lightness) { return 0xff000000 | hslTriplet(hueRatio, saturation, lightness); } public static @ColorInt - int hsvTriplet(float hue, float saturation, float value) { - @ColorLong long result; - int r, g, b; - - if ((hue < -0.00005) || (hue > 1.0000005) || (saturation < 0) || (saturation > 1) || - (value < 0) || (value > 1)) - throw new IllegalArgumentException(String.format( - "hue, saturation, value and alpha must all be between 0 and 1. Arguments " + - "given: " + "hue=%1.5f, sat=%1.5f, val=%1.5f", hue, saturation, value)); - - int h = (int) (hue * 6); - float f = hue * 6 - h; - float p = value * (1 - saturation); - float q = value * (1 - f * saturation); - float t = value * (1 - (1 - f) * saturation); - - switch (h) { - case 0: - case 6: - return tupleToColor(value, t, p); - case 1: - return tupleToColor(q, value, p); - case 2: - return tupleToColor(p, value, t); - case 3: - return tupleToColor(p, q, value); - case 4: - return tupleToColor(t, p, value); - case 5: - return tupleToColor(value, p, q); - default: - throw new RuntimeException(String.format("Unexpected value for h (%d) while " + - "converting hsv(%1.2f, %1.2f, %1.2f) to " + - "rgb", h, hue, saturation, value)); - } - } - public static @ColorInt int hslTriplet(float hueRatio, float saturation, float lightness) { @ColorLong long result; float h = hueRatio * 6;