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

onValueChanged called several times, with alternating values #201

Open
MlsCf opened this issue Sep 12, 2022 · 1 comment
Open

onValueChanged called several times, with alternating values #201

MlsCf opened this issue Sep 12, 2022 · 1 comment

Comments

@MlsCf
Copy link

MlsCf commented Sep 12, 2022

Hello, I have found this issue: when dragging to choose a value, the onValueChanged handler gets called several times.

For example, when dragging from value "1" to "2" , this occurs

oldVal:1 newVal:2
oldVal:2 newVal:1
oldVal:1 newVal:2
oldVal:2 newVal:1
oldVal:1 newVal:2
oldVal:2 newVal:1
oldVal:1 newVal:2

this is not a big problem, since the last value is correct.
However, in case we need other actions to be performed on value changed (i.e. persisting value to storage, or calling other functions) this can create problems.

I checked the behaviour of the original Android widget and this issue does not occur.

As a temporary workaround, I tried to track the timestamps atwhich the value changes occur, discarding every second one in case the timestamp difference is less than a few ms. This - however - in not the optimal solution since it sets sometimes the wrong value (in case the item is dragged back and forth).

Regards.

@MlsCf
Copy link
Author

MlsCf commented Sep 12, 2022

Could this issue be related to #183 ? I haven't tried to integrate the change proposed by the user, yet.

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