From 1b5ef50eb2bd09dcc65087ffac0a432ae9a435eb Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Fri, 6 Oct 2017 03:24:35 +0200 Subject: [PATCH] update NP value after manual entry --- .../info/nightscout/utils/NumberPicker.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/info/nightscout/utils/NumberPicker.java b/app/src/main/java/info/nightscout/utils/NumberPicker.java index ce960cbe7a..1827009a94 100644 --- a/app/src/main/java/info/nightscout/utils/NumberPicker.java +++ b/app/src/main/java/info/nightscout/utils/NumberPicker.java @@ -3,6 +3,7 @@ package info.nightscout.utils; import android.content.Context; import android.os.Handler; import android.os.Message; +import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; import android.view.KeyEvent; @@ -119,6 +120,22 @@ public class NumberPicker extends LinearLayout implements View.OnKeyListener, plusButton.setOnTouchListener(this); plusButton.setOnKeyListener(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) {