You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to send something to a server when I stop touching the rangebar, i.e do the same thing as onStopTrackingTouch() in the Android SeekBar. The only way I've found of doing this is to use an onTouchListener and check MotionEvent.ACTION_UP, but then the view of the RangeBar does not update until I release my finger.
I can't use onRangeBarChangeListener() for this, as I don't want to be sending information to the server on every change.
Is there any easy way of doing this? :)
Thanks in advance!
The text was updated successfully, but these errors were encountered:
I would ask highly that this be added - very basic but important functionality to know when the seek has stopped and what is the final value (ie to save it or send to server, etc)
Been struggling with that exact same issue for a couple hours, finally I decided to get hacky and took matters into my own hands.. literally..
public class RangeBar extends com.appyvet.rangebar.RangeBar {
public RangeBar(Context context) {
super(context);
}
public RangeBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public RangeBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
EventBus.getDefault().post(new PriceRangeUpdated());
return super.onTouchEvent(event);
}
return super.onTouchEvent(event);
}
public class PriceRangeUpdated {
}
}
As you can see, I extended his RangeBar and overridden the onTouchEventMethod, in it I notify my activity that a the user's finger is leaving the RangeBar, then in the activity, I can easily retrieve the values like this:
I want to send something to a server when I stop touching the rangebar, i.e do the same thing as onStopTrackingTouch() in the Android SeekBar. The only way I've found of doing this is to use an onTouchListener and check MotionEvent.ACTION_UP, but then the view of the RangeBar does not update until I release my finger.
I can't use onRangeBarChangeListener() for this, as I don't want to be sending information to the server on every change.
Is there any easy way of doing this? :)
Thanks in advance!
The text was updated successfully, but these errors were encountered: