StatusLights thresholds adjustable in preferences
This commit is contained in:
parent
639dfd3f77
commit
e068bf4337
15 changed files with 244 additions and 116 deletions
|
@ -28,6 +28,7 @@ import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin
|
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||||
|
@ -49,8 +50,8 @@ import info.nightscout.androidaps.plugins.source.EversensePlugin
|
||||||
import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
||||||
import info.nightscout.androidaps.plugins.source.PoctechPlugin
|
import info.nightscout.androidaps.plugins.source.PoctechPlugin
|
||||||
import info.nightscout.androidaps.plugins.source.TomatoPlugin
|
import info.nightscout.androidaps.plugins.source.TomatoPlugin
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
|
||||||
import info.nightscout.androidaps.utils.SafeParse
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
||||||
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -97,6 +98,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
||||||
@Inject lateinit var maintenancePlugin: MaintenancePlugin
|
@Inject lateinit var maintenancePlugin: MaintenancePlugin
|
||||||
|
|
||||||
@Inject lateinit var passwordCheck: PasswordCheck
|
@Inject lateinit var passwordCheck: PasswordCheck
|
||||||
|
@Inject lateinit var nsSettingStatus: NSSettingsStatus
|
||||||
|
|
||||||
@Inject lateinit var androidInjector: DispatchingAndroidInjector<Any>
|
@Inject lateinit var androidInjector: DispatchingAndroidInjector<Any>
|
||||||
|
|
||||||
|
@ -339,6 +341,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
||||||
passwordCheck.setPassword(context, R.string.application_password, R.string.key_application_password)
|
passwordCheck.setPassword(context, R.string.application_password, R.string.key_application_password)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// NSClient copy settings
|
||||||
|
if (preference.key == resourceHelper.gs(R.string.key_statuslights_copy_ns)) {
|
||||||
|
nsSettingStatus.copyStatusLightsNsSettings(context)
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.onPreferenceTreeClick(preference)
|
return super.onPreferenceTreeClick(preference)
|
||||||
|
|
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Point
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
import info.nightscout.androidaps.utils.Translator;
|
import info.nightscout.androidaps.utils.Translator;
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_CAREPORTALEVENTS)
|
@DatabaseTable(tableName = DatabaseHelper.DATABASE_CAREPORTALEVENTS)
|
||||||
public class CareportalEvent implements DataPointWithLabelInterface, Interval {
|
public class CareportalEvent implements DataPointWithLabelInterface, Interval {
|
||||||
|
@ -93,15 +94,15 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval {
|
||||||
return (System.currentTimeMillis() - date) / (60 * 60 * 1000.0);
|
return (System.currentTimeMillis() - date) / (60 * 60 * 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String age(boolean useShortText) {
|
public String age(boolean useShortText, ResourceHelper resourceHelper) {
|
||||||
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
|
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
|
||||||
|
|
||||||
String days = " " + MainApp.gs(R.string.days) + " ";
|
String days = " " + resourceHelper.gs(R.string.days) + " ";
|
||||||
String hours = " " + MainApp.gs(R.string.hours) + " ";
|
String hours = " " + resourceHelper.gs(R.string.hours) + " ";
|
||||||
|
|
||||||
if (useShortText) {
|
if (useShortText) {
|
||||||
days = MainApp.gs(R.string.shortday);
|
days = resourceHelper.gs(R.string.shortday);
|
||||||
hours = MainApp.gs(R.string.shorthour);
|
hours = resourceHelper.gs(R.string.shorthour);
|
||||||
}
|
}
|
||||||
|
|
||||||
return diff.get(TimeUnit.DAYS) + days + diff.get(TimeUnit.HOURS) + hours;
|
return diff.get(TimeUnit.DAYS) + days + diff.get(TimeUnit.HOURS) + hours;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.events.EventCareportalEventChange
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
|
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
|
||||||
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
|
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -23,7 +22,6 @@ import javax.inject.Inject
|
||||||
class CareportalFragment : DaggerFragment(), View.OnClickListener {
|
class CareportalFragment : DaggerFragment(), View.OnClickListener {
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
@Inject lateinit var rxBus: RxBusWrapper
|
@Inject lateinit var rxBus: RxBusWrapper
|
||||||
@Inject lateinit var nsSettingsStatus: NSSettingsStatus
|
|
||||||
@Inject lateinit var statusLightHandler: StatusLightHandler
|
@Inject lateinit var statusLightHandler: StatusLightHandler
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||||
|
|
|
@ -185,14 +185,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
super.preprocessPreferences(preferenceFragment);
|
super.preprocessPreferences(preferenceFragment);
|
||||||
|
|
||||||
if (Config.NSCLIENT) {
|
if (Config.NSCLIENT) {
|
||||||
PreferenceScreen scrnAdvancedSettings = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_advancedsettings));
|
preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_overview_advanced));
|
||||||
if (scrnAdvancedSettings != null) {
|
|
||||||
scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_res_warning)));
|
|
||||||
scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_res_critical)));
|
|
||||||
scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_bat_warning)));
|
|
||||||
scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_bat_critical)));
|
|
||||||
scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_show_statuslights)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.general.nsclient.data
|
package info.nightscout.androidaps.plugins.general.nsclient.data
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import info.nightscout.androidaps.Config
|
import info.nightscout.androidaps.Config
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
|
@ -10,7 +11,9 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -111,10 +114,12 @@ class NSSettingsStatus @Inject constructor(
|
||||||
private val aapsLogger: AAPSLogger,
|
private val aapsLogger: AAPSLogger,
|
||||||
private val resourceHelper: ResourceHelper,
|
private val resourceHelper: ResourceHelper,
|
||||||
private val rxBus: RxBusWrapper,
|
private val rxBus: RxBusWrapper,
|
||||||
private val defaultValueHelper: DefaultValueHelper
|
private val defaultValueHelper: DefaultValueHelper,
|
||||||
|
private val sp: SP
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var nightscoutVersionName = ""
|
var nightscoutVersionName = ""
|
||||||
|
|
||||||
// ***** PUMP STATUS ******
|
// ***** PUMP STATUS ******
|
||||||
var data: JSONObject? = null
|
var data: JSONObject? = null
|
||||||
|
|
||||||
|
@ -133,6 +138,7 @@ class NSSettingsStatus @Inject constructor(
|
||||||
val targetlow = getSettingsThreshold("bgTargetBottom")
|
val targetlow = getSettingsThreshold("bgTargetBottom")
|
||||||
if (targetHigh != null) defaultValueHelper.bgTargetHigh = targetHigh
|
if (targetHigh != null) defaultValueHelper.bgTargetHigh = targetHigh
|
||||||
if (targetlow != null) defaultValueHelper.bgTargetLow = targetlow
|
if (targetlow != null) defaultValueHelper.bgTargetLow = targetlow
|
||||||
|
copyStatusLightsNsSettings(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getName(): String? =
|
fun getName(): String? =
|
||||||
|
@ -152,10 +158,14 @@ class NSSettingsStatus @Inject constructor(
|
||||||
|
|
||||||
// valid property is "warn" or "urgent"
|
// valid property is "warn" or "urgent"
|
||||||
// plugings "iage" "sage" "cage" "pbage"
|
// plugings "iage" "sage" "cage" "pbage"
|
||||||
fun getExtendedWarnValue(plugin: String, property: String, defaultValue: Double): Double {
|
fun getExtendedWarnValue(plugin: String, property: String): Double? {
|
||||||
val extendedSettings = getExtendedSettings() ?: return defaultValue
|
val extendedSettings = getExtendedSettings() ?: return null
|
||||||
val pluginJson = extendedSettings.optJSONObject(plugin) ?: return defaultValue
|
val pluginJson = extendedSettings.optJSONObject(plugin) ?: return null
|
||||||
return pluginJson.optDouble(property, defaultValue)
|
try {
|
||||||
|
return pluginJson.getDouble(property)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// "bgHigh": 252,
|
// "bgHigh": 252,
|
||||||
|
@ -211,4 +221,20 @@ class NSSettingsStatus @Inject constructor(
|
||||||
val openaps = JsonHelper.safeGetJSONObject(getExtendedSettings(), "openaps", null)
|
val openaps = JsonHelper.safeGetJSONObject(getExtendedSettings(), "openaps", null)
|
||||||
return JsonHelper.safeGetBoolean(openaps, "enableAlerts")
|
return JsonHelper.safeGetBoolean(openaps, "enableAlerts")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun copyStatusLightsNsSettings(context: Context?) {
|
||||||
|
val action = Runnable {
|
||||||
|
getExtendedWarnValue("cage", "warn")?.let { sp.putDouble(R.string.key_statuslights_cage_warning, it) }
|
||||||
|
getExtendedWarnValue("cage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_cage_critical, it) }
|
||||||
|
getExtendedWarnValue("iage", "warn")?.let { sp.putDouble(R.string.key_statuslights_iage_warning, it) }
|
||||||
|
getExtendedWarnValue("iage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_iage_critical, it) }
|
||||||
|
getExtendedWarnValue("sage", "warn")?.let { sp.putDouble(R.string.key_statuslights_sage_warning, it) }
|
||||||
|
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_sage_critical, it) }
|
||||||
|
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(R.string.key_statuslights_bage_warning, it) }
|
||||||
|
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_bage_critical, it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context != null) OKDialog.showConfirmation(context, resourceHelper.gs(R.string.statuslights), resourceHelper.gs(R.string.copyexistingvalues), action)
|
||||||
|
else action.run()
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -720,7 +720,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status lights
|
// Status lights
|
||||||
overview_statuslights?.visibility = (sp.getBoolean(R.string.key_show_statuslights, false) || Config.NSCLIENT).toVisibility()
|
overview_statuslights?.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || Config.NSCLIENT).toVisibility()
|
||||||
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_pbage, careportal_batterylevel)
|
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_pbage, careportal_batterylevel)
|
||||||
|
|
||||||
// cob
|
// cob
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview
|
package info.nightscout.androidaps.plugins.general.overview
|
||||||
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.Config
|
import info.nightscout.androidaps.Config
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.db.CareportalEvent
|
import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.WarnColors
|
import info.nightscout.androidaps.utils.WarnColors
|
||||||
|
@ -17,7 +17,6 @@ import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class StatusLightHandler @Inject constructor(
|
class StatusLightHandler @Inject constructor(
|
||||||
private val nsSettingsStatus: NSSettingsStatus,
|
|
||||||
private val resourceHelper: ResourceHelper,
|
private val resourceHelper: ResourceHelper,
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val activePlugin: ActivePluginProvider,
|
private val activePlugin: ActivePluginProvider,
|
||||||
|
@ -29,23 +28,23 @@ class StatusLightHandler @Inject constructor(
|
||||||
*/
|
*/
|
||||||
fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) {
|
fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) {
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
handleAge(careportal_canulaage, "cage", CareportalEvent.SITECHANGE, 48.0, 72.0)
|
handleAge(careportal_canulaage, "cage", CareportalEvent.SITECHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
|
||||||
handleAge(careportal_insulinage, "iage", CareportalEvent.INSULINCHANGE, 72.0, 96.0)
|
handleAge(careportal_insulinage, "iage", CareportalEvent.INSULINCHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
|
||||||
handleAge(careportal_sensorage, "sage", CareportalEvent.SENSORCHANGE, 164.0, 166.0)
|
handleAge(careportal_sensorage, "sage", CareportalEvent.SENSORCHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
|
||||||
handleAge(careportal_pbage, "bage", CareportalEvent.PUMPBATTERYCHANGE, 224.0, 336.0)
|
handleAge(careportal_pbage, "bage", CareportalEvent.PUMPBATTERYCHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
|
||||||
if (!Config.NSCLIENT)
|
if (!Config.NSCLIENT)
|
||||||
handleLevel(careportal_reservoirlevel, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel)
|
handleLevel(careportal_reservoirlevel, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel)
|
||||||
if (!Config.NSCLIENT && pump.model() != PumpType.AccuChekCombo)
|
if (!Config.NSCLIENT && pump.model() != PumpType.AccuChekCombo)
|
||||||
handleLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble())
|
handleLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleAge(view: TextView?, nsSettingPlugin: String, eventName: String, defaultWarnThreshold: Double, defaultUrgentThreshold: Double) {
|
private fun handleAge(view: TextView?, nsSettingPlugin: String, eventName: String, @StringRes warnSettings: Int, defaultWarnThreshold: Double, @StringRes urgentSettings: Int, defaultUrgentThreshold: Double) {
|
||||||
val urgent = nsSettingsStatus.getExtendedWarnValue(nsSettingPlugin, "urgent", defaultUrgentThreshold)
|
val warn = sp.getDouble(warnSettings, defaultWarnThreshold)
|
||||||
val warn = nsSettingsStatus.getExtendedWarnValue(nsSettingPlugin, "warn", defaultWarnThreshold)
|
val urgent = sp.getDouble(urgentSettings, defaultUrgentThreshold)
|
||||||
val careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(eventName)
|
val careportalEvent = MainApp.getDbHelper().getLastCareportalEvent(eventName)
|
||||||
if (careportalEvent != null) {
|
if (careportalEvent != null) {
|
||||||
warnColors.setColorByAge(view, careportalEvent, warn, urgent)
|
warnColors.setColorByAge(view, careportalEvent, warn, urgent)
|
||||||
view?.text = careportalEvent.age(resourceHelper.shortTextMode())
|
view?.text = careportalEvent.age(resourceHelper.shortTextMode(), resourceHelper)
|
||||||
} else {
|
} else {
|
||||||
view?.text = if (resourceHelper.shortTextMode()) "-" else resourceHelper.gs(R.string.notavailable)
|
view?.text = if (resourceHelper.shortTextMode()) "-" else resourceHelper.gs(R.string.notavailable)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ class StatusLightHandler @Inject constructor(
|
||||||
val resUrgent = sp.getDouble(criticalSetting, criticalDefaultValue)
|
val resUrgent = sp.getDouble(criticalSetting, criticalDefaultValue)
|
||||||
val resWarn = sp.getDouble(warnSetting, warnDefaultValue)
|
val resWarn = sp.getDouble(warnSetting, warnDefaultValue)
|
||||||
@Suppress("SetTextI18n")
|
@Suppress("SetTextI18n")
|
||||||
view?.text = DecimalFormatter.to0Decimal(level)
|
view?.text = " " + DecimalFormatter.to0Decimal(level)
|
||||||
warnColors.setColorInverse(view, level, resWarn, resUrgent)
|
warnColors.setColorInverse(view, level, resWarn, resUrgent)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSAlarm
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -21,7 +20,6 @@ class NotificationWithAction constructor(
|
||||||
@Inject lateinit var resourceHelper: ResourceHelper
|
@Inject lateinit var resourceHelper: ResourceHelper
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
||||||
@Inject lateinit var nsSettingsStatus: NSSettingsStatus
|
|
||||||
@Inject lateinit var nsClientPlugin: NSClientPlugin
|
@Inject lateinit var nsClientPlugin: NSClientPlugin
|
||||||
|
|
||||||
private var nsAlarm: NSAlarm? = null
|
private var nsAlarm: NSAlarm? = null
|
||||||
|
|
|
@ -29,6 +29,7 @@ interface SP {
|
||||||
fun putBoolean(key: String, value: Boolean)
|
fun putBoolean(key: String, value: Boolean)
|
||||||
fun putBoolean(@StringRes resourceID: Int, value: Boolean)
|
fun putBoolean(@StringRes resourceID: Int, value: Boolean)
|
||||||
fun putDouble(key: String, value: Double)
|
fun putDouble(key: String, value: Double)
|
||||||
|
fun putDouble(@StringRes resourceID: Int, value: Double)
|
||||||
fun putLong(key: String, value: Long)
|
fun putLong(key: String, value: Long)
|
||||||
fun putLong(@StringRes resourceID: Int, value: Long)
|
fun putLong(@StringRes resourceID: Int, value: Long)
|
||||||
fun putInt(key: String, value: Int)
|
fun putInt(key: String, value: Int)
|
||||||
|
|
|
@ -102,6 +102,10 @@ class SPImplementation @Inject constructor(
|
||||||
override fun putDouble(key: String, value: Double) =
|
override fun putDouble(key: String, value: Double) =
|
||||||
sharedPreferences.edit().putString(key, value.toString()).apply()
|
sharedPreferences.edit().putString(key, value.toString()).apply()
|
||||||
|
|
||||||
|
override fun putDouble(resourceID: Int, value: Double) {
|
||||||
|
sharedPreferences.edit().putString(resourceHelper.gs(resourceID), value.toString()).apply()
|
||||||
|
}
|
||||||
|
|
||||||
override fun putLong(key: String, value: Long) =
|
override fun putLong(key: String, value: Long) =
|
||||||
sharedPreferences.edit().putLong(key, value).apply()
|
sharedPreferences.edit().putLong(key, value).apply()
|
||||||
|
|
||||||
|
|
|
@ -365,6 +365,8 @@
|
||||||
android:id="@+id/overview_statuslights"
|
android:id="@+id/overview_statuslights"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginBottom="3dp"
|
||||||
android:background="?android:attr/colorControlHighlight"
|
android:background="?android:attr/colorControlHighlight"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
@ -375,12 +377,10 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_canula" />
|
android:src="@drawable/icon_cp_age_canula" />
|
||||||
|
|
||||||
|
@ -388,19 +388,16 @@
|
||||||
android:id="@+id/careportal_canulaage"
|
android:id="@+id/careportal_canulaage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_insulin" />
|
android:src="@drawable/icon_cp_age_insulin" />
|
||||||
|
|
||||||
|
@ -408,7 +405,6 @@
|
||||||
android:id="@+id/careportal_insulinage"
|
android:id="@+id/careportal_insulinage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
@ -418,17 +414,14 @@
|
||||||
android:id="@+id/careportal_reservoirlevel"
|
android:id="@+id/careportal_reservoirlevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_sensor" />
|
android:src="@drawable/icon_cp_age_sensor" />
|
||||||
|
|
||||||
|
@ -436,19 +429,16 @@
|
||||||
android:id="@+id/careportal_sensorage"
|
android:id="@+id/careportal_sensorage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_battery" />
|
android:src="@drawable/icon_cp_age_battery" />
|
||||||
|
|
||||||
|
@ -456,7 +446,6 @@
|
||||||
android:id="@+id/careportal_pbage"
|
android:id="@+id/careportal_pbage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="1dp"
|
android:paddingEnd="1dp"
|
||||||
|
@ -466,7 +455,6 @@
|
||||||
android:id="@+id/careportal_batterylevel"
|
android:id="@+id/careportal_batterylevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
|
|
@ -365,6 +365,8 @@
|
||||||
android:id="@+id/overview_statuslights"
|
android:id="@+id/overview_statuslights"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginBottom="3dp"
|
||||||
android:background="?android:attr/colorControlHighlight"
|
android:background="?android:attr/colorControlHighlight"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
@ -375,12 +377,10 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_canula" />
|
android:src="@drawable/icon_cp_age_canula" />
|
||||||
|
|
||||||
|
@ -388,19 +388,16 @@
|
||||||
android:id="@+id/careportal_canulaage"
|
android:id="@+id/careportal_canulaage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_insulin" />
|
android:src="@drawable/icon_cp_age_insulin" />
|
||||||
|
|
||||||
|
@ -408,7 +405,6 @@
|
||||||
android:id="@+id/careportal_insulinage"
|
android:id="@+id/careportal_insulinage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
@ -418,17 +414,14 @@
|
||||||
android:id="@+id/careportal_reservoirlevel"
|
android:id="@+id/careportal_reservoirlevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_sensor" />
|
android:src="@drawable/icon_cp_age_sensor" />
|
||||||
|
|
||||||
|
@ -436,19 +429,16 @@
|
||||||
android:id="@+id/careportal_sensorage"
|
android:id="@+id/careportal_sensorage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_battery" />
|
android:src="@drawable/icon_cp_age_battery" />
|
||||||
|
|
||||||
|
@ -456,7 +446,6 @@
|
||||||
android:id="@+id/careportal_pbage"
|
android:id="@+id/careportal_pbage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="1dp"
|
android:paddingEnd="1dp"
|
||||||
|
@ -466,7 +455,6 @@
|
||||||
android:id="@+id/careportal_batterylevel"
|
android:id="@+id/careportal_batterylevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
|
|
@ -365,6 +365,8 @@
|
||||||
android:id="@+id/overview_statuslights"
|
android:id="@+id/overview_statuslights"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginBottom="3dp"
|
||||||
android:background="?android:attr/colorControlHighlight"
|
android:background="?android:attr/colorControlHighlight"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
@ -375,12 +377,10 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
app:layout_constraintTop_toBottomOf="@id/bg_tbr_layout">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_canula" />
|
android:src="@drawable/icon_cp_age_canula" />
|
||||||
|
|
||||||
|
@ -388,19 +388,16 @@
|
||||||
android:id="@+id/careportal_canulaage"
|
android:id="@+id/careportal_canulaage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_insulin" />
|
android:src="@drawable/icon_cp_age_insulin" />
|
||||||
|
|
||||||
|
@ -408,7 +405,6 @@
|
||||||
android:id="@+id/careportal_insulinage"
|
android:id="@+id/careportal_insulinage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
@ -418,17 +414,14 @@
|
||||||
android:id="@+id/careportal_reservoirlevel"
|
android:id="@+id/careportal_reservoirlevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_sensor" />
|
android:src="@drawable/icon_cp_age_sensor" />
|
||||||
|
|
||||||
|
@ -436,19 +429,16 @@
|
||||||
android:id="@+id/careportal_sensorage"
|
android:id="@+id/careportal_sensorage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="45dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="2dp"
|
|
||||||
android:paddingEnd="1dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/icon_cp_age_battery" />
|
android:src="@drawable/icon_cp_age_battery" />
|
||||||
|
|
||||||
|
@ -456,7 +446,6 @@
|
||||||
android:id="@+id/careportal_pbage"
|
android:id="@+id/careportal_pbage"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="1dp"
|
android:paddingEnd="1dp"
|
||||||
|
@ -466,7 +455,6 @@
|
||||||
android:id="@+id/careportal_batterylevel"
|
android:id="@+id/careportal_batterylevel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="1dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
|
|
|
@ -651,15 +651,31 @@
|
||||||
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
|
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
|
||||||
<string name="enablesuperbolus">Enable superbolus in wizard</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>
|
<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>
|
||||||
<string name="key_show_statuslights" translatable="false">key_show_statuslights</string>
|
<string name="key_show_statuslights" translatable="false">show_statuslights</string>
|
||||||
<string name="show_statuslights">Show status lights on home screen</string>
|
<string name="show_statuslights">Show status lights on home screen</string>
|
||||||
<string name="key_statuslights_res_warning" translatable="false">key_statuslights_res_warning</string>
|
<string name="key_statuslights_cage_warning" translatable="false">statuslights_cage_warning</string>
|
||||||
|
<string name="statuslights_cage_warning">Threshold warning canula age [h]</string>
|
||||||
|
<string name="key_statuslights_cage_critical" translatable="false">statuslights_cage_critical</string>
|
||||||
|
<string name="statuslights_cage_critical">Threshold critical canula age [h]</string>
|
||||||
|
<string name="key_statuslights_iage_warning" translatable="false">statuslights_iage_warning</string>
|
||||||
|
<string name="statuslights_iage_warning">Threshold warning insulin age [h]</string>
|
||||||
|
<string name="key_statuslights_iage_critical" translatable="false">statuslights_iage_critical</string>
|
||||||
|
<string name="statuslights_iage_critical">Threshold critical insulin age [h]</string>
|
||||||
|
<string name="key_statuslights_sage_warning" translatable="false">statuslights_sage_warning</string>
|
||||||
|
<string name="statuslights_sage_warning">Threshold warning sensor age [h]</string>
|
||||||
|
<string name="key_statuslights_sage_critical" translatable="false">statuslights_sage_critical</string>
|
||||||
|
<string name="statuslights_sage_critical">Threshold critical sensor age [h]</string>
|
||||||
|
<string name="key_statuslights_bage_warning" translatable="false">statuslights_bage_warning</string>
|
||||||
|
<string name="statuslights_bage_warning">Threshold warning battery age [h]</string>
|
||||||
|
<string name="key_statuslights_bage_critical" translatable="false">statuslights_bage_critical</string>
|
||||||
|
<string name="statuslights_bage_critical">Threshold critical battery age [h]</string>
|
||||||
|
<string name="key_statuslights_res_warning" translatable="false">statuslights_res_warning</string>
|
||||||
<string name="statuslights_res_warning">Threshold warning reservoir level [U]</string>
|
<string name="statuslights_res_warning">Threshold warning reservoir level [U]</string>
|
||||||
<string name="key_statuslights_res_critical" translatable="false">key_statuslights_res_critical</string>
|
<string name="key_statuslights_res_critical" translatable="false">statuslights_res_critical</string>
|
||||||
<string name="statuslights_res_critical">Threshold critical reservoir level [U]</string>
|
<string name="statuslights_res_critical">Threshold critical reservoir level [U]</string>
|
||||||
<string name="key_statuslights_bat_warning" translatable="false">key_statuslights_bat_warning</string>
|
<string name="key_statuslights_bat_warning" translatable="false">statuslights_bat_warning</string>
|
||||||
<string name="statuslights_bat_warning">Threshold warning battery level [%]</string>
|
<string name="statuslights_bat_warning">Threshold warning battery level [%]</string>
|
||||||
<string name="key_statuslights_bat_critical" translatable="false">key_statuslights_bat_critical</string>
|
<string name="key_statuslights_bat_critical" translatable="false">statuslights_bat_critical</string>
|
||||||
<string name="statuslights_bat_critical">Threshold critical battery level [%]</string>
|
<string name="statuslights_bat_critical">Threshold critical battery level [%]</string>
|
||||||
<string name="iob">IOB</string>
|
<string name="iob">IOB</string>
|
||||||
<string name="cob">COB</string>
|
<string name="cob">COB</string>
|
||||||
|
@ -1804,4 +1820,9 @@
|
||||||
<string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string>
|
<string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string>
|
||||||
<string name="passwords_dont_match">Passwords don\'t match</string>
|
<string name="passwords_dont_match">Passwords don\'t match</string>
|
||||||
<string name="current_master_password">Current master password</string>
|
<string name="current_master_password">Current master password</string>
|
||||||
|
<string name="statuslights">Status lights</string>
|
||||||
|
<string name="statuslights_copy_ns">Copy settings from NS</string>
|
||||||
|
<string name="key_statuslights_copy_ns">statuslights_copy_ns</string>
|
||||||
|
<string name="copyexistingvalues">Copy NS settins (if exists)?</string>
|
||||||
|
<string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -274,33 +274,118 @@
|
||||||
android:title="@string/overview_show_notes_field_in_dialogs_title" />
|
android:title="@string/overview_show_notes_field_in_dialogs_title" />
|
||||||
|
|
||||||
<androidx.preference.PreferenceScreen
|
<androidx.preference.PreferenceScreen
|
||||||
android:key="absorption_overview_advanced"
|
android:key="@string/key_statuslights_overview_advanced"
|
||||||
android:title="@string/advancedsettings_title">
|
android:title="@string/statuslights">
|
||||||
|
|
||||||
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
|
||||||
android:defaultValue="100"
|
|
||||||
android:dialogMessage="@string/deliverpartofboluswizard"
|
|
||||||
android:inputType="number"
|
|
||||||
android:key="@string/key_boluswizard_percentage"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:title="@string/partialboluswizard"
|
|
||||||
validate:maxNumber="100"
|
|
||||||
validate:minNumber="10"
|
|
||||||
validate:testType="numericRange" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="true"
|
||||||
android:key="@string/key_usesuperbolus"
|
|
||||||
android:summary="@string/enablesuperbolus_summary"
|
|
||||||
android:title="@string/enablesuperbolus" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="@string/key_show_statuslights"
|
android:key="@string/key_show_statuslights"
|
||||||
android:title="@string/show_statuslights" />
|
android:title="@string/show_statuslights" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="48"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_cage_warning"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_cage_warning"
|
||||||
|
validate:maxNumber="120"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="72"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_cage_critical"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_cage_critical"
|
||||||
|
validate:maxNumber="120"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="72"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_iage_warning"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_iage_warning"
|
||||||
|
validate:maxNumber="240"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="144"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_iage_critical"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_iage_critical"
|
||||||
|
validate:maxNumber="240"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="216"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_sage_warning"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_sage_warning"
|
||||||
|
validate:maxNumber="720"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="240"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_sage_critical"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_sage_critical"
|
||||||
|
validate:maxNumber="720"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="216"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_bage_warning"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_bage_warning"
|
||||||
|
validate:maxNumber="1000"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="240"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
android:key="@string/key_statuslights_bage_critical"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/statuslights_bage_critical"
|
||||||
|
validate:maxNumber="1000"
|
||||||
|
validate:minNumber="24"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
android:defaultValue="80"
|
android:defaultValue="80"
|
||||||
android:dependency="@string/key_show_statuslights"
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
@ -353,6 +438,37 @@
|
||||||
validate:minNumber="0"
|
validate:minNumber="0"
|
||||||
validate:testType="numericRange" />
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="@string/key_statuslights_copy_ns"
|
||||||
|
android:dependency="@string/key_show_statuslights"
|
||||||
|
android:title="@string/statuslights_copy_ns">
|
||||||
|
</Preference>
|
||||||
|
|
||||||
|
</androidx.preference.PreferenceScreen>
|
||||||
|
|
||||||
|
<androidx.preference.PreferenceScreen
|
||||||
|
android:key="overview_advanced"
|
||||||
|
android:title="@string/advancedsettings_title">
|
||||||
|
|
||||||
|
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||||
|
android:defaultValue="100"
|
||||||
|
android:dialogMessage="@string/deliverpartofboluswizard"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="@string/key_boluswizard_percentage"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/partialboluswizard"
|
||||||
|
validate:maxNumber="100"
|
||||||
|
validate:minNumber="10"
|
||||||
|
validate:testType="numericRange" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_usesuperbolus"
|
||||||
|
android:summary="@string/enablesuperbolus_summary"
|
||||||
|
android:title="@string/enablesuperbolus" />
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
Loading…
Reference in a new issue