Merge pull request #445 from AdrianLxM/numberpicker-update

update NP value after manual entry
This commit is contained in:
Milos Kozak 2017-10-06 12:41:34 +02:00 committed by GitHub
commit a670a43346

View file

@ -3,6 +3,7 @@ package info.nightscout.utils;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -119,6 +120,22 @@ public class NumberPicker extends LinearLayout implements View.OnKeyListener,
plusButton.setOnTouchListener(this); plusButton.setOnTouchListener(this);
plusButton.setOnKeyListener(this); plusButton.setOnKeyListener(this);
plusButton.setOnClickListener(this); plusButton.setOnClickListener(this);
this.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
value = SafeParse.stringToDouble(editText.getText().toString());
}
});
} }
public void removeTextChangedListener(TextWatcher textWatcher) { public void removeTextChangedListener(TextWatcher textWatcher) {