WearPlugin -> plugins

This commit is contained in:
Milos Kozak 2022-11-24 00:01:20 +01:00
parent 94f3b716dd
commit 0571c00c74
28 changed files with 146 additions and 128 deletions

View file

@ -229,8 +229,6 @@ dependencies {
// MainApp
api "com.uber.rxdogtag2:rxdogtag:2.0.1"
// DataLayerListenerService
api "com.google.android.gms:play-services-wearable:$play_services_wearable_version"
}
apply from: "${project.rootDir}/core/core-main/test_dependencies.gradle"

View file

@ -143,29 +143,6 @@
android:resource="@xml/filepaths" />
</provider>
<service
android:name=".plugins.general.wear.wearintegration.DataLayerListenerServiceMobile"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.wearable.CHANNEL_EVENT" />
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" />
<data
android:host="*"
android:scheme="wear" />
</intent-filter>
<intent-filter>
<!-- listeners receive events that match the action and data filters -->
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<data
android:host="*"
android:pathPrefix="@string/path_rx_bridge"
android:scheme="wear" />
</intent-filter>
</service>
<service
android:name=".services.AlarmSoundService"
android:enabled="true"

View file

@ -24,7 +24,7 @@ import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin

View file

@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
import info.nightscout.androidaps.plugins.general.overview.OverviewFragment
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.androidaps.plugins.general.wear.WearFragment
import info.nightscout.plugins.general.wear.WearFragment
@Module
@Suppress("unused")

View file

@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.automation.services.LocationService
import info.nightscout.plugins.general.overview.notifications.DismissNotificationService
@ -16,5 +15,4 @@ abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesDismissNotificationService(): DismissNotificationService
@ContributesAndroidInjector abstract fun contributesDummyService(): DummyService
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): DataLayerListenerServiceMobile
}

View file

