Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider's Set position in one use case is not working #15

Open
navalpatel5 opened this issue Mar 20, 2017 · 1 comment
Open

Slider's Set position in one use case is not working #15

navalpatel5 opened this issue Mar 20, 2017 · 1 comment

Comments

@navalpatel5
Copy link

We have a non-linear data to be selected upon like, 1hours,1 day, 1week, 2 weeks,1 month, 6 months, 1 year, 2 year.

So this library comes as a healthy rescue. I have hit upon a problem which I am not sure is the problem with the library or it is with my code. I have tried quite a few things before thinking to write to you.

By default I set the selection for 1 week (i.e. position = 2). This works, and the circle thumb appears at the correct position. This is more like initializing the position of the slider when it is shown to the user. There after the user slides and sets the position. And we capture the user's selection in

setOnDiscreteSliderChangeListener

We get the position as argument and we perform slider.setPosition(position). This also works.

This time we have defined a red area (starts from 1 month to 2 year selection). If the user slides to any of the values in red area, we want to prompt the user that he is not allowed to select these values as he is not a premium user. I am able to read the position value from the changeListener and bring up the pop-up to the user. However sliding the thumb back to its original or for that matter even hardcoded position of 0 does not work for me (visually). the thumb does not slide back, however the position value of the slider is programatically set.

At one end when we initialize the slider, i do see that setPosition works (but this happens on main UI thread). When I try to set a position in the setOnDiscreteSliderChangeListener , i dont see the thumb moving, but the variable value of position gets set. Not sure how do I address this.

@navalpatel5
Copy link
Author

Just in case you want to visually understand my problem...

screenshot_2017-03-20-16-53-13

When the thumb is moved to the beeds that are positioned with red, and we want that the thumb should slide back to the original position. I know the original position from slider.getPosition() when the setOnDiscreteSliderChangeListener, i check the threshold position and try to set the known position. This does not work. Let me additionally tell you that I am making this all work through an adapter, the slider component is drawn in the recyclerview via an adapter. I am clear that there is no issue with the overall 'position of the item in the adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant