From 8dd2430c7c79a0514a2882b15645526803a9d6ae Mon Sep 17 00:00:00 2001 From: Vinicius Sossella Date: Wed, 7 Feb 2018 16:27:12 -0200 Subject: [PATCH] fix calc --- app/build.gradle | 3 +++ .../main/java/opencraft/com/verticalseekbar/MainActivity.kt | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- build.gradle | 1 + .../java/opencraft/com/verticalseekbarlib/VerticalSeekBar.java | 3 ++- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 956da7b..3bce822 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,5 +30,8 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + +// compile 'com.github.OpenCraft:VerticalSeekBar:v1.0.11' + implementation project(':verticalseekbarlib') } diff --git a/app/src/main/java/opencraft/com/verticalseekbar/MainActivity.kt b/app/src/main/java/opencraft/com/verticalseekbar/MainActivity.kt index 035cdf7..4d517a2 100644 --- a/app/src/main/java/opencraft/com/verticalseekbar/MainActivity.kt +++ b/app/src/main/java/opencraft/com/verticalseekbar/MainActivity.kt @@ -34,7 +34,7 @@ class MainActivity : AppCompatActivity() { }) - seekbar.post { seekbar.applyInitialValue(1075, false) } + seekbar.post { seekbar.applyInitialValue(1075, true) } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7934fbe..54caf0b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -46,7 +46,7 @@ android:layout_below="@+id/top" android:clipChildren="false" app:seekbar_backgroundColor="@color/colorPrimaryDark" - app:seekbar_max_value="2500" + app:seekbar_max_value="1000" app:seekbar_step="25" app:seekbar_thumb="@drawable/check_on" app:seekbar_thumbMarginTop="-25dp" diff --git a/build.gradle b/build.gradle index 3a52685..62b5e9a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ buildscript { allprojects { repositories { + maven { url "https://jitpack.io" } google() jcenter() } diff --git a/verticalseekbarlib/src/main/java/opencraft/com/verticalseekbarlib/VerticalSeekBar.java b/verticalseekbarlib/src/main/java/opencraft/com/verticalseekbarlib/VerticalSeekBar.java index be39086..222ad2b 100644 --- a/verticalseekbarlib/src/main/java/opencraft/com/verticalseekbarlib/VerticalSeekBar.java +++ b/verticalseekbarlib/src/main/java/opencraft/com/verticalseekbarlib/VerticalSeekBar.java @@ -190,7 +190,8 @@ private void animateViews(float wantedY) { callOnValueChanged(calculatedValue); } else { if (wantedY >= maxValueY) { - callOnValueChanged(value == maxValue ? 0 : maxValue); + int valueChanged = value == maxValue ? 0 : value - maxValue; + callOnValueChanged(valueChanged); setYPosition(maxValueY, maxValueY); } if (wantedY <= 0) {