@ -40,7 +40,6 @@
<string name="description_config_builder">Used for configuring the active plugins</string>
<string name="description_overview">Displays the current state of your loop and buttons for most common actions</string>
<string name="description_persistent_notification">Shows an ongoing notification with a short overview of what your loop is doing</string>
<string name="description_wear">Monitor and control AAPS using your WearOS watch.</string>
<string name="delta">Delta</string>
<string name="configbuilder">Config Builder</string>
<string name="overview">Overview</string>
@ -81,17 +80,12 @@
<string name="low_mark">LOW mark</string>
<string name="high_mark">HIGH mark</string>
<string name="wear">Wear</string>
<string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string>
<string name="ongoingnotificaction">Ongoing Notification</string>
<string name="old_data">OLD DATA</string>
<string name="configbuilder_shortname">CONF</string>
<string name="overview_shortname">HOME</string>
<string name="treatments_shortname">TREAT</string>
<string name="wear_shortname">WEAR</string>
<string name="short_tabtitles">Shorten tab titles</string>
<string name="wear_settings">Wear settings</string>
<string name="nosuccess">not successful - please check phone</string>
<string name="restartingapp">Exiting application to apply settings.</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
@ -128,16 +122,12 @@
<string name="activity_target">activity target</string>
<string name="hypo_duration">hypo duration</string>
<string name="hypo_target">hypo target</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>
<string name="localalertsettings_title">Local alerts</string>
<string name="enable_missed_bg_readings_alert">Alert if no BG data is received</string>
<string name="enable_pump_unreachable_alert">Alert if pump is unreachable</string>
<string name="pump_unreachable_threshold">Pump unreachable threshold [min]</string>
<string name="enable_carbs_req_alert">Alert if carbs are required</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
<string name="overview_editquickwizard_usebg">BG calculation</string>
<string name="overview_editquickwizard_usebolusiob">Bolus IOB calculation</string>
<string name="overview_editquickwizard_usebasaliob">Basal IOB calculation</string>
@ -160,10 +150,6 @@
<string name="carb_increment_button_message">Number of carbs to add when button is pressed</string>
<string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string>
<string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string>
<string name="wear_notifysmb_title">Notify on SMB</string>
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
<string name="wear_predictions_summary">Show the predictions on the watchface.</string>
<string name="wear_predictions_title">Predictions</string>
<string name="g5appnotdetected">Please update your Dexcom app to supported version</string>
<string name="dexcom_app_not_installed">Dexcom app is not installed.</string>
<string name="overview_show_activity">Activity</string>
@ -182,14 +168,6 @@
<string name="secondcarbsincrement">Second carbs increment</string>
<string name="thirdcarbsincrement">Third carbs increment</string>
<string name="cgm">CGM</string>
<string name="key_wearwizard_bg" translatable="false">wearwizard_bg</string>
<string name="key_wearwizard_tt" translatable="false">wearwizard_tt</string>
<string name="key_wearwizard_trend" translatable="false">wearwizard_trend</string>
<string name="key_wearwizard_cob" translatable="false">wearwizard_cob</string>
<string name="key_wearwizard_iob" translatable="false">wearwizard_iob</string>
<string name="wear_wizard_settings_summary">Calculations included in the Wizard result:</string>
<string name="wear_display_settings">Display Settings</string>
<string name="wear_general_settings">General Settings</string>
<string name="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string>
<string name="key_keep_screen_on" translatable="false">keep_screen_on</string>
@ -218,11 +196,8 @@
<string name="profile_total">== ∑ %1$s U</string>
<string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string>
<string name="unitsnosemicolon">Units</string>
<string name="key_wear_detailediob" translatable="false">wear_detailediob</string>
<string name="key_wear_showbgi" translatable="false">wear_showbgi</string>
<string name="show_removed">Show removed</string>
<string name="clearqueueconfirm">Clear queue? All data in queue will be lost!</string>
<string name="key_wear_detailed_delta" translatable="false">wear_detailed_delta</string>
<string name="chartmenu">Chart menu</string>
<string name="overview_show_predictions">Predictions</string>
<string name="overview_show_treatments">Treatments</string>
@ -246,26 +221,13 @@
<string name="a11y_dialog">dialog</string>
<string name="not_available_full">Not available</string>
<!-- WEAR OS-->
<string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string>
<string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string>
<string name="wear_action_tempt_unit_error">Different units used on watch and phone!</string>
<string name="wear_action_tempt_zero_message">Zero-Temp-Target - cancelling running Temp-Targets?</string>
<string name="wear_action_tempt_min_bg_error">Min-BG out of range!</string>
<string name="wear_action_tempt_max_bg_error">Max-BG out of range!</string>
<string name="wear_action_tempt_manual_range_message">Temptarget:\nMin: %1$s\nMax: %2$s\nDuration: %3$s</string>
<string name="wear_action_tempt_manual_message">Temptarget:\nTarget: %1$s\nDuration: %2$s</string>
<string name="wear_action_tempt_preset_message">Temptarget:\nReason: %1$s\nTarget: %2$s\nDuration: %3$s</string>
<string name="quick_wizard_message">QuickWizard: %1$s\nInsulin: %2$.2fU\nCarbs: %3$dg</string>
<string name="wizard_result">Calc. Wizard:\nInsulin: %1$.2fU\nCarbs: %2$dg</string>
<string name="overview_editquickwizard_show_on_device">Show entry on device:</string>
<string name="quick_wizard_not_available">Selected quickwizard no longer available, please refresh your tile</string>
<string name="wear_unknown_action_string">Unknown action command:</string>
<string name="overview_editquickwizard_percentage">Percentage</string>
<string name="app_default">Application default</string>
<string name="remove_selected_items">Remove selected items</string>
<string name="count_selected">%1$d selected</string>
<string name="sort_label">Sort</string>
<string name="loop_status">Loop status</string>
<string name="graph_scale">Graph scale</string>
<string name="a11y_open_settings">open settings</string>
<string name="device_all">All</string>
@ -276,7 +238,6 @@
<string name="a11y_drag_and_drop_handle">drag and drop handle</string>
<string name="search">Search</string>
<string name="no_watch_connected">(No Watch Connected)</string>
<string name="database_cleanup">Database cleanup</string>
<string name="cleanup_db_confirm">Do you want to cleanup the database?\nIt will remove tracked changes and historic data older than 3 months.</string>
<string name="cleared_entries">Cleared entries</string>

View file

