Skip to content

Commit

Permalink
fixed values
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinicius Sossella committed Jan 15, 2018
1 parent 531fb51 commit 236b247
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import opencraft.com.verticalseekbarlib.VerticalSeekBarListener

class MainActivity : AppCompatActivity() {

var animationStoped = false

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Expand All @@ -16,9 +18,12 @@ class MainActivity : AppCompatActivity() {
override fun onAnimationStop(thumbY: Float, backgroundY: Float) {
balloon.y = thumbY - 15
balloon.visibility = View.VISIBLE
animationStoped = true
}

override fun onYPositionChanged(thumbY: Float, backgroundY: Float) {
if (animationStoped)
balloon.visibility = View.GONE
background_top.y = backgroundY + top.height - 10
}

Expand Down
14 changes: 8 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
android:layout_height="wrap_content" />


<TextView
android:id="@+id/text_bottom"
android:text="500"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />


<ImageView
android:id="@+id/background_top"
Expand All @@ -53,6 +48,7 @@
app:seekbar_thumbMarginTop="-25dp"
app:seekbar_thumb="@drawable/check_on"
app:seekbar_value="5000"
app:seekbar_max_value="2500"
app:seekbar_step="25" />

<View
Expand All @@ -62,5 +58,11 @@
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary" />

<TextView
android:id="@+id/text_bottom"
android:text="500"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ private void animateViews(float wantedY) {
callOnValueChanged(calculatedValue);
} else {
if (wantedY >= maxValueY) {
callOnValueChanged(maxValue);
callOnValueChanged(value == maxValue ? 0 : maxValue);
setYPosition(maxValueY, maxValueY);
}
if (wantedY <= 0) {
callOnValueChanged(0);
callOnValueChanged(value);
setYPosition(0, 0);
}
}
Expand Down

0 comments on commit 236b247

Please sign in to comment.