CareDialog -> ui module
This commit is contained in:
parent
571ab88451
commit
cb2adc9fab
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFr
|
|||
import info.nightscout.androidaps.activities.fragments.TreatmentsTempTargetFragment
|
||||
import info.nightscout.androidaps.activities.fragments.TreatmentsTemporaryBasalsFragment
|
||||
import info.nightscout.androidaps.activities.fragments.TreatmentsUserEntryFragment
|
||||
import info.nightscout.androidaps.dialogs.CareDialog
|
||||
import info.nightscout.androidaps.dialogs.ExtendedBolusDialog
|
||||
import info.nightscout.androidaps.dialogs.FillDialog
|
||||
import info.nightscout.androidaps.dialogs.InsulinDialog
|
||||
|
@ -74,8 +73,6 @@ abstract class FragmentsModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog
|
||||
|
|
|
@ -17,7 +17,6 @@ import info.nightscout.androidaps.database.ValueWrapper
|
|||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.CareDialog
|
||||
import info.nightscout.androidaps.dialogs.ExtendedBolusDialog
|
||||
import info.nightscout.androidaps.dialogs.FillDialog
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
|
@ -56,6 +55,7 @@ import info.nightscout.androidaps.utils.ui.UIRunnable
|
|||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.ui.activities.TDDStatsActivity
|
||||
import info.nightscout.ui.dialogs.CareDialog
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -153,12 +153,8 @@
|
|||
<string name="carbssuggestion">Carbs Suggestion</string>
|
||||
<string name="unsupportednsversion">Unsupported version of Nightscout</string>
|
||||
<string name="treatments_wizard_basaliob_label">Basal IOB</string>
|
||||
<string name="careportal_newnstreatment_other">Other</string>
|
||||
<string name="careportal_newnstreatment_meter">Meter</string>
|
||||
<string name="careportal_newnstreatment_sensor">Sensor</string>
|
||||
<string name="carb_time_label">Carb time</string>
|
||||
<string name="profile_label">Profile</string>
|
||||
<string name="careportal_newnstreatment_glucosetype">Glucose type</string>
|
||||
<string name="overview_tempbasal_button">TempBasal</string>
|
||||
<string name="overview_extendedbolus_button">Extended Bolus</string>
|
||||
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
|
||||
|
@ -435,7 +431,6 @@
|
|||
<string name="wearcontrol_title">Controls from Watch</string>
|
||||
<string name="wearcontrol_summary">Set Temp-Targets and enter Treatments from the watch.</string>
|
||||
<string name="food">Food</string>
|
||||
<string name="none"><![CDATA[<none>]]></string>
|
||||
<string name="shortkilojoul">kJ</string>
|
||||
<string name="shortenergy">En</string>
|
||||
<string name="shortprotein">Pr</string>
|
||||
|
|
|
@ -2,13 +2,14 @@ package info.nightscout.ui.di
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.ui.activities.SurveyActivity
|
||||
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
||||
import info.nightscout.ui.activities.ErrorHelperActivity
|
||||
import info.nightscout.ui.activities.StatsActivity
|
||||
import info.nightscout.ui.activities.SurveyActivity
|
||||
import info.nightscout.ui.activities.TDDStatsActivity
|
||||
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||
import info.nightscout.ui.dialogs.CarbsDialog
|
||||
import info.nightscout.ui.dialogs.CareDialog
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
@ -16,6 +17,7 @@ abstract class UiModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog
|
||||
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
|
||||
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
||||
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
package info.nightscout.ui.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
|
@ -11,30 +11,30 @@ import androidx.annotation.StringRes
|
|||
import com.google.common.base.Joiner
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||
import info.nightscout.androidaps.databinding.DialogCareBinding
|
||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||
import info.nightscout.androidaps.extensions.fromConstant
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.Profile
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.Translator
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.extensions.fromConstant
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.databinding.DialogCareBinding
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import java.text.DecimalFormat
|
||||
import java.util.*
|
||||
import java.util.LinkedList
|
||||
import javax.inject.Inject
|
||||
|
||||
class CareDialog : DialogFragmentWithDate() {
|
||||
|
@ -142,8 +142,10 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
}
|
||||
|
||||
val bg = Profile.fromMgdlToUnits(glucoseStatusProvider.glucoseStatusData?.glucose
|
||||
?: 0.0, profileFunction.getUnits())
|
||||
val bg = Profile.fromMgdlToUnits(
|
||||
glucoseStatusProvider.glucoseStatusData?.glucose
|
||||
?: 0.0, profileFunction.getUnits()
|
||||
)
|
||||
val bgTextWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {}
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
@ -202,7 +204,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
binding.sensor.isChecked -> TherapyEvent.MeterType.SENSOR
|
||||
else -> TherapyEvent.MeterType.MANUAL
|
||||
}
|
||||
actions.add(rh.gs(R.string.careportal_newnstreatment_glucosetype) + ": " + translator.translate(meterType))
|
||||
actions.add(rh.gs(R.string.glucose_type) + ": " + translator.translate(meterType))
|
||||
actions.add(rh.gs(R.string.bg_label) + ": " + Profile.toCurrentUnitsString(profileFunction, binding.bg.value) + " " + rh.gs(unitResId))
|
||||
therapyEvent.glucoseType = meterType
|
||||
therapyEvent.glucose = binding.bg.value
|
||||
|
@ -225,13 +227,13 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
therapyEvent.enteredBy = enteredBy
|
||||
|
||||
val source = when (options) {
|
||||
EventType.BGCHECK -> Sources.BgCheck
|
||||
EventType.SENSOR_INSERT -> Sources.SensorInsert
|
||||
EventType.BATTERY_CHANGE -> Sources.BatteryChange
|
||||
EventType.NOTE -> Sources.Note
|
||||
EventType.EXERCISE -> Sources.Exercise
|
||||
EventType.QUESTION -> Sources.Question
|
||||
EventType.ANNOUNCEMENT -> Sources.Announcement
|
||||
EventType.BGCHECK -> UserEntry.Sources.BgCheck
|
||||
EventType.SENSOR_INSERT -> UserEntry.Sources.SensorInsert
|
||||
EventType.BATTERY_CHANGE -> UserEntry.Sources.BatteryChange
|
||||
EventType.NOTE -> UserEntry.Sources.Note
|
||||
EventType.EXERCISE -> UserEntry.Sources.Exercise
|
||||
EventType.QUESTION -> UserEntry.Sources.Question
|
||||
EventType.ANNOUNCEMENT -> UserEntry.Sources.Announcement
|
||||
}
|
||||
|
||||
activity?.let { activity ->
|
||||
|
@ -243,7 +245,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
)
|
||||
valuesWithUnit.add(0, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
|
||||
valuesWithUnit.add(1, ValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||
uel.log(Action.CAREPORTAL, source, notes, valuesWithUnit)
|
||||
uel.log(UserEntry.Action.CAREPORTAL, source, notes, valuesWithUnit)
|
||||
}, null)
|
||||
}
|
||||
return true
|
|
@ -60,20 +60,20 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:text="@string/careportal_newnstreatment_meter" />
|
||||
android:text="@string/bg_meter" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/sensor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/careportal_newnstreatment_sensor" />
|
||||
android:text="@string/bg_sensor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/other"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/careportal_newnstreatment_other" />
|
||||
android:text="@string/bg_other" />
|
||||
|
||||
</RadioGroup>
|
||||
|
|
@ -35,5 +35,11 @@
|
|||
<string name="most_common_profile">Most common profile:</string>
|
||||
<string name="survey_comment">Note: Only data visible on this screen will be anonymously uploaded. ID is assigned to this installation of AAPS. You can submit data again if your main profile get changed but let it running at least for a week to make result visible in time in range. Your help is appreciated.</string>
|
||||
|
||||
<!-- CareDialog -->
|
||||
<string name="glucose_type">Glucose type</string>
|
||||
<string name="bg_other">Other</string>
|
||||
<string name="bg_meter">Meter</string>
|
||||
<string name="bg_sensor">Sensor</string>
|
||||
<string name="none"><![CDATA[<none>]]></string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue