+ * the to range is 0-20
+ * the form gange is 0-10
+ * the result must be 10
+ *
+ * @throws Exception
+ */
+ public void testRange() throws Exception {
+ int value = convertRange(5, 0, 20, 0, 10);
+
+ int value2 = convert(5, 0, 35, 0, 255);
+
+ assertTrue(value == 10);
+ assertTrue(value2 == 10);
+
+ }
+
+ private int convertRange(int value, int fromLow, int fromHigh, int toLow, int toHigh) {
+ return ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow) + toLow;
+ }
+
+ private int convert(int value, int min1, int max1, int min2, int max2) {
+ return min2 + ((value - min1) / (max1 - min1)) * (max2 - min2);
+ }
}
diff --git a/materialanimatedswitch/src/main/AndroidManifest.xml b/materialanimatedswitch/src/main/AndroidManifest.xml
index 9607480..4f761ae 100644
--- a/materialanimatedswitch/src/main/AndroidManifest.xml
+++ b/materialanimatedswitch/src/main/AndroidManifest.xml
@@ -1,10 +1,10 @@