ProfileSwitchDialog -> ui
This commit is contained in:
parent
ccb42caa60
commit
71f01a00ab
15 changed files with 29 additions and 29 deletions
|
@ -15,7 +15,6 @@ import androidx.work.PeriodicWorkRequest
|
|||
import androidx.work.WorkManager
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.DaggerApplication
|
||||
import info.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.androidaps.db.CompatDBHelper
|
||||
import info.nightscout.androidaps.di.DaggerAppComponent
|
||||
import info.nightscout.androidaps.di.StaticInjector
|
||||
|
@ -48,6 +47,7 @@ import info.nightscout.rx.logging.LTag
|
|||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.ui.widget.Widget
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.exceptions.UndeliverableException
|
||||
|
@ -65,7 +65,7 @@ class MainApp : DaggerApplication() {
|
|||
|
||||
@Inject lateinit var pluginStore: PluginStore
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var activityMonitor: info.activityMonitor.ActivityMonitor
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var versionCheckersUtils: VersionCheckerUtils
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var config: Config
|
||||
|
|
|
@ -5,7 +5,6 @@ import dagger.android.ContributesAndroidInjector
|
|||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.TempBasalDialog
|
||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
|
@ -40,7 +39,6 @@ abstract class FragmentsModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
|
||||
@ContributesAndroidInjector abstract fun contributesProfileSwitchDialog(): ProfileSwitchDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempBasalDialog(): TempBasalDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempTargetDialog(): TempTargetDialog
|
||||
@ContributesAndroidInjector abstract fun contributesWizardDialog(): WizardDialog
|
||||
|
|
|
@ -7,7 +7,7 @@ import androidx.annotation.RawRes
|
|||
import androidx.fragment.app.FragmentManager
|
||||
import info.nightscout.androidaps.MainActivity
|
||||
import info.nightscout.androidaps.activities.SingleFragmentActivity
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.services.AlarmSoundService
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.TempBasalDialog
|
||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.extensions.toStringMedium
|
||||
|
|
|
@ -31,7 +31,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="key_objectiveuseprofileswitch" translatable="false">ObjectivesProfileSwitchUsed</string>
|
||||
<string name="key_objectiveusedisconnect" translatable="false">ObjectivesDisconnectUsed</string>
|
||||
<string name="key_objectiveusereconnect" translatable="false">ObjectivesReconnectUsed</string>
|
||||
<string name="key_objectiveusetemptarget" translatable="false">ObjectivesTempTargetUsed</string>
|
||||
|
|
|
@ -293,7 +293,6 @@
|
|||
<string name="key_wizard_include_cob" translatable="false">wizard_include_cob</string>
|
||||
<string name="key_wizard_include_trend_bg" translatable="false">wizard_include_trend_bg</string>
|
||||
<string name="careportal_newnstreatment_percentage_label">Percentage</string>
|
||||
<string name="careportal_newnstreatment_timeshift_label">Time shift</string>
|
||||
<string name="default_temptargets">Default Temp-Targets</string>
|
||||
<string name="eatingsoon_duration">eatingsoon duration</string>
|
||||
<string name="eatingsoon_target">eatingsoon target</string>
|
||||
|
@ -301,7 +300,6 @@
|
|||
<string name="activity_target">activity target</string>
|
||||
<string name="hypo_duration">hypo duration</string>
|
||||
<string name="hypo_target">hypo target</string>
|
||||
<string name="reuse_profile_pct_hours">Reuse %1$d%% %2$dh</string>
|
||||
<string name="wearcontrol_title">Controls from Watch</string>
|
||||
<string name="wearcontrol_summary">Set Temp-Targets and enter Treatments from the watch.</string>
|
||||
<string name="gradually_increase_notification_volume">Gradually increase the volume for alerts and notifications</string>
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
<string name="key_ns_receive_profile_switch" translatable="false">ns_receive_profile_switch</string>
|
||||
<string name="key_ns_receive_offline_event" translatable="false">ns_receive_offline_event</string>
|
||||
<string name="key_ns_receive_temp_target" translatable="false">ns_receive_temp_target</string>
|
||||
<string name="key_objectiveuseprofileswitch" translatable="false">ObjectivesProfileSwitchUsed</string>
|
||||
|
||||
<!-- General-->
|
||||
<string name="refresh">Refresh</string>
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.ui.activities
|
|||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import info.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.interfaces.stats.DexcomTirCalculator
|
||||
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
||||
|
@ -15,6 +14,7 @@ import info.nightscout.database.entities.UserEntry.Action
|
|||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.ui.databinding.ActivityStatsBinding
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
|
@ -26,7 +26,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var tddCalculator: TddCalculator
|
||||
@Inject lateinit var tirCalculator: TirCalculator
|
||||
@Inject lateinit var dexcomTirCalculator: DexcomTirCalculator
|
||||
@Inject lateinit var activityMonitor: info.activityMonitor.ActivityMonitor
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.activityMonitor
|
||||
package info.nightscout.ui.activityMonitor
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
|
@ -22,6 +22,7 @@ import info.nightscout.ui.dialogs.CareDialog
|
|||
import info.nightscout.ui.dialogs.ExtendedBolusDialog
|
||||
import info.nightscout.ui.dialogs.FillDialog
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.ui.dialogs.TreatmentDialog
|
||||
import info.nightscout.ui.dialogs.WizardInfoDialog
|
||||
|
@ -39,6 +40,7 @@ abstract class UiModule {
|
|||
@ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog
|
||||
@ContributesAndroidInjector abstract fun contributesInsulinDialog(): InsulinDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentDialog(): TreatmentDialog
|
||||
@ContributesAndroidInjector abstract fun contributesProfileSwitchDialog(): ProfileSwitchDialog
|
||||
|
||||
@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
|
||||
|
@ -9,9 +9,8 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
|
||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -19,11 +18,9 @@ import info.nightscout.androidaps.utils.DefaultValueHelper
|
|||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||
import info.nightscout.core.profile.toMgdl
|
||||
import info.nightscout.database.entities.TemporaryTarget
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.entities.ValueWithUnit
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
|
||||
|
@ -37,6 +34,8 @@ import info.nightscout.rx.logging.LTag
|
|||
import info.nightscout.shared.extensions.toVisibility
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.databinding.DialogProfileswitchBinding
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import java.text.DecimalFormat
|
||||
|
@ -179,7 +178,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
actions.add(rh.gs(R.string.percent) + ": " + percent + "%")
|
||||
val timeShift = binding.timeshift.value.toInt()
|
||||
if (timeShift != 0)
|
||||
actions.add(rh.gs(R.string.careportal_newnstreatment_timeshift_label) + ": " + rh.gs(R.string.format_hours, timeShift.toDouble()))
|
||||
actions.add(rh.gs(R.string.timeshift_label) + ": " + rh.gs(R.string.format_hours, timeShift.toDouble()))
|
||||
val notes = binding.notesLayout.notes.text.toString()
|
||||
if (notes.isNotEmpty())
|
||||
actions.add(rh.gs(R.string.notes_label) + ": " + notes)
|
||||
|
@ -206,8 +205,8 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
timestamp = eventTime
|
||||
)
|
||||
) {
|
||||
uel.log(Action.PROFILE_SWITCH,
|
||||
Sources.ProfileSwitchDialog,
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH,
|
||||
UserEntry.Sources.ProfileSwitchDialog,
|
||||
notes,
|
||||
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
|
||||
ValueWithUnit.SimpleString(profileName),
|
||||
|
@ -231,7 +230,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
})
|
||||
uel.log(
|
||||
Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
|
||||
UserEntry.Action.TT, UserEntry.Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
|
||||
TemporaryTarget.Reason.ACTIVITY
|
||||
), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration)
|
||||
)
|
||||
|
@ -252,7 +251,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if(!queryingProtection) {
|
||||
if (!queryingProtection) {
|
||||
queryingProtection = true
|
||||
activity?.let { activity ->
|
||||
val cancelFail = {
|
||||
|
@ -261,8 +260,8 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||
dismiss()
|
||||
}
|
||||
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -168,7 +168,7 @@
|
|||
android:width="120dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:text="@string/careportal_newnstreatment_timeshift_label"
|
||||
android:text="@string/timeshift_label"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
@ -176,7 +176,7 @@
|
|||
android:id="@+id/timeshift"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
app:customContentDescription="@string/careportal_newnstreatment_timeshift_label"/>
|
||||
app:customContentDescription="@string/timeshift_label"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
|
@ -65,6 +65,9 @@
|
|||
<string name="do_not_bolus_record_only">Do not bolus, record only</string>
|
||||
<string name="bolus_recorded_only">Bolus will be recorded only (not delivered by pump)</string>
|
||||
|
||||
<!-- ProfileSwitchDialog -->
|
||||
<string name="reuse_profile_pct_hours">Reuse %1$d%% %2$dh</string>
|
||||
<string name="timeshift_label">Time shift</string>
|
||||
|
||||
<!-- Treatments -->
|
||||
<string name="no_records_available">No records available</string>
|
||||
|
|
Loading…
Reference in a new issue