diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2a3dd58566..98043e941c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -64,8 +64,8 @@ - - + + diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt index 7315329ab2..0e55e30b85 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt @@ -17,12 +17,10 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread abstract class APSModule { @ContributesAndroidInjector abstract fun loggerCallbackInjector(): LoggerCallback - @ContributesAndroidInjector abstract fun apsResultInjector(): APSResult @ContributesAndroidInjector abstract fun determineBasalResultSMBInjector(): DetermineBasalResultSMB @ContributesAndroidInjector abstract fun determineBasalResultAMAInjector(): DetermineBasalResultAMA @ContributesAndroidInjector abstract fun determineBasalAdapterAMAJSInjector(): DetermineBasalAdapterAMAJS @ContributesAndroidInjector abstract fun determineBasalAdapterSMBJSInjector(): DetermineBasalAdapterSMBJS - @ContributesAndroidInjector abstract fun autosensDataInjector(): AutosensData @ContributesAndroidInjector abstract fun iobCobThreadInjector(): IobCobThread @ContributesAndroidInjector abstract fun iobCobOref1ThreadInjector(): IobCobOref1Thread } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt index a1c5f342d8..6174bcdf64 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt @@ -4,7 +4,6 @@ import dagger.Module import dagger.android.ContributesAndroidInjector import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.activities.* -import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity @@ -12,9 +11,6 @@ import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizar import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity -import info.nightscout.androidaps.dana.activities.DanaRHistoryActivity -import info.nightscout.androidaps.dana.activities.DanaRUserOptionsActivity -import info.nightscout.androidaps.danars.activities.EnterPinActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity @@ -25,10 +21,6 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity @Suppress("unused") abstract class ActivitiesModule { - @ContributesAndroidInjector abstract fun contributeDanaRHistoryActivity(): DanaRHistoryActivity - @ContributesAndroidInjector abstract fun contributeDanaRUserOptionsActivity(): DanaRUserOptionsActivity - @ContributesAndroidInjector abstract fun contributeEnterPinActivity(): EnterPinActivity - @ContributesAndroidInjector abstract fun contributeErrorHelperActivity(): ErrorHelperActivity @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesInsightAlertActivity(): InsightAlertActivity @ContributesAndroidInjector abstract fun contributesInsightPairingActivity(): InsightPairingActivity diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt index ad1c3e435b..24dadb14d1 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt @@ -5,9 +5,10 @@ import dagger.Component import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjector import info.nightscout.androidaps.MainApp -import info.nightscout.androidaps.core.dependencyInjection.CoreModule -import info.nightscout.androidaps.danars.dependencyInjection.DanaRSActivitiesModule -import info.nightscout.androidaps.danars.dependencyInjection.DanaRSCommModule +import info.nightscout.androidaps.core.di.CoreModule +import info.nightscout.androidaps.dana.di.DanaModule +import info.nightscout.androidaps.danar.di.DanaRServicesModule +import info.nightscout.androidaps.danars.di.DanaRSModule import javax.inject.Singleton @Singleton @@ -33,8 +34,9 @@ import javax.inject.Singleton SMSModule::class, UIModule::class, CoreModule::class, - DanaRSCommModule::class, - DanaRSActivitiesModule::class + DanaModule::class, + DanaRServicesModule::class, + DanaRSModule::class ] ) interface AppComponent : AndroidInjector { diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt index c6f1303866..4fb00e9bb5 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt @@ -10,17 +10,12 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.db.DatabaseHelperProvider import info.nightscout.androidaps.interfaces.* -import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.PluginStore -import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.queue.CommandQueue -import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.androidNotification.NotificationHolder -import info.nightscout.androidaps.utils.resources.ResourceHelper -import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.storage.FileStorage import info.nightscout.androidaps.utils.storage.Storage import javax.inject.Singleton @@ -30,12 +25,6 @@ import javax.inject.Singleton ]) open class AppModule { - @Provides - @Singleton - fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider, fabricPrivacy: FabricPrivacy): ProfileFunction { - return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin, fabricPrivacy) - } - @Provides fun providesPlugins(configInterface: ConfigInterface, @PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>, diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt index b0850bacc2..e9339e187b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt @@ -2,7 +2,6 @@ package info.nightscout.androidaps.dependencyInjection import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.queue.commands.* @@ -10,8 +9,6 @@ import info.nightscout.androidaps.queue.commands.* @Suppress("unused") abstract class CommandQueueModule { - @ContributesAndroidInjector abstract fun pumpEnactResultInjector(): PumpEnactResult - @ContributesAndroidInjector abstract fun commandQueueInjector(): CommandQueue @ContributesAndroidInjector abstract fun commandBolusInjector(): CommandBolus @ContributesAndroidInjector abstract fun commandCancelExtendedBolusInjector(): CommandCancelExtendedBolus diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/DataClassesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/DataClassesModule.kt index 536454413c..2441f34314 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/DataClassesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/DataClassesModule.kt @@ -19,17 +19,7 @@ import info.nightscout.androidaps.utils.wizard.QuickWizardEntry @Suppress("unused") abstract class DataClassesModule { - @ContributesAndroidInjector abstract fun profileInjector(): Profile @ContributesAndroidInjector abstract fun glucoseStatusInjector(): GlucoseStatus - @ContributesAndroidInjector abstract fun profileStoreInjector(): ProfileStore - - // TODO move to Core - @ContributesAndroidInjector abstract fun bgReadingInjector(): BgReading - @ContributesAndroidInjector abstract fun treatmentInjector(): Treatment - @ContributesAndroidInjector abstract fun profileSwitchInjector(): ProfileSwitch - @ContributesAndroidInjector abstract fun temporaryBasalInjector(): TemporaryBasal - @ContributesAndroidInjector abstract fun careportalEventInjector(): CareportalEvent - @ContributesAndroidInjector abstract fun extendedBolusInjector(): ExtendedBolus @ContributesAndroidInjector abstract fun treatmentServiceInjector(): TreatmentService diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt index 9f65841adc..4535f6820b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt @@ -32,7 +32,6 @@ import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment import info.nightscout.androidaps.plugins.pump.combo.ComboFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment -import info.nightscout.androidaps.dana.DanaRFragment import info.nightscout.androidaps.danars.dialogs.PairingProgressDialog import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment @@ -58,7 +57,6 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment - @ContributesAndroidInjector abstract fun contributesDanaRFragment(): DanaRFragment @ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment @ContributesAndroidInjector abstract fun contributesInsulinFragment(): InsulinFragment @ContributesAndroidInjector abstract fun contributesLocalProfileFragment(): LocalProfileFragment @@ -87,8 +85,6 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment - @ContributesAndroidInjector abstract fun contributesPairingProgressDialog(): PairingProgressDialog - @ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog @ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog @ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog @ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog @@ -99,7 +95,6 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog - @ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog @ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog @ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog @ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt index 0921ed7cd0..a54665f8d2 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt @@ -14,7 +14,6 @@ abstract class ReceiversModule { @ContributesAndroidInjector abstract fun contributesChargingStateReceiver(): ChargingStateReceiver @ContributesAndroidInjector abstract fun contributesDataReceiver(): DataReceiver @ContributesAndroidInjector abstract fun contributesKeepAliveReceiver(): KeepAliveReceiver - @ContributesAndroidInjector abstract fun contributesNetworkChangeReceiver(): NetworkChangeReceiver @ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver @ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver @ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt index 70258c66e5..f961c3a863 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt @@ -7,11 +7,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Dismiss import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService -import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService -import info.nightscout.androidaps.danar.services.DanaRExecutionService -import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService -import info.nightscout.androidaps.danars.services.DanaRSService -import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService @@ -24,17 +19,12 @@ import info.nightscout.androidaps.services.LocationService @Suppress("unused") abstract class ServicesModule { - @ContributesAndroidInjector abstract fun contributesAbstractDanaRExecutionService(): info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService @ContributesAndroidInjector abstract fun contributesAlarmSoundService(): AlarmSoundService @ContributesAndroidInjector abstract fun contributesDataService(): DataService @ContributesAndroidInjector abstract fun contributesDismissNotificationService(): DismissNotificationService @ContributesAndroidInjector abstract fun contributesDummyService(): DummyService @ContributesAndroidInjector abstract fun contributesLocationService(): LocationService @ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService - @ContributesAndroidInjector abstract fun contributesDanaRSService(): DanaRSService - @ContributesAndroidInjector abstract fun contributesDanaRv2ExecutionService(): DanaRv2ExecutionService - @ContributesAndroidInjector abstract fun contributesDanaRExecutionService(): DanaRExecutionService - @ContributesAndroidInjector abstract fun contributesDanaRKoreanExecutionService(): DanaRKoreanExecutionService @ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService @ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/dependency-injection-todo.txt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/dependency-injection-todo.txt deleted file mode 100644 index 6ee0c902dc..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/dependency-injection-todo.txt +++ /dev/null @@ -1,16 +0,0 @@ -PreferenceActivity is an Example how to make an Activity injectable. -We might undo that as we don't actually have us inject things. - -MyPreferencesFragment is an injectable Fragment. Here we actually have Dagger2 provide us an InsulinOrefFreePeakPlugin instance. - -If we use multiple Fragments, we should generate a base-class. Then we only have to add a "provides***Fragment" to the FragmentsModule and derive from that class. - -InsulinOrefFreePeakPlugin is an example how to get things injected via the constructor. -You could call "new InsulinOrefFreePeakPlugin(new SPImpl(SPImpl(PreferenceManager.getDefaultSharedPreferences(context))), new ResourceHelper())"... but Dagger will resolve that for you in MainApp. :) - -SPImpl is an example how to bind an implementation to an Interface via Dagger. - -ResourceHelper is an example how to generate simple classes that Dagger can auto-resolve how to inject them. No need for a provider here. -ResourceHelper might have a weak reference at some point and not a static dependency on MainApp... but at least we reduced the static dependencies within a plugin. - -In order to Test: Any dependency of InsulinOrefFreePeakPlugin is passed via the constructor. Instead of static mocking MainApp you now can Mock ResourceHelper with a very small interface. \ No newline at end of file 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 3e6a2c374e..14f0897cc5 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -89,19 +89,19 @@ class TempBasalDialog : DialogFragmentWithDate() { if (isPercentPump) { val basalPercentInput = SafeParse.stringToInt(actions_tempbasal_basalpercentinput.text) percent = constraintChecker.applyBasalPercentConstraints(Constraint(basalPercentInput), profile).value() - actions.add(resourceHelper.gs(R.string.pump_tempbasal_label) + ": $percent%") + actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": $percent%") actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes)) if (percent != basalPercentInput) actions.add(resourceHelper.gs(R.string.constraintapllied)) } else { val basalAbsoluteInput = SafeParse.stringToDouble(actions_tempbasal_basalabsoluteinput.text) absolute = constraintChecker.applyBasalConstraints(Constraint(basalAbsoluteInput), profile).value() - actions.add(resourceHelper.gs(R.string.pump_tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute)) + actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute)) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes)) if (abs(absolute - basalAbsoluteInput) > 0.01) actions.add("" + resourceHelper.gs(R.string.constraintapllied) + "") } activity?.let { activity -> - OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.pump_tempbasal_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable { + OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), Runnable { val callback: Callback = object : Callback() { override fun run() { if (!result.success) { diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index d2e9c0454f..a16c6ac471 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -16,7 +16,6 @@ import info.nightscout.androidaps.db.TempTarget import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin -import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.HtmlHelper import info.nightscout.androidaps.utils.alertDialogs.OKDialog @@ -123,7 +122,7 @@ class TempTargetDialog : DialogFragmentWithDate() { val duration = overview_temptarget_duration.value.toInt() if (target != 0.0 && duration != 0) { actions.add(resourceHelper.gs(R.string.reason) + ": " + reason) - actions.add(resourceHelper.gs(R.string.nsprofileview_target_label) + ": " + Profile.toCurrentUnitsString(profileFunction, target) + " " + resourceHelper.gs(unitResId)) + actions.add(resourceHelper.gs(R.string.target_label) + ": " + Profile.toCurrentUnitsString(profileFunction, target) + " " + resourceHelper.gs(unitResId)) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, duration)) } else { actions.add(resourceHelper.gs(R.string.stoptemptarget)) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index bda7d5b249..c257431ebf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -346,7 +346,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList val lastRun = loopPlugin.lastRun loopPlugin.invoke("Accept temp button", false) if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) { - OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.pump_tempbasal_label), lastRun.constraintsProcessed?.toSpanned() + OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned() ?: "".toSpanned(), Runnable { aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL") overview_accepttempbutton?.visibility = View.GONE @@ -664,9 +664,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList overview_basebasal?.text = activeTemp?.let { if (resourceHelper.shortTextMode()) "T:" + activeTemp.toStringVeryShort() else activeTemp.toStringFull() } ?: resourceHelper.gs(R.string.pump_basebasalrate, profile.basal) overview_basal_llayout?.setOnClickListener { - var fullText = "${resourceHelper.gs(R.string.pump_basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}" + var fullText = "${resourceHelper.gs(R.string.basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}" if (activeTemp != null) - fullText += "\n" + resourceHelper.gs(R.string.pump_tempbasal_label) + ": " + activeTemp.toStringFull() + fullText += "\n" + resourceHelper.gs(R.string.tempbasal_label) + ": " + activeTemp.toStringFull() activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.basal), fullText) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt index 69c6f84cb2..1cc60f0400 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt @@ -206,7 +206,7 @@ class OverviewMenus @Inject constructor( R.id.overview_activeprofile -> { menu.setHeaderTitle(resourceHelper.gs(R.string.profile)) - menu.add(resourceHelper.gs(R.string.danar_viewprofile)) + menu.add(resourceHelper.gs(R.string.viewprofile)) if (activePlugin.activeProfileInterface.profile != null) { menu.add(resourceHelper.gs(R.string.careportal_profileswitch)) } @@ -341,18 +341,18 @@ class OverviewMenus @Inject constructor( return true } - resourceHelper.gs(R.string.disconnectpumpfor3h) -> { + resourceHelper.gs(R.string.disconnectpumpfor3h) -> { aapsLogger.debug("USER ENTRY: DISCONNECT 3h") loopPlugin.disconnectPump(180, profile) rxBus.send(EventRefreshOverview("suspendmenu")) return true } - resourceHelper.gs(R.string.careportal_profileswitch) -> { + resourceHelper.gs(R.string.careportal_profileswitch) -> { ProfileSwitchDialog().show(manager, "Overview") } - resourceHelper.gs(R.string.danar_viewprofile) -> { + resourceHelper.gs(R.string.viewprofile) -> { val args = Bundle() args.putLong("time", DateUtil.now()) args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal) @@ -361,7 +361,7 @@ class OverviewMenus @Inject constructor( pvd.show(manager, "ProfileViewDialog") } - resourceHelper.gs(R.string.eatingsoon) -> { + resourceHelper.gs(R.string.eatingsoon) -> { aapsLogger.debug("USER ENTRY: TEMP TARGET EATING SOON") val target = Profile.toMgdl(defaultValueHelper.determineEatingSoonTT(), profileFunction.getUnits()) val tempTarget = TempTarget() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt index 1fd3222cbf..29ed323ee1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt @@ -7,7 +7,7 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.Constants import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.R -import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.CareportalEvent @@ -65,7 +65,7 @@ class ActionStringHandler @Inject constructor( private val danaRKoreanPlugin: DanaRKoreanPlugin, private val danaRv2Plugin: DanaRv2Plugin, private val danaRSPlugin: DanaRSPlugin, - private val danaRPump: DanaRPump, + private val danaPump: DanaPump, private val hardLimits: HardLimits, private val carbsGenerator: CarbsGenerator, private val dateUtil: DateUtil, @@ -326,7 +326,7 @@ class ActionStringHandler @Inject constructor( message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n" message += "\n" } else if (pump is DanaRPlugin) { - val tdd = danaRPump.dailyTotalUnits + val tdd = danaPump.dailyTotalUnits message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n" message += "\n" } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt index ef64d4a690..057fe53ee0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt @@ -45,7 +45,7 @@ class LocalProfileFragment : DaggerFragment() { private val save = Runnable { doEdit() - basalView?.updateLabel(resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel()) + basalView?.updateLabel(resourceHelper.gs(R.string.basal_label) + ": " + sumLabel()) } private val textWatch = object : TextWatcher { @@ -106,14 +106,14 @@ class LocalProfileFragment : DaggerFragment() { localprofile_name.addTextChangedListener(textWatch) localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch) localprofile_dia.tag = "LP_DIA" - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save) - basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save) + basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) if (units == Constants.MGDL) { - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save) - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save) } else { - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save) - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save) } // Spinner @@ -190,10 +190,10 @@ class LocalProfileFragment : DaggerFragment() { localprofile_units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (localProfilePlugin.currentProfile().mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol)) localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, MIN_DIA, 12.0, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch) localprofile_dia.tag = "LP_DIA" - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save) - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save) - basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) - TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save) + basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) + TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save) updateGUI() } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java index 2c1c9b6e91..cc4cdd9516 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java @@ -269,7 +269,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick private void getBatteryStatusItem(List statusItems) { if (localInsightPlugin.getBatteryStatus() == null) return; - statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_battery_label), + statusItems.add(getStatusItem(resourceHelper.gs(R.string.battery_label), localInsightPlugin.getBatteryStatus().getBatteryAmount() + "%")); } @@ -280,7 +280,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick if (cartridgeStatus.isInserted()) status = DecimalFormatter.to2Decimal(localInsightPlugin.getCartridgeStatus().getRemainingAmount()) + "U"; else status = resourceHelper.gs(R.string.not_inserted); - statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_reservoir_label), status)); + statusItems.add(getStatusItem(resourceHelper.gs(R.string.reservoir_label), status)); } private void getTDDItems(List statusItems) { @@ -294,14 +294,14 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick private void getBaseBasalRateItem(List statusItems) { if (localInsightPlugin.getActiveBasalRate() == null) return; ActiveBasalRate activeBasalRate = localInsightPlugin.getActiveBasalRate(); - statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_basebasalrate_label), + statusItems.add(getStatusItem(resourceHelper.gs(R.string.basebasalrate_label), DecimalFormatter.to2Decimal(activeBasalRate.getActiveBasalRate()) + " U/h (" + activeBasalRate.getActiveBasalProfileName() + ")")); } private void getTBRItem(List statusItems) { if (localInsightPlugin.getActiveTBR() == null) return; ActiveTBR activeTBR = localInsightPlugin.getActiveTBR(); - statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_tempbasal_label), + statusItems.add(getStatusItem(resourceHelper.gs(R.string.tempbasal_label), resourceHelper.gs(R.string.tbr_formatter, activeTBR.getPercentage(), activeTBR.getInitialDuration() - activeTBR.getRemainingDuration(), activeTBR.getInitialDuration()))); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt index 191957a8f3..26165ec661 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt @@ -133,7 +133,7 @@ class TreatmentsCareportalFragment : DaggerFragment() { remove.setOnClickListener { v: View -> val careportalEvent = v.tag as CareportalEvent activity?.let { activity -> - val text = resourceHelper.gs(R.string.careportal_newnstreatment_eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" + + val text = resourceHelper.gs(R.string.eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" + resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date) OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt index 8b8aee6b91..fed0ba1137 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -162,7 +162,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() { context?.let { showConfirmation(it, resourceHelper.gs(R.string.removerecord), """ - ${resourceHelper.gs(R.string.pump_tempbasal_label)}: ${tempBasal.toStringFull()} + ${resourceHelper.gs(R.string.tempbasal_label)}: ${tempBasal.toStringFull()} ${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)} """.trimIndent(), DialogInterface.OnClickListener { _: DialogInterface?, _: Int -> diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml index 588bde9ab8..0290c1cf8a 100644 --- a/app/src/main/res/layout/actions_fragment.xml +++ b/app/src/main/res/layout/actions_fragment.xml @@ -290,7 +290,7 @@ android:drawableTop="@drawable/icon_danarstats" android:paddingLeft="0dp" android:paddingRight="0dp" - android:text="@string/danar_stats_tdd" + android:text="@string/tdd" app:layout_column="1" app:layout_columnWeight="1" diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml index 4251efd3a2..a501e70a77 100644 --- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml +++ b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml @@ -233,7 +233,7 @@ diff --git a/app/src/main/res/layout/dialog_temptarget.xml b/app/src/main/res/layout/dialog_temptarget.xml index be4258ec5c..d03413a237 100644 --- a/app/src/main/res/layout/dialog_temptarget.xml +++ b/app/src/main/res/layout/dialog_temptarget.xml @@ -81,7 +81,7 @@ android:layout_gravity="center_vertical" android:width="120dp" android:padding="10dp" - android:text="@string/nsprofileview_target_label" + android:text="@string/target_label" android:textAppearance="@android:style/TextAppearance.Material.Small" android:textStyle="bold" /> diff --git a/app/src/main/res/layout/medtronic_fragment.xml b/app/src/main/res/layout/medtronic_fragment.xml index a67872fa5d..af16dd26cb 100644 --- a/app/src/main/res/layout/medtronic_fragment.xml +++ b/app/src/main/res/layout/medtronic_fragment.xml @@ -164,7 +164,7 @@ android:layout_weight="1.5" android:gravity="end" android:paddingRight="5dp" - android:text="@string/pump_battery_label" + android:text="@string/battery_label" android:textSize="14sp" /> + android:text="@string/pumphistory" />