Skip to content

onValueChanged called several times, with alternating values #201

Description

@MlsCf

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions