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 493e665..3f6dbb9 100644 (file)
@@ -100,10 +100,12 @@ public class HueRing extends View {
         return hueDegrees;
     }
     public void setHue(int hueDegrees) {
         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);
 
         this.hueDegrees = hueDegrees;
         this.color = Colors.getPrimaryColorForHue(hueDegrees);