@ -5,6 +5,9 @@
<string name="profile_set_ok">Basal profile in pump updated</string>
<string name="invalid_input">Invalid input data</string>
<string name="bolus_delivering">Delivering %1$.2f U</string>
<string name="constraint_applied">Constraint applied!</string>
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
<string name="tt_label">TT</string>
<!-- Locale -->
<string name="key_language" translatable="false">language</string>

View file

@ -106,5 +106,13 @@
<string name="key_high_temptarget_raises_sensitivity" translatable="false">high_temptarget_raises_sensitivity</string>
<string name="key_low_temptarget_lowers_sensitivity" translatable="false">low_temptarget_lowers_sensitivity</string>
<string name="key_openapsama_bolus_snooze_dia_divisor" translatable="false">bolussnooze_dia_divisor</string>
<string name="key_wear_detailediob" translatable="false">wear_detailediob</string>
<string name="key_wear_showbgi" translatable="false">wear_showbgi</string>
<string name="key_wear_detailed_delta" translatable="false">wear_detailed_delta</string>
<string name="key_wearwizard_bg" translatable="false">wearwizard_bg</string>
<string name="key_wearwizard_tt" translatable="false">wearwizard_tt</string>
<string name="key_wearwizard_trend" translatable="false">wearwizard_trend</string>
<string name="key_wearwizard_cob" translatable="false">wearwizard_cob</string>
<string name="key_wearwizard_iob" translatable="false">wearwizard_iob</string>
</resources>

View file

@ -100,4 +100,15 @@ object Constants {
* so we add leeway to still accept given amount of older tokens
*/
const val OTP_ACCEPT_OLD_TOKENS_COUNT = 1
/**
* Button increments
*/
const val INSULIN_PLUS1_DEFAULT = 0.5
const val INSULIN_PLUS2_DEFAULT = 1.0
const val INSULIN_PLUS3_DEFAULT = 2.0
const val CARBS_FAV1_DEFAULT = 5
const val CARBS_FAV2_DEFAULT = 10
const val CARBS_FAV3_DEFAULT = 20
}

View file

@ -59,4 +59,7 @@ dependencies {
// Food
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
// DataLayerListenerService
api "com.google.android.gms:play-services-wearable:$play_services_wearable_version"
}

View file

@ -26,6 +26,31 @@
android:name=".sync.nsclient.services.NSClientService"
android:enabled="true"
android:exported="true" />
<service
android:name=".general.wear.wearintegration.DataLayerListenerServiceMobile"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.wearable.CHANNEL_EVENT" />
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" />
<data
android:host="*"
android:scheme="wear" />
</intent-filter>
<intent-filter>
<!-- listeners receive events that match the action and data filters -->
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<data
android:host="*"
android:pathPrefix="@string/path_rx_bridge"
android:scheme="wear" />
</intent-filter>
</service>
</application>
</manifest>

View file

@ -15,7 +15,8 @@ import dagger.Module
SkinsModule::class,
SkinsUiModule::class,
LoopModule::class,
ActionsModule::class
ActionsModule::class,
WearModule::class
]
)

View file

@ -0,0 +1,12 @@
package info.nightscout.plugins.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
@Module
@Suppress("unused")
abstract class WearModule {
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): DataLayerListenerServiceMobile
}

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.general.wear
package info.nightscout.plugins.general.wear
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.databinding.WearFragmentBinding
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.plugins.databinding.WearFragmentBinding
import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus

View file

@ -1,15 +1,15 @@
package info.nightscout.androidaps.plugins.general.wear
package info.nightscout.plugins.general.wear
import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataHandlerMobile
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobileHelper
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.plugins.general.wear.wearintegration.DataHandlerMobile
import info.nightscout.plugins.general.wear.wearintegration.DataLayerListenerServiceMobileHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAutosensCalculationFinished
@ -37,7 +37,7 @@ class WearPlugin @Inject constructor(
private val rxBus: RxBus,
private val context: Context,
private val dataHandlerMobile: DataHandlerMobile,
val dataLayerListenerServiceMobileHelper: DataLayerListenerServiceMobileHelper
private val dataLayerListenerServiceMobileHelper: DataLayerListenerServiceMobileHelper
) : PluginBase(
PluginDescription()
@ -65,7 +65,7 @@ class WearPlugin @Inject constructor(
event.resultSuccess?.let {
val status =
if (it) rh.gs(R.string.success)
else rh.gs(R.string.nosuccess)
else rh.gs(R.string.no_success)
if (isEnabled()) rxBus.send(EventMobileToWear(EventData.BolusProgress(percent = 100, status = status)))
}
}, fabricPrivacy::logException)

