Skip to content

Commit

Permalink
animation ends
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinicius Sossella committed Jan 15, 2018
1 parent e3522e9 commit 531fb51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package opencraft.com.verticalseekbar

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*
import opencraft.com.verticalseekbarlib.VerticalSeekBarListener

Expand All @@ -13,7 +14,8 @@ class MainActivity : AppCompatActivity() {

seekbar.setVerticalSeekBarListener(object : VerticalSeekBarListener {
override fun onAnimationStop(thumbY: Float, backgroundY: Float) {

balloon.y = thumbY - 15
balloon.visibility = View.VISIBLE
}

override fun onYPositionChanged(thumbY: Float, backgroundY: Float) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
android:src="@drawable/dotted"
android:layerType="software" />

<View
android:id="@+id/balloon"
android:visibility="gone"
android:layout_width="match_parent"
android:background="#FFF"
android:layout_height="4dp"/>

<opencraft.com.verticalseekbarlib.VerticalSeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
addMarginToBackground(finalYPosition);
callOnValueChanged(calculatedValue);
listener.onAnimationStop(verticalSeekBarThumb.getY(),
verticalSeekBarBackground.getY());
}
});
animSetViews.start();
listener.onYPositionChanged(finalYPosition + thumbMarginTop, finalYPosition);
}
listener.onAnimationStop(verticalSeekBarThumb.getY(),
verticalSeekBarBackground.getY());
}

private void calculateValueFromYPosition(int yPosition, int pixelNumberToInteractionWithoutMargin) {
Expand Down

0 comments on commit 531fb51

Please sign in to comment.