small cleanup
This commit is contained in:
parent
2ce590a700
commit
953d6bc029
18 changed files with 237 additions and 193 deletions
|
@ -3,7 +3,11 @@ package info.nightscout.androidaps.dialogs
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
|
|
@ -14,8 +14,8 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
import info.nightscout.androidaps.utils.XdripCalibrations
|
import info.nightscout.androidaps.utils.XdripCalibrations
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
import kotlinx.android.synthetic.main.dialog_calibration.*
|
import kotlinx.android.synthetic.main.dialog_calibration.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_calibration, container, false)
|
return inflater.inflate(R.layout.dialog_calibration, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
|
import kotlinx.android.synthetic.main.dialog_carbs.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_carbs.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
@ -72,7 +72,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_carbs, container, false)
|
return inflater.inflate(R.layout.dialog_carbs, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,14 @@ import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.Translator
|
||||||
import kotlinx.android.synthetic.main.dialog_care.*
|
import kotlinx.android.synthetic.main.dialog_care.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -49,7 +53,7 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_care, container, false)
|
return inflater.inflate(R.layout.dialog_care, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +77,7 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
action_care_bg_layout.visibility = View.GONE
|
action_care_bg_layout.visibility = View.GONE
|
||||||
actions_care_bgsource.visibility = View.GONE
|
actions_care_bgsource.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
import kotlinx.android.synthetic.main.datetime.*
|
import kotlinx.android.synthetic.main.datetime.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
|
@ -42,7 +43,7 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
|
savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onCreateView() {
|
fun onCreateViewGeneral() {
|
||||||
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
|
||||||
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
|
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
|
||||||
isCancelable = true
|
isCancelable = true
|
||||||
|
@ -103,7 +104,7 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notes_layout?.visibility = if (SP.getBoolean(R.string.key_show_notes_entry_dialogs, false)) View.VISIBLE else View.GONE
|
notes_layout?.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
|
||||||
|
|
||||||
ok.setOnClickListener {
|
ok.setOnClickListener {
|
||||||
synchronized(okClicked) {
|
synchronized(okClicked) {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package info.nightscout.androidaps.dialogs
|
package info.nightscout.androidaps.dialogs
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
|
|
@ -8,9 +8,9 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
@ -31,7 +31,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_extendedbolus, container, false)
|
return inflater.inflate(R.layout.dialog_extendedbolus, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.db.Source
|
import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
import kotlinx.android.synthetic.main.dialog_fill.*
|
import kotlinx.android.synthetic.main.dialog_fill.*
|
||||||
|
@ -32,7 +32,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_fill, container, false)
|
return inflater.inflate(R.layout.dialog_fill, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.Profile
|
import info.nightscout.androidaps.data.Profile
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
|
@ -19,13 +20,12 @@ import info.nightscout.androidaps.db.TempTarget
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
|
import kotlinx.android.synthetic.main.dialog_insulin.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_insulin.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -69,7 +69,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_insulin, container, false)
|
return inflater.inflate(R.layout.dialog_insulin, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
overview_insulin_time_layout.visibility = View.GONE
|
overview_insulin_time_layout.visibility = View.GONE
|
||||||
overview_insulin_record_only.setOnCheckedChangeListener { _, isChecked: Boolean ->
|
overview_insulin_record_only.setOnCheckedChangeListener { _, isChecked: Boolean ->
|
||||||
overview_insulin_time_layout.visibility = if (isChecked) View.VISIBLE else View.GONE
|
overview_insulin_time_layout.visibility = isChecked.toVisibility()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import kotlinx.android.synthetic.main.dialog_profileswitch.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import kotlinx.android.synthetic.main.dialog_profileswitch.*
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_profileswitch, container, false)
|
return inflater.inflate(R.layout.dialog_profileswitch, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
@ -35,7 +35,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_tempbasal, container, false)
|
return inflater.inflate(R.layout.dialog_tempbasal, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,13 @@ import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.db.TempTarget
|
import info.nightscout.androidaps.db.TempTarget
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SP
|
||||||
import kotlinx.android.synthetic.main.dialog_temptarget.*
|
import kotlinx.android.synthetic.main.dialog_temptarget.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -32,7 +36,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_temptarget, container, false)
|
return inflater.inflate(R.layout.dialog_temptarget, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,18 +79,22 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineEatingSoonTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineEatingSoonTT()
|
defaultTarget = DefaultValueHelper.determineEatingSoonTT()
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.gs(R.string.activity) -> {
|
MainApp.gs(R.string.activity) -> {
|
||||||
defaultDuration = DefaultValueHelper.determineActivityTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineActivityTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineActivityTT()
|
defaultTarget = DefaultValueHelper.determineActivityTT()
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.gs(R.string.hypo) -> {
|
MainApp.gs(R.string.hypo) -> {
|
||||||
defaultDuration = DefaultValueHelper.determineHypoTTDuration().toDouble()
|
defaultDuration = DefaultValueHelper.determineHypoTTDuration().toDouble()
|
||||||
defaultTarget = DefaultValueHelper.determineHypoTT()
|
defaultTarget = DefaultValueHelper.determineHypoTT()
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.gs(R.string.cancel) -> {
|
MainApp.gs(R.string.cancel) -> {
|
||||||
defaultDuration = 0.0
|
defaultDuration = 0.0
|
||||||
defaultTarget = 0.0
|
defaultTarget = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
defaultDuration = overview_temptarget_duration.value
|
defaultDuration = overview_temptarget_duration.value
|
||||||
defaultTarget = overview_temptarget_temptarget.value
|
defaultTarget = overview_temptarget_temptarget.value
|
||||||
|
|
|
@ -10,17 +10,21 @@ import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.db.Source
|
import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import kotlinx.android.synthetic.main.dialog_treatment.*
|
import kotlinx.android.synthetic.main.dialog_treatment.*
|
||||||
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -56,7 +60,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
onCreateView()
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.dialog_treatment, container, false)
|
return inflater.inflate(R.layout.dialog_treatment, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,11 @@ package info.nightscout.androidaps.dialogs
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.AdapterView.OnItemSelectedListener
|
import android.widget.AdapterView.OnItemSelectedListener
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
@ -75,8 +79,8 @@ class WizardDialog : DialogFragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
loadCheckedStates()
|
loadCheckedStates()
|
||||||
processCobCheckBox()
|
processCobCheckBox()
|
||||||
treatments_wizard_sbcheckbox.visibility = if (SP.getBoolean(R.string.key_usesuperbolus, false)) View.VISIBLE else View.GONE
|
treatments_wizard_sbcheckbox.visibility = SP.getBoolean(R.string.key_usesuperbolus, false).toVisibility()
|
||||||
treatments_wizard_notes_layout.visibility = if (SP.getBoolean(R.string.key_show_notes_entry_dialogs, false)) View.VISIBLE else View.GONE
|
treatments_wizard_notes_layout.visibility = SP.getBoolean(R.string.key_show_notes_entry_dialogs, false).toVisibility()
|
||||||
|
|
||||||
val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value()
|
val maxCarbs = MainApp.getConstraintChecker().maxCarbsAllowed.value()
|
||||||
val maxCorrection = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
val maxCorrection = MainApp.getConstraintChecker().maxBolusAllowed.value()
|
||||||
|
@ -110,23 +114,23 @@ class WizardDialog : DialogFragment() {
|
||||||
// cancel button
|
// cancel button
|
||||||
cancel.setOnClickListener { dismiss() }
|
cancel.setOnClickListener { dismiss() }
|
||||||
// checkboxes
|
// checkboxes
|
||||||
treatments_wizard_bgcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bgcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_ttcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_ttcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_cobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_cobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_basaliobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bolusiobcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_bgtrendcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
treatments_wizard_sbcheckbox.setOnCheckedChangeListener { buttonView, _ -> onCheckedChanged(buttonView) }
|
treatments_wizard_sbcheckbox.setOnCheckedChangeListener(::onCheckedChanged)
|
||||||
|
|
||||||
val showCalc = SP.getBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), false)
|
val showCalc = SP.getBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), false)
|
||||||
treatments_wizard_delimiter.visibility = if (showCalc) View.VISIBLE else View.GONE
|
treatments_wizard_delimiter.visibility = showCalc.toVisibility()
|
||||||
treatments_wizard_resulttable.visibility = if (showCalc) View.VISIBLE else View.GONE
|
treatments_wizard_resulttable.visibility = showCalc.toVisibility()
|
||||||
treatments_wizard_calculationcheckbox.isChecked = showCalc
|
treatments_wizard_calculationcheckbox.isChecked = showCalc
|
||||||
treatments_wizard_calculationcheckbox.setOnCheckedChangeListener { _, isChecked ->
|
treatments_wizard_calculationcheckbox.setOnCheckedChangeListener { _, isChecked ->
|
||||||
run {
|
run {
|
||||||
SP.putBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), isChecked)
|
SP.putBoolean(MainApp.gs(R.string.key_wizard_calculation_visible), isChecked)
|
||||||
treatments_wizard_delimiter.visibility = if (isChecked) View.VISIBLE else View.GONE
|
treatments_wizard_delimiter.visibility = isChecked.toVisibility()
|
||||||
treatments_wizard_resulttable.visibility = if (isChecked) View.VISIBLE else View.GONE
|
treatments_wizard_resulttable.visibility = isChecked.toVisibility()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// profile spinner
|
// profile spinner
|
||||||
|
@ -159,7 +163,7 @@ class WizardDialog : DialogFragment() {
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCheckedChanged(buttonView: CompoundButton) {
|
private fun onCheckedChanged(buttonView: CompoundButton, ignored: Boolean) {
|
||||||
saveCheckedStates()
|
saveCheckedStates()
|
||||||
treatments_wizard_ttcheckbox.isEnabled = treatments_wizard_bgcheckbox.isChecked && TreatmentsPlugin.getPlugin().tempTargetFromHistory != null
|
treatments_wizard_ttcheckbox.isEnabled = treatments_wizard_bgcheckbox.isChecked && TreatmentsPlugin.getPlugin().tempTargetFromHistory != null
|
||||||
if (buttonView.id == treatments_wizard_cobcheckbox.id)
|
if (buttonView.id == treatments_wizard_cobcheckbox.id)
|
||||||
|
@ -207,7 +211,6 @@ class WizardDialog : DialogFragment() {
|
||||||
treatments_wizard_profile.adapter = adapter
|
treatments_wizard_profile.adapter = adapter
|
||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
|
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
treatments_wizard_bgunits.text = units
|
treatments_wizard_bgunits.text = units
|
||||||
if (units == Constants.MGDL)
|
if (units == Constants.MGDL)
|
||||||
|
@ -236,7 +239,7 @@ class WizardDialog : DialogFragment() {
|
||||||
|
|
||||||
calculateInsulin()
|
calculateInsulin()
|
||||||
|
|
||||||
treatments_wizard_percent_used.visibility = if (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100) View.VISIBLE else View.GONE
|
treatments_wizard_percent_used.visibility = (SP.getInt(R.string.key_boluswizard_percentage, 100) != 100).toVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateInsulin() {
|
private fun calculateInsulin() {
|
||||||
|
|
|
@ -2,7 +2,11 @@ package info.nightscout.androidaps.plugins.configBuilder
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.*
|
import android.widget.CheckBox
|
||||||
|
import android.widget.ImageButton
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.RadioButton
|
||||||
|
import android.widget.TextView
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||||
|
@ -10,6 +14,7 @@ import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
import info.nightscout.androidaps.interfaces.PluginType
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.utils.PasswordProtection
|
import info.nightscout.androidaps.utils.PasswordProtection
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
|
|
||||||
class PluginViewHolder internal constructor(private val fragment: ConfigBuilderFragment,
|
class PluginViewHolder internal constructor(private val fragment: ConfigBuilderFragment,
|
||||||
private val pluginType: PluginType,
|
private val pluginType: PluginType,
|
||||||
|
@ -56,8 +61,8 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
|
||||||
}
|
}
|
||||||
|
|
||||||
fun update() {
|
fun update() {
|
||||||
enabledExclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.GONE else View.VISIBLE
|
enabledExclusive.visibility = areMultipleSelectionsAllowed(pluginType).not().toVisibility()
|
||||||
enabledInclusive.visibility = if (areMultipleSelectionsAllowed(pluginType)) View.VISIBLE else View.GONE
|
enabledInclusive.visibility = areMultipleSelectionsAllowed(pluginType).toVisibility()
|
||||||
enabledExclusive.isChecked = plugin.isEnabled(pluginType)
|
enabledExclusive.isChecked = plugin.isEnabled(pluginType)
|
||||||
enabledInclusive.isChecked = plugin.isEnabled(pluginType)
|
enabledInclusive.isChecked = plugin.isEnabled(pluginType)
|
||||||
enabledInclusive.isEnabled = !plugin.pluginDescription.alwaysEnabled
|
enabledInclusive.isEnabled = !plugin.pluginDescription.alwaysEnabled
|
||||||
|
@ -70,7 +75,7 @@ class PluginViewHolder internal constructor(private val fragment: ConfigBuilderF
|
||||||
pluginDescription.text = plugin.description
|
pluginDescription.text = plugin.description
|
||||||
}
|
}
|
||||||
pluginPreferences.visibility = if (plugin.preferencesId == -1 || !plugin.isEnabled(pluginType)) View.INVISIBLE else View.VISIBLE
|
pluginPreferences.visibility = if (plugin.preferencesId == -1 || !plugin.isEnabled(pluginType)) View.INVISIBLE else View.VISIBLE
|
||||||
pluginVisibility.visibility = if (plugin.hasFragment()) View.VISIBLE else View.INVISIBLE
|
pluginVisibility.visibility = plugin.hasFragment().toVisibility()
|
||||||
pluginVisibility.isEnabled = !(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType)
|
pluginVisibility.isEnabled = !(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwaysVisible) && plugin.isEnabled(pluginType)
|
||||||
pluginVisibility.isChecked = plugin.isFragmentVisible
|
pluginVisibility.isChecked = plugin.isFragmentVisible
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.SP
|
import info.nightscout.androidaps.utils.SP
|
||||||
import info.nightscout.androidaps.utils.SingleClickButton
|
import info.nightscout.androidaps.utils.SingleClickButton
|
||||||
import info.nightscout.androidaps.utils.plusAssign
|
import info.nightscout.androidaps.utils.plusAssign
|
||||||
|
import info.nightscout.androidaps.utils.toVisibility
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import kotlinx.android.synthetic.main.actions_fragment.*
|
import kotlinx.android.synthetic.main.actions_fragment.*
|
||||||
|
@ -205,8 +206,8 @@ class ActionsFragment : Fragment() {
|
||||||
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
|
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
|
||||||
else View.VISIBLE
|
else View.VISIBLE
|
||||||
|
|
||||||
actions_temptarget?.visibility = if (!Config.APS) View.GONE else View.VISIBLE
|
actions_temptarget?.visibility = Config.APS.toVisibility()
|
||||||
actions_tddstats?.visibility = if (!pump.pumpDescription.supportsTDDs) View.GONE else View.VISIBLE
|
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
CareportalFragment.updateAge(activity, careportal_sensorage, careportal_insulinage, careportal_canulaage, careportal_pbage)
|
CareportalFragment.updateAge(activity, careportal_sensorage, careportal_insulinage, careportal_canulaage, careportal_pbage)
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,15 +79,15 @@ class TreatmentsProfileSwitchFragment : Fragment() {
|
||||||
fun updateGUI() =
|
fun updateGUI() =
|
||||||
profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(),false)), false)
|
profileswitch_recyclerview?.swapAdapter(RecyclerProfileViewAdapter(MainApp.getDbHelper().getProfileSwitchData(DateUtil.now() - T.days(30).msecs(),false)), false)
|
||||||
|
|
||||||
inner class RecyclerProfileViewAdapter(var profileSwitchList: List<ProfileSwitch>) : RecyclerView.Adapter<ProfileSwitchViewHolder>() {
|
inner class RecyclerProfileViewAdapter(private var profileSwitchList: List<ProfileSwitch>) : RecyclerView.Adapter<ProfileSwitchViewHolder>() {
|
||||||
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder {
|
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder {
|
||||||
return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false))
|
return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) {
|
||||||
val profileSwitch = profileSwitchList[position]
|
val profileSwitch = profileSwitchList[position]
|
||||||
holder.ph.visibility = if (profileSwitch.source == Source.PUMP) View.VISIBLE else View.GONE
|
holder.ph.visibility = (profileSwitch.source == Source.PUMP).toVisibility()
|
||||||
holder.ns.visibility = if (NSUpload.isIdValid(profileSwitch._id)) View.VISIBLE else View.GONE
|
holder.ns.visibility = NSUpload.isIdValid(profileSwitch._id).toVisibility()
|
||||||
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
|
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
|
||||||
if (!profileSwitch.isEndingEvent) {
|
if (!profileSwitch.isEndingEvent) {
|
||||||
holder.duration.text = DecimalFormatter.to0Decimal(profileSwitch.durationInMinutes.toDouble()) + " " + MainApp.gs(R.string.unit_minute_short)
|
holder.duration.text = DecimalFormatter.to0Decimal(profileSwitch.durationInMinutes.toDouble()) + " " + MainApp.gs(R.string.unit_minute_short)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 2019-12-20.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fun Boolean.toVisibility() = if (this) View.VISIBLE else View.GONE
|
||||||
|
|
Loading…
Reference in a new issue