View file

@ -1,14 +1,12 @@
package info.nightscout.androidaps.plugins.general.wear.wearintegration
package info.nightscout.plugins.general.wear.wearintegration
import android.app.NotificationManager
import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.toStringShort
import info.nightscout.androidaps.extensions.valueToUnits
import info.nightscout.androidaps.extensions.valueToUnitsString
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.core.graph.data.GlucoseValueDataPoint
@ -39,6 +37,7 @@ import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.profile.DefaultValueHelper
@ -50,6 +49,7 @@ import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.interfaces.utils.TrendCalculator
import info.nightscout.plugins.R
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
@ -61,8 +61,6 @@ import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import info.nightscout.ui.dialogs.CarbsDialog
import info.nightscout.ui.dialogs.InsulinDialog
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.text.DateFormat
@ -149,7 +147,7 @@ class DataHandlerMobile @Inject constructor(
rxBus.send(
EventMobileToWear(
EventData.ConfirmAction(
rh.gs(R.string.medtronic_pump_status).uppercase(),
rh.gs(R.string.pump_status).uppercase(),
activePlugin.activePump.shortStatus(false),
returnCommand = null
)
@ -730,10 +728,10 @@ class DataHandlerMobile @Inject constructor(
bolusPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100),
maxCarbs = sp.getInt(R.string.key_treatmentssafety_maxcarbs, 48),
maxBolus = sp.getDouble(R.string.key_treatmentssafety_maxbolus, 3.0),
insulinButtonIncrement1 = sp.getDouble(R.string.key_insulin_button_increment_1, InsulinDialog.PLUS1_DEFAULT),
insulinButtonIncrement2 = sp.getDouble(R.string.key_insulin_button_increment_2, InsulinDialog.PLUS2_DEFAULT),
carbsButtonIncrement1 = sp.getInt(R.string.key_carbs_button_increment_1, CarbsDialog.FAV1_DEFAULT),
carbsButtonIncrement2 = sp.getInt(R.string.key_carbs_button_increment_2, CarbsDialog.FAV2_DEFAULT)
insulinButtonIncrement1 = sp.getDouble(R.string.key_insulin_button_increment_1, Constants.INSULIN_PLUS1_DEFAULT),
insulinButtonIncrement2 = sp.getDouble(R.string.key_insulin_button_increment_2, Constants.INSULIN_PLUS2_DEFAULT),
carbsButtonIncrement1 = sp.getInt(R.string.key_carbs_button_increment_1, Constants.CARBS_FAV1_DEFAULT),
carbsButtonIncrement2 = sp.getInt(R.string.key_carbs_button_increment_2, Constants.CARBS_FAV2_DEFAULT)
)
)
)

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.wear.wearintegration
package info.nightscout.plugins.general.wear.wearintegration
import android.os.Binder
import android.os.Handler
@ -15,8 +15,6 @@ import com.google.android.gms.wearable.PutDataMapRequest
import com.google.android.gms.wearable.Wearable
import com.google.android.gms.wearable.WearableListenerService
import dagger.android.AndroidInjection
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.general.wear.events.EventWearUpdateGui
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.core.utils.receivers.ReceiverStatusStore
@ -27,6 +25,8 @@ import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.plugins.R
import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventMobileToWear

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.wear.wearintegration
package info.nightscout.plugins.general.wear.wearintegration
import android.content.ComponentName
import android.content.Context

View file

@ -4,7 +4,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="2dp"
tools:context=".plugins.general.wear.WearFragment">
tools:context="info.nightscout.plugins.general.wear.WearFragment">
<TextView
android:id="@+id/connected_device"

View file

