Comments (2)
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:
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPriceRangeUpdated(RangeBar.PriceRangeUpdated updateEvent) {
String leftPin = priceRangeBar.getLeftPinValue();
String rightPin = priceRangeBar.getRightPinValue();
Log.d("@@@@", "onPriceRangeUpdated: leftPin: " + leftPin);
Log.d("@@@@", "onPriceRangeUpdated: rightPin: " + rightPin);
}
from material-range-bar.
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)
from material-range-bar.
Related Issues (20)
- Scrolling in Scrollview changes MaterialRangeBar HOT 1
- Set minimum range HOT 2
- Selectors/thumbs can be switched HOT 1
- How to disable temporary baloons? HOT 1
- How to prevent overlapping two sliders HOT 4
- mrb_rangeBar broken
- Selector elevation
- Supporting RTL?
- For single thumb it start from tick end. How to start thumb from start tick?And is it possible to add custom drawable for thumb?
- How to find out which thumb triggered the onTouchStarted and onTouchEnded events?
- Thumbs cannot move across each other for tickInterval != 1
- onTouchEnded called when setting pin ranges programmatically
- How assign interval to Range-bar ?
- version 1.5.2 Kotlin Conversion and API support for 24+ @oli107 HOT 1
- how can i change ranage bar backgound line color and change pin image using this library?
- How to provide a drawable for range bar color?
- How to define styles in styles.xml? HOT 1
- JCenter Sunsets on May 1st HOT 4
- java.lang.IllegalArgumentException: tickCount less than 2; invalid tickCount.
- Expose colors for disabled state
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-range-bar.