This commit is contained in:
Milos Kozak 2022-05-19 12:49:17 +02:00
commit 1cdbde89bc
25 changed files with 54 additions and 59 deletions

View file

@ -322,12 +322,6 @@ class DataHandlerMobile @Inject constructor(
sendError(rh.gs(R.string.wizard_carbs_constraint))
return
}
val useBG = sp.getBoolean(R.string.key_wearwizard_bg, true)
val useTT = sp.getBoolean(R.string.key_wearwizard_tt, false)
val useBolusIOB = sp.getBoolean(R.string.key_wearwizard_bolusiob, true)
val useBasalIOB = sp.getBoolean(R.string.key_wearwizard_basaliob, true)
val useCOB = sp.getBoolean(R.string.key_wearwizard_cob, true)
val useTrend = sp.getBoolean(R.string.key_wearwizard_trend, false)
val percentage = command.percentage
val profile = profileFunction.getProfile()
val profileName = profileFunction.getProfileName()
@ -349,9 +343,22 @@ class DataHandlerMobile @Inject constructor(
val tempTarget = if (dbRecord is ValueWrapper.Existing) dbRecord.value else null
val bolusWizard = BolusWizard(injector).doCalc(
profile, profileName, tempTarget,
carbsAfterConstraints, cobInfo.displayCob!!, bgReading.valueToUnits(profileFunction.getUnits()),
0.0, percentage, useBG, useCOB, useBolusIOB, useBasalIOB, false, useTT, useTrend, false
profile = profile,
profileName = profileName,
tempTarget = tempTarget,
carbs = carbsAfterConstraints,
cob = cobInfo.displayCob!!,
bg = bgReading.valueToUnits(profileFunction.getUnits()),
correction = 0.0,
percentageCorrection = percentage,
useBg = sp.getBoolean(R.string.key_wearwizard_bg, true),
useCob = sp.getBoolean(R.string.key_wearwizard_cob, true),
includeBolusIOB = sp.getBoolean(R.string.key_wearwizard_iob, true),
includeBasalIOB = sp.getBoolean(R.string.key_wearwizard_iob, true),
useSuperBolus = false,
useTT = sp.getBoolean(R.string.key_wearwizard_tt, false),
useTrend = sp.getBoolean(R.string.key_wearwizard_trend, false),
useAlarm = false
)
val insulinAfterConstraints = bolusWizard.insulinAfterConstraints
val minStep = pump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints)
@ -833,7 +840,7 @@ class DataHandlerMobile @Inject constructor(
iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob)
iobDetail = "(${DecimalFormatter.to2Decimal(bolusIob.iob)}|${DecimalFormatter.to2Decimal(basalIob.basaliob)})"
cobString = iobCobCalculator.getCobInfo(false, "WatcherUpdaterService").generateCOBString()
currentBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())?.toStringShort() ?: DecimalFormatter.to2Decimal(profile.getBasal()) + "U/h"
currentBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())?.toStringShort() ?: rh.gs(R.string.pump_basebasalrate, profile.getBasal())
//bgi
val bgi = -(bolusIob.activity + basalIob.activity) * 5 * Profile.fromMgdlToUnits(profile.getIsfMgdl(), profileFunction.getUnits())
@ -1167,6 +1174,6 @@ class DataHandlerMobile @Inject constructor(
}
@Synchronized private fun sendError(errorMessage: String) {
rxBus.send(EventData.ConfirmAction(rh.gs(R.string.error), errorMessage, returnCommand = EventData.Error(dateUtil.now()))) // ignore return path
rxBus.send(EventMobileToWear(EventData.ConfirmAction(rh.gs(R.string.error), errorMessage, returnCommand = EventData.Error(dateUtil.now())))) // ignore return path
}
}

View file