@ -588,4 +588,38 @@
<string name="send_logfiles">Send today\'s log files to developers along with this time. Unexpected situation.</string>
<string name="iob_cob_calculator" translatable="false">IobCobCalculator</string>
<!-- Wear-->
<string name="wear_shortname">WEAR</string>
<string name="description_wear">Monitor and control AAPS using your WearOS watch.</string>
<string name="no_watch_connected">(No Watch Connected)</string>
<string name="pump_status">Pump status</string>
<string name="loop_status">Loop status</string>
<string name="wizard_result">Calc. Wizard:\nInsulin: %1$.2fU\nCarbs: %2$dg</string>
<string name="quick_wizard_not_available">Selected quickwizard no longer available, please refresh your tile</string>
<string name="quick_wizard_message">QuickWizard: %1$s\nInsulin: %2$.2fU\nCarbs: %3$dg</string>
<string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string>
<string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string>
<string name="wear_action_tempt_unit_error">Different units used on watch and phone!</string>
<string name="wear_action_tempt_zero_message">Zero-Temp-Target - cancelling running Temp-Targets?</string>
<string name="wear_action_tempt_min_bg_error">Min-BG out of range!</string>
<string name="wear_action_tempt_max_bg_error">Max-BG out of range!</string>
<string name="wear_action_tempt_manual_range_message">Temptarget:\nMin: %1$s\nMax: %2$s\nDuration: %3$s</string>
<string name="wear_action_tempt_manual_message">Temptarget:\nTarget: %1$s\nDuration: %2$s</string>
<string name="wear_action_tempt_preset_message">Temptarget:\nReason: %1$s\nTarget: %2$s\nDuration: %3$s</string>
<string name="no_success">not successful - please check phone</string>
<string name="wear_settings">Wear settings</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="wear_wizard_settings_summary">Calculations included in the Wizard result:</string>
<string name="wear_display_settings">Display Settings</string>
<string name="wear_general_settings">General Settings</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
<string name="wear_notifysmb_title">Notify on SMB</string>
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
<string name="wear_predictions_summary">Show the predictions on the watchface.</string>
<string name="wear_predictions_title">Predictions</string>
<string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string>
</resources>

View file

@ -28,7 +28,7 @@
android:defaultValue="false"
android:dependency="@string/key_wearwizard_bg"
android:key="@string/key_wearwizard_tt"
android:title="@string/treatments_wizard_tt_label" />
android:title="@string/tt_label" />
<CheckBoxPreference
android:defaultValue="false"

View file

@ -8,7 +8,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
@ -21,10 +20,14 @@ import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.CarbTimer
import info.nightscout.interfaces.Constants.CARBS_FAV1_DEFAULT
import info.nightscout.interfaces.Constants.CARBS_FAV2_DEFAULT
import info.nightscout.interfaces.Constants.CARBS_FAV3_DEFAULT
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.ProfileFunction
@ -66,13 +69,6 @@ class CarbsDialog : DialogFragmentWithDate() {
@Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var activityNames: ActivityNames
companion object {
const val FAV1_DEFAULT = 5
const val FAV2_DEFAULT = 10
const val FAV3_DEFAULT = 20
}
private var queryingProtection = false
private val disposable = CompositeDisposable()
@ -153,36 +149,36 @@ class CarbsDialog : DialogFragmentWithDate() {
savedInstanceState?.getDouble("carbs")
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher
)
val plus1text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT))
val plus1text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT))
binding.plus1.text = plus1text
binding.plus1.contentDescription = rh.gs(R.string.carbs) + " " + plus1text
binding.plus1.setOnClickListener {
binding.carbs.value = max(
0.0, binding.carbs.value
+ sp.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)
+ sp.getInt(R.string.key_carbs_button_increment_1, CARBS_FAV1_DEFAULT)
)
validateInputs()
binding.carbs.announceValue()
}
val plus2text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT))
val plus2text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT))
binding.plus2.text = plus2text
binding.plus2.contentDescription = rh.gs(R.string.carbs) + " " + plus2text
binding.plus2.setOnClickListener {
binding.carbs.value = max(
0.0, binding.carbs.value
+ sp.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)
+ sp.getInt(R.string.key_carbs_button_increment_2, CARBS_FAV2_DEFAULT)
)
validateInputs()
binding.carbs.announceValue()
}
val plus3text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT))
val plus3text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT))
binding.plus3.text = plus3text
binding.plus2.contentDescription = rh.gs(R.string.carbs) + " " + plus3text
binding.plus3.setOnClickListener {
binding.carbs.value = max(
0.0, binding.carbs.value
+ sp.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)
+ sp.getInt(R.string.key_carbs_button_increment_3, CARBS_FAV3_DEFAULT)
)
validateInputs()
binding.carbs.announceValue()

