]> git.ktnx.net Git - mobile-ledger.git/commitdiff
HueRing: allow selecting the default hue which is not divisable by 15
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 3 Mar 2019 09:27:23 +0000 (11:27 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 3 Mar 2019 09:27:23 +0000 (11:27 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/HueRing.java

index 493e6658d4e18f89477d72571427eeb7f23bdd12..3f6dbb924e3ca47fb3346c5cb2416f0e9210f747 100644 (file)
@@ -100,10 +100,12 @@ public class HueRing extends View {
         return hueDegrees;
     }
     public void setHue(int hueDegrees) {
-        // round to 15 degrees
-        int rem = hueDegrees % 15;
-        if (rem < 8) hueDegrees -= rem;
-        else hueDegrees += 15 - rem;
+        if (hueDegrees != Colors.DEFAULT_HUE_DEG) {
+            // round to 15 degrees
+            int rem = hueDegrees % 15;
+            if (rem < 8) hueDegrees -= rem;
+            else hueDegrees += 15 - rem;
+        }
 
         this.hueDegrees = hueDegrees;
         this.color = Colors.getPrimaryColorForHue(hueDegrees);