diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt index 62da94d3ff..02e46e5c17 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt @@ -62,7 +62,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { override fun submit(): Boolean { val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin.text) - val durationInMinutes = SafeParse.stringToInt(actions_extendedbolus_duration.text) + val durationInMinutes = actions_extendedbolus_duration.value.toInt() val actions: LinkedList = LinkedList() val insulinAfterConstraint = constraintChecker.applyExtendedBolusConstraints(Constraint(insulin)).value() actions.add(resourceHelper.gs(R.string.formatinsulinunits, insulinAfterConstraint)) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index 14f0897cc5..7ab5850f87 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -83,7 +83,7 @@ class TempBasalDialog : DialogFragmentWithDate() { override fun submit(): Boolean { var percent = 0 var absolute = 0.0 - val durationInMinutes = SafeParse.stringToInt(actions_tempbasal_duration.text) + val durationInMinutes = actions_tempbasal_duration.value.toInt() val profile = profileFunction.getProfile() ?: return false val actions: LinkedList = LinkedList() if (isPercentPump) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBg.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBg.kt index f81ef07bb8..24b48e0fb7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBg.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBg.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.kt index e7624a98c7..46b696eaec 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDelta.kt @@ -9,7 +9,7 @@ import android.widget.Spinner import androidx.annotation.StringRes import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import info.nightscout.androidaps.utils.resources.ResourceHelper import java.text.DecimalFormat import java.util.* diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDouble.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDouble.kt index 7824b51960..566315b9eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDouble.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDouble.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import android.widget.LinearLayout import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat class InputDouble(injector: HasAndroidInjector) : Element(injector) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDuration.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDuration.kt index cab16d2502..08647735cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDuration.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDuration.kt @@ -3,7 +3,8 @@ package info.nightscout.androidaps.plugins.general.automation.elements import android.widget.LinearLayout import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.MinutesNumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat class InputDuration(injector: HasAndroidInjector) : Element(injector) { @@ -20,11 +21,14 @@ class InputDuration(injector: HasAndroidInjector) : Element(injector) { var value: Int = 0 override fun addToLayout(root: LinearLayout) { - val numberPicker = NumberPicker(root.context, null) - if (unit == TimeUnit.MINUTES) + val numberPicker : NumberPicker + if (unit == TimeUnit.MINUTES) { + numberPicker = MinutesNumberPicker(root.context, null) numberPicker.setParams(0.0, 0.0, 24 * 60.0, 10.0, DecimalFormat("0"), false, root.findViewById(R.id.ok)) - else + } else { + numberPicker = NumberPicker(root.context, null) numberPicker.setParams(0.0, 0.0, 24.0, 1.0, DecimalFormat("0"), false, root.findViewById(R.id.ok)) + } numberPicker.value = value.toDouble() numberPicker.setOnValueChangedListener { value: Double -> this.value = value.toInt() } root.addView(numberPicker) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulin.kt index f822a971f4..0903824a94 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulin.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import android.widget.LinearLayout import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat class InputInsulin(injector: HasAndroidInjector) : Element(injector) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercent.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercent.kt index 7b1f739ed7..05524abc40 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercent.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercent.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import android.widget.LinearLayout import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat class InputPercent(injector: HasAndroidInjector) : Element(injector) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTarget.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTarget.kt index 8208e7e687..4f58be8167 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTarget.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTarget.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import java.text.DecimalFormat import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt index 978455a4ae..2d49eb3a97 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWEditNumberWithUnits.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.setupwizard.SWNumberValidator -import info.nightscout.androidaps.utils.NumberPicker +import info.nightscout.androidaps.utils.ui.NumberPicker import info.nightscout.androidaps.utils.SafeParse import java.text.DecimalFormat import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java b/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java index f09f562d25..5244c5c4ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java @@ -1,30 +1,11 @@ package info.nightscout.androidaps.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; import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.LinearLayout; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.NumberFormat; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; +import info.nightscout.androidaps.utils.ui.NumberPicker; /** * Created by mike on 28.06.2016. diff --git a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java index 7010a82c12..1440a65c21 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/TimeListEdit.java @@ -13,24 +13,20 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import androidx.core.widget.TextViewCompat; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; -import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; +import info.nightscout.androidaps.utils.ui.NumberPicker; /** * Created by mike on 29.12.2016. diff --git a/app/src/main/res/layout/activity_profilehelper.xml b/app/src/main/res/layout/activity_profilehelper.xml index effa56b112..310a4c566d 100644 --- a/app/src/main/res/layout/activity_profilehelper.xml +++ b/app/src/main/res/layout/activity_profilehelper.xml @@ -94,7 +94,7 @@ android:text="@string/age" android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> - @@ -115,7 +115,7 @@ android:text="@string/tdd_total" android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> - @@ -136,7 +136,7 @@ android:text="@string/weight_label" android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> - @@ -157,7 +157,7 @@ android:text="@string/basalpctfromtdd_label" android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> - diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml deleted file mode 100644 index a501e70a77..0000000000 --- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml +++ /dev/null @@ -1,576 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -