Browse Source

fix native android wheel glitch

master
Henning Hall 5 years ago
parent
commit
6a4ab3d64f
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      android/src/main/java/com/henninghall/date_picker/pickers/AndroidNative.java

+ 7
- 2
android/src/main/java/com/henninghall/date_picker/pickers/AndroidNative.java View File

@ -1,7 +1,6 @@
package com.henninghall.date_picker.pickers;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Paint;
import android.os.Handler;
import android.util.AttributeSet;
@ -174,7 +173,13 @@ public class AndroidNative extends NumberPicker implements Picker {
public void onScrollStateChange(NumberPicker numberPicker, int state) {
boolean stoppedScrolling = previousState != SCROLL_STATE_IDLE && state == SCROLL_STATE_IDLE;
if (stoppedScrolling) {
listener.onValueChange();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
listener.onValueChange();
}
// the delay make sure the wheel has stopped before sending the value change event
}, 500);
}
previousState = state;
}

Loading…
Cancel
Save