@ -408,8 +408,7 @@ class BolusWizard @Inject constructor(
}
if (useCob) message += "\n" + rh.gs(R.string.wizard_explain_cob, cob, insulinFromCOB)
if (useBg) message += "\n" + rh.gs(R.string.wizard_explain_bg, insulinFromBG)
if (includeBolusIOB) message += "\n" + rh.gs(R.string.wizard_explain_bolus_iob, insulinFromBolusIOB)
if (includeBasalIOB) message += "\n" + rh.gs(R.string.wizard_explain_basal_iob, insulinFromBasalIOB)
if (includeBolusIOB) message += "\n" + rh.gs(R.string.wizard_explain_iob, insulinFromBolusIOB + insulinFromBasalIOB)
if (useTrend) message += "\n" + rh.gs(R.string.wizard_explain_trend, insulinFromTrend)
if (useSuperBolus) message += "\n" + rh.gs(R.string.wizard_explain_superbolus, insulinFromSuperBolus)
if (percentageCorrection != 100) {

View file

@ -21,8 +21,7 @@
android:id="@+id/resend"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_refresh"
android:paddingLeft="0dp"
android:paddingRight="0dp"
@ -33,8 +32,7 @@
android:id="@+id/open_settings"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_settings"
android:paddingLeft="0dp"
android:paddingRight="0dp"

View file

@ -970,7 +970,7 @@
<string name="wizard_no_active_profile">Není nastaven žádný aktivní profil!</string>
<string name="wizard_no_cob">Neznámý COB! Chybějící glykémie nebo nedávný restart aplikace?</string>
<string name="wizard_carbs_constraint">Sacharidy mimo povolený rozsah!</string>
<string name="wizard_explain_calc">Kalk (IC: %2$.1f, ISF: %2$.1f) z:\"</string>
<string name="wizard_explain_calc">Kalk (IC: %1$.1f, ISF: %2$.1f)</string>
<string name="wizard_explain_carbs">Sacharidy: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">Glykémie: %1$.2fU</string>

View file

@ -969,7 +969,7 @@
<string name="wizard_no_active_profile">Ingen aktiv profil angivet!</string>
<string name="wizard_no_cob">Ukendt COB! BG læsning mangler eller nylig app genstart?</string>
<string name="wizard_carbs_constraint">KH begrænsninger overtrådt!</string>
<string name="wizard_explain_calc">Calc (IC: %2$.1f, ISF: %2$.1f) fra:\"</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, ISF: %2$.1f) fra:\"</string>
<string name="wizard_explain_carbs">Kulhydrater: %1$.2fE</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fE</string>
<string name="wizard_explain_bg">BS: %1$.2fE</string>

View file

@ -970,7 +970,7 @@
<string name="wizard_no_active_profile">¡No hay perfil activo!</string>
<string name="wizard_no_cob">COB desconocido! ¿Valor de glucosa ausente o reincio reciente de la aplicación?</string>
<string name="wizard_carbs_constraint">¡Violación de restricción de carbohidratos!</string>
<string name="wizard_explain_calc">Calc (CI: %2$.1f, ISF: %2$.1f) desde:\"</string>
<string name="wizard_explain_calc">Calc (CI: %1$.1f, ISF: %2$.1f) desde:\"</string>
<string name="wizard_explain_carbs">Carbohidratos: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">BG: %1$.2fU</string>

View file

@ -970,7 +970,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="wizard_no_active_profile">Aucun profil activé !</string>
<string name="wizard_no_cob">GA inconnu! glycémie manquante ou démarrage récent de l\'application ?</string>
<string name="wizard_carbs_constraint">Violation de contrainte des glucides!</string>
<string name="wizard_explain_calc">Calcul (G/I: %2$.1f, SI: %2$.1f) de:\"</string>
<string name="wizard_explain_calc">Calcul (G/I: %1$.1f, SI: %2$.1f) de:\"</string>
<string name="wizard_explain_carbs">Glucides : %1$.2fU</string>
<string name="wizard_explain_cob">GA: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">Gly: %1$.2fU</string>

View file

@ -969,7 +969,7 @@
<string name="wizard_no_active_profile">Nessun profilo attivo!</string>
<string name="wizard_no_cob">Valore COB sconosciuto! Lettura BG mancante o recente riavvio dell\'app?</string>
<string name="wizard_carbs_constraint">Violazione vincolo CHO!</string>
<string name="wizard_explain_calc">Calc (IC: %2$.1f, ISF: %2$.1f) da:\"</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, ISF: %2$.1f) da:\"</string>
<string name="wizard_explain_carbs">CHO: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">BG: %1$.2fU</string>

View file

@ -969,7 +969,7 @@
<string name="wizard_no_active_profile">Geen actief profiel ingesteld!</string>
<string name="wizard_no_cob">Onbekende COB! BG uitlezing ontbreekt of de recente app herstart?</string>
<string name="wizard_carbs_constraint">Koolhydraten beperking overschreden!</string>
<string name="wizard_explain_calc">Bereken (IC: %2$.1f, ISF: %2$.1f) van:\"</string>
<string name="wizard_explain_calc">Bereken (IC: %1$.1f, ISF: %2$.1f) van:\"</string>
<string name="wizard_explain_carbs">Koolhydraten: %1$.2fE</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fE</string>
<string name="wizard_explain_bg">BG: %1$.2fE</string>

View file

@ -970,7 +970,7 @@
<string name="wizard_no_active_profile">Det er ikke angitt noen aktiv profil!</string>
<string name="wizard_no_cob">Ukjent COB! BS verdier mangler eller nylig oppstart av appen?</string>
<string name="wizard_carbs_constraint">Brudd på karbo begrensning!</string>
<string name="wizard_explain_calc">Kalk (IC: %2$.1f, ISF: %2$.1f) fra:\"</string>
<string name="wizard_explain_calc">Kalk (IC: %1$.1f, ISF: %2$.1f) fra:\"</string>
<string name="wizard_explain_carbs">Karbo: %1$.2fE</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fE</string>
<string name="wizard_explain_bg">BS: %1$.2fE</string>

View file

@ -876,7 +876,7 @@
<string name="quick_wizard_not_available">O assistente rápido selecionado não está mais disponível, atualize seu atalho</string>
<string name="wizard_no_actual_bg">Nenhuma glicemia recente para base de cálculo!</string>
<string name="wizard_no_cob">CA desconhecido! Leitura de Glicemia faltando ou reinício recente do app?</string>
<string name="wizard_explain_calc">Calc (IC: %2$.1f, FSI: %2$.1f) de:\"</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, FSI: %2$.1f) de:\"</string>
<string name="wizard_explain_cob">CA: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_trend">Tendência 15min: %1$.2fU</string>
<string name="show_invalidated_records">Exibir registros invalidados / removidos</string>

View file

@ -968,7 +968,7 @@
<string name="wizard_no_active_profile">Активный профиль не установлен!</string>
<string name="wizard_no_cob">Неизвестный COB! Отсутствуют данные ГК или приложения недавно перезапущено?</string>
<string name="wizard_carbs_constraint">Нарушено ограничение по углеводам!</string>
<string name="wizard_explain_calc">Кальк (IC: %2$.1f, ISF: %2$.1f) из:\"</string>
<string name="wizard_explain_calc">Кальк (IC: %1$.1f, ISF: %2$.1f) из:\"</string>
<string name="wizard_explain_carbs">Углеводов: %1$.2fгУ</string>
<string name="wizard_explain_cob">Акт Инс COB: %1$.0fг %2$.2fед</string>
<string name="wizard_explain_bg">ГК: %1$.2f</string>

View file

@ -970,7 +970,7 @@
<string name="wizard_no_active_profile">Nie je nastavený žiadny aktívny profil!</string>
<string name="wizard_no_cob">Neznáme COB! Chýbajú glykémie, alebo bola práve reštartovaná aplikácia?</string>
<string name="wizard_carbs_constraint">Sacharidy mimo povolený rozsah!</string>
<string name="wizard_explain_calc">Kalk (IC: %2$.1f, ISF: %2$.1f) z:\"</string>
<string name="wizard_explain_calc">Kalk (IC: %1$.1f, ISF: %2$.1f) z:\"</string>
<string name="wizard_explain_carbs">Sacharidy: %1$.2fJI</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fJI</string>
<string name="wizard_explain_bg">Gly: %1$.2fJI</string>

View file

@ -953,7 +953,7 @@ Eversense-appen.</string>
<string name="wizard_no_active_profile">Ingen aktiv profil vald!</string>
<string name="wizard_no_cob">Okänt COB! Saknas BG eller är appen nyss omstartad?</string>
<string name="wizard_carbs_constraint">Max KH uppnått!</string>
<string name="wizard_explain_calc">Kalkyl (IC: %2$.1f, ISF: %2$.1f) från:\"</string>
<string name="wizard_explain_calc">Kalkyl (IC: %1$.1f, ISF: %2$.1f) från:\"</string>
<string name="wizard_explain_carbs">Kolhydrater: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">BG: %1$.2fU</string>

View file

@ -971,7 +971,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
<string name="wizard_no_active_profile">Etkin profil ayarlanmadı!</string>
<string name="wizard_no_cob">Aktif karbonhidrat bilinmiyor! KŞ okuması eksik veya son uygulama yeniden başlatılsın mı?</string>
<string name="wizard_carbs_constraint">Karbonhidrat kısıtlaması ihlali!</string>
<string name="wizard_explain_calc">Tarafından hesaplanan (IC: %2$.1f, İDF: %2$.1f):\"</string>
<string name="wizard_explain_calc">Tarafından hesaplanan (IC: %1$.1f, İDF: %2$.1f):\"</string>
<string name="wizard_explain_carbs">Karb: %1$.2fÜ</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fÜ</string>
<string name="wizard_explain_bg">KŞ: %1$.2fÜ</string>

View file

@ -969,7 +969,7 @@
<string name="wizard_no_active_profile">没有激活的个人配置文件!</string>
<string name="wizard_no_cob">未知的活性碳水!血糖读取缺失或最近重新启动了应用程序?</string>
<string name="wizard_carbs_constraint">碳水违反约束条件!</string>
<string name="wizard_explain_calc">计算(IC: %2$.1f, ISF: %2$.1f) 从:\"</string>
<string name="wizard_explain_calc">计算(IC: %1$.1f, ISF: %2$.1f) 从:\"</string>
<string name="wizard_explain_carbs">碳水: %1$.2fU</string>
<string name="wizard_explain_cob">活性碳水: %1$.0f克 %2$.2fU</string>
<string name="wizard_explain_bg">血糖: %1$.2fU</string>

View file

@ -761,8 +761,7 @@
<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_bolusiob" translatable="false">wearwizard_bolusiob</string>
<string name="key_wearwizard_basaliob" translatable="false">wearwizard_basaliob</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>
@ -1173,12 +1172,11 @@
<string name="wizard_no_active_profile">No active profile set!</string>
<string name="wizard_no_cob">Unknown COB! BG reading missing or recent app restart?</string>
<string name="wizard_carbs_constraint">Carb constraint violation!</string>
<string name="wizard_explain_calc">Calc (IC: %2$.1f, ISF: %2$.1f) from:"</string>
<string name="wizard_explain_calc">Calc (IC: %1$.1f, ISF: %2$.1f)</string>
<string name="wizard_explain_carbs">Carbs: %1$.2fU</string>
<string name="wizard_explain_cob">COB: %1$.0fg %2$.2fU</string>
<string name="wizard_explain_bg">BG: %1$.2fU</string>
<string name="wizard_explain_basal_iob">Basal IOB: %1$.2fU</string>
<string name="wizard_explain_bolus_iob">Bolus IOB: %1$.2fU</string>
<string name="wizard_explain_iob">IOB: %1$.2fU</string>
<string name="wizard_explain_superbolus">Superbolus: %1$.2fU</string>
<string name="wizard_explain_trend">15\' trend: %1$.2fU</string>
<string name="wizard_explain_percent">Percentage: %1$.2fU x %2$d%% ≈ %3$.2fU</string>

View file

@ -45,14 +45,8 @@
<CheckBoxPreference
android:defaultValue="true"
android:dependency="@string/key_wear_control"
android:key="@string/key_wearwizard_bolusiob"
android:title="@string/bolus_iob_label" />
<CheckBoxPreference
android:defaultValue="true"
android:dependency="@string/key_wear_control"
android:key="@string/key_wearwizard_basaliob"
android:title="@string/treatments_wizard_basaliob_label" />
android:key="@string/key_wearwizard_iob"
android:title="@string/iob_label" />
</PreferenceCategory>

View file

@ -81,7 +81,7 @@ class ComplicationTapBroadcastReceiver : DaggerBroadcastReceiver() {
}
private val complicationTapAction: String
get() = sp.getString("complication_tap_action", "default")
get() = sp.getString(R.string.key_complication_tap_action, "default")
private fun remapActionWithUserPreferences(originalAction: ComplicationAction): ComplicationAction {
val userPrefAction = complicationTapAction

View file

@ -74,7 +74,7 @@ open class ViewSelectorActivity : DaggerActivity() {
}
fun getInflatedPlusMinusView(container: ViewGroup?): View =
when (sp.getInt("input_design", 1)) {
when (sp.getInt(R.string.key_input_design, 1)) {
2 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_quickrighty, container, false)
3 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_quicklefty, container, false)
4 -> LayoutInflater.from(applicationContext).inflate(R.layout.action_editplusminus_item_viktoria, container, false)

View file

@ -64,16 +64,13 @@ class WizardActivity : ViewSelectorActivity() {
view
} else {
val view = LayoutInflater.from(applicationContext).inflate(R.layout.action_confirm_ok, container, false)
val confirmButton = view.findViewById<ImageView>(R.id.confirmbutton)
confirmButton.setOnClickListener {
val action = ActionWizardPreCheck(
SafeParse.stringToInt(editCarbs?.editText?.text.toString()),
SafeParse.stringToInt(editPercentage?.editText?.text.toString())
)
rxBus.send(EventWearToMobile(action))
showToast(this@WizardActivity, R.string.action_wizard_confirmation)
finishAffinity()
}
view.findViewById<ImageView>(R.id.confirmbutton)
.setOnClickListener {
val percentage = if (hasPercentage) SafeParse.stringToInt(editPercentage?.editText?.text.toString()) else sp.getInt(getString(R.string.key_bolus_wizard_percentage), 100)
rxBus.send(EventWearToMobile(ActionWizardPreCheck(SafeParse.stringToInt(editCarbs?.editText?.text.toString()), percentage)))
showToast(this@WizardActivity, R.string.action_wizard_confirmation)
finishAffinity()
}
container.addView(view)
view
}

View file

@ -236,7 +236,7 @@ abstract class BaseWatchFace : WatchFace() {
open fun changeChartTimeframe() {
var timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
timeframe = timeframe % 5 + 1
sp.putInt(R.string.key_chart_time_frame, timeframe)
sp.putString(R.string.key_chart_time_frame, timeframe.toString())
}
override fun getWatchFaceStyle(): WatchFaceStyle {

View file

@ -198,6 +198,6 @@ class SteampunkWatchface : BaseWatchFace() {
var timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
timeframe = timeframe % 5 + 1
pointSize = if (timeframe < 3) 2 else 1
sp.putInt(R.string.key_chart_time_frame, timeframe)
sp.putString(R.string.key_chart_time_frame, timeframe.toString())
}
}

View file

@ -220,5 +220,7 @@
<string name="key_match_divider" translatable="false">match_divider</string>
<string name="key_simplify_ui" translatable="false">simplify_ui</string>
<string name="key_dark" translatable="false">dark</string>
<string name="key_input_design" translatable="false">input_design</string>
<string name="key_complication_tap_action" translatable="false">complication_tap_action</string>
</resources>

View file

@ -105,7 +105,7 @@
android:defaultValue="1"
android:entries="@array/input_design"
android:entryValues="@array/input_design_values"
android:key="input_design"
android:key="@string/key_input_design"
android:summary="Input Design"
android:title="@string/pref_input_design" />
@ -152,7 +152,7 @@
android:defaultValue="default"
android:entries="@array/complication_tap_action"
android:entryValues="@array/complication_tap_action_values"
android:key="complication_tap_action"
android:key="@string/key_complication_tap_action"
android:summary="What dialog to show after tap on complication"
android:title="@string/pref_complication_tap_action" />