View file

@ -8,7 +8,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.core.pump.insertBolusTransaction
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
@ -20,9 +19,13 @@ import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants.INSULIN_PLUS1_DEFAULT
import info.nightscout.interfaces.Constants.INSULIN_PLUS2_DEFAULT
import info.nightscout.interfaces.Constants.INSULIN_PLUS3_DEFAULT
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.Profile
@ -67,13 +70,6 @@ class InsulinDialog : DialogFragmentWithDate() {
@Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var activityNames: ActivityNames
companion object {
const val PLUS1_DEFAULT = 0.5
const val PLUS2_DEFAULT = 1.0
const val PLUS3_DEFAULT = 2.0
}
private var queryingProtection = false
private val disposable = CompositeDisposable()
private var _binding: DialogInsulinBinding? = null
@ -135,35 +131,35 @@ class InsulinDialog : DialogFragmentWithDate() {
?: 0.0, 0.0, maxInsulin, activePlugin.activePump.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher
)
val plus05Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT).toSignedString(activePlugin.activePump)
val plus05Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), INSULIN_PLUS1_DEFAULT).toSignedString(activePlugin.activePump)
binding.plus05.text = plus05Text
binding.plus05.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus05Text
binding.plus05.setOnClickListener {
binding.amount.value = max(
0.0, binding.amount.value
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), INSULIN_PLUS1_DEFAULT)
)
validateInputs()
binding.amount.announceValue()
}
val plus10Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT).toSignedString(activePlugin.activePump)
val plus10Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), INSULIN_PLUS2_DEFAULT).toSignedString(activePlugin.activePump)
binding.plus10.text = plus10Text
binding.plus10.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus10Text
binding.plus10.setOnClickListener {
binding.amount.value = max(
0.0, binding.amount.value
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), INSULIN_PLUS2_DEFAULT)
)
validateInputs()
binding.amount.announceValue()
}
val plus20Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT).toSignedString(activePlugin.activePump)
val plus20Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), INSULIN_PLUS3_DEFAULT).toSignedString(activePlugin.activePump)
binding.plus20.text = plus20Text
binding.plus20.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus20Text
binding.plus20.setOnClickListener {
binding.amount.value = max(
0.0, binding.amount.value
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT)
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), INSULIN_PLUS3_DEFAULT)
)
validateInputs()
binding.amount.announceValue()

View file

@ -241,7 +241,7 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:checked="true"
android:contentDescription="@string/treatments_wizard_tt_label"
android:contentDescription="@string/tt_label"
android:drawableTop="@drawable/checkbox_tt_icon"
android:scaleX="1.6"
android:scaleY="1.6" />
@ -443,7 +443,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="@string/treatments_wizard_tt_label" />
android:text="@string/tt_label" />
</LinearLayout>

View file

@ -76,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="30dp"
android:text="@string/treatments_wizard_tt_label"
android:text="@string/tt_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="constraint_applied">Constraint applied!</string>
<string name="bolus_constraint_applied">Bolus constraint applied</string>
<string name="carbs_constraint_applied">Carbs constraint applied</string>
<string name="temp_target_short">TT</string>
@ -110,8 +109,6 @@
<string name="tempbasals_netratio_label_string">Ratio:</string>
<string name="tempbasals_netinsulin_label_string">Ins:</string>
<string name="tempbasals_iob_label_string">IOB:</string>
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
<string name="treatments_wizard_tt_label">TT</string>
<string name="treatments_wizard_correction_label">Corr</string>
<string name="meal_bolus">Meal</string>
<string name="prime">Prime</string>