:core:ui cleanup

This commit is contained in:
Milos Kozak 2023-09-25 11:58:24 +02:00
parent 588c21fcfd
commit d7d01a0b3e
423 changed files with 2383 additions and 2396 deletions

View file

@ -63,10 +63,10 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule
import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityMainBinding import info.nightscout.androidaps.databinding.ActivityMainBinding
import info.nightscout.core.ui.UIRunnable import app.aaps.core.ui.UIRunnable
import info.nightscout.core.ui.dialogs.OKDialog import app.aaps.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.locale.LocaleHelper import app.aaps.core.ui.locale.LocaleHelper
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.toast.ToastUtils
import info.nightscout.core.utils.isRunningRealPumpTest import info.nightscout.core.utils.isRunningRealPumpTest
import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.UserEntry.Sources
@ -212,16 +212,16 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
message += "${rh.gs(app.aaps.configuration.R.string.configbuilder_nightscoutversion_label)} ${activePlugin.activeNsClient?.detectedNsVersion() ?: rh.gs(info.nightscout.plugins.R.string.not_available_full)}" message += "${rh.gs(app.aaps.configuration.R.string.configbuilder_nightscoutversion_label)} ${activePlugin.activeNsClient?.detectedNsVersion() ?: rh.gs(info.nightscout.plugins.R.string.not_available_full)}"
if (config.isEngineeringMode()) message += "\n${rh.gs(app.aaps.configuration.R.string.engineering_mode_enabled)}" if (config.isEngineeringMode()) message += "\n${rh.gs(app.aaps.configuration.R.string.engineering_mode_enabled)}"
if (config.isUnfinishedMode()) message += "\nUnfinished mode enabled" if (config.isUnfinishedMode()) message += "\nUnfinished mode enabled"
if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(info.nightscout.core.ui.R.string.fabric_upload_disabled)}" if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(app.aaps.core.ui.R.string.fabric_upload_disabled)}"
message += rh.gs(info.nightscout.core.ui.R.string.about_link_urls) message += rh.gs(app.aaps.core.ui.R.string.about_link_urls)
val messageSpanned = SpannableString(message) val messageSpanned = SpannableString(message)
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS) Linkify.addLinks(messageSpanned, Linkify.WEB_URLS)
MaterialAlertDialogBuilder(this@MainActivity, info.nightscout.core.ui.R.style.DialogTheme) MaterialAlertDialogBuilder(this@MainActivity, app.aaps.core.ui.R.style.DialogTheme)
.setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION) .setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION)
.setIcon(iconsProvider.getIcon()) .setIcon(iconsProvider.getIcon())
.setMessage(messageSpanned) .setMessage(messageSpanned)
.setPositiveButton(rh.gs(info.nightscout.core.ui.R.string.ok), null) .setPositiveButton(rh.gs(app.aaps.core.ui.R.string.ok), null)
.setNeutralButton(rh.gs(info.nightscout.core.ui.R.string.cta_dont_kill_my_app_info)) { _, _ -> .setNeutralButton(rh.gs(app.aaps.core.ui.R.string.cta_dont_kill_my_app_info)) { _, _ ->
startActivity( startActivity(
Intent( Intent(
Intent.ACTION_VIEW, Intent.ACTION_VIEW,
@ -356,7 +356,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
if (p.menuIcon != -1) { if (p.menuIcon != -1) {
menuItem.setIcon(p.menuIcon) menuItem.setIcon(p.menuIcon)
} else { } else {
menuItem.setIcon(info.nightscout.core.ui.R.drawable.ic_settings) menuItem.setIcon(app.aaps.core.ui.R.drawable.ic_settings)
} }
menuItem.setOnMenuItemClickListener { menuItem.setOnMenuItemClickListener {
startActivity( startActivity(
@ -377,7 +377,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
if (sp.getBoolean(info.nightscout.plugins.R.string.key_short_tabtitles, false)) { if (sp.getBoolean(info.nightscout.plugins.R.string.key_short_tabtitles, false)) {
binding.tabsNormal.visibility = View.GONE binding.tabsNormal.visibility = View.GONE
binding.tabsCompact.visibility = View.VISIBLE binding.tabsCompact.visibility = View.VISIBLE
binding.toolbar.layoutParams = LinearLayout.LayoutParams(Toolbar.LayoutParams.MATCH_PARENT, resources.getDimension(info.nightscout.core.ui.R.dimen.compact_height).toInt()) binding.toolbar.layoutParams = LinearLayout.LayoutParams(Toolbar.LayoutParams.MATCH_PARENT, resources.getDimension(app.aaps.core.ui.R.dimen.compact_height).toInt())
TabLayoutMediator(binding.tabsCompact, binding.mainPager) { tab, position -> TabLayoutMediator(binding.tabsCompact, binding.mainPager) { tab, position ->
tab.text = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(position).nameShort tab.text = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(position).nameShort
}.attach() }.attach()
@ -416,7 +416,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
private fun setDisabledMenuItemColorPluginPreferences() { private fun setDisabledMenuItemColorPluginPreferences() {
if (pluginPreferencesMenuItem?.isEnabled == false) { if (pluginPreferencesMenuItem?.isEnabled == false) {
val spanString = SpannableString(this.menu?.findItem(R.id.nav_plugin_preferences)?.title.toString()) val spanString = SpannableString(this.menu?.findItem(R.id.nav_plugin_preferences)?.title.toString())
spanString.setSpan(ForegroundColorSpan(rh.gac(info.nightscout.core.ui.R.attr.disabledTextColor)), 0, spanString.length, 0) spanString.setSpan(ForegroundColorSpan(rh.gac(app.aaps.core.ui.R.attr.disabledTextColor)), 0, spanString.length, 0)
this.menu?.findItem(R.id.nav_plugin_preferences)?.title = spanString this.menu?.findItem(R.id.nav_plugin_preferences)?.title = spanString
} }
} }
@ -458,7 +458,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
.replace(".org/", ":") .replace(".org/", ":")
.replace(".net/", ":") .replace(".net/", ":")
fabricPrivacy.firebaseAnalytics.setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled) fabricPrivacy.firebaseAnalytics.setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled)
fabricPrivacy.firebaseAnalytics.setUserProperty("Language", sp.getString(info.nightscout.core.ui.R.string.key_language, Locale.getDefault().language)) fabricPrivacy.firebaseAnalytics.setUserProperty("Language", sp.getString(app.aaps.core.ui.R.string.key_language, Locale.getDefault().language))
fabricPrivacy.firebaseAnalytics.setUserProperty("Version", BuildConfig.VERSION) fabricPrivacy.firebaseAnalytics.setUserProperty("Version", BuildConfig.VERSION)
fabricPrivacy.firebaseAnalytics.setUserProperty("HEAD", BuildConfig.HEAD) fabricPrivacy.firebaseAnalytics.setUserProperty("HEAD", BuildConfig.HEAD)
fabricPrivacy.firebaseAnalytics.setUserProperty("Remote", remote) fabricPrivacy.firebaseAnalytics.setUserProperty("Remote", remote)
@ -492,7 +492,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
val sn = activePlugin.activePump.serialNumber() val sn = activePlugin.activePump.serialNumber()
sp.putString(info.nightscout.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn)) sp.putString(info.nightscout.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn))
passwordReset.delete() passwordReset.delete()
ToastUtils.okToast(context, context.getString(info.nightscout.core.ui.R.string.password_set)) ToastUtils.okToast(context, context.getString(app.aaps.core.ui.R.string.password_set))
} }
} }
} }

View file

@ -36,7 +36,7 @@ import dagger.android.AndroidInjector
import dagger.android.DaggerApplication import dagger.android.DaggerApplication
import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.core.ui.locale.LocaleHelper import app.aaps.core.ui.locale.LocaleHelper
import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
@ -138,7 +138,7 @@ class MainApp : DaggerApplication() {
InsertIfNewByTimestampTherapyEventTransaction( InsertIfNewByTimestampTherapyEventTransaction(
timestamp = dateUtil.now(), timestamp = dateUtil.now(),
type = TherapyEvent.Type.NOTE, type = TherapyEvent.Type.NOTE,
note = rh.get().gs(info.nightscout.core.ui.R.string.androidaps_start) + " - " + Build.MANUFACTURER + " " + Build.MODEL, note = rh.get().gs(app.aaps.core.ui.R.string.androidaps_start) + " - " + Build.MANUFACTURER + " " + Build.MODEL,
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
) )
) )
@ -201,7 +201,7 @@ class MainApp : DaggerApplication() {
// set values for different builds // set values for different builds
if (!sp.contains(R.string.key_ns_alarms)) sp.putBoolean(R.string.key_ns_alarms, config.NSCLIENT) if (!sp.contains(R.string.key_ns_alarms)) sp.putBoolean(R.string.key_ns_alarms, config.NSCLIENT)
if (!sp.contains(R.string.key_ns_announcements)) sp.putBoolean(R.string.key_ns_announcements, config.NSCLIENT) if (!sp.contains(R.string.key_ns_announcements)) sp.putBoolean(R.string.key_ns_announcements, config.NSCLIENT)
if (!sp.contains(info.nightscout.core.ui.R.string.key_language)) sp.putString(info.nightscout.core.ui.R.string.key_language, "default") if (!sp.contains(app.aaps.core.ui.R.string.key_language)) sp.putString(app.aaps.core.ui.R.string.key_language, "default")
// 3.1.0 // 3.1.0
if (sp.contains("ns_wifionly")) { if (sp.contains("ns_wifionly")) {
if (sp.getBoolean("ns_wifionly", false)) { if (sp.getBoolean("ns_wifionly", false)) {

View file

@ -33,7 +33,7 @@ import com.google.android.material.datepicker.MaterialDatePicker
import com.jjoe64.graphview.GraphView import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.databinding.ActivityHistorybrowseBinding import info.nightscout.androidaps.databinding.ActivityHistorybrowseBinding
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity import app.aaps.core.ui.activities.TranslatedDaggerAppCompatActivity
import info.nightscout.plugins.general.overview.graphData.GraphData import info.nightscout.plugins.general.overview.graphData.GraphData
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign
@ -113,7 +113,7 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
binding.date.setOnClickListener { binding.date.setOnClickListener {
MaterialDatePicker.Builder.datePicker() MaterialDatePicker.Builder.datePicker()
.setSelection(dateUtil.timeStampToUtcDateMillis(historyBrowserData.overviewData.fromTime)) .setSelection(dateUtil.timeStampToUtcDateMillis(historyBrowserData.overviewData.fromTime))
.setTheme(info.nightscout.core.ui.R.style.DatePicker) .setTheme(app.aaps.core.ui.R.style.DatePicker)
.build() .build()
.apply { .apply {
addOnPositiveButtonClickListener { selection -> addOnPositiveButtonClickListener { selection ->
@ -133,7 +133,7 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
windowManager.defaultDisplay.getMetrics(dm) windowManager.defaultDisplay.getMetrics(dm)
axisWidth = if (dm.densityDpi <= 120) 3 else if (dm.densityDpi <= 160) 10 else if (dm.densityDpi <= 320) 35 else if (dm.densityDpi <= 420) 50 else if (dm.densityDpi <= 560) 70 else 80 axisWidth = if (dm.densityDpi <= 120) 3 else if (dm.densityDpi <= 160) 10 else if (dm.densityDpi <= 320) 35 else if (dm.densityDpi <= 420) 50 else if (dm.densityDpi <= 560) 70 else 80
binding.bgGraph.gridLabelRenderer?.gridColor = rh.gac(this, info.nightscout.core.ui.R.attr.graphGrid) binding.bgGraph.gridLabelRenderer?.gridColor = rh.gac(this, app.aaps.core.ui.R.attr.graphGrid)
binding.bgGraph.gridLabelRenderer?.reloadStyles() binding.bgGraph.gridLabelRenderer?.reloadStyles()
binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
@ -214,12 +214,12 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
val graph = GraphView(this) val graph = GraphView(this)
graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(100)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) } graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(100)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
graph.gridLabelRenderer?.gridColor = rh.gac(info.nightscout.core.ui.R.attr.graphGrid) graph.gridLabelRenderer?.gridColor = rh.gac(app.aaps.core.ui.R.attr.graphGrid)
graph.gridLabelRenderer?.reloadStyles() graph.gridLabelRenderer?.reloadStyles()
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
graph.gridLabelRenderer?.numVerticalLabels = 3 graph.gridLabelRenderer?.numVerticalLabels = 3
graph.viewport.backgroundColor = rh.gac(this, info.nightscout.core.ui.R.attr.viewPortBackgroundColor) graph.viewport.backgroundColor = rh.gac(this, app.aaps.core.ui.R.attr.viewPortBackgroundColor)
relativeLayout.addView(graph) relativeLayout.addView(graph)
val label = TextView(this) val label = TextView(this)

View file

@ -40,7 +40,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.automation.AutomationPlugin import info.nightscout.automation.AutomationPlugin
import info.nightscout.core.ui.dialogs.OKDialog import app.aaps.core.ui.dialogs.OKDialog
import info.nightscout.implementation.plugin.PluginStore import info.nightscout.implementation.plugin.PluginStore
import info.nightscout.insulin.InsulinOrefFreePeakPlugin import info.nightscout.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.plugins.aps.loop.LoopPlugin import info.nightscout.plugins.aps.loop.LoopPlugin
@ -238,7 +238,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
key ?: return key ?: return
rxBus.send(EventPreferenceChange(key)) rxBus.send(EventPreferenceChange(key))
if (key == rh.gs(info.nightscout.core.ui.R.string.key_language)) { if (key == rh.gs(app.aaps.core.ui.R.string.key_language)) {
rxBus.send(EventRebuildTabs(true)) rxBus.send(EventRebuildTabs(true))
//recreate() does not update language so better close settings //recreate() does not update language so better close settings
activity?.finish() activity?.finish()
@ -276,7 +276,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
sp.getInt(key, NONE.ordinal) == BIOMETRIC.ordinal sp.getInt(key, NONE.ordinal) == BIOMETRIC.ordinal
) { ) {
activity?.let { activity?.let {
val title = rh.gs(info.nightscout.core.ui.R.string.unsecure_fallback_biometric) val title = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_biometric)
val message = val message =
rh.gs(app.aaps.configuration.R.string.master_password_missing, rh.gs(app.aaps.configuration.R.string.configbuilder_general), rh.gs(app.aaps.configuration.R.string.protection)) rh.gs(app.aaps.configuration.R.string.master_password_missing, rh.gs(app.aaps.configuration.R.string.configbuilder_general), rh.gs(app.aaps.configuration.R.string.protection))
OKDialog.show(it, title = title, message = message) OKDialog.show(it, title = title, message = message)
@ -289,8 +289,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
sp.getInt(info.nightscout.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal sp.getInt(info.nightscout.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal
if (rh.gs(info.nightscout.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) { if (rh.gs(info.nightscout.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) {
activity?.let { activity?.let {
val title = rh.gs(info.nightscout.core.ui.R.string.unsecure_fallback_biometric) val title = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_biometric)
val message = rh.gs(info.nightscout.core.ui.R.string.unsecure_fallback_descriotion_biometric) val message = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_descriotion_biometric)
OKDialog.show(it, title = title, message = message) OKDialog.show(it, title = title, message = message)
} }
} }
@ -409,9 +409,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
pref.summary = "******" pref.summary = "******"
} else { } else {
if (pref.key.contains("pin")) { if (pref.key.contains("pin")) {
pref.summary = rh.gs(info.nightscout.core.ui.R.string.pin_not_set) pref.summary = rh.gs(app.aaps.core.ui.R.string.pin_not_set)
} else { } else {
pref.summary = rh.gs(info.nightscout.core.ui.R.string.password_not_set) pref.summary = rh.gs(app.aaps.core.ui.R.string.password_not_set)
} }
} }
} }
@ -440,38 +440,38 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
when (preference.key) { when (preference.key) {
rh.gs(info.nightscout.core.utils.R.string.key_master_password) -> { rh.gs(info.nightscout.core.utils.R.string.key_master_password) -> {
passwordCheck.queryPassword(context, app.aaps.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, { passwordCheck.queryPassword(context, app.aaps.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password)
}) })
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_settings_password) -> { rh.gs(info.nightscout.core.utils.R.string.key_settings_password) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.settings_password, info.nightscout.core.utils.R.string.key_settings_password) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_password, info.nightscout.core.utils.R.string.key_settings_password)
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_bolus_password) -> { rh.gs(info.nightscout.core.utils.R.string.key_bolus_password) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.bolus_password, info.nightscout.core.utils.R.string.key_bolus_password) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_password, info.nightscout.core.utils.R.string.key_bolus_password)
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_application_password) -> { rh.gs(info.nightscout.core.utils.R.string.key_application_password) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.application_password, info.nightscout.core.utils.R.string.key_application_password) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_password, info.nightscout.core.utils.R.string.key_application_password)
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_settings_pin) -> { rh.gs(info.nightscout.core.utils.R.string.key_settings_pin) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.settings_pin, info.nightscout.core.utils.R.string.key_settings_pin, pinInput = true) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_pin, info.nightscout.core.utils.R.string.key_settings_pin, pinInput = true)
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin) -> { rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.bolus_pin, info.nightscout.core.utils.R.string.key_bolus_pin, pinInput = true) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_pin, info.nightscout.core.utils.R.string.key_bolus_pin, pinInput = true)
true true
} }
rh.gs(info.nightscout.core.utils.R.string.key_application_pin) -> { rh.gs(info.nightscout.core.utils.R.string.key_application_pin) -> {
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.application_pin, info.nightscout.core.utils.R.string.key_application_pin, pinInput = true) passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_pin, info.nightscout.core.utils.R.string.key_application_pin, pinInput = true)
true true
} }
// NSClient copy settings // NSClient copy settings

View file

@ -18,7 +18,7 @@ import app.aaps.core.interfaces.rx.bus.RxBus
import app.aaps.core.interfaces.ui.UiInteraction import app.aaps.core.interfaces.ui.UiInteraction
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.toast.ToastUtils
import info.nightscout.plugins.general.overview.notifications.NotificationWithAction import info.nightscout.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.BolusProgressHelperActivity
import info.nightscout.ui.activities.ErrorHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity

View file

@ -187,10 +187,10 @@ class KeepAliveWorker(
rxBus.send(EventProfileSwitchChanged()) rxBus.send(EventProfileSwitchChanged())
} else if (isStatusOutdated && !pump.isBusy()) { } else if (isStatusOutdated && !pump.isBusy()) {
lastReadStatus = now lastReadStatus = now
commandQueue.readStatus(rh.gs(info.nightscout.core.ui.R.string.keepalive_status_outdated), null) commandQueue.readStatus(rh.gs(app.aaps.core.ui.R.string.keepalive_status_outdated), null)
} else if (isBasalOutdated && !pump.isBusy()) { } else if (isBasalOutdated && !pump.isBusy()) {
lastReadStatus = now lastReadStatus = now
commandQueue.readStatus(rh.gs(info.nightscout.core.ui.R.string.keepalive_basal_outdated), null) commandQueue.readStatus(rh.gs(app.aaps.core.ui.R.string.keepalive_basal_outdated), null)
} }
} }
} }

View file

@ -22,4 +22,4 @@ fun TemporaryTarget.target(): Double =
fun TemporaryTarget.friendlyDescription(units: GlucoseUnit, rh: ResourceHelper, profileUtil: ProfileUtil): String = fun TemporaryTarget.friendlyDescription(units: GlucoseUnit, rh: ResourceHelper, profileUtil: ProfileUtil): String =
profileUtil.toTargetRangeString(lowTarget, highTarget, GlucoseUnit.MGDL, units) + profileUtil.toTargetRangeString(lowTarget, highTarget, GlucoseUnit.MGDL, units) +
units.asText + units.asText +
"@" + rh.gs(info.nightscout.core.ui.R.string.format_mins, TimeUnit.MILLISECONDS.toMinutes(duration)) + "(" + reason.text + ")" "@" + rh.gs(app.aaps.core.ui.R.string.format_mins, TimeUnit.MILLISECONDS.toMinutes(duration)) + "(" + reason.text + ")"

View file

@ -76,8 +76,8 @@ class BasalProfileGraph : GraphView {
addSeries(basalSeries2) addSeries(basalSeries2)
basalSeries2.thickness = 8 basalSeries2.thickness = 8
basalSeries2.isDrawBackground = false basalSeries2.isDrawBackground = false
basalSeries2.color = context.getColor(info.nightscout.core.ui.R.color.examinedProfile) basalSeries2.color = context.getColor(app.aaps.core.ui.R.color.examinedProfile)
basalSeries2.backgroundColor = context.getColor(info.nightscout.core.ui.R.color.examinedProfile) basalSeries2.backgroundColor = context.getColor(app.aaps.core.ui.R.color.examinedProfile)
viewport.isXAxisBoundsManual = true viewport.isXAxisBoundsManual = true
viewport.setMinX(0.0) viewport.setMinX(0.0)

View file

@ -78,7 +78,7 @@ class IcProfileGraph : GraphView {
addSeries(icSeries2) addSeries(icSeries2)
icSeries2.thickness = 8 icSeries2.thickness = 8
icSeries2.isDrawBackground = false icSeries2.isDrawBackground = false
icSeries2.color = context.getColor(info.nightscout.core.ui.R.color.examinedProfile) icSeries2.color = context.getColor(app.aaps.core.ui.R.color.examinedProfile)
viewport.isXAxisBoundsManual = true viewport.isXAxisBoundsManual = true
viewport.setMinX(0.0) viewport.setMinX(0.0)

View file

@ -86,7 +86,7 @@ class IsfProfileGraph : GraphView {
addSeries(isfSeries2) addSeries(isfSeries2)
isfSeries2.thickness = 8 isfSeries2.thickness = 8
isfSeries2.isDrawBackground = false isfSeries2.isDrawBackground = false
isfSeries2.color = context.getColor(info.nightscout.core.ui.R.color.examinedProfile) isfSeries2.color = context.getColor(app.aaps.core.ui.R.color.examinedProfile)
viewport.isXAxisBoundsManual = true viewport.isXAxisBoundsManual = true
viewport.setMinX(0.0) viewport.setMinX(0.0)

View file

@ -87,7 +87,7 @@ class TargetBgProfileGraph : GraphView {
val targetSeries2: AreaGraphSeries<DoubleDataPoint> = AreaGraphSeries(targetDataPoints2) val targetSeries2: AreaGraphSeries<DoubleDataPoint> = AreaGraphSeries(targetDataPoints2)
addSeries(targetSeries2) addSeries(targetSeries2)
targetSeries2.isDrawBackground = false targetSeries2.isDrawBackground = false
targetSeries2.color = context.getColor(info.nightscout.core.ui.R.color.examinedProfile) targetSeries2.color = context.getColor(app.aaps.core.ui.R.color.examinedProfile)
viewport.isXAxisBoundsManual = true viewport.isXAxisBoundsManual = true
viewport.setMinX(0.0) viewport.setMinX(0.0)

View file

@ -29,9 +29,9 @@ class BolusDataPoint(
get() = if (data.type == Bolus.Type.SMB) PointsWithLabelGraphSeries.Shape.SMB else PointsWithLabelGraphSeries.Shape.BOLUS get() = if (data.type == Bolus.Type.SMB) PointsWithLabelGraphSeries.Shape.SMB else PointsWithLabelGraphSeries.Shape.BOLUS
override fun color(context: Context?): Int = override fun color(context: Context?): Int =
if (data.type == Bolus.Type.SMB) rh.gac(context, info.nightscout.core.ui.R.attr.smbColor) if (data.type == Bolus.Type.SMB) rh.gac(context, app.aaps.core.ui.R.attr.smbColor)
else if (data.isValid) rh.gac(context, info.nightscout.core.ui.R.attr.bolusDataPointColor) else if (data.isValid) rh.gac(context, app.aaps.core.ui.R.attr.bolusDataPointColor)
else rh.gac(context, info.nightscout.core.ui.R.attr.alarmColor) else rh.gac(context, app.aaps.core.ui.R.attr.alarmColor)
override fun setY(y: Double) { override fun setY(y: Double) {
yValue = y yValue = y

View file

@ -22,7 +22,7 @@ class CarbsDataPoint(
override val paintStyle: Paint.Style = Paint.Style.FILL // not used override val paintStyle: Paint.Style = Paint.Style.FILL // not used
override fun color(context: Context?): Int { override fun color(context: Context?): Int {
return if (data.isValid) rh.gac(context, info.nightscout.core.ui.R.attr.cobColor) else rh.gac(context, info.nightscout.core.ui.R.attr.alarmColor) return if (data.isValid) rh.gac(context, app.aaps.core.ui.R.attr.cobColor) else rh.gac(context, app.aaps.core.ui.R.attr.alarmColor)
} }
override fun setY(y: Double) { override fun setY(y: Double) {

View file

@ -25,6 +25,6 @@ class EffectiveProfileSwitchDataPoint(
override val size = 2f override val size = 2f
override val paintStyle: Paint.Style = Paint.Style.FILL // not used override val paintStyle: Paint.Style = Paint.Style.FILL // not used
override fun color(context: Context?): Int { override fun color(context: Context?): Int {
return rh.gac(context, info.nightscout.core.ui.R.attr.profileSwitchColor) return rh.gac(context, app.aaps.core.ui.R.attr.profileSwitchColor)
} }
} }

View file

@ -22,7 +22,7 @@ class ExtendedBolusDataPoint(
override val shape = PointsWithLabelGraphSeries.Shape.EXTENDEDBOLUS override val shape = PointsWithLabelGraphSeries.Shape.EXTENDEDBOLUS
override val paintStyle: Paint.Style = Paint.Style.FILL // not used override val paintStyle: Paint.Style = Paint.Style.FILL // not used
override fun color(context: Context?): Int { override fun color(context: Context?): Int {
return rh.gac(context, info.nightscout.core.ui.R.attr.extBolusColor) return rh.gac(context, app.aaps.core.ui.R.attr.extBolusColor)
} }
override fun setY(y: Double) { override fun setY(y: Double) {

View file

@ -30,18 +30,18 @@ class GlucoseValueDataPoint(
override fun color(context: Context?): Int { override fun color(context: Context?): Int {
return when { return when {
isPrediction -> predictionColor(context) isPrediction -> predictionColor(context)
else -> rh.gac(context, info.nightscout.core.ui.R.attr.originalBgValueColor) else -> rh.gac(context, app.aaps.core.ui.R.attr.originalBgValueColor)
} }
} }
private fun predictionColor(context: Context?): Int { private fun predictionColor(context: Context?): Int {
return when (data.sourceSensor) { return when (data.sourceSensor) {
GlucoseValue.SourceSensor.IOB_PREDICTION -> rh.gac(context, info.nightscout.core.ui.R.attr.iobColor) GlucoseValue.SourceSensor.IOB_PREDICTION -> rh.gac(context, app.aaps.core.ui.R.attr.iobColor)
GlucoseValue.SourceSensor.COB_PREDICTION -> rh.gac(context, info.nightscout.core.ui.R.attr.cobColor) GlucoseValue.SourceSensor.COB_PREDICTION -> rh.gac(context, app.aaps.core.ui.R.attr.cobColor)
GlucoseValue.SourceSensor.A_COB_PREDICTION -> -0x7f000001 and rh.gac(context, info.nightscout.core.ui.R.attr.cobColor) GlucoseValue.SourceSensor.A_COB_PREDICTION -> -0x7f000001 and rh.gac(context, app.aaps.core.ui.R.attr.cobColor)
GlucoseValue.SourceSensor.UAM_PREDICTION -> rh.gac(context, info.nightscout.core.ui.R.attr.uamColor) GlucoseValue.SourceSensor.UAM_PREDICTION -> rh.gac(context, app.aaps.core.ui.R.attr.uamColor)
GlucoseValue.SourceSensor.ZT_PREDICTION -> rh.gac(context, info.nightscout.core.ui.R.attr.ztColor) GlucoseValue.SourceSensor.ZT_PREDICTION -> rh.gac(context, app.aaps.core.ui.R.attr.ztColor)
else -> rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor) else -> rh.gac(context, app.aaps.core.ui.R.attr.defaultTextColor)
} }
} }

View file

@ -20,5 +20,5 @@ class HeartRateDataPoint(
override val size = 10f override val size = 10f
override val paintStyle: Paint.Style = Paint.Style.FILL override val paintStyle: Paint.Style = Paint.Style.FILL
override fun color(context: Context?): Int = rh.gac(context, info.nightscout.core.ui.R.attr.heartRateColor) override fun color(context: Context?): Int = rh.gac(context, app.aaps.core.ui.R.attr.heartRateColor)
} }

View file

@ -36,9 +36,9 @@ class InMemoryGlucoseValueDataPoint(
val lowLine = defaultValueHelper.determineLowLine() val lowLine = defaultValueHelper.determineLowLine()
val highLine = defaultValueHelper.determineHighLine() val highLine = defaultValueHelper.determineHighLine()
val color = when { val color = when {
valueToUnits(units) < lowLine -> rh.gac(context, info.nightscout.core.ui.R.attr.bgLow) valueToUnits(units) < lowLine -> rh.gac(context, app.aaps.core.ui.R.attr.bgLow)
valueToUnits(units) > highLine -> rh.gac(context, info.nightscout.core.ui.R.attr.highColor) valueToUnits(units) > highLine -> rh.gac(context, app.aaps.core.ui.R.attr.highColor)
else -> rh.gac(context, info.nightscout.core.ui.R.attr.bgInRange) else -> rh.gac(context, app.aaps.core.ui.R.attr.bgInRange)
} }
return if (data.filledGap) ColorUtils.setAlphaComponent(color, 128) else color return if (data.filledGap) ColorUtils.setAlphaComponent(color, 128) else color
} }

View file

@ -50,15 +50,15 @@ class TherapyEventDataPoint(
} }
override val paintStyle: Paint.Style = Paint.Style.FILL // not used override val paintStyle: Paint.Style = Paint.Style.FILL // not used
override val size get() = if (rh.gb(info.nightscout.core.ui.R.bool.isTablet)) 12.0f else 10.0f override val size get() = if (rh.gb(app.aaps.core.ui.R.bool.isTablet)) 12.0f else 10.0f
override fun color(context: Context?): Int { override fun color(context: Context?): Int {
return when (data.type) { return when (data.type) {
TherapyEvent.Type.ANNOUNCEMENT -> rh.gac(context, info.nightscout.core.ui.R.attr.notificationAnnouncement) TherapyEvent.Type.ANNOUNCEMENT -> rh.gac(context, app.aaps.core.ui.R.attr.notificationAnnouncement)
TherapyEvent.Type.NS_MBG -> rh.gac(context, info.nightscout.core.ui.R.attr.therapyEvent_NS_MBG) TherapyEvent.Type.NS_MBG -> rh.gac(context, app.aaps.core.ui.R.attr.therapyEvent_NS_MBG)
TherapyEvent.Type.FINGER_STICK_BG_VALUE -> rh.gac(context, info.nightscout.core.ui.R.attr.therapyEvent_FINGER_STICK_BG_VALUE) TherapyEvent.Type.FINGER_STICK_BG_VALUE -> rh.gac(context, app.aaps.core.ui.R.attr.therapyEvent_FINGER_STICK_BG_VALUE)
TherapyEvent.Type.EXERCISE -> rh.gac(context, info.nightscout.core.ui.R.attr.therapyEvent_EXERCISE) TherapyEvent.Type.EXERCISE -> rh.gac(context, app.aaps.core.ui.R.attr.therapyEvent_EXERCISE)
TherapyEvent.Type.APS_OFFLINE -> rh.gac(context, info.nightscout.core.ui.R.attr.therapyEvent_APS_OFFLINE) and -0x7f000001 TherapyEvent.Type.APS_OFFLINE -> rh.gac(context, app.aaps.core.ui.R.attr.therapyEvent_APS_OFFLINE) and -0x7f000001
else -> rh.gac(context, info.nightscout.core.ui.R.attr.therapyEvent_Default) else -> rh.gac(context, app.aaps.core.ui.R.attr.therapyEvent_Default)
} }
} }
} }

View file

@ -17,7 +17,7 @@ fun CobInfo.generateCOBString(decimalFormatter: DecimalFormatter): String {
fun CobInfo.displayText(rh: ResourceHelper, decimalFormatter: DecimalFormatter): String? = fun CobInfo.displayText(rh: ResourceHelper, decimalFormatter: DecimalFormatter): String? =
displayCob?.let { displayCob -> displayCob?.let { displayCob ->
var cobText = rh.gs(info.nightscout.core.ui.R.string.format_carbs, displayCob.toInt()) var cobText = rh.gs(app.aaps.core.ui.R.string.format_carbs, displayCob.toInt())
if (futureCarbs > 0) cobText += "(" + decimalFormatter.to0Decimal(futureCarbs) + ")" if (futureCarbs > 0) cobText += "(" + decimalFormatter.to0Decimal(futureCarbs) + ")"
cobText cobText
} }

View file

@ -112,21 +112,21 @@ sealed class ProfileSealed(
if (sendNotifications && config.APS) { if (sendNotifications && config.APS) {
val notification = Notification( val notification = Notification(
Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS,
rh.gs(info.nightscout.core.ui.R.string.basalprofilenotaligned, from), rh.gs(app.aaps.core.ui.R.string.basalprofilenotaligned, from),
Notification.NORMAL Notification.NORMAL
) )
rxBus.send(EventNewNotification(notification)) rxBus.send(EventNewNotification(notification))
} }
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add( validityCheck.reasons.add(
rh.gs(info.nightscout.core.ui.R.string.basalprofilenotaligned, from) rh.gs(app.aaps.core.ui.R.string.basalprofilenotaligned, from)
) )
break break
} }
} }
if (!hardLimits.isInRange(basalAmount, 0.01, hardLimits.maxBasal())) { if (!hardLimits.isInRange(basalAmount, 0.01, hardLimits.maxBasal())) {
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.value_out_of_hard_limits, rh.gs(info.nightscout.core.ui.R.string.basal_value), basalAmount)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.value_out_of_hard_limits, rh.gs(app.aaps.core.ui.R.string.basal_value), basalAmount))
break break
} }
// Check for minimal basal value // Check for minimal basal value
@ -134,28 +134,28 @@ sealed class ProfileSealed(
basal.amount = description.basalMinimumRate basal.amount = description.basalMinimumRate
if (sendNotifications) sendBelowMinimumNotification(from, rxBus, rh) if (sendNotifications) sendBelowMinimumNotification(from, rxBus, rh)
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.minimalbasalvaluereplaced, from)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.minimalbasalvaluereplaced, from))
break break
} else if (basalAmount > description.basalMaximumRate) { } else if (basalAmount > description.basalMaximumRate) {
basal.amount = description.basalMaximumRate basal.amount = description.basalMaximumRate
if (sendNotifications) sendAboveMaximumNotification(from, rxBus, rh) if (sendNotifications) sendAboveMaximumNotification(from, rxBus, rh)
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.maximumbasalvaluereplaced, from)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.maximumbasalvaluereplaced, from))
break break
} }
} }
if (!hardLimits.isInRange(dia, hardLimits.minDia(), hardLimits.maxDia())) { if (!hardLimits.isInRange(dia, hardLimits.minDia(), hardLimits.maxDia())) {
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.value_out_of_hard_limits, rh.gs(info.nightscout.core.ui.R.string.profile_dia), dia)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.value_out_of_hard_limits, rh.gs(app.aaps.core.ui.R.string.profile_dia), dia))
} }
for (ic in icBlocks) for (ic in icBlocks)
if (!hardLimits.isInRange(ic.amount * 100.0 / percentage, hardLimits.minIC(), hardLimits.maxIC())) { if (!hardLimits.isInRange(ic.amount * 100.0 / percentage, hardLimits.minIC(), hardLimits.maxIC())) {
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add( validityCheck.reasons.add(
rh.gs( rh.gs(
info.nightscout.core.ui.R.string.value_out_of_hard_limits, app.aaps.core.ui.R.string.value_out_of_hard_limits,
rh.gs(info.nightscout.core.ui.R.string.profile_carbs_ratio_value), rh.gs(app.aaps.core.ui.R.string.profile_carbs_ratio_value),
ic.amount * 100.0 / percentage ic.amount * 100.0 / percentage
) )
) )
@ -166,8 +166,8 @@ sealed class ProfileSealed(
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add( validityCheck.reasons.add(
rh.gs( rh.gs(
info.nightscout.core.ui.R.string.value_out_of_hard_limits, app.aaps.core.ui.R.string.value_out_of_hard_limits,
rh.gs(info.nightscout.core.ui.R.string.profile_sensitivity_value), rh.gs(app.aaps.core.ui.R.string.profile_sensitivity_value),
isf.amount * 100.0 / percentage isf.amount * 100.0 / percentage
) )
) )
@ -181,7 +181,7 @@ sealed class ProfileSealed(
) )
) { ) {
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.value_out_of_hard_limits, rh.gs(info.nightscout.core.ui.R.string.profile_low_target), target.lowTarget)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.value_out_of_hard_limits, rh.gs(app.aaps.core.ui.R.string.profile_low_target), target.lowTarget))
break break
} }
if (!hardLimits.isInRange( if (!hardLimits.isInRange(
@ -191,7 +191,7 @@ sealed class ProfileSealed(
) )
) { ) {
validityCheck.isValid = false validityCheck.isValid = false
validityCheck.reasons.add(rh.gs(info.nightscout.core.ui.R.string.value_out_of_hard_limits, rh.gs(info.nightscout.core.ui.R.string.profile_high_target), target.highTarget)) validityCheck.reasons.add(rh.gs(app.aaps.core.ui.R.string.value_out_of_hard_limits, rh.gs(app.aaps.core.ui.R.string.profile_high_target), target.highTarget))
break break
} }
} }
@ -199,11 +199,11 @@ sealed class ProfileSealed(
} }
protected open fun sendBelowMinimumNotification(from: String, rxBus: RxBus, rh: ResourceHelper) { protected open fun sendBelowMinimumNotification(from: String, rxBus: RxBus, rh: ResourceHelper) {
rxBus.send(EventNewNotification(Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, rh.gs(info.nightscout.core.ui.R.string.minimalbasalvaluereplaced, from), Notification.NORMAL))) rxBus.send(EventNewNotification(Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, rh.gs(app.aaps.core.ui.R.string.minimalbasalvaluereplaced, from), Notification.NORMAL)))
} }
protected open fun sendAboveMaximumNotification(from: String, rxBus: RxBus, rh: ResourceHelper) { protected open fun sendAboveMaximumNotification(from: String, rxBus: RxBus, rh: ResourceHelper) {
rxBus.send(EventNewNotification(Notification(Notification.MAXIMUM_BASAL_VALUE_REPLACED, rh.gs(info.nightscout.core.ui.R.string.maximumbasalvaluereplaced, from), Notification.NORMAL))) rxBus.send(EventNewNotification(Notification(Notification.MAXIMUM_BASAL_VALUE_REPLACED, rh.gs(app.aaps.core.ui.R.string.maximumbasalvaluereplaced, from), Notification.NORMAL)))
} }
override val units: GlucoseUnit override val units: GlucoseUnit
@ -255,13 +255,13 @@ sealed class ProfileSealed(
override fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double = toMgdl(targetBlocks.highTargetBlockValueBySeconds(timeAsSeconds, timeshift), units) override fun getTargetHighMgdlTimeFromMidnight(timeAsSeconds: Int): Double = toMgdl(targetBlocks.highTargetBlockValueBySeconds(timeAsSeconds, timeshift), units)
override fun getIcList(rh: ResourceHelper, dateUtil: DateUtil): String = override fun getIcList(rh: ResourceHelper, dateUtil: DateUtil): String =
getValuesList(icBlocks, 100.0 / percentage, DecimalFormat("0.0"), rh.gs(info.nightscout.core.ui.R.string.profile_carbs_per_unit), dateUtil) getValuesList(icBlocks, 100.0 / percentage, DecimalFormat("0.0"), rh.gs(app.aaps.core.ui.R.string.profile_carbs_per_unit), dateUtil)
override fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String = override fun getIsfList(rh: ResourceHelper, dateUtil: DateUtil): String =
getValuesList(isfBlocks, 100.0 / percentage, DecimalFormat("0.0"), units.asText + rh.gs(info.nightscout.core.ui.R.string.profile_per_unit), dateUtil) getValuesList(isfBlocks, 100.0 / percentage, DecimalFormat("0.0"), units.asText + rh.gs(app.aaps.core.ui.R.string.profile_per_unit), dateUtil)
override fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String = override fun getBasalList(rh: ResourceHelper, dateUtil: DateUtil): String =
getValuesList(basalBlocks, percentage / 100.0, DecimalFormat("0.00"), rh.gs(info.nightscout.core.ui.R.string.profile_ins_units_per_hour), dateUtil) getValuesList(basalBlocks, percentage / 100.0, DecimalFormat("0.00"), rh.gs(app.aaps.core.ui.R.string.profile_ins_units_per_hour), dateUtil)
override fun getTargetList(rh: ResourceHelper, dateUtil: DateUtil): String = getTargetValuesList(targetBlocks, DecimalFormat("0.0"), units.asText, dateUtil) override fun getTargetList(rh: ResourceHelper, dateUtil: DateUtil): String = getTargetValuesList(targetBlocks, DecimalFormat("0.0"), units.asText, dateUtil)

View file

@ -5,39 +5,39 @@ import app.aaps.core.interfaces.resources.ResourceHelper
import app.aaps.core.interfaces.utils.DecimalFormatter import app.aaps.core.interfaces.utils.DecimalFormatter
fun PumpEnactResult.toHtml(rh: ResourceHelper, decimalFormatter: DecimalFormatter): String { fun PumpEnactResult.toHtml(rh: ResourceHelper, decimalFormatter: DecimalFormatter): String {
var ret = "<b>" + rh.gs(info.nightscout.core.ui.R.string.success) + "</b>: " + success var ret = "<b>" + rh.gs(app.aaps.core.ui.R.string.success) + "</b>: " + success
if (queued) { if (queued) {
ret = rh.gs(info.nightscout.core.ui.R.string.waitingforpumpresult) ret = rh.gs(app.aaps.core.ui.R.string.waitingforpumpresult)
} else if (enacted) { } else if (enacted) {
when { when {
bolusDelivered > 0 -> { bolusDelivered > 0 -> {
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.enacted) + "</b>: " + enacted ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.enacted) + "</b>: " + enacted
if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.comment) + "</b>: " + comment if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.comment) + "</b>: " + comment
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.smb_shortname) + "</b>: " + bolusDelivered + " " + rh.gs(info.nightscout.core.ui.R.string.insulin_unit_shortname) ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.smb_shortname) + "</b>: " + bolusDelivered + " " + rh.gs(app.aaps.core.ui.R.string.insulin_unit_shortname)
} }
isTempCancel -> { isTempCancel -> {
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.enacted) + "</b>: " + enacted ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.enacted) + "</b>: " + enacted
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.comment) + "</b>: " + comment + ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.comment) + "</b>: " + comment +
"<br>" + rh.gs(info.nightscout.core.ui.R.string.cancel_temp) "<br>" + rh.gs(app.aaps.core.ui.R.string.cancel_temp)
} }
isPercent && percent != -1 -> { isPercent && percent != -1 -> {
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.enacted) + "</b>: " + enacted ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.enacted) + "</b>: " + enacted
if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.comment) + "</b>: " + comment if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.comment) + "</b>: " + comment
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.duration) + "</b>: " + duration + " min" ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.duration) + "</b>: " + duration + " min"
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.percent) + "</b>: " + percent + "%" ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.percent) + "</b>: " + percent + "%"
} }
absolute != -1.0 -> { absolute != -1.0 -> {
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.enacted) + "</b>: " + enacted ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.enacted) + "</b>: " + enacted
if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.comment) + "</b>: " + comment if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.comment) + "</b>: " + comment
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.duration) + "</b>: " + duration + " min" ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.duration) + "</b>: " + duration + " min"
ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.absolute) + "</b>: " + decimalFormatter.to2Decimal(absolute) + " U/h" ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.absolute) + "</b>: " + decimalFormatter.to2Decimal(absolute) + " U/h"
} }
} }
} else { } else {
if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(info.nightscout.core.ui.R.string.comment) + "</b>: " + comment if (comment.isNotEmpty()) ret += "<br><b>" + rh.gs(app.aaps.core.ui.R.string.comment) + "</b>: " + comment
} }
return ret return ret
} }

View file

@ -38,7 +38,7 @@ import app.aaps.core.interfaces.utils.Round
import app.aaps.core.interfaces.utils.T import app.aaps.core.interfaces.utils.T
import com.google.common.base.Joiner import com.google.common.base.Joiner
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.ui.dialogs.OKDialog import app.aaps.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.HtmlHelper import info.nightscout.core.utils.HtmlHelper
import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.OfflineEvent import info.nightscout.database.entities.OfflineEvent
@ -320,47 +320,47 @@ class BolusWizard @Inject constructor(
if (insulinAfterConstraints > 0) { if (insulinAfterConstraints > 0) {
val pct = if (percentageCorrection != 100) " ($percentageCorrection%)" else "" val pct = if (percentageCorrection != 100) " ($percentageCorrection%)" else ""
actions.add( actions.add(
rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, insulinAfterConstraints).formatColor rh.gs(app.aaps.core.ui.R.string.bolus) + ": " + rh.gs(app.aaps.core.ui.R.string.format_insulin_units, insulinAfterConstraints).formatColor
(context, rh, info.nightscout.core.ui.R.attr.bolusColor) + pct (context, rh, app.aaps.core.ui.R.attr.bolusColor) + pct
) )
} }
if (carbs > 0 && !advisor) { if (carbs > 0 && !advisor) {
var timeShift = "" var timeShift = ""
if (carbTime > 0) { if (carbTime > 0) {
timeShift += " (+" + rh.gs(info.nightscout.core.ui.R.string.mins, carbTime) + ")" timeShift += " (+" + rh.gs(app.aaps.core.ui.R.string.mins, carbTime) + ")"
} else if (carbTime < 0) { } else if (carbTime < 0) {
timeShift += " (" + rh.gs(info.nightscout.core.ui.R.string.mins, carbTime) + ")" timeShift += " (" + rh.gs(app.aaps.core.ui.R.string.mins, carbTime) + ")"
} }
actions.add( actions.add(
rh.gs(info.nightscout.core.ui.R.string.carbs) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_carbs, carbs) rh.gs(app.aaps.core.ui.R.string.carbs) + ": " + rh.gs(app.aaps.core.ui.R.string.format_carbs, carbs)
.formatColor(context, rh, info.nightscout.core.ui.R.attr.carbsColor) + timeShift .formatColor(context, rh, app.aaps.core.ui.R.attr.carbsColor) + timeShift
) )
} }
if (insulinFromCOB > 0) { if (insulinFromCOB > 0) {
actions.add( actions.add(
rh.gs(info.nightscout.core.ui.R.string.cobvsiob) + ": " + rh.gs( rh.gs(app.aaps.core.ui.R.string.cobvsiob) + ": " + rh.gs(
info.nightscout.core.ui.R.string.formatsignedinsulinunits, app.aaps.core.ui.R.string.formatsignedinsulinunits,
insulinFromBolusIOB + insulinFromBasalIOB + insulinFromCOB + insulinFromBG insulinFromBolusIOB + insulinFromBasalIOB + insulinFromCOB + insulinFromBG
).formatColor( ).formatColor(
context, rh, info.nightscout.core.ui.R.attr context, rh, app.aaps.core.ui.R.attr
.cobAlertColor .cobAlertColor
) )
) )
val absorptionRate = iobCobCalculator.ads.slowAbsorptionPercentage(60) val absorptionRate = iobCobCalculator.ads.slowAbsorptionPercentage(60)
if (absorptionRate > .25) if (absorptionRate > .25)
actions.add(rh.gs(info.nightscout.core.ui.R.string.slowabsorptiondetected, rh.gac(context, info.nightscout.core.ui.R.attr.cobAlertColor), (absorptionRate * 100).toInt())) actions.add(rh.gs(app.aaps.core.ui.R.string.slowabsorptiondetected, rh.gac(context, app.aaps.core.ui.R.attr.cobAlertColor), (absorptionRate * 100).toInt()))
} }
if (abs(insulinAfterConstraints - calculatedTotalInsulin) > activePlugin.activePump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints)) if (abs(insulinAfterConstraints - calculatedTotalInsulin) > activePlugin.activePump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
actions.add( actions.add(
rh.gs(info.nightscout.core.ui.R.string.bolus_constraint_applied_warn, calculatedTotalInsulin, insulinAfterConstraints) rh.gs(app.aaps.core.ui.R.string.bolus_constraint_applied_warn, calculatedTotalInsulin, insulinAfterConstraints)
.formatColor(context, rh, info.nightscout.core.ui.R.attr.warningColor) .formatColor(context, rh, app.aaps.core.ui.R.attr.warningColor)
) )
if (config.NSCLIENT && insulinAfterConstraints > 0) if (config.NSCLIENT && insulinAfterConstraints > 0)
actions.add(rh.gs(info.nightscout.core.ui.R.string.bolus_recorded_only).formatColor(context, rh, info.nightscout.core.ui.R.attr.warningColor)) actions.add(rh.gs(app.aaps.core.ui.R.string.bolus_recorded_only).formatColor(context, rh, app.aaps.core.ui.R.attr.warningColor))
if (useAlarm && !advisor && carbs > 0 && carbTime > 0) if (useAlarm && !advisor && carbs > 0 && carbTime > 0)
actions.add(rh.gs(info.nightscout.core.ui.R.string.alarminxmin, carbTime).formatColor(context, rh, info.nightscout.core.ui.R.attr.infoColor)) actions.add(rh.gs(app.aaps.core.ui.R.string.alarminxmin, carbTime).formatColor(context, rh, app.aaps.core.ui.R.attr.infoColor))
if (advisor) if (advisor)
actions.add(rh.gs(info.nightscout.core.ui.R.string.advisoralarm).formatColor(context, rh, info.nightscout.core.ui.R.attr.infoColor)) actions.add(rh.gs(app.aaps.core.ui.R.string.advisoralarm).formatColor(context, rh, app.aaps.core.ui.R.attr.infoColor))
return HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)) return HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))
} }
@ -376,21 +376,21 @@ class BolusWizard @Inject constructor(
automation.removeAutomationEventBolusReminder() automation.removeAutomationEventBolusReminder()
if (carbs > 0.0) if (carbs > 0.0)
automation.removeAutomationEventEatReminder() automation.removeAutomationEventEatReminder()
if (sp.getBoolean(info.nightscout.core.ui.R.string.key_usebolusadvisor, false) && profileUtil.convertToMgdl(bg, profile.units) > 180 && carbs > 0 && carbTime >= 0) if (sp.getBoolean(app.aaps.core.ui.R.string.key_usebolusadvisor, false) && profileUtil.convertToMgdl(bg, profile.units) > 180 && carbs > 0 && carbTime >= 0)
OKDialog.showYesNoCancel(ctx, rh.gs(info.nightscout.core.ui.R.string.bolus_advisor), rh.gs(info.nightscout.core.ui.R.string.bolus_advisor_message), OKDialog.showYesNoCancel(ctx, rh.gs(app.aaps.core.ui.R.string.bolus_advisor), rh.gs(app.aaps.core.ui.R.string.bolus_advisor_message),
{ bolusAdvisorProcessing(ctx) }, { bolusAdvisorProcessing(ctx) },
{ commonProcessing(ctx) } { commonProcessing(ctx) }
) )
else else
commonProcessing(ctx) commonProcessing(ctx)
} else { } else {
OKDialog.show(ctx, rh.gs(info.nightscout.core.ui.R.string.boluswizard), rh.gs(info.nightscout.core.ui.R.string.no_action_selected)) OKDialog.show(ctx, rh.gs(app.aaps.core.ui.R.string.boluswizard), rh.gs(app.aaps.core.ui.R.string.no_action_selected))
} }
} }
private fun bolusAdvisorProcessing(ctx: Context) { private fun bolusAdvisorProcessing(ctx: Context) {
val confirmMessage = confirmMessageAfterConstraints(ctx, advisor = true) val confirmMessage = confirmMessageAfterConstraints(ctx, advisor = true)
OKDialog.showConfirmation(ctx, rh.gs(info.nightscout.core.ui.R.string.boluswizard), confirmMessage, { OKDialog.showConfirmation(ctx, rh.gs(app.aaps.core.ui.R.string.boluswizard), confirmMessage, {
DetailedBolusInfo().apply { DetailedBolusInfo().apply {
eventType = DetailedBolusInfo.EventType.CORRECTION_BOLUS eventType = DetailedBolusInfo.EventType.CORRECTION_BOLUS
insulin = insulinAfterConstraints insulin = insulinAfterConstraints
@ -412,7 +412,7 @@ class BolusWizard @Inject constructor(
commandQueue.bolus(this, object : Callback() { commandQueue.bolus(this, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
uiInteraction.runAlarm(result.comment, rh.gs(info.nightscout.core.ui.R.string.treatmentdeliveryerror), info.nightscout.core.ui.R.raw.boluserror) uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.treatmentdeliveryerror), app.aaps.core.ui.R.raw.boluserror)
} else } else
automation.scheduleAutomationEventEatReminder() automation.scheduleAutomationEventEatReminder()
} }
@ -423,24 +423,24 @@ class BolusWizard @Inject constructor(
} }
fun explainShort(): String { fun explainShort(): String {
var message = rh.gs(info.nightscout.core.ui.R.string.wizard_explain_calc, ic, sens) var message = rh.gs(app.aaps.core.ui.R.string.wizard_explain_calc, ic, sens)
message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_carbs, insulinFromCarbs) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_carbs, insulinFromCarbs)
if (useTT && tempTarget != null) { if (useTT && tempTarget != null) {
val tt = if (tempTarget?.lowTarget == tempTarget?.highTarget) tempTarget?.lowValueToUnitsToString(profile.units, decimalFormatter) val tt = if (tempTarget?.lowTarget == tempTarget?.highTarget) tempTarget?.lowValueToUnitsToString(profile.units, decimalFormatter)
else rh.gs( else rh.gs(
info.nightscout.core.ui.R.string.wizard_explain_tt_to, app.aaps.core.ui.R.string.wizard_explain_tt_to,
tempTarget?.lowValueToUnitsToString(profile.units, decimalFormatter), tempTarget?.lowValueToUnitsToString(profile.units, decimalFormatter),
tempTarget?.highValueToUnitsToString(profile.units, decimalFormatter) tempTarget?.highValueToUnitsToString(profile.units, decimalFormatter)
) )
message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_tt, tt) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_tt, tt)
} }
if (useCob) message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_cob, cob, insulinFromCOB) if (useCob) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_cob, cob, insulinFromCOB)
if (useBg) message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_bg, insulinFromBG) if (useBg) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_bg, insulinFromBG)
if (includeBolusIOB) message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_iob, insulinFromBolusIOB + insulinFromBasalIOB) if (includeBolusIOB) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_iob, insulinFromBolusIOB + insulinFromBasalIOB)
if (useTrend) message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_trend, insulinFromTrend) if (useTrend) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_trend, insulinFromTrend)
if (useSuperBolus) message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_superbolus, insulinFromSuperBolus) if (useSuperBolus) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_superbolus, insulinFromSuperBolus)
if (percentageCorrection != 100) { if (percentageCorrection != 100) {
message += "\n" + rh.gs(info.nightscout.core.ui.R.string.wizard_explain_percent, totalBeforePercentageAdjustment, percentageCorrection, calculatedTotalInsulin) message += "\n" + rh.gs(app.aaps.core.ui.R.string.wizard_explain_percent, totalBeforePercentageAdjustment, percentageCorrection, calculatedTotalInsulin)
} }
return message return message
} }
@ -450,7 +450,7 @@ class BolusWizard @Inject constructor(
val pump = activePlugin.activePump val pump = activePlugin.activePump
val confirmMessage = confirmMessageAfterConstraints(ctx, advisor = false) val confirmMessage = confirmMessageAfterConstraints(ctx, advisor = false)
OKDialog.showConfirmation(ctx, rh.gs(info.nightscout.core.ui.R.string.boluswizard), confirmMessage, { OKDialog.showConfirmation(ctx, rh.gs(app.aaps.core.ui.R.string.boluswizard), confirmMessage, {
if (insulinAfterConstraints > 0 || carbs > 0) { if (insulinAfterConstraints > 0 || carbs > 0) {
if (useSuperBolus) { if (useSuperBolus) {
uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog) uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog)
@ -463,7 +463,7 @@ class BolusWizard @Inject constructor(
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() { commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
uiInteraction.runAlarm(result.comment, rh.gs(info.nightscout.core.ui.R.string.temp_basal_delivery_error), info.nightscout.core.ui.R.raw.boluserror) uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.temp_basal_delivery_error), app.aaps.core.ui.R.raw.boluserror)
} }
} }
}) })
@ -471,7 +471,7 @@ class BolusWizard @Inject constructor(
commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() { commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
uiInteraction.runAlarm(result.comment, rh.gs(info.nightscout.core.ui.R.string.temp_basal_delivery_error), info.nightscout.core.ui.R.raw.boluserror) uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.temp_basal_delivery_error), app.aaps.core.ui.R.raw.boluserror)
} }
} }
}) })
@ -502,7 +502,7 @@ class BolusWizard @Inject constructor(
commandQueue.bolus(this, object : Callback() { commandQueue.bolus(this, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
uiInteraction.runAlarm(result.comment, rh.gs(info.nightscout.core.ui.R.string.treatmentdeliveryerror), info.nightscout.core.ui.R.raw.boluserror) uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.treatmentdeliveryerror), app.aaps.core.ui.R.raw.boluserror)
} }
} }
}) })

View file

@ -60,9 +60,9 @@ class ProfileSealedTest : TestBase() {
dateUtil = DateUtilImpl(context) dateUtil = DateUtilImpl(context)
hardLimits = HardLimitsMock(sp, rh) hardLimits = HardLimitsMock(sp, rh)
`when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin)
`when`(rh.gs(info.nightscout.core.ui.R.string.profile_per_unit)).thenReturn("/U") `when`(rh.gs(app.aaps.core.ui.R.string.profile_per_unit)).thenReturn("/U")
`when`(rh.gs(info.nightscout.core.ui.R.string.profile_carbs_per_unit)).thenReturn("g/U") `when`(rh.gs(app.aaps.core.ui.R.string.profile_carbs_per_unit)).thenReturn("g/U")
`when`(rh.gs(info.nightscout.core.ui.R.string.profile_ins_units_per_hour)).thenReturn("U/h") `when`(rh.gs(app.aaps.core.ui.R.string.profile_ins_units_per_hour)).thenReturn("U/h")
`when`(rh.gs(anyInt(), anyString())).thenReturn("") `when`(rh.gs(anyInt(), anyString())).thenReturn("")
} }

View file

@ -8,7 +8,7 @@ apply from: "${project.rootDir}/core/main/android_dependencies.gradle"
apply from: "${project.rootDir}/core/main/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/main/android_module_dependencies.gradle"
android { android {
namespace 'info.nightscout.core.ui' namespace 'app.aaps.core.ui'
buildFeatures { buildFeatures {
viewBinding true viewBinding true

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui package app.aaps.core.ui
import android.content.Context import android.content.Context
import android.util.TypedValue import android.util.TypedValue

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui package app.aaps.core.ui
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper

View file

@ -1,8 +1,8 @@
package info.nightscout.core.ui.activities package app.aaps.core.ui.activities
import android.os.Bundle import android.os.Bundle
import dagger.android.support.DaggerAppCompatActivity import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.core.ui.R import app.aaps.core.ui.R
open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() { open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.activities package app.aaps.core.ui.activities
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
@ -6,8 +6,8 @@ import android.view.Menu
import android.view.MenuInflater import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import androidx.core.view.MenuProvider import androidx.core.view.MenuProvider
import app.aaps.core.ui.locale.LocaleHelper
import dagger.android.support.DaggerAppCompatActivity import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.core.ui.locale.LocaleHelper
open class TranslatedDaggerAppCompatActivity : DaggerAppCompatActivity() { open class TranslatedDaggerAppCompatActivity : DaggerAppCompatActivity() {
override fun attachBaseContext(newBase: Context) { override fun attachBaseContext(newBase: Context) {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dialogs package app.aaps.core.ui.dialogs
import android.content.Context import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
@ -10,7 +10,7 @@ import androidx.annotation.LayoutRes
import androidx.annotation.StyleRes import androidx.annotation.StyleRes
import androidx.appcompat.view.ContextThemeWrapper import androidx.appcompat.view.ContextThemeWrapper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.core.ui.R import app.aaps.core.ui.R
object AlertDialogHelper { object AlertDialogHelper {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dialogs package app.aaps.core.ui.dialogs
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -9,7 +9,7 @@ import android.os.SystemClock
import android.text.Spanned import android.text.Spanned
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.core.ui.R import app.aaps.core.ui.R
object OKDialog { object OKDialog {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dialogs package app.aaps.core.ui.dialogs
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -11,7 +11,7 @@ import android.view.View
import android.widget.TextView import android.widget.TextView
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.core.ui.R import app.aaps.core.ui.R
object TwoMessagesAlertDialog { object TwoMessagesAlertDialog {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dialogs package app.aaps.core.ui.dialogs
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -8,7 +8,7 @@ import android.os.Looper
import android.os.SystemClock import android.os.SystemClock
import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.core.ui.R import app.aaps.core.ui.R
// if you need error dialog - duplicate to ErrorDialog and make it and use: AppThemeErrorDialog & R.drawable.ic_header_error instead // if you need error dialog - duplicate to ErrorDialog and make it and use: AppThemeErrorDialog & R.drawable.ic_header_error instead

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dragHelpers package app.aaps.core.ui.dragHelpers
interface ItemTouchHelperAdapter { interface ItemTouchHelperAdapter {
@ -6,15 +6,15 @@ interface ItemTouchHelperAdapter {
* Called when an item has been dragged far enough to trigger a move. This is called every time * Called when an item has been dragged far enough to trigger a move. This is called every time
* an item is shifted, and **not** at the end of a "drop" event.<br></br> * an item is shifted, and **not** at the end of a "drop" event.<br></br>
* <br></br> * <br></br>
* Implementations should call [RecyclerView.Adapter.notifyItemMoved] after * Implementations should call [androidx.recyclerview.widget.RecyclerView.Adapter.notifyItemMoved] after
* adjusting the underlying data to reflect this move. * adjusting the underlying data to reflect this move.
* *
* @param fromPosition The start position of the moved item. * @param fromPosition The start position of the moved item.
* @param toPosition Then resolved position of the moved item. * @param toPosition Then resolved position of the moved item.
* @return True if the item was moved to the new adapter position. * @return True if the item was moved to the new adapter position.
* *
* @see RecyclerView.getAdapterPositionFor * @see androidx.recyclerview.widget.RecyclerView.getAdapterPositionFor
* @see RecyclerView.ViewHolder.getAdapterPosition * @see androidx.recyclerview.widget.RecyclerView.ViewHolder.getAdapterPosition
*/ */
fun onItemMove(fromPosition: Int, toPosition: Int): Boolean fun onItemMove(fromPosition: Int, toPosition: Int): Boolean

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dragHelpers package app.aaps.core.ui.dragHelpers
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.dragHelpers package app.aaps.core.ui.dragHelpers
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.Manifest import android.Manifest
import android.bluetooth.BluetoothManager import android.bluetooth.BluetoothManager
@ -8,8 +8,8 @@ import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.preference.ListPreference import androidx.preference.ListPreference
import info.nightscout.core.ui.R import app.aaps.core.ui.toast.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.R
import java.util.Vector import java.util.Vector
class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) { class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.text.InputType import android.text.InputType
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
@ -19,7 +19,7 @@ import androidx.preference.SeekBarPreference
* value is re-read as a string and then converted to an int. * value is re-read as a string and then converted to an int.
* *
* To use this in fragment XMLs, replace "SeekBarPreference" in them * To use this in fragment XMLs, replace "SeekBarPreference" in them
* with "info.nightscout.core.ui.elements.IntSeekBarPreference". * with "app.aaps.core.ui.elements.IntSeekBarPreference".
*/ */
class IntSeekBarPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : SeekBarPreference(context, attrs) { class IntSeekBarPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : SeekBarPreference(context, attrs) {
override fun onSetInitialValue(defaultValue: Any?) { override fun onSetInitialValue(defaultValue: Any?) {

View file

@ -1,12 +1,12 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.Button import android.widget.Button
import info.nightscout.core.ui.R import app.aaps.core.ui.R
import java.text.DecimalFormat import java.text.DecimalFormat
class MinutesNumberPicker constructor(context: Context, attrs: AttributeSet? = null) : NumberPicker(context, attrs) { class MinutesNumberPicker(context: Context, attrs: AttributeSet? = null) : NumberPicker(context, attrs) {
fun setParams(initValue: Double, minValue: Double, maxValue: Double, step: Double, allowZero: Boolean, okButton: Button? = null) { fun setParams(initValue: Double, minValue: Double, maxValue: Double, step: Double, allowZero: Boolean, okButton: Button? = null) {
super.setParams(initValue, minValue, maxValue, step, null, allowZero, okButton) super.setParams(initValue, minValue, maxValue, step, null, allowZero, okButton)

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Service import android.app.Service
@ -21,9 +21,9 @@ import android.view.accessibility.AccessibilityManager
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.Button import android.widget.Button
import android.widget.LinearLayout import android.widget.LinearLayout
import info.nightscout.core.ui.R import app.aaps.core.ui.toast.ToastUtils
import info.nightscout.core.ui.databinding.NumberPickerLayoutBinding import app.aaps.core.ui.R
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.databinding.NumberPickerLayoutBinding
import java.text.NumberFormat import java.text.NumberFormat
import java.util.concurrent.Executors import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.ScheduledExecutorService

View file

@ -1,9 +1,9 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import info.nightscout.core.ui.databinding.NumberPickerLayoutVerticalBinding import app.aaps.core.ui.databinding.NumberPickerLayoutVerticalBinding
class NumberPickerVertical(context: Context, attrs: AttributeSet? = null) : NumberPicker(context, attrs) { class NumberPickerVertical(context: Context, attrs: AttributeSet? = null) : NumberPicker(context, attrs) {

View file

@ -1,21 +1,16 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import info.nightscout.core.ui.databinding.NumberPickerLayoutBinding import app.aaps.core.ui.databinding.NumberPickerLayoutBinding
import info.nightscout.core.ui.databinding.NumberPickerLayoutVerticalBinding import app.aaps.core.ui.databinding.NumberPickerLayoutVerticalBinding
/** /**
* NumberPickerViewAdapter binds both NumberPickerLayoutBinding and NumberPickerLayoutVerticalBinding shared attributes to one common view adapter. * NumberPickerViewAdapter binds both NumberPickerLayoutBinding and NumberPickerLayoutVerticalBinding shared attributes to one common view adapter.
* Requires at least one of the ViewBinding as a parameter. Recommended to use the factory object to create the binding. * Requires at least one of the ViewBinding as a parameter. Recommended to use the factory object to create the binding.
*/ */
class NumberPickerViewAdapter( class NumberPickerViewAdapter(nH: NumberPickerLayoutBinding?, nV: NumberPickerLayoutVerticalBinding?) {
val nH: NumberPickerLayoutBinding?,
nV: NumberPickerLayoutVerticalBinding?,
) {
init { init {
if (nH == null && nV == null) { require(nH != null || nV != null) { "Require at least on Binding parameter" }
throw IllegalArgumentException("Require at least on Binding parameter")
}
} }
val editText = nH?.display ?: nV?.display ?: throw IllegalArgumentException("Missing require View Binding parameter display") val editText = nH?.display ?: nV?.display ?: throw IllegalArgumentException("Missing require View Binding parameter display")
@ -25,12 +20,7 @@ class NumberPickerViewAdapter(
companion object { companion object {
fun getBinding(bindLayout: NumberPickerLayoutBinding): NumberPickerViewAdapter { fun getBinding(bindLayout: NumberPickerLayoutBinding): NumberPickerViewAdapter = NumberPickerViewAdapter(bindLayout, null)
return NumberPickerViewAdapter(bindLayout, null) fun getBinding(bindLayout: NumberPickerLayoutVerticalBinding): NumberPickerViewAdapter = NumberPickerViewAdapter(null, bindLayout)
}
fun getBinding(bindLayout: NumberPickerLayoutVerticalBinding): NumberPickerViewAdapter {
return NumberPickerViewAdapter(null, bindLayout)
}
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.graphics.Canvas import android.graphics.Canvas

View file

@ -1,8 +1,8 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.annotation.StringRes import androidx.annotation.StringRes
import info.nightscout.core.ui.R import app.aaps.core.ui.R
import java.util.Calendar import java.util.Calendar
import java.util.Date import java.util.Date
@ -41,21 +41,21 @@ open class WeekDay {
fun fromCalendarInt(day: Int): DayOfWeek { fun fromCalendarInt(day: Int): DayOfWeek {
for (i in calendarInts.indices) { for (i in calendarInts.indices) {
if (calendarInts[i] == day) return values()[i] if (calendarInts[i] == day) return entries[i]
} }
throw IllegalStateException("Invalid day") throw IllegalStateException("Invalid day")
} }
} }
} }
val weekdays = BooleanArray(DayOfWeek.values().size) val weekdays = BooleanArray(DayOfWeek.entries.size)
var view: WeekdayPicker? = null var view: WeekdayPicker? = null
init { init {
for (day in DayOfWeek.values()) set(day, false) for (day in DayOfWeek.entries) set(day, false)
} }
fun setAll(value: Boolean) { fun setAll(value: Boolean) {
for (day in DayOfWeek.values()) set(day, value) for (day in DayOfWeek.entries) set(day, value)
} }
operator fun set(day: DayOfWeek, value: Boolean): WeekDay { operator fun set(day: DayOfWeek, value: Boolean): WeekDay {
@ -73,7 +73,7 @@ open class WeekDay {
fun getSelectedDays(): List<Int> { fun getSelectedDays(): List<Int> {
val selectedDays: MutableList<Int> = ArrayList() val selectedDays: MutableList<Int> = ArrayList()
for (i in weekdays.indices) { for (i in weekdays.indices) {
val day = DayOfWeek.values()[i] val day = DayOfWeek.entries[i]
val selected = weekdays[i] val selected = weekdays[i]
if (selected) selectedDays.add(day.toCalendarInt()) if (selected) selectedDays.add(day.toCalendarInt())
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.elements package app.aaps.core.ui.elements
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
@ -7,12 +7,10 @@ import android.view.View
import android.widget.Checkable import android.widget.Checkable
import androidx.appcompat.widget.AppCompatCheckedTextView import androidx.appcompat.widget.AppCompatCheckedTextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import info.nightscout.core.ui.databinding.WeekdayPickerBinding import app.aaps.core.ui.databinding.WeekdayPickerBinding
import java.util.Calendar import java.util.Calendar
class WeekdayPicker constructor( class WeekdayPicker(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr) {
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private var changeListener: ((Int, Boolean) -> Unit)? = null private var changeListener: ((Int, Boolean) -> Unit)? = null

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.extensions package app.aaps.core.ui.extensions
import android.widget.RadioGroup import android.widget.RadioGroup
import androidx.appcompat.widget.AppCompatRadioButton import androidx.appcompat.widget.AppCompatRadioButton

View file

@ -1,11 +1,11 @@
package info.nightscout.core.ui.locale package app.aaps.core.ui.locale
import android.content.Context import android.content.Context
import android.content.ContextWrapper import android.content.ContextWrapper
import android.content.res.Configuration import android.content.res.Configuration
import android.os.LocaleList import android.os.LocaleList
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import info.nightscout.core.ui.R import app.aaps.core.ui.R
import java.util.Locale import java.util.Locale
object LocaleHelper { object LocaleHelper {

View file

@ -1,4 +1,4 @@
package info.nightscout.core.ui.toast package app.aaps.core.ui.toast
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -14,8 +14,8 @@ import android.widget.Toast
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.appcompat.view.ContextThemeWrapper import androidx.appcompat.view.ContextThemeWrapper
import info.nightscout.core.ui.R import app.aaps.core.ui.getThemeColor
import info.nightscout.core.ui.getThemeColor import app.aaps.core.ui.R
object ToastUtils { object ToastUtils {

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="130dp" android:layout_width="130dp"
android:layout_height="40dp" android:layout_height="40dp"
tools:context="info.nightscout.core.ui.elements.NumberPicker"> tools:context="app.aaps.core.ui.elements.NumberPicker">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout" android:id="@+id/textInputLayout"

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="100dp" android:layout_height="100dp"
tools:context="info.nightscout.core.ui.elements.NumberPickerVertical"> tools:context="app.aaps.core.ui.elements.NumberPickerVertical">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout" android:id="@+id/textInputLayout"

View file

@ -94,12 +94,12 @@ class HardLimitsImpl @Inject constructor(
if (newValue < lowLimit || newValue > highLimit) { if (newValue < lowLimit || newValue > highLimit) {
newValue = max(newValue, lowLimit) newValue = max(newValue, lowLimit)
newValue = min(newValue, highLimit) newValue = min(newValue, highLimit)
var msg = rh.gs(info.nightscout.core.ui.R.string.valueoutofrange, rh.gs(valueName)) var msg = rh.gs(app.aaps.core.ui.R.string.valueoutofrange, rh.gs(valueName))
msg += ".\n" msg += ".\n"
msg += rh.gs(info.nightscout.core.ui.R.string.valuelimitedto, value, newValue) msg += rh.gs(app.aaps.core.ui.R.string.valuelimitedto, value, newValue)
aapsLogger.error(msg) aapsLogger.error(msg)
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe() disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe()
uiInteraction.showToastAndNotification(context, msg, info.nightscout.core.ui.R.raw.error) uiInteraction.showToastAndNotification(context, msg, app.aaps.core.ui.R.raw.error)
} }
return newValue return newValue
} }

View file

@ -65,16 +65,16 @@ class LocalAlertUtilsImpl @Inject constructor(
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_pump_unreachable_alert, true)) { if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_pump_unreachable_alert, true)) {
aapsLogger.debug(LTag.CORE, "Generating pump unreachable alarm. lastConnection: " + dateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated) aapsLogger.debug(LTag.CORE, "Generating pump unreachable alarm. lastConnection: " + dateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated)
sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold()) sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold())
rxBus.send(EventNewNotification(Notification(Notification.PUMP_UNREACHABLE, rh.gs(info.nightscout.core.ui.R.string.pump_unreachable), Notification.URGENT).also { rxBus.send(EventNewNotification(Notification(Notification.PUMP_UNREACHABLE, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), Notification.URGENT).also {
it.soundId = it.soundId =
info.nightscout.core.ui.R.raw.alarm app.aaps.core.ui.R.raw.alarm
})) }))
uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(info.nightscout.core.ui.R.string.pump_unreachable), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT))
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true))
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(rh.gs(info.nightscout.core.ui.R.string.pump_unreachable))).subscribe() disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(rh.gs(app.aaps.core.ui.R.string.pump_unreachable))).subscribe()
} }
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true)) if (sp.getBoolean(info.nightscout.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true))
smsCommunicator.sendNotificationToAllNumbers(rh.gs(info.nightscout.core.ui.R.string.pump_unreachable)) smsCommunicator.sendNotificationToAllNumbers(rh.gs(app.aaps.core.ui.R.string.pump_unreachable))
} }
if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE)) if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE))
} }
@ -127,11 +127,11 @@ class LocalAlertUtilsImpl @Inject constructor(
&& bgReading.timestamp + missedReadingsThreshold() < System.currentTimeMillis() && bgReading.timestamp + missedReadingsThreshold() < System.currentTimeMillis()
&& sp.getLong("nextMissedReadingsAlarm", 0L) < System.currentTimeMillis() && sp.getLong("nextMissedReadingsAlarm", 0L) < System.currentTimeMillis()
) { ) {
val n = Notification(Notification.BG_READINGS_MISSED, rh.gs(info.nightscout.core.ui.R.string.missed_bg_readings), Notification.URGENT) val n = Notification(Notification.BG_READINGS_MISSED, rh.gs(app.aaps.core.ui.R.string.missed_bg_readings), Notification.URGENT)
n.soundId = info.nightscout.core.ui.R.raw.alarm n.soundId = app.aaps.core.ui.R.raw.alarm
sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold()) sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold())
rxBus.send(EventNewNotification(n)) rxBus.send(EventNewNotification(n))
uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(info.nightscout.core.ui.R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT))
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) { if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) {
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(n.text)).subscribe() disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(n.text)).subscribe()
} }

View file

@ -17,140 +17,140 @@ class TranslatorImpl @Inject internal constructor(
) : Translator { ) : Translator {
override fun translate(action: Action): String = when (action) { override fun translate(action: Action): String = when (action) {
Action.BOLUS -> rh.gs(info.nightscout.core.ui.R.string.uel_bolus) Action.BOLUS -> rh.gs(app.aaps.core.ui.R.string.uel_bolus)
Action.BOLUS_CALCULATOR_RESULT -> rh.gs(info.nightscout.core.ui.R.string.uel_bolus_calculator) Action.BOLUS_CALCULATOR_RESULT -> rh.gs(app.aaps.core.ui.R.string.uel_bolus_calculator)
Action.BOLUS_CALCULATOR_RESULT_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_bolus_calculator) Action.BOLUS_CALCULATOR_RESULT_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_bolus_calculator)
Action.SMB -> rh.gs(info.nightscout.core.ui.R.string.smb_shortname) Action.SMB -> rh.gs(app.aaps.core.ui.R.string.smb_shortname)
Action.BOLUS_ADVISOR -> rh.gs(info.nightscout.core.ui.R.string.uel_bolus_advisor) Action.BOLUS_ADVISOR -> rh.gs(app.aaps.core.ui.R.string.uel_bolus_advisor)
Action.EXTENDED_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.uel_extended_bolus) Action.EXTENDED_BOLUS -> rh.gs(app.aaps.core.ui.R.string.uel_extended_bolus)
Action.SUPERBOLUS_TBR -> rh.gs(info.nightscout.core.ui.R.string.uel_superbolus_tbr) Action.SUPERBOLUS_TBR -> rh.gs(app.aaps.core.ui.R.string.uel_superbolus_tbr)
Action.CARBS -> rh.gs(info.nightscout.core.ui.R.string.uel_carbs) Action.CARBS -> rh.gs(app.aaps.core.ui.R.string.uel_carbs)
Action.EXTENDED_CARBS -> rh.gs(info.nightscout.core.ui.R.string.uel_extended_carbs) Action.EXTENDED_CARBS -> rh.gs(app.aaps.core.ui.R.string.uel_extended_carbs)
Action.TEMP_BASAL -> rh.gs(info.nightscout.core.ui.R.string.uel_temp_basal) Action.TEMP_BASAL -> rh.gs(app.aaps.core.ui.R.string.uel_temp_basal)
Action.TT -> rh.gs(info.nightscout.core.ui.R.string.uel_tt) Action.TT -> rh.gs(app.aaps.core.ui.R.string.uel_tt)
Action.NEW_PROFILE -> rh.gs(info.nightscout.core.ui.R.string.uel_new_profile) Action.NEW_PROFILE -> rh.gs(app.aaps.core.ui.R.string.uel_new_profile)
Action.CLONE_PROFILE -> rh.gs(info.nightscout.core.ui.R.string.uel_clone_profile) Action.CLONE_PROFILE -> rh.gs(app.aaps.core.ui.R.string.uel_clone_profile)
Action.STORE_PROFILE -> rh.gs(info.nightscout.core.ui.R.string.uel_store_profile) Action.STORE_PROFILE -> rh.gs(app.aaps.core.ui.R.string.uel_store_profile)
Action.PROFILE_SWITCH -> rh.gs(info.nightscout.core.ui.R.string.uel_profile_switch) Action.PROFILE_SWITCH -> rh.gs(app.aaps.core.ui.R.string.uel_profile_switch)
Action.PROFILE_SWITCH_CLONED -> rh.gs(info.nightscout.core.ui.R.string.uel_profile_switch_cloned) Action.PROFILE_SWITCH_CLONED -> rh.gs(app.aaps.core.ui.R.string.uel_profile_switch_cloned)
Action.CLOSED_LOOP_MODE -> rh.gs(info.nightscout.core.ui.R.string.uel_closed_loop_mode) Action.CLOSED_LOOP_MODE -> rh.gs(app.aaps.core.ui.R.string.uel_closed_loop_mode)
Action.LGS_LOOP_MODE -> rh.gs(info.nightscout.core.ui.R.string.uel_lgs_loop_mode) Action.LGS_LOOP_MODE -> rh.gs(app.aaps.core.ui.R.string.uel_lgs_loop_mode)
Action.OPEN_LOOP_MODE -> rh.gs(info.nightscout.core.ui.R.string.uel_open_loop_mode) Action.OPEN_LOOP_MODE -> rh.gs(app.aaps.core.ui.R.string.uel_open_loop_mode)
Action.LOOP_DISABLED -> rh.gs(info.nightscout.core.ui.R.string.uel_loop_disabled) Action.LOOP_DISABLED -> rh.gs(app.aaps.core.ui.R.string.uel_loop_disabled)
Action.LOOP_ENABLED -> rh.gs(info.nightscout.core.ui.R.string.uel_loop_enabled) Action.LOOP_ENABLED -> rh.gs(app.aaps.core.ui.R.string.uel_loop_enabled)
Action.RECONNECT -> rh.gs(info.nightscout.core.ui.R.string.uel_reconnect) Action.RECONNECT -> rh.gs(app.aaps.core.ui.R.string.uel_reconnect)
Action.DISCONNECT -> rh.gs(info.nightscout.core.ui.R.string.uel_disconnect) Action.DISCONNECT -> rh.gs(app.aaps.core.ui.R.string.uel_disconnect)
Action.RESUME -> rh.gs(info.nightscout.core.ui.R.string.uel_resume) Action.RESUME -> rh.gs(app.aaps.core.ui.R.string.uel_resume)
Action.SUSPEND -> rh.gs(info.nightscout.core.ui.R.string.uel_suspend) Action.SUSPEND -> rh.gs(app.aaps.core.ui.R.string.uel_suspend)
Action.HW_PUMP_ALLOWED -> rh.gs(info.nightscout.core.ui.R.string.uel_hw_pump_allowed) Action.HW_PUMP_ALLOWED -> rh.gs(app.aaps.core.ui.R.string.uel_hw_pump_allowed)
Action.CLEAR_PAIRING_KEYS -> rh.gs(info.nightscout.core.ui.R.string.uel_clear_pairing_keys) Action.CLEAR_PAIRING_KEYS -> rh.gs(app.aaps.core.ui.R.string.uel_clear_pairing_keys)
Action.ACCEPTS_TEMP_BASAL -> rh.gs(info.nightscout.core.ui.R.string.uel_accepts_temp_basal) Action.ACCEPTS_TEMP_BASAL -> rh.gs(app.aaps.core.ui.R.string.uel_accepts_temp_basal)
Action.CANCEL_TEMP_BASAL -> rh.gs(info.nightscout.core.ui.R.string.uel_cancel_temp_basal) Action.CANCEL_TEMP_BASAL -> rh.gs(app.aaps.core.ui.R.string.uel_cancel_temp_basal)
Action.CANCEL_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.uel_cancel_bolus) Action.CANCEL_BOLUS -> rh.gs(app.aaps.core.ui.R.string.uel_cancel_bolus)
Action.CANCEL_EXTENDED_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.uel_cancel_extended_bolus) Action.CANCEL_EXTENDED_BOLUS -> rh.gs(app.aaps.core.ui.R.string.uel_cancel_extended_bolus)
Action.CANCEL_TT -> rh.gs(info.nightscout.core.ui.R.string.uel_cancel_tt) Action.CANCEL_TT -> rh.gs(app.aaps.core.ui.R.string.uel_cancel_tt)
Action.CAREPORTAL -> rh.gs(info.nightscout.core.ui.R.string.uel_careportal) Action.CAREPORTAL -> rh.gs(app.aaps.core.ui.R.string.uel_careportal)
Action.SITE_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.uel_site_change) Action.SITE_CHANGE -> rh.gs(app.aaps.core.ui.R.string.uel_site_change)
Action.RESERVOIR_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.uel_reservoir_change) Action.RESERVOIR_CHANGE -> rh.gs(app.aaps.core.ui.R.string.uel_reservoir_change)
Action.CALIBRATION -> rh.gs(info.nightscout.core.ui.R.string.uel_calibration) Action.CALIBRATION -> rh.gs(app.aaps.core.ui.R.string.uel_calibration)
Action.PRIME_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.uel_prime_bolus) Action.PRIME_BOLUS -> rh.gs(app.aaps.core.ui.R.string.uel_prime_bolus)
Action.TREATMENT -> rh.gs(info.nightscout.core.ui.R.string.uel_treatment) Action.TREATMENT -> rh.gs(app.aaps.core.ui.R.string.uel_treatment)
Action.CAREPORTAL_NS_REFRESH -> rh.gs(info.nightscout.core.ui.R.string.uel_careportal_ns_refresh) Action.CAREPORTAL_NS_REFRESH -> rh.gs(app.aaps.core.ui.R.string.uel_careportal_ns_refresh)
Action.PROFILE_SWITCH_NS_REFRESH -> rh.gs(info.nightscout.core.ui.R.string.uel_profile_switch_ns_refresh) Action.PROFILE_SWITCH_NS_REFRESH -> rh.gs(app.aaps.core.ui.R.string.uel_profile_switch_ns_refresh)
Action.TREATMENTS_NS_REFRESH -> rh.gs(info.nightscout.core.ui.R.string.uel_treatments_ns_refresh) Action.TREATMENTS_NS_REFRESH -> rh.gs(app.aaps.core.ui.R.string.uel_treatments_ns_refresh)
Action.TT_NS_REFRESH -> rh.gs(info.nightscout.core.ui.R.string.uel_tt_ns_refresh) Action.TT_NS_REFRESH -> rh.gs(app.aaps.core.ui.R.string.uel_tt_ns_refresh)
Action.AUTOMATION_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_automation_removed) Action.AUTOMATION_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_automation_removed)
Action.BG_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_bg_removed) Action.BG_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_bg_removed)
Action.CAREPORTAL_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_careportal_removed) Action.CAREPORTAL_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_careportal_removed)
Action.BOLUS_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_bolus_removed) Action.BOLUS_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_bolus_removed)
Action.CARBS_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_carbs_removed) Action.CARBS_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_carbs_removed)
Action.TEMP_BASAL_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_temp_basal_removed) Action.TEMP_BASAL_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_temp_basal_removed)
Action.EXTENDED_BOLUS_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_extended_bolus_removed) Action.EXTENDED_BOLUS_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_extended_bolus_removed)
Action.FOOD -> rh.gs(info.nightscout.core.ui.R.string.uel_food) Action.FOOD -> rh.gs(app.aaps.core.ui.R.string.uel_food)
Action.FOOD_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_food_removed) Action.FOOD_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_food_removed)
Action.PROFILE_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_profile_removed) Action.PROFILE_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_profile_removed)
Action.PROFILE_SWITCH_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_profile_switch_removed) Action.PROFILE_SWITCH_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_profile_switch_removed)
Action.RESTART_EVENTS_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_restart_events_removed) Action.RESTART_EVENTS_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_restart_events_removed)
Action.TREATMENT_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_treatment_removed) Action.TREATMENT_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_treatment_removed)
Action.TT_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_tt_removed) Action.TT_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_tt_removed)
Action.NS_PAUSED -> rh.gs(info.nightscout.core.ui.R.string.uel_ns_paused) Action.NS_PAUSED -> rh.gs(app.aaps.core.ui.R.string.uel_ns_paused)
Action.NS_RESUME -> rh.gs(info.nightscout.core.ui.R.string.uel_ns_resume) Action.NS_RESUME -> rh.gs(app.aaps.core.ui.R.string.uel_ns_resume)
Action.NS_QUEUE_CLEARED -> rh.gs(info.nightscout.core.ui.R.string.uel_ns_queue_cleared) Action.NS_QUEUE_CLEARED -> rh.gs(app.aaps.core.ui.R.string.uel_ns_queue_cleared)
Action.NS_SETTINGS_COPIED -> rh.gs(info.nightscout.core.ui.R.string.uel_ns_settings_copied) Action.NS_SETTINGS_COPIED -> rh.gs(app.aaps.core.ui.R.string.uel_ns_settings_copied)
Action.ERROR_DIALOG_OK -> rh.gs(info.nightscout.core.ui.R.string.uel_error_dialog_ok) Action.ERROR_DIALOG_OK -> rh.gs(app.aaps.core.ui.R.string.uel_error_dialog_ok)
Action.ERROR_DIALOG_MUTE -> rh.gs(info.nightscout.core.ui.R.string.uel_error_dialog_mute) Action.ERROR_DIALOG_MUTE -> rh.gs(app.aaps.core.ui.R.string.uel_error_dialog_mute)
Action.ERROR_DIALOG_MUTE_5MIN -> rh.gs(info.nightscout.core.ui.R.string.uel_error_dialog_mute_5min) Action.ERROR_DIALOG_MUTE_5MIN -> rh.gs(app.aaps.core.ui.R.string.uel_error_dialog_mute_5min)
Action.OBJECTIVE_STARTED -> rh.gs(info.nightscout.core.ui.R.string.uel_objective_started) Action.OBJECTIVE_STARTED -> rh.gs(app.aaps.core.ui.R.string.uel_objective_started)
Action.OBJECTIVE_UNSTARTED -> rh.gs(info.nightscout.core.ui.R.string.uel_objective_unstarted) Action.OBJECTIVE_UNSTARTED -> rh.gs(app.aaps.core.ui.R.string.uel_objective_unstarted)
Action.OBJECTIVES_SKIPPED -> rh.gs(info.nightscout.core.ui.R.string.uel_objectives_skipped) Action.OBJECTIVES_SKIPPED -> rh.gs(app.aaps.core.ui.R.string.uel_objectives_skipped)
Action.STAT_RESET -> rh.gs(info.nightscout.core.ui.R.string.uel_stat_reset) Action.STAT_RESET -> rh.gs(app.aaps.core.ui.R.string.uel_stat_reset)
Action.DELETE_LOGS -> rh.gs(info.nightscout.core.ui.R.string.uel_delete_logs) Action.DELETE_LOGS -> rh.gs(app.aaps.core.ui.R.string.uel_delete_logs)
Action.DELETE_FUTURE_TREATMENTS -> rh.gs(info.nightscout.core.ui.R.string.uel_delete_future_treatments) Action.DELETE_FUTURE_TREATMENTS -> rh.gs(app.aaps.core.ui.R.string.uel_delete_future_treatments)
Action.EXPORT_SETTINGS -> rh.gs(info.nightscout.core.ui.R.string.uel_export_settings) Action.EXPORT_SETTINGS -> rh.gs(app.aaps.core.ui.R.string.uel_export_settings)
Action.IMPORT_SETTINGS -> rh.gs(info.nightscout.core.ui.R.string.uel_import_settings) Action.IMPORT_SETTINGS -> rh.gs(app.aaps.core.ui.R.string.uel_import_settings)
Action.RESET_DATABASES -> rh.gs(info.nightscout.core.ui.R.string.uel_reset_databases) Action.RESET_DATABASES -> rh.gs(app.aaps.core.ui.R.string.uel_reset_databases)
Action.CLEANUP_DATABASES -> rh.gs(info.nightscout.core.ui.R.string.uel_cleanup_databases) Action.CLEANUP_DATABASES -> rh.gs(app.aaps.core.ui.R.string.uel_cleanup_databases)
Action.EXPORT_DATABASES -> rh.gs(info.nightscout.core.ui.R.string.uel_export_databases) Action.EXPORT_DATABASES -> rh.gs(app.aaps.core.ui.R.string.uel_export_databases)
Action.IMPORT_DATABASES -> rh.gs(info.nightscout.core.ui.R.string.uel_import_databases) Action.IMPORT_DATABASES -> rh.gs(app.aaps.core.ui.R.string.uel_import_databases)
Action.OTP_EXPORT -> rh.gs(info.nightscout.core.ui.R.string.uel_otp_export) Action.OTP_EXPORT -> rh.gs(app.aaps.core.ui.R.string.uel_otp_export)
Action.OTP_RESET -> rh.gs(info.nightscout.core.ui.R.string.uel_otp_reset) Action.OTP_RESET -> rh.gs(app.aaps.core.ui.R.string.uel_otp_reset)
Action.EXPORT_CSV -> rh.gs(info.nightscout.core.ui.R.string.uel_export_csv) Action.EXPORT_CSV -> rh.gs(app.aaps.core.ui.R.string.uel_export_csv)
Action.STOP_SMS -> rh.gs(info.nightscout.core.ui.R.string.uel_stop_sms) Action.STOP_SMS -> rh.gs(app.aaps.core.ui.R.string.uel_stop_sms)
Action.START_AAPS -> rh.gs(info.nightscout.core.ui.R.string.uel_start_aaps) Action.START_AAPS -> rh.gs(app.aaps.core.ui.R.string.uel_start_aaps)
Action.EXIT_AAPS -> rh.gs(info.nightscout.core.ui.R.string.uel_exit_aaps) Action.EXIT_AAPS -> rh.gs(app.aaps.core.ui.R.string.uel_exit_aaps)
Action.PLUGIN_ENABLED -> rh.gs(info.nightscout.core.ui.R.string.uel_plugin_enabled) Action.PLUGIN_ENABLED -> rh.gs(app.aaps.core.ui.R.string.uel_plugin_enabled)
Action.PLUGIN_DISABLED -> rh.gs(info.nightscout.core.ui.R.string.uel_plugin_disabled) Action.PLUGIN_DISABLED -> rh.gs(app.aaps.core.ui.R.string.uel_plugin_disabled)
Action.LOOP_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.uel_loop_change) Action.LOOP_CHANGE -> rh.gs(app.aaps.core.ui.R.string.uel_loop_change)
Action.LOOP_REMOVED -> rh.gs(info.nightscout.core.ui.R.string.uel_loop_removed) Action.LOOP_REMOVED -> rh.gs(app.aaps.core.ui.R.string.uel_loop_removed)
Action.UNKNOWN -> rh.gs(info.nightscout.core.ui.R.string.unknown) Action.UNKNOWN -> rh.gs(app.aaps.core.ui.R.string.unknown)
} }
override fun translate(units: ValueWithUnit?): String = when (units) { override fun translate(units: ValueWithUnit?): String = when (units) {
is ValueWithUnit.Gram -> rh.gs(info.nightscout.core.ui.R.string.shortgram) is ValueWithUnit.Gram -> rh.gs(app.aaps.core.ui.R.string.shortgram)
is ValueWithUnit.Hour -> rh.gs(app.aaps.core.interfaces.R.string.shorthour) is ValueWithUnit.Hour -> rh.gs(app.aaps.core.interfaces.R.string.shorthour)
is ValueWithUnit.Insulin -> rh.gs(info.nightscout.core.ui.R.string.insulin_unit_shortname) is ValueWithUnit.Insulin -> rh.gs(app.aaps.core.ui.R.string.insulin_unit_shortname)
is ValueWithUnit.Mgdl -> rh.gs(info.nightscout.core.ui.R.string.mgdl) is ValueWithUnit.Mgdl -> rh.gs(app.aaps.core.ui.R.string.mgdl)
is ValueWithUnit.Minute -> rh.gs(app.aaps.core.interfaces.R.string.shortminute) is ValueWithUnit.Minute -> rh.gs(app.aaps.core.interfaces.R.string.shortminute)
is ValueWithUnit.Mmoll -> rh.gs(info.nightscout.core.ui.R.string.mmol) is ValueWithUnit.Mmoll -> rh.gs(app.aaps.core.ui.R.string.mmol)
is ValueWithUnit.Percent -> rh.gs(info.nightscout.core.ui.R.string.shortpercent) is ValueWithUnit.Percent -> rh.gs(app.aaps.core.ui.R.string.shortpercent)
is ValueWithUnit.UnitPerHour -> rh.gs(info.nightscout.core.ui.R.string.profile_ins_units_per_hour) is ValueWithUnit.UnitPerHour -> rh.gs(app.aaps.core.ui.R.string.profile_ins_units_per_hour)
else -> "" else -> ""
} }
override fun translate(meterType: TherapyEvent.MeterType?): String = when (meterType) { override fun translate(meterType: TherapyEvent.MeterType?): String = when (meterType) {
TherapyEvent.MeterType.FINGER -> rh.gs(info.nightscout.core.ui.R.string.glucosetype_finger) TherapyEvent.MeterType.FINGER -> rh.gs(app.aaps.core.ui.R.string.glucosetype_finger)
TherapyEvent.MeterType.SENSOR -> rh.gs(info.nightscout.core.ui.R.string.glucosetype_sensor) TherapyEvent.MeterType.SENSOR -> rh.gs(app.aaps.core.ui.R.string.glucosetype_sensor)
TherapyEvent.MeterType.MANUAL -> rh.gs(info.nightscout.core.ui.R.string.manual) TherapyEvent.MeterType.MANUAL -> rh.gs(app.aaps.core.ui.R.string.manual)
else -> rh.gs(info.nightscout.core.ui.R.string.unknown) else -> rh.gs(app.aaps.core.ui.R.string.unknown)
} }
override fun translate(type: TherapyEvent.Type?): String = when (type) { override fun translate(type: TherapyEvent.Type?): String = when (type) {
TherapyEvent.Type.FINGER_STICK_BG_VALUE -> rh.gs(info.nightscout.core.ui.R.string.careportal_bgcheck) TherapyEvent.Type.FINGER_STICK_BG_VALUE -> rh.gs(app.aaps.core.ui.R.string.careportal_bgcheck)
TherapyEvent.Type.SNACK_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.careportal_snackbolus) TherapyEvent.Type.SNACK_BOLUS -> rh.gs(app.aaps.core.ui.R.string.careportal_snackbolus)
TherapyEvent.Type.MEAL_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.careportal_mealbolus) TherapyEvent.Type.MEAL_BOLUS -> rh.gs(app.aaps.core.ui.R.string.careportal_mealbolus)
TherapyEvent.Type.CORRECTION_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.careportal_correctionbolus) TherapyEvent.Type.CORRECTION_BOLUS -> rh.gs(app.aaps.core.ui.R.string.careportal_correctionbolus)
TherapyEvent.Type.CARBS_CORRECTION -> rh.gs(info.nightscout.core.ui.R.string.careportal_carbscorrection) TherapyEvent.Type.CARBS_CORRECTION -> rh.gs(app.aaps.core.ui.R.string.careportal_carbscorrection)
TherapyEvent.Type.BOLUS_WIZARD -> rh.gs(info.nightscout.core.ui.R.string.boluswizard) TherapyEvent.Type.BOLUS_WIZARD -> rh.gs(app.aaps.core.ui.R.string.boluswizard)
TherapyEvent.Type.COMBO_BOLUS -> rh.gs(info.nightscout.core.ui.R.string.careportal_combobolus) TherapyEvent.Type.COMBO_BOLUS -> rh.gs(app.aaps.core.ui.R.string.careportal_combobolus)
TherapyEvent.Type.ANNOUNCEMENT -> rh.gs(info.nightscout.core.ui.R.string.careportal_announcement) TherapyEvent.Type.ANNOUNCEMENT -> rh.gs(app.aaps.core.ui.R.string.careportal_announcement)
TherapyEvent.Type.NOTE -> rh.gs(info.nightscout.core.ui.R.string.careportal_note) TherapyEvent.Type.NOTE -> rh.gs(app.aaps.core.ui.R.string.careportal_note)
TherapyEvent.Type.QUESTION -> rh.gs(info.nightscout.core.ui.R.string.careportal_question) TherapyEvent.Type.QUESTION -> rh.gs(app.aaps.core.ui.R.string.careportal_question)
TherapyEvent.Type.EXERCISE -> rh.gs(info.nightscout.core.ui.R.string.careportal_exercise) TherapyEvent.Type.EXERCISE -> rh.gs(app.aaps.core.ui.R.string.careportal_exercise)
TherapyEvent.Type.CANNULA_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.careportal_pump_site_change) TherapyEvent.Type.CANNULA_CHANGE -> rh.gs(app.aaps.core.ui.R.string.careportal_pump_site_change)
TherapyEvent.Type.PUMP_BATTERY_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.pump_battery_change) TherapyEvent.Type.PUMP_BATTERY_CHANGE -> rh.gs(app.aaps.core.ui.R.string.pump_battery_change)
TherapyEvent.Type.SENSOR_STARTED -> rh.gs(info.nightscout.core.ui.R.string.careportal_cgmsensorstart) TherapyEvent.Type.SENSOR_STARTED -> rh.gs(app.aaps.core.ui.R.string.careportal_cgmsensorstart)
TherapyEvent.Type.SENSOR_STOPPED -> rh.gs(info.nightscout.core.ui.R.string.careportal_cgm_sensor_stop) TherapyEvent.Type.SENSOR_STOPPED -> rh.gs(app.aaps.core.ui.R.string.careportal_cgm_sensor_stop)
TherapyEvent.Type.SENSOR_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.cgm_sensor_insert) TherapyEvent.Type.SENSOR_CHANGE -> rh.gs(app.aaps.core.ui.R.string.cgm_sensor_insert)
TherapyEvent.Type.INSULIN_CHANGE -> rh.gs(info.nightscout.core.ui.R.string.careportal_insulin_cartridge_change) TherapyEvent.Type.INSULIN_CHANGE -> rh.gs(app.aaps.core.ui.R.string.careportal_insulin_cartridge_change)
TherapyEvent.Type.DAD_ALERT -> rh.gs(info.nightscout.core.ui.R.string.careportal_dad_alert) TherapyEvent.Type.DAD_ALERT -> rh.gs(app.aaps.core.ui.R.string.careportal_dad_alert)
TherapyEvent.Type.TEMPORARY_BASAL_START -> rh.gs(info.nightscout.core.ui.R.string.careportal_tempbasalstart) TherapyEvent.Type.TEMPORARY_BASAL_START -> rh.gs(app.aaps.core.ui.R.string.careportal_tempbasalstart)
TherapyEvent.Type.TEMPORARY_BASAL_END -> rh.gs(info.nightscout.core.ui.R.string.careportal_tempbasalend) TherapyEvent.Type.TEMPORARY_BASAL_END -> rh.gs(app.aaps.core.ui.R.string.careportal_tempbasalend)
TherapyEvent.Type.PROFILE_SWITCH -> rh.gs(info.nightscout.core.ui.R.string.careportal_profileswitch) TherapyEvent.Type.PROFILE_SWITCH -> rh.gs(app.aaps.core.ui.R.string.careportal_profileswitch)
TherapyEvent.Type.TEMPORARY_TARGET -> rh.gs(info.nightscout.core.ui.R.string.temporary_target) TherapyEvent.Type.TEMPORARY_TARGET -> rh.gs(app.aaps.core.ui.R.string.temporary_target)
TherapyEvent.Type.TEMPORARY_TARGET_CANCEL -> rh.gs(info.nightscout.core.ui.R.string.careportal_temporarytargetcancel) TherapyEvent.Type.TEMPORARY_TARGET_CANCEL -> rh.gs(app.aaps.core.ui.R.string.careportal_temporarytargetcancel)
TherapyEvent.Type.APS_OFFLINE -> rh.gs(info.nightscout.core.ui.R.string.careportal_openapsoffline) TherapyEvent.Type.APS_OFFLINE -> rh.gs(app.aaps.core.ui.R.string.careportal_openapsoffline)
TherapyEvent.Type.NS_MBG -> rh.gs(info.nightscout.core.ui.R.string.careportal_mbg) TherapyEvent.Type.NS_MBG -> rh.gs(app.aaps.core.ui.R.string.careportal_mbg)
/* /*
TherapyEvent.Type.TEMPORARY_BASAL -> TODO() TherapyEvent.Type.TEMPORARY_BASAL -> TODO()
TherapyEvent.Type.TUBE_CHANGE -> TODO() TherapyEvent.Type.TUBE_CHANGE -> TODO()
@ -171,29 +171,29 @@ class TranslatorImpl @Inject internal constructor(
TherapyEvent.Type.FEELING_HIGH -> TODO() TherapyEvent.Type.FEELING_HIGH -> TODO()
TherapyEvent.Type.LEAKING_INFUSION_SET -> TODO() TherapyEvent.Type.LEAKING_INFUSION_SET -> TODO()
*/ */
TherapyEvent.Type.NONE -> rh.gs(info.nightscout.core.ui.R.string.unknown) TherapyEvent.Type.NONE -> rh.gs(app.aaps.core.ui.R.string.unknown)
else -> rh.gs(info.nightscout.core.ui.R.string.unknown) else -> rh.gs(app.aaps.core.ui.R.string.unknown)
} }
override fun translate(reason: TemporaryTarget.Reason?): String = when (reason) { override fun translate(reason: TemporaryTarget.Reason?): String = when (reason) {
TemporaryTarget.Reason.CUSTOM -> rh.gs(info.nightscout.core.ui.R.string.custom) TemporaryTarget.Reason.CUSTOM -> rh.gs(app.aaps.core.ui.R.string.custom)
TemporaryTarget.Reason.HYPOGLYCEMIA -> rh.gs(info.nightscout.core.ui.R.string.hypo) TemporaryTarget.Reason.HYPOGLYCEMIA -> rh.gs(app.aaps.core.ui.R.string.hypo)
TemporaryTarget.Reason.EATING_SOON -> rh.gs(info.nightscout.core.ui.R.string.eatingsoon) TemporaryTarget.Reason.EATING_SOON -> rh.gs(app.aaps.core.ui.R.string.eatingsoon)
TemporaryTarget.Reason.ACTIVITY -> rh.gs(info.nightscout.core.ui.R.string.activity) TemporaryTarget.Reason.ACTIVITY -> rh.gs(app.aaps.core.ui.R.string.activity)
TemporaryTarget.Reason.AUTOMATION -> rh.gs(info.nightscout.core.ui.R.string.automation) TemporaryTarget.Reason.AUTOMATION -> rh.gs(app.aaps.core.ui.R.string.automation)
TemporaryTarget.Reason.WEAR -> rh.gs(info.nightscout.core.ui.R.string.wear) TemporaryTarget.Reason.WEAR -> rh.gs(app.aaps.core.ui.R.string.wear)
else -> rh.gs(info.nightscout.core.ui.R.string.unknown) else -> rh.gs(app.aaps.core.ui.R.string.unknown)
} }
override fun translate(reason: OfflineEvent.Reason?): String = when (reason) { override fun translate(reason: OfflineEvent.Reason?): String = when (reason) {
OfflineEvent.Reason.SUSPEND -> rh.gs(info.nightscout.core.ui.R.string.uel_suspend) OfflineEvent.Reason.SUSPEND -> rh.gs(app.aaps.core.ui.R.string.uel_suspend)
OfflineEvent.Reason.DISABLE_LOOP -> rh.gs(info.nightscout.core.ui.R.string.disableloop) OfflineEvent.Reason.DISABLE_LOOP -> rh.gs(app.aaps.core.ui.R.string.disableloop)
OfflineEvent.Reason.DISCONNECT_PUMP -> rh.gs(info.nightscout.core.ui.R.string.uel_disconnect) OfflineEvent.Reason.DISCONNECT_PUMP -> rh.gs(app.aaps.core.ui.R.string.uel_disconnect)
OfflineEvent.Reason.OTHER -> rh.gs(info.nightscout.core.ui.R.string.uel_other) OfflineEvent.Reason.OTHER -> rh.gs(app.aaps.core.ui.R.string.uel_other)
else -> rh.gs(info.nightscout.core.ui.R.string.unknown) else -> rh.gs(app.aaps.core.ui.R.string.unknown)
} }
override fun translate(source: Sources): String = when (source) { override fun translate(source: Sources): String = when (source) {
@ -285,14 +285,14 @@ class TranslatorImpl @Inject internal constructor(
Sources.Stats -> TODO() Sources.Stats -> TODO()
Sources.Aaps -> TODO() Sources.Aaps -> TODO()
*/ */
Sources.Automation -> rh.gs(info.nightscout.core.ui.R.string.automation) Sources.Automation -> rh.gs(app.aaps.core.ui.R.string.automation)
Sources.Autotune -> rh.gs(info.nightscout.core.ui.R.string.autotune) Sources.Autotune -> rh.gs(app.aaps.core.ui.R.string.autotune)
Sources.Loop -> rh.gs(info.nightscout.core.ui.R.string.loop) Sources.Loop -> rh.gs(app.aaps.core.ui.R.string.loop)
Sources.NSClient -> rh.gs(info.nightscout.core.ui.R.string.ns) Sources.NSClient -> rh.gs(app.aaps.core.ui.R.string.ns)
Sources.Pump -> rh.gs(info.nightscout.core.ui.R.string.pump) Sources.Pump -> rh.gs(app.aaps.core.ui.R.string.pump)
Sources.SMS -> rh.gs(info.nightscout.core.ui.R.string.sms) Sources.SMS -> rh.gs(app.aaps.core.ui.R.string.sms)
Sources.Wear -> rh.gs(info.nightscout.core.ui.R.string.wear) Sources.Wear -> rh.gs(app.aaps.core.ui.R.string.wear)
Sources.Unknown -> rh.gs(info.nightscout.core.ui.R.string.unknown) Sources.Unknown -> rh.gs(app.aaps.core.ui.R.string.unknown)
else -> source.name else -> source.name
} }

View file

@ -32,15 +32,15 @@ class TrendCalculatorImpl @Inject constructor(
override fun getTrendDescription(glucoseValue: GlucoseValue?): String = override fun getTrendDescription(glucoseValue: GlucoseValue?): String =
when (getTrendArrow(glucoseValue)) { when (getTrendArrow(glucoseValue)) {
GlucoseValue.TrendArrow.DOUBLE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_double_down) GlucoseValue.TrendArrow.DOUBLE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_double_down)
GlucoseValue.TrendArrow.SINGLE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_single_down) GlucoseValue.TrendArrow.SINGLE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_single_down)
GlucoseValue.TrendArrow.FORTY_FIVE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_forty_five_down) GlucoseValue.TrendArrow.FORTY_FIVE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_forty_five_down)
GlucoseValue.TrendArrow.FLAT -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_flat) GlucoseValue.TrendArrow.FLAT -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_flat)
GlucoseValue.TrendArrow.FORTY_FIVE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_forty_five_up) GlucoseValue.TrendArrow.FORTY_FIVE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_forty_five_up)
GlucoseValue.TrendArrow.SINGLE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_single_up) GlucoseValue.TrendArrow.SINGLE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_single_up)
GlucoseValue.TrendArrow.DOUBLE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_double_up) GlucoseValue.TrendArrow.DOUBLE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_double_up)
GlucoseValue.TrendArrow.NONE -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_none) GlucoseValue.TrendArrow.NONE -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_none)
else -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_unknown) else -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_unknown)
} }
private fun calculateDirection(glucoseValue: InMemoryGlucoseValue): GlucoseValue.TrendArrow { private fun calculateDirection(glucoseValue: InMemoryGlucoseValue): GlucoseValue.TrendArrow {
@ -85,15 +85,15 @@ class TrendCalculatorImpl @Inject constructor(
override fun getTrendDescription(autosensDataStore: AutosensDataStore): String { override fun getTrendDescription(autosensDataStore: AutosensDataStore): String {
return when (getTrendArrow(autosensDataStore)) { return when (getTrendArrow(autosensDataStore)) {
GlucoseValue.TrendArrow.DOUBLE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_double_down) GlucoseValue.TrendArrow.DOUBLE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_double_down)
GlucoseValue.TrendArrow.SINGLE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_single_down) GlucoseValue.TrendArrow.SINGLE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_single_down)
GlucoseValue.TrendArrow.FORTY_FIVE_DOWN -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_forty_five_down) GlucoseValue.TrendArrow.FORTY_FIVE_DOWN -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_forty_five_down)
GlucoseValue.TrendArrow.FLAT -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_flat) GlucoseValue.TrendArrow.FLAT -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_flat)
GlucoseValue.TrendArrow.FORTY_FIVE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_forty_five_up) GlucoseValue.TrendArrow.FORTY_FIVE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_forty_five_up)
GlucoseValue.TrendArrow.SINGLE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_single_up) GlucoseValue.TrendArrow.SINGLE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_single_up)
GlucoseValue.TrendArrow.DOUBLE_UP -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_double_up) GlucoseValue.TrendArrow.DOUBLE_UP -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_double_up)
GlucoseValue.TrendArrow.NONE -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_none) GlucoseValue.TrendArrow.NONE -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_none)
else -> rh.gs(info.nightscout.core.ui.R.string.a11y_arrow_unknown) else -> rh.gs(app.aaps.core.ui.R.string.a11y_arrow_unknown)
} }
} }

View file

@ -48,7 +48,7 @@ class NotificationHolderImpl @Inject constructor(
.setCategory(NotificationCompat.CATEGORY_STATUS) .setCategory(NotificationCompat.CATEGORY_STATUS)
.setSmallIcon(iconsProvider.getNotificationIcon()) .setSmallIcon(iconsProvider.getNotificationIcon())
.setLargeIcon(rh.decodeResource(iconsProvider.getIcon())) .setLargeIcon(rh.decodeResource(iconsProvider.getIcon()))
.setContentTitle(rh.gs(info.nightscout.core.ui.R.string.loading)) .setContentTitle(rh.gs(app.aaps.core.ui.R.string.loading))
.setContentIntent(openAppIntent(context)) .setContentIntent(openAppIntent(context))
.build() .build()
.also { .also {

View file

@ -159,16 +159,16 @@ class OverviewDataImpl @Inject constructor(
@ColorInt @ColorInt
override fun lastBgColor(context: Context?, autosensDataStore: AutosensDataStore): Int = override fun lastBgColor(context: Context?, autosensDataStore: AutosensDataStore): Int =
when { when {
isLow(autosensDataStore) -> rh.gac(context, info.nightscout.core.ui.R.attr.bgLow) isLow(autosensDataStore) -> rh.gac(context, app.aaps.core.ui.R.attr.bgLow)
isHigh(autosensDataStore) -> rh.gac(context, info.nightscout.core.ui.R.attr.highColor) isHigh(autosensDataStore) -> rh.gac(context, app.aaps.core.ui.R.attr.highColor)
else -> rh.gac(context, info.nightscout.core.ui.R.attr.bgInRange) else -> rh.gac(context, app.aaps.core.ui.R.attr.bgInRange)
} }
override fun lastBgDescription(autosensDataStore: AutosensDataStore): String = override fun lastBgDescription(autosensDataStore: AutosensDataStore): String =
when { when {
isLow(autosensDataStore) -> rh.gs(info.nightscout.core.ui.R.string.a11y_low) isLow(autosensDataStore) -> rh.gs(app.aaps.core.ui.R.string.a11y_low)
isHigh(autosensDataStore) -> rh.gs(info.nightscout.core.ui.R.string.a11y_high) isHigh(autosensDataStore) -> rh.gs(app.aaps.core.ui.R.string.a11y_high)
else -> rh.gs(info.nightscout.core.ui.R.string.a11y_inrange) else -> rh.gs(app.aaps.core.ui.R.string.a11y_inrange)
} }
override fun isActualBg(autosensDataStore: AutosensDataStore): Boolean = override fun isActualBg(autosensDataStore: AutosensDataStore): Boolean =
@ -185,17 +185,17 @@ class OverviewDataImpl @Inject constructor(
var temporaryBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now()) var temporaryBasal = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())
if (temporaryBasal?.isInProgress == false) temporaryBasal = null if (temporaryBasal?.isInProgress == false) temporaryBasal = null
temporaryBasal?.let { "T:" + it.toStringShort(decimalFormatter) } temporaryBasal?.let { "T:" + it.toStringShort(decimalFormatter) }
?: rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, profile.getBasal()) ?: rh.gs(app.aaps.core.ui.R.string.pump_base_basal_rate, profile.getBasal())
} ?: rh.gs(info.nightscout.core.ui.R.string.value_unavailable_short) } ?: rh.gs(app.aaps.core.ui.R.string.value_unavailable_short)
override fun temporaryBasalDialogText(iobCobCalculator: IobCobCalculator): String = override fun temporaryBasalDialogText(iobCobCalculator: IobCobCalculator): String =
profileFunction.getProfile()?.let { profile -> profileFunction.getProfile()?.let { profile ->
iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { temporaryBasal -> iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { temporaryBasal ->
"${rh.gs(info.nightscout.core.ui.R.string.base_basal_rate_label)}: ${rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, profile.getBasal())}" + "${rh.gs(app.aaps.core.ui.R.string.base_basal_rate_label)}: ${rh.gs(app.aaps.core.ui.R.string.pump_base_basal_rate, profile.getBasal())}" +
"\n" + rh.gs(info.nightscout.core.ui.R.string.tempbasal_label) + ": " + temporaryBasal.toStringFull(profile, dateUtil, decimalFormatter) "\n" + rh.gs(app.aaps.core.ui.R.string.tempbasal_label) + ": " + temporaryBasal.toStringFull(profile, dateUtil, decimalFormatter)
} }
?: "${rh.gs(info.nightscout.core.ui.R.string.base_basal_rate_label)}: ${rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, profile.getBasal())}" ?: "${rh.gs(app.aaps.core.ui.R.string.base_basal_rate_label)}: ${rh.gs(app.aaps.core.ui.R.string.pump_base_basal_rate, profile.getBasal())}"
} ?: rh.gs(info.nightscout.core.ui.R.string.value_unavailable_short) } ?: rh.gs(app.aaps.core.ui.R.string.value_unavailable_short)
@DrawableRes override fun temporaryBasalIcon(iobCobCalculator: IobCobCalculator): Int = @DrawableRes override fun temporaryBasalIcon(iobCobCalculator: IobCobCalculator): Int =
profileFunction.getProfile()?.let { profile -> profileFunction.getProfile()?.let { profile ->
@ -211,11 +211,11 @@ class OverviewDataImpl @Inject constructor(
@AttrRes override fun temporaryBasalColor(context: Context?, iobCobCalculator: IobCobCalculator): Int = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { @AttrRes override fun temporaryBasalColor(context: Context?, iobCobCalculator: IobCobCalculator): Int = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let {
rh.gac( rh.gac(
context, info.nightscout.core.ui.R context, app.aaps.core.ui.R
.attr.basal .attr.basal
) )
} }
?: rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor) ?: rh.gac(context, app.aaps.core.ui.R.attr.defaultTextColor)
/* /*
* EXTENDED BOLUS * EXTENDED BOLUS
@ -224,7 +224,7 @@ class OverviewDataImpl @Inject constructor(
override fun extendedBolusText(iobCobCalculator: IobCobCalculator): String = override fun extendedBolusText(iobCobCalculator: IobCobCalculator): String =
iobCobCalculator.getExtendedBolus(dateUtil.now())?.let { extendedBolus -> iobCobCalculator.getExtendedBolus(dateUtil.now())?.let { extendedBolus ->
if (!extendedBolus.isInProgress(dateUtil)) "" if (!extendedBolus.isInProgress(dateUtil)) ""
else if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, extendedBolus.rate) else if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) rh.gs(app.aaps.core.ui.R.string.pump_base_basal_rate, extendedBolus.rate)
else "" else ""
} ?: "" } ?: ""
@ -245,12 +245,12 @@ class OverviewDataImpl @Inject constructor(
} }
override fun iobText(iobCobCalculator: IobCobCalculator): String = override fun iobText(iobCobCalculator: IobCobCalculator): String =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) rh.gs(app.aaps.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob)
override fun iobDialogText(iobCobCalculator: IobCobCalculator): String = override fun iobDialogText(iobCobCalculator: IobCobCalculator): String =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) + "\n" + rh.gs(app.aaps.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) + "\n" +
rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob) + "\n" + rh.gs(app.aaps.core.ui.R.string.bolus) + ": " + rh.gs(app.aaps.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob) + "\n" +
rh.gs(info.nightscout.core.ui.R.string.basal) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, basalIob(iobCobCalculator).basaliob) rh.gs(app.aaps.core.ui.R.string.basal) + ": " + rh.gs(app.aaps.core.ui.R.string.format_insulin_units, basalIob(iobCobCalculator).basaliob)
/* /*
* TEMP TARGET * TEMP TARGET

View file

@ -71,7 +71,7 @@ class ProfileFunctionImpl @Inject constructor(
getProfileName(System.currentTimeMillis(), customized = true, showRemainingTime = true) getProfileName(System.currentTimeMillis(), customized = true, showRemainingTime = true)
private fun getProfileName(time: Long, customized: Boolean, showRemainingTime: Boolean): String { private fun getProfileName(time: Long, customized: Boolean, showRemainingTime: Boolean): String {
var profileName = rh.gs(info.nightscout.core.ui.R.string.no_profile_set) var profileName = rh.gs(app.aaps.core.ui.R.string.no_profile_set)
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet() val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
if (profileSwitch is ValueWrapper.Existing) { if (profileSwitch is ValueWrapper.Existing) {
@ -181,7 +181,7 @@ class ProfileFunctionImpl @Inject constructor(
val profileStore = activePlugin.activeProfileSource.profile ?: return false val profileStore = activePlugin.activeProfileSource.profile ?: return false
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
val validity = ProfileSealed.PS(ps).isValid( val validity = ProfileSealed.PS(ps).isValid(
rh.gs(info.nightscout.core.ui.R.string.careportal_profileswitch), rh.gs(app.aaps.core.ui.R.string.careportal_profileswitch),
activePlugin.activePump, activePlugin.activePump,
config, config,
rh, rh,

View file

@ -19,8 +19,8 @@ import androidx.biometric.BiometricPrompt.PromptInfo
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import app.aaps.core.interfaces.extensions.runOnUiThread import app.aaps.core.interfaces.extensions.runOnUiThread
import app.aaps.core.interfaces.protection.PasswordCheck import app.aaps.core.interfaces.protection.PasswordCheck
import info.nightscout.core.ui.R import app.aaps.core.ui.R
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.toast.ToastUtils
import java.util.concurrent.Executors import java.util.concurrent.Executors
object BiometricCheck { object BiometricCheck {

View file

@ -17,7 +17,7 @@ import app.aaps.core.interfaces.protection.PasswordCheck
import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.core.interfaces.sharedPreferences.SP
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.Reusable import dagger.Reusable
import info.nightscout.core.ui.toast.ToastUtils import app.aaps.core.ui.toast.ToastUtils
import javax.inject.Inject import javax.inject.Inject
@Reusable @Reusable
@ -41,7 +41,7 @@ class PasswordCheckImpl @Inject constructor(
return return
} }
val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null) val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null)
val alertDialogBuilder = MaterialAlertDialogBuilder(context, info.nightscout.core.ui.R.style.DialogTheme) val alertDialogBuilder = MaterialAlertDialogBuilder(context, app.aaps.core.ui.R.style.DialogTheme)
alertDialogBuilder.setView(promptsView) alertDialogBuilder.setView(promptsView)
val userInput = promptsView.findViewById<View>(R.id.password_prompt_pass) as EditText val userInput = promptsView.findViewById<View>(R.id.password_prompt_pass) as EditText
@ -49,7 +49,7 @@ class PasswordCheckImpl @Inject constructor(
userInput2.visibility = View.GONE userInput2.visibility = View.GONE
if (pinInput) { if (pinInput) {
userInput.setHint(info.nightscout.core.ui.R.string.pin_hint) userInput.setHint(app.aaps.core.ui.R.string.pin_hint)
userInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD userInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
} }
val autoFillHintPasswordKind = context.getString(preference) val autoFillHintPasswordKind = context.getString(preference)
@ -64,7 +64,7 @@ class PasswordCheckImpl @Inject constructor(
ok?.invoke(enteredPassword) ok?.invoke(enteredPassword)
return true return true
} }
val msg = if (pinInput) info.nightscout.core.ui.R.string.wrongpin else info.nightscout.core.ui.R.string.wrongpassword val msg = if (pinInput) app.aaps.core.ui.R.string.wrongpin else app.aaps.core.ui.R.string.wrongpassword
ToastUtils.errorToast(context, context.getString(msg)) ToastUtils.errorToast(context, context.getString(msg))
fail?.invoke() fail?.invoke()
return false return false
@ -72,9 +72,9 @@ class PasswordCheckImpl @Inject constructor(
alertDialogBuilder alertDialogBuilder
.setCancelable(false) .setCancelable(false)
.setCustomTitle(info.nightscout.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key)) .setCustomTitle(app.aaps.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key))
.setPositiveButton(context.getString(info.nightscout.core.ui.R.string.ok)) { _, _ -> validatePassword() } .setPositiveButton(context.getString(app.aaps.core.ui.R.string.ok)) { _, _ -> validatePassword() }
.setNegativeButton(context.getString(info.nightscout.core.ui.R.string.cancel)) { dialog, _ -> .setNegativeButton(context.getString(app.aaps.core.ui.R.string.cancel)) { dialog, _ ->
cancel?.invoke() cancel?.invoke()
dialog.cancel() dialog.cancel()
} }
@ -98,7 +98,7 @@ class PasswordCheckImpl @Inject constructor(
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
override fun setPassword(context: Context, @StringRes labelId: Int, @StringRes preference: Int, ok: ((String) -> Unit)?, cancel: (() -> Unit)?, clear: (() -> Unit)?, pinInput: Boolean) { override fun setPassword(context: Context, @StringRes labelId: Int, @StringRes preference: Int, ok: ((String) -> Unit)?, cancel: (() -> Unit)?, clear: (() -> Unit)?, pinInput: Boolean) {
val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null) val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null)
val alertDialogBuilder = MaterialAlertDialogBuilder(context, info.nightscout.core.ui.R.style.DialogTheme) val alertDialogBuilder = MaterialAlertDialogBuilder(context, app.aaps.core.ui.R.style.DialogTheme)
alertDialogBuilder.setView(promptsView) alertDialogBuilder.setView(promptsView)
val userInput = promptsView.findViewById<View>(R.id.password_prompt_pass) as EditText val userInput = promptsView.findViewById<View>(R.id.password_prompt_pass) as EditText
@ -106,8 +106,8 @@ class PasswordCheckImpl @Inject constructor(
if (pinInput) { if (pinInput) {
userInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD userInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
userInput2.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD userInput2.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
userInput.setHint(info.nightscout.core.ui.R.string.pin_hint) userInput.setHint(app.aaps.core.ui.R.string.pin_hint)
userInput2.setHint(info.nightscout.core.ui.R.string.pin_hint) userInput2.setHint(app.aaps.core.ui.R.string.pin_hint)
} }
val autoFillHintPasswordKind = context.getString(preference) val autoFillHintPasswordKind = context.getString(preference)
userInput.setAutofillHints(AUTOFILL_HINT_NEW_PASSWORD, "aaps_${autoFillHintPasswordKind}") userInput.setAutofillHints(AUTOFILL_HINT_NEW_PASSWORD, "aaps_${autoFillHintPasswordKind}")
@ -115,26 +115,26 @@ class PasswordCheckImpl @Inject constructor(
alertDialogBuilder alertDialogBuilder
.setCancelable(false) .setCancelable(false)
.setCustomTitle(info.nightscout.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key)) .setCustomTitle(app.aaps.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key))
.setPositiveButton(context.getString(info.nightscout.core.ui.R.string.ok)) { _, _ -> .setPositiveButton(context.getString(app.aaps.core.ui.R.string.ok)) { _, _ ->
val enteredPassword = userInput.text.toString() val enteredPassword = userInput.text.toString()
val enteredPassword2 = userInput2.text.toString() val enteredPassword2 = userInput2.text.toString()
if (enteredPassword != enteredPassword2) { if (enteredPassword != enteredPassword2) {
val msg = if (pinInput) info.nightscout.core.ui.R.string.pin_dont_match else info.nightscout.core.ui.R.string.passwords_dont_match val msg = if (pinInput) app.aaps.core.ui.R.string.pin_dont_match else app.aaps.core.ui.R.string.passwords_dont_match
ToastUtils.errorToast(context, context.getString(msg)) ToastUtils.errorToast(context, context.getString(msg))
} else if (enteredPassword.isNotEmpty()) { } else if (enteredPassword.isNotEmpty()) {
sp.putString(preference, cryptoUtil.hashPassword(enteredPassword)) sp.putString(preference, cryptoUtil.hashPassword(enteredPassword))
val msg = if (pinInput) info.nightscout.core.ui.R.string.pin_set else info.nightscout.core.ui.R.string.password_set val msg = if (pinInput) app.aaps.core.ui.R.string.pin_set else app.aaps.core.ui.R.string.password_set
ToastUtils.okToast(context, context.getString(msg)) ToastUtils.okToast(context, context.getString(msg))
ok?.invoke(enteredPassword) ok?.invoke(enteredPassword)
} else { } else {
if (sp.contains(preference)) { if (sp.contains(preference)) {
sp.remove(preference) sp.remove(preference)
val msg = if (pinInput) info.nightscout.core.ui.R.string.pin_cleared else info.nightscout.core.ui.R.string.password_cleared val msg = if (pinInput) app.aaps.core.ui.R.string.pin_cleared else app.aaps.core.ui.R.string.password_cleared
ToastUtils.graphicalToast(context, context.getString(msg), info.nightscout.core.ui.R.drawable.ic_toast_delete_confirm) ToastUtils.graphicalToast(context, context.getString(msg), app.aaps.core.ui.R.drawable.ic_toast_delete_confirm)
clear?.invoke() clear?.invoke()
} else { } else {
val msg = if (pinInput) info.nightscout.core.ui.R.string.pin_not_changed else info.nightscout.core.ui.R.string.password_not_changed val msg = if (pinInput) app.aaps.core.ui.R.string.pin_not_changed else app.aaps.core.ui.R.string.password_not_changed
ToastUtils.warnToast(context, context.getString(msg)) ToastUtils.warnToast(context, context.getString(msg))
cancel?.invoke() cancel?.invoke()
} }
@ -142,9 +142,9 @@ class PasswordCheckImpl @Inject constructor(
} }
.setNegativeButton( .setNegativeButton(
context.getString(info.nightscout.core.ui.R.string.cancel) context.getString(app.aaps.core.ui.R.string.cancel)
) { dialog, _ -> ) { dialog, _ ->
val msg = if (pinInput) info.nightscout.core.ui.R.string.pin_not_changed else info.nightscout.core.ui.R.string.password_not_changed val msg = if (pinInput) app.aaps.core.ui.R.string.pin_not_changed else app.aaps.core.ui.R.string.password_not_changed
ToastUtils.infoToast(context, msg) ToastUtils.infoToast(context, msg)
cancel?.invoke() cancel?.invoke()
dialog.cancel() dialog.cancel()
@ -165,7 +165,7 @@ class PasswordCheckImpl @Inject constructor(
) { ) {
val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null) val promptsView = LayoutInflater.from(context).inflate(R.layout.passwordprompt, null)
val alertDialogBuilder = MaterialAlertDialogBuilder(context, info.nightscout.core.ui.R.style.DialogTheme) val alertDialogBuilder = MaterialAlertDialogBuilder(context, app.aaps.core.ui.R.style.DialogTheme)
alertDialogBuilder.setView(promptsView) alertDialogBuilder.setView(promptsView)
passwordExplanation?.let { alertDialogBuilder.setMessage(it) } passwordExplanation?.let { alertDialogBuilder.setMessage(it) }
@ -191,10 +191,10 @@ class PasswordCheckImpl @Inject constructor(
alertDialogBuilder alertDialogBuilder
.setCancelable(false) .setCancelable(false)
.setCustomTitle(info.nightscout.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key)) .setCustomTitle(app.aaps.core.ui.dialogs.AlertDialogHelper.buildCustomTitle(context, context.getString(labelId), R.drawable.ic_header_key))
.setPositiveButton(context.getString(info.nightscout.core.ui.R.string.ok)) { _, _ -> validatePassword() } .setPositiveButton(context.getString(app.aaps.core.ui.R.string.ok)) { _, _ -> validatePassword() }
.setNegativeButton( .setNegativeButton(
context.getString(info.nightscout.core.ui.R.string.cancel) context.getString(app.aaps.core.ui.R.string.cancel)
) { dialog, _ -> ) { dialog, _ ->
cancel?.invoke() cancel?.invoke()
dialog.cancel() dialog.cancel()

View file

@ -37,15 +37,15 @@ class ProtectionCheckImpl @Inject constructor(
) )
private val titlePassResourceIDs = listOf( private val titlePassResourceIDs = listOf(
info.nightscout.core.ui.R.string.settings_password, app.aaps.core.ui.R.string.settings_password,
info.nightscout.core.ui.R.string.application_password, app.aaps.core.ui.R.string.application_password,
info.nightscout.core.ui.R.string.bolus_password app.aaps.core.ui.R.string.bolus_password
) )
private val titlePinResourceIDs = listOf( private val titlePinResourceIDs = listOf(
info.nightscout.core.ui.R.string.settings_pin, app.aaps.core.ui.R.string.settings_pin,
info.nightscout.core.ui.R.string.application_pin, app.aaps.core.ui.R.string.application_pin,
info.nightscout.core.ui.R.string.bolus_pin app.aaps.core.ui.R.string.bolus_pin
) )
override fun isLocked(protection: ProtectionCheck.Protection): Boolean { override fun isLocked(protection: ProtectionCheck.Protection): Boolean {
@ -95,7 +95,7 @@ class ProtectionCheckImpl @Inject constructor(
ProtectionCheck.ProtectionType.MASTER_PASSWORD -> ProtectionCheck.ProtectionType.MASTER_PASSWORD ->
passwordCheck.queryPassword( passwordCheck.queryPassword(
activity, activity,
info.nightscout.core.ui.R.string.master_password, app.aaps.core.ui.R.string.master_password,
info.nightscout.core.utils.R.string.key_master_password, info.nightscout.core.utils.R.string.key_master_password,
{ onOk(protection); ok?.run() }, { onOk(protection); ok?.run() },
{ cancel?.run() }, { cancel?.run() },

View file

@ -13,7 +13,7 @@ import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import app.aaps.core.interfaces.pump.BlePreCheck import app.aaps.core.interfaces.pump.BlePreCheck
import app.aaps.core.interfaces.resources.ResourceHelper import app.aaps.core.interfaces.resources.ResourceHelper
import info.nightscout.core.ui.dialogs.OKDialog import app.aaps.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.extensions.safeEnable import info.nightscout.core.utils.extensions.safeEnable
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -32,7 +32,7 @@ class BlePreCheckImpl @Inject constructor(
override fun prerequisitesCheck(activity: AppCompatActivity): Boolean { override fun prerequisitesCheck(activity: AppCompatActivity): Boolean {
if (!activity.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { if (!activity.packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
OKDialog.show(activity, rh.gs(info.nightscout.core.ui.R.string.message), rh.gs(info.nightscout.core.ui.R.string.ble_not_supported)) OKDialog.show(activity, rh.gs(app.aaps.core.ui.R.string.message), rh.gs(app.aaps.core.ui.R.string.ble_not_supported))
return false return false
} else { } else {
// Use this check to determine whether BLE is supported on the device. Then // Use this check to determine whether BLE is supported on the device. Then
@ -56,7 +56,7 @@ class BlePreCheckImpl @Inject constructor(
// displays a dialog requesting user permission to enable Bluetooth. // displays a dialog requesting user permission to enable Bluetooth.
bluetoothAdapter?.safeEnable(3000) bluetoothAdapter?.safeEnable(3000)
if (bluetoothAdapter?.isEnabled != true) { if (bluetoothAdapter?.isEnabled != true) {
OKDialog.show(activity, rh.gs(info.nightscout.core.ui.R.string.message), rh.gs(info.nightscout.core.ui.R.string.ble_not_enabled)) OKDialog.show(activity, rh.gs(app.aaps.core.ui.R.string.message), rh.gs(app.aaps.core.ui.R.string.ble_not_enabled))
return false return false
} else { } else {
// Will request that GPS be enabled for devices running Marshmallow or newer. // Will request that GPS be enabled for devices running Marshmallow or newer.
@ -95,7 +95,7 @@ class BlePreCheckImpl @Inject constructor(
} }
// Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533 // Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533
OKDialog.showConfirmation(activity, rh.gs(info.nightscout.core.ui.R.string.location_not_found_title), rh.gs(info.nightscout.core.ui.R.string.location_not_found_message), Runnable { OKDialog.showConfirmation(activity, rh.gs(app.aaps.core.ui.R.string.location_not_found_title), rh.gs(app.aaps.core.ui.R.string.location_not_found_message), Runnable {
activity.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) activity.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
}) })
} }

View file

@ -115,7 +115,7 @@ class PumpSyncImplementation @Inject constructor(
} }
if (showNotification && (type.description != storedType || serialNumber != storedSerial) && timestamp >= storedTimestamp) if (showNotification && (type.description != storedType || serialNumber != storedSerial) && timestamp >= storedTimestamp)
rxBus.send(EventNewNotification(Notification(Notification.WRONG_PUMP_DATA, rh.gs(info.nightscout.core.ui.R.string.wrong_pump_data), Notification.URGENT))) rxBus.send(EventNewNotification(Notification(Notification.WRONG_PUMP_DATA, rh.gs(app.aaps.core.ui.R.string.wrong_pump_data), Notification.URGENT)))
aapsLogger.error( aapsLogger.error(
LTag.PUMP, LTag.PUMP,
"Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${ "Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${

View file

@ -17,9 +17,9 @@ import javax.inject.Singleton
view?.setTextColor( view?.setTextColor(
rh.gac( rh.gac(
view.context, when { view.context, when {
value >= urgentLevel -> info.nightscout.core.ui.R.attr.urgentColor value >= urgentLevel -> app.aaps.core.ui.R.attr.urgentColor
value >= warnLevel -> info.nightscout.core.ui.R.attr.warnColor value >= warnLevel -> app.aaps.core.ui.R.attr.warnColor
else -> info.nightscout.core.ui.R.attr.defaultTextColor else -> app.aaps.core.ui.R.attr.defaultTextColor
} }
) )
) )
@ -29,9 +29,9 @@ import javax.inject.Singleton
view?.setTextColor( view?.setTextColor(
rh.gac( rh.gac(
view.context, when { view.context, when {
value <= urgentLevel -> info.nightscout.core.ui.R.attr.urgentColor value <= urgentLevel -> app.aaps.core.ui.R.attr.urgentColor
value <= warnLevel -> info.nightscout.core.ui.R.attr.warnColor value <= warnLevel -> app.aaps.core.ui.R.attr.warnColor
else -> info.nightscout.core.ui.R.attr.defaultTextColor else -> app.aaps.core.ui.R.attr.defaultTextColor
} }
) )
) )
@ -41,9 +41,9 @@ import javax.inject.Singleton
view?.setTextColor( view?.setTextColor(
rh.gac( rh.gac(
view.context, when { view.context, when {
therapyEvent.isOlderThan(urgentThreshold, dateUtil) -> info.nightscout.core.ui.R.attr.lowColor therapyEvent.isOlderThan(urgentThreshold, dateUtil) -> app.aaps.core.ui.R.attr.lowColor
therapyEvent.isOlderThan(warnThreshold, dateUtil) -> info.nightscout.core.ui.R.attr.highColor therapyEvent.isOlderThan(warnThreshold, dateUtil) -> app.aaps.core.ui.R.attr.highColor
else -> info.nightscout.core.ui.R.attr.defaultTextColor else -> app.aaps.core.ui.R.attr.defaultTextColor
} }
) )
) )

View file

@ -124,7 +124,7 @@ class CommandQueueImplementation @Inject constructor(
setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() { setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {
uiInteraction.runAlarm(result.comment, rh.gs(info.nightscout.core.ui.R.string.failed_update_basal_profile), info.nightscout.core.ui.R.raw.boluserror) uiInteraction.runAlarm(result.comment, rh.gs(app.aaps.core.ui.R.string.failed_update_basal_profile), app.aaps.core.ui.R.raw.boluserror)
} else if (result.enacted || effective is ValueWrapper.Existing && effective.value.originalEnd < dateUtil.now() && effective.value.originalDuration != 0L) { } else if (result.enacted || effective is ValueWrapper.Existing && effective.value.originalEnd < dateUtil.now() && effective.value.originalDuration != 0L) {
val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil) val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil)
EffectiveProfileSwitch( EffectiveProfileSwitch(
@ -326,7 +326,7 @@ class CommandQueueImplementation @Inject constructor(
EventMobileToWear( EventMobileToWear(
EventData.BolusProgress( EventData.BolusProgress(
percent = 0, percent = 0,
status = rh.gs(info.nightscout.core.ui.R.string.goingtodeliver, detailedBolusInfo.insulin) status = rh.gs(app.aaps.core.ui.R.string.goingtodeliver, detailedBolusInfo.insulin)
) )
) )
) )

View file

@ -19,7 +19,7 @@ import app.aaps.core.interfaces.rx.events.EventPumpStatusChanged
import app.aaps.core.interfaces.rx.events.EventQueueChanged import app.aaps.core.interfaces.rx.events.EventQueueChanged
import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.core.interfaces.sharedPreferences.SP
import app.aaps.core.interfaces.utils.T import app.aaps.core.interfaces.utils.T
import info.nightscout.core.ui.R import app.aaps.core.ui.R
import info.nightscout.core.utils.extensions.safeDisable import info.nightscout.core.utils.extensions.safeDisable
import info.nightscout.core.utils.extensions.safeEnable import info.nightscout.core.utils.extensions.safeEnable

View file

@ -33,17 +33,17 @@ class CommandBolus(
} }
override fun status(): String { override fun status(): String {
return (if (detailedBolusInfo.insulin > 0) rh.gs(info.nightscout.core.ui.R.string.bolus_u_min, detailedBolusInfo.insulin) else "") + return (if (detailedBolusInfo.insulin > 0) rh.gs(app.aaps.core.ui.R.string.bolus_u_min, detailedBolusInfo.insulin) else "") +
if (detailedBolusInfo.carbs > 0) rh.gs(info.nightscout.core.ui.R.string.carbs_g, detailedBolusInfo.carbs.toInt()) else "" if (detailedBolusInfo.carbs > 0) rh.gs(app.aaps.core.ui.R.string.carbs_g, detailedBolusInfo.carbs.toInt()) else ""
} }
override fun log(): String { override fun log(): String {
return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin) else "") + return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(app.aaps.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin) else "") +
if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(app.aaps.core.main.R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else "" if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(app.aaps.core.main.R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else ""
} }
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -21,11 +21,11 @@ class CommandCancelExtendedBolus(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.uel_cancel_extended_bolus) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.uel_cancel_extended_bolus)
override fun log(): String = "CANCEL EXTENDEDBOLUS" override fun log(): String = "CANCEL EXTENDEDBOLUS"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -22,11 +22,11 @@ class CommandCancelTempBasal(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.uel_accepts_temp_basal) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.uel_accepts_temp_basal)
override fun log(): String = "CANCEL TEMPBASAL" override fun log(): String = "CANCEL TEMPBASAL"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -27,11 +27,11 @@ class CommandClearAlarms(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.clear_alarms) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.clear_alarms)
override fun log(): String = "CLEAR ALARMS" override fun log(): String = "CLEAR ALARMS"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -29,6 +29,6 @@ class CommandCustomCommand(
override fun log(): String = customCommand.statusDescription override fun log(): String = customCommand.statusDescription
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -27,11 +27,11 @@ class CommandDeactivate(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.deactivate) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.deactivate)
override fun log(): String = "DEACTIVATE" override fun log(): String = "DEACTIVATE"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -23,11 +23,11 @@ class CommandExtendedBolus(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.extended_bolus_u_min, insulin, durationInMinutes) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.extended_bolus_u_min, insulin, durationInMinutes)
override fun log(): String = "EXTENDEDBOLUS $insulin U $durationInMinutes min" override fun log(): String = "EXTENDEDBOLUS $insulin U $durationInMinutes min"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -25,12 +25,12 @@ class CommandInsightSetTBROverNotification(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.insight_set_tbr_over_notification) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.insight_set_tbr_over_notification)
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
override fun log(): String = "INSIGHTSETTBROVERNOTIFICATION" override fun log(): String = "INSIGHTSETTBROVERNOTIFICATION"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -42,11 +42,11 @@ class CommandLoadEvents(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.load_events) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.load_events)
override fun log(): String = "LOAD EVENTS" override fun log(): String = "LOAD EVENTS"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -35,11 +35,11 @@ class CommandLoadHistory(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.load_history, type.toInt()) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.load_history, type.toInt())
override fun log(): String = "LOAD HISTORY $type" override fun log(): String = "LOAD HISTORY $type"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -22,11 +22,11 @@ class CommandLoadTDDs(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.load_tdds) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.load_tdds)
override fun log(): String = "LOAD TDDs" override fun log(): String = "LOAD TDDs"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -30,11 +30,11 @@ class CommandReadStatus(
callback?.result(result)?.run() callback?.result(result)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.read_status, reason) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.read_status, reason)
override fun log(): String = "READSTATUS $reason" override fun log(): String = "READSTATUS $reason"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -39,11 +39,11 @@ class CommandSMBBolus(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.smb_bolus_u, detailedBolusInfo.insulin) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.smb_bolus_u, detailedBolusInfo.insulin)
override fun log(): String = "SMB BOLUS ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin)}" override fun log(): String = "SMB BOLUS ${rh.gs(app.aaps.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin)}"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -42,15 +42,15 @@ class CommandSetProfile(
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet()
if (profileSwitch is ValueWrapper.Existing && r.enacted && hasNsId && !config.NSCLIENT) { if (profileSwitch is ValueWrapper.Existing && r.enacted && hasNsId && !config.NSCLIENT) {
if (smsCommunicator.isEnabled()) if (smsCommunicator.isEnabled())
smsCommunicator.sendNotificationToAllNumbers(rh.gs(info.nightscout.core.ui.R.string.profile_set_ok)) smsCommunicator.sendNotificationToAllNumbers(rh.gs(app.aaps.core.ui.R.string.profile_set_ok))
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.set_profile) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.set_profile)
override fun log(): String = "SET PROFILE" override fun log(): String = "SET PROFILE"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -39,11 +39,11 @@ class CommandSetUserSettings(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.set_user_settings) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.set_user_settings)
override fun log(): String = "SET USER SETTINGS" override fun log(): String = "SET USER SETTINGS"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -24,11 +24,11 @@ class CommandStartPump(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.start_pump) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.start_pump)
override fun log(): String = "START PUMP" override fun log(): String = "START PUMP"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -24,11 +24,11 @@ class CommandStopPump(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.stop_pump) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.stop_pump)
override fun log(): String = "STOP PUMP" override fun log(): String = "STOP PUMP"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -28,11 +28,11 @@ class CommandTempBasalAbsolute(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.temp_basal_absolute, absoluteRate, durationInMinutes) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.temp_basal_absolute, absoluteRate, durationInMinutes)
override fun log(): String = "TEMP BASAL $absoluteRate U/h $durationInMinutes min" override fun log(): String = "TEMP BASAL $absoluteRate U/h $durationInMinutes min"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -32,11 +32,11 @@ class CommandTempBasalPercent(
callback?.result(r)?.run() callback?.result(r)?.run()
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.temp_basal_percent, percent, durationInMinutes) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.temp_basal_percent, percent, durationInMinutes)
override fun log(): String = "TEMP BASAL $percent% $durationInMinutes min" override fun log(): String = "TEMP BASAL $percent% $durationInMinutes min"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -27,11 +27,11 @@ class CommandUpdateTime(
} }
} }
override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.update_time) override fun status(): String = rh.gs(app.aaps.core.ui.R.string.update_time)
override fun log(): String = "UPDATE TIME" override fun log(): String = "UPDATE TIME"
override fun cancel() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(app.aaps.core.ui.R.string.connectiontimedout))?.run()
} }
} }

View file

@ -11,10 +11,10 @@ class IconsProviderImplementation @Inject constructor(private val config: Config
override fun getIcon(): Int = override fun getIcon(): Int =
when { when {
config.NSCLIENT2 -> info.nightscout.core.ui.R.mipmap.ic_blueowl config.NSCLIENT2 -> app.aaps.core.ui.R.mipmap.ic_blueowl
config.NSCLIENT1 -> info.nightscout.core.ui.R.mipmap.ic_yellowowl config.NSCLIENT1 -> app.aaps.core.ui.R.mipmap.ic_yellowowl
config.PUMPCONTROL -> info.nightscout.core.ui.R.mipmap.ic_pumpcontrol config.PUMPCONTROL -> app.aaps.core.ui.R.mipmap.ic_pumpcontrol
else -> info.nightscout.core.ui.R.mipmap.ic_launcher else -> app.aaps.core.ui.R.mipmap.ic_launcher
} }
override fun getNotificationIcon(): Int = override fun getNotificationIcon(): Int =

View file

@ -20,8 +20,8 @@ import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import app.aaps.core.main.utils.fabric.FabricPrivacy import app.aaps.core.main.utils.fabric.FabricPrivacy
import app.aaps.core.interfaces.resources.ResourceHelper import app.aaps.core.interfaces.resources.ResourceHelper
import info.nightscout.core.ui.getThemeColor import app.aaps.core.ui.getThemeColor
import info.nightscout.core.ui.locale.LocaleHelper import app.aaps.core.ui.locale.LocaleHelper
import java.util.Locale import java.util.Locale
import javax.inject.Inject import javax.inject.Inject
@ -93,13 +93,13 @@ class ResourceHelperImpl @Inject constructor(var context: Context, private val f
return (dp * scale + 0.5f).toInt() return (dp * scale + 0.5f).toInt()
} }
override fun shortTextMode(): Boolean = !gb(info.nightscout.core.ui.R.bool.isTablet) override fun shortTextMode(): Boolean = !gb(app.aaps.core.ui.R.bool.isTablet)
override fun gac(context: Context?, attributeId: Int): Int = override fun gac(context: Context?, attributeId: Int): Int =
(ContextThemeWrapper(context ?: this.context, info.nightscout.core.ui.R.style.AppTheme)).getThemeColor(attributeId) (ContextThemeWrapper(context ?: this.context, app.aaps.core.ui.R.style.AppTheme)).getThemeColor(attributeId)
override fun gac(attributeId: Int): Int = override fun gac(attributeId: Int): Int =
ContextThemeWrapper(this.context, info.nightscout.core.ui.R.style.AppTheme).getThemeColor(attributeId) ContextThemeWrapper(this.context, app.aaps.core.ui.R.style.AppTheme).getThemeColor(attributeId)
override fun getThemedCtx(context: Context): Context { override fun getThemedCtx(context: Context): Context {
val res: Resources = context.resources val res: Resources = context.resources

View file

@ -148,23 +148,23 @@ class DexcomTirImpl : DexcomTIR {
row.gravity = Gravity.CENTER_HORIZONTAL row.gravity = Gravity.CENTER_HORIZONTAL
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text =
context.getString(info.nightscout.core.ui.R.string.formatPercent, veryLowPct()) context.getString(app.aaps.core.ui.R.string.formatPercent, veryLowPct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text =
context.getString(info.nightscout.core.ui.R.string.formatPercent, lowPct()) context.getString(app.aaps.core.ui.R.string.formatPercent, lowPct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text =
context.getString(info.nightscout.core.ui.R.string.formatPercent, inRangePct()) context.getString(app.aaps.core.ui.R.string.formatPercent, inRangePct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text =
context.getString(info.nightscout.core.ui.R.string.formatPercent, highPct()) context.getString(app.aaps.core.ui.R.string.formatPercent, highPct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text =
context.getString(info.nightscout.core.ui.R.string.formatPercent, veryHighPct()) context.getString(app.aaps.core.ui.R.string.formatPercent, veryHighPct())
}) })
} }
} }

View file

@ -145,7 +145,7 @@ class TddCalculatorImpl @Inject constructor(
return TableLayout(context).also { layout -> return TableLayout(context).also { layout ->
layout.layoutParams = TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f) layout.layoutParams = TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)
layout.addView(TextView(context).apply { layout.addView(TextView(context).apply {
text = rh.gs(info.nightscout.core.ui.R.string.tdd) text = rh.gs(app.aaps.core.ui.R.string.tdd)
setTypeface(typeface, Typeface.BOLD) setTypeface(typeface, Typeface.BOLD)
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
setTextAppearance(android.R.style.TextAppearance_Material_Medium) setTextAppearance(android.R.style.TextAppearance_Material_Medium)
@ -155,7 +155,7 @@ class TddCalculatorImpl @Inject constructor(
averageTdd?.let { averageTdd -> averageTdd?.let { averageTdd ->
layout.addView(TextView(context).apply { layout.addView(TextView(context).apply {
layoutParams = lp layoutParams = lp
text = rh.gs(info.nightscout.core.ui.R.string.average) text = rh.gs(app.aaps.core.ui.R.string.average)
setTypeface(typeface, Typeface.BOLD) setTypeface(typeface, Typeface.BOLD)
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
setTextAppearance(android.R.style.TextAppearance_Material_Medium) setTextAppearance(android.R.style.TextAppearance_Material_Medium)

View file

@ -87,7 +87,7 @@ class TirCalculatorImpl @Inject constructor(
layout.layoutParams = TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f) layout.layoutParams = TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)
layout.addView( layout.addView(
TextView(context).apply { TextView(context).apply {
text = rh.gs(info.nightscout.core.ui.R.string.tir) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTirMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTirMgdl) + ")" text = rh.gs(app.aaps.core.ui.R.string.tir) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTirMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTirMgdl) + ")"
setTypeface(typeface, Typeface.BOLD) setTypeface(typeface, Typeface.BOLD)
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
setTextAppearance(android.R.style.TextAppearance_Material_Medium) setTextAppearance(android.R.style.TextAppearance_Material_Medium)
@ -96,7 +96,7 @@ class TirCalculatorImpl @Inject constructor(
for (i in 0 until tir7.size()) layout.addView(tir7.valueAt(i).toTableRow(context, rh, dateUtil)) for (i in 0 until tir7.size()) layout.addView(tir7.valueAt(i).toTableRow(context, rh, dateUtil))
layout.addView( layout.addView(
TextView(context).apply { TextView(context).apply {
text = rh.gs(info.nightscout.core.ui.R.string.average) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTirMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTirMgdl) + ")" text = rh.gs(app.aaps.core.ui.R.string.average) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTirMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTirMgdl) + ")"
setTypeface(typeface, Typeface.BOLD) setTypeface(typeface, Typeface.BOLD)
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
setTextAppearance(android.R.style.TextAppearance_Material_Medium) setTextAppearance(android.R.style.TextAppearance_Material_Medium)
@ -105,7 +105,7 @@ class TirCalculatorImpl @Inject constructor(
layout.addView(averageTir30.toTableRow(context, rh, tir30.size())) layout.addView(averageTir30.toTableRow(context, rh, tir30.size()))
layout.addView( layout.addView(
TextView(context).apply { TextView(context).apply {
text = rh.gs(info.nightscout.core.ui.R.string.average) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTitMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTitMgdl) + ")" text = rh.gs(app.aaps.core.ui.R.string.average) + " (" + profileUtil.stringInCurrentUnitsDetect(lowTitMgdl) + "-" + profileUtil.stringInCurrentUnitsDetect(highTitMgdl) + ")"
setTypeface(typeface, Typeface.BOLD) setTypeface(typeface, Typeface.BOLD)
gravity = Gravity.CENTER_HORIZONTAL gravity = Gravity.CENTER_HORIZONTAL
setTextAppearance(android.R.style.TextAppearance_Material_Medium) setTextAppearance(android.R.style.TextAppearance_Material_Medium)

View file

@ -47,7 +47,7 @@ class TirImpl(override val date: Long, override val lowThreshold: Double, overri
header.gravity = Gravity.CENTER_HORIZONTAL header.gravity = Gravity.CENTER_HORIZONTAL
header.addView(TextView(context).apply { header.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0; weight = 1f }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0; weight = 1f }; text =
rh.gs(info.nightscout.core.ui.R.string.date) rh.gs(app.aaps.core.ui.R.string.date)
}) })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1; weight = 1f }; text = rh.gs(R.string.below) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1; weight = 1f }; text = rh.gs(R.string.below) })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2; weight = 1f }; text = rh.gs(R.string.in_range) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2; weight = 1f }; text = rh.gs(R.string.in_range) })
@ -63,15 +63,15 @@ class TirImpl(override val date: Long, override val lowThreshold: Double, overri
row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = dateUtil.dateStringShort(date) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = dateUtil.dateStringShort(date) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, belowPct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, belowPct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, inRangePct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, inRangePct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, abovePct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, abovePct())
}) })
} }
@ -87,15 +87,15 @@ class TirImpl(override val date: Long, override val lowThreshold: Double, overri
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, belowPct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, belowPct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, inRangePct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, inRangePct())
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text =
rh.gs(info.nightscout.core.ui.R.string.formatPercent, abovePct()) rh.gs(app.aaps.core.ui.R.string.formatPercent, abovePct())
}) })
} }
} }

View file

@ -21,11 +21,11 @@ fun TotalDailyDose.Companion.toTableRowHeader(context: Context, rh: ResourceHelp
val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT) val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)
header.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT) header.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)
header.gravity = Gravity.CENTER_HORIZONTAL header.gravity = Gravity.CENTER_HORIZONTAL
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0; weight = 1f }; text = rh.gs(info.nightscout.core.ui.R.string.date) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0; weight = 1f }; text = rh.gs(app.aaps.core.ui.R.string.date) })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1; weight = 1f }; text = "" }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1; weight = 1f }; text = "" })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2; weight = 1f }; text = rh.gs(info.nightscout.core.ui.R.string.bolus) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2; weight = 1f }; text = rh.gs(app.aaps.core.ui.R.string.bolus) })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3; weight = 1f }; text = rh.gs(info.nightscout.core.ui.R.string.basal) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3; weight = 1f }; text = rh.gs(app.aaps.core.ui.R.string.basal) })
header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4; weight = 1f }; text = rh.gs(info.nightscout.core.ui.R.string.basalpct) }) header.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4; weight = 1f }; text = rh.gs(app.aaps.core.ui.R.string.basalpct) })
if (includeCarbs) if (includeCarbs)
header.addView(TextView(context).apply { layoutParams = lp.apply { column = 5; weight = 1f }; text = rh.gs(R.string.carbs_short) }) header.addView(TextView(context).apply { layoutParams = lp.apply { column = 5; weight = 1f }; text = rh.gs(R.string.carbs_short) })
} }
@ -39,17 +39,17 @@ fun TotalDailyDose.toTableRow(context: Context, rh: ResourceHelper, dateUtil: Da
row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = dateUtil.dateStringShort(timestamp) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = dateUtil.dateStringShort(timestamp) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, total) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, total)
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, bolusAmount) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, bolusAmount)
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, basalAmount) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, basalAmount)
}) })
row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(info.nightscout.core.ui.R.string.formatPercent, basalPct) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(app.aaps.core.ui.R.string.formatPercent, basalPct) })
if (includeCarbs) if (includeCarbs)
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs( gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs(
@ -73,17 +73,17 @@ fun TotalDailyDose.toTableRow(context: Context, rh: ResourceHelper, days: Int, i
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, total) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, total)
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, bolusAmount) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, bolusAmount)
}) })
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text =
rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, basalAmount) rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, basalAmount)
}) })
row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(info.nightscout.core.ui.R.string.formatPercent, basalPct) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(app.aaps.core.ui.R.string.formatPercent, basalPct) })
if (includeCarbs) if (includeCarbs)
row.addView(TextView(context).apply { row.addView(TextView(context).apply {
gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs( gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs(

View file

@ -29,16 +29,16 @@ class UserEntryPresentationHelperImpl @Inject constructor(
) : UserEntryPresentationHelper { ) : UserEntryPresentationHelper {
override fun colorId(colorGroup: ColorGroup): Int = when (colorGroup) { override fun colorId(colorGroup: ColorGroup): Int = when (colorGroup) {
ColorGroup.InsulinTreatment -> info.nightscout.core.ui.R.color.iob ColorGroup.InsulinTreatment -> app.aaps.core.ui.R.color.iob
ColorGroup.BasalTreatment -> info.nightscout.core.ui.R.color.basal ColorGroup.BasalTreatment -> app.aaps.core.ui.R.color.basal
ColorGroup.CarbTreatment -> info.nightscout.core.ui.R.color.carbs ColorGroup.CarbTreatment -> app.aaps.core.ui.R.color.carbs
ColorGroup.TT -> info.nightscout.core.ui.R.color.tempTargetConfirmation ColorGroup.TT -> app.aaps.core.ui.R.color.tempTargetConfirmation
ColorGroup.Profile -> info.nightscout.core.ui.R.color.white ColorGroup.Profile -> app.aaps.core.ui.R.color.white
ColorGroup.Loop -> info.nightscout.core.ui.R.color.loopClosed ColorGroup.Loop -> app.aaps.core.ui.R.color.loopClosed
ColorGroup.Careportal -> info.nightscout.core.ui.R.color.high ColorGroup.Careportal -> app.aaps.core.ui.R.color.high
ColorGroup.Pump -> info.nightscout.core.ui.R.color.loopDisconnected ColorGroup.Pump -> app.aaps.core.ui.R.color.loopDisconnected
ColorGroup.Aaps -> info.nightscout.core.ui.R.color.defaultText ColorGroup.Aaps -> app.aaps.core.ui.R.color.defaultText
else -> info.nightscout.core.ui.R.color.defaultText else -> app.aaps.core.ui.R.color.defaultText
} }
override fun iconId(source: Sources): Int = when (source) { override fun iconId(source: Sources): Int = when (source) {
@ -49,7 +49,7 @@ class UserEntryPresentationHelperImpl @Inject constructor(
Sources.QuickWizard -> R.drawable.ic_quick_wizard Sources.QuickWizard -> R.drawable.ic_quick_wizard
Sources.ExtendedBolusDialog -> R.drawable.ic_actions_start_extended_bolus Sources.ExtendedBolusDialog -> R.drawable.ic_actions_start_extended_bolus
Sources.TTDialog -> R.drawable.ic_temptarget_high Sources.TTDialog -> R.drawable.ic_temptarget_high
Sources.ProfileSwitchDialog -> info.nightscout.core.ui.R.drawable.ic_actions_profileswitch Sources.ProfileSwitchDialog -> app.aaps.core.ui.R.drawable.ic_actions_profileswitch
Sources.LoopDialog -> R.drawable.ic_loop_closed Sources.LoopDialog -> R.drawable.ic_loop_closed
Sources.TempBasalDialog -> R.drawable.ic_actions_start_temp_basal Sources.TempBasalDialog -> R.drawable.ic_actions_start_temp_basal
Sources.CalibrationDialog -> R.drawable.ic_calibration Sources.CalibrationDialog -> R.drawable.ic_calibration
@ -74,30 +74,30 @@ class UserEntryPresentationHelperImpl @Inject constructor(
Sources.PocTech -> R.drawable.ic_poctech Sources.PocTech -> R.drawable.ic_poctech
Sources.Tomato -> R.drawable.ic_sensor Sources.Tomato -> R.drawable.ic_sensor
Sources.Glunovo -> R.drawable.ic_glunovo Sources.Glunovo -> R.drawable.ic_glunovo
Sources.Intelligo -> info.nightscout.core.ui.R.drawable.ic_intelligo Sources.Intelligo -> app.aaps.core.ui.R.drawable.ic_intelligo
Sources.Xdrip -> R.drawable.ic_blooddrop_48 Sources.Xdrip -> R.drawable.ic_blooddrop_48
Sources.LocalProfile -> R.drawable.ic_local_profile Sources.LocalProfile -> R.drawable.ic_local_profile
Sources.Loop -> R.drawable.ic_loop_closed_white Sources.Loop -> R.drawable.ic_loop_closed_white
Sources.Maintenance -> info.nightscout.core.ui.R.drawable.ic_maintenance Sources.Maintenance -> app.aaps.core.ui.R.drawable.ic_maintenance
Sources.NSClient -> info.nightscout.core.ui.R.drawable.ic_nightscout_syncs Sources.NSClient -> app.aaps.core.ui.R.drawable.ic_nightscout_syncs
Sources.NSProfile -> R.drawable.ic_nightscout_profile Sources.NSProfile -> R.drawable.ic_nightscout_profile
Sources.Objectives -> info.nightscout.core.ui.R.drawable.ic_graduation Sources.Objectives -> app.aaps.core.ui.R.drawable.ic_graduation
Sources.Pump -> info.nightscout.core.ui.R.drawable.ic_generic_icon Sources.Pump -> app.aaps.core.ui.R.drawable.ic_generic_icon
Sources.Dana -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.Dana -> app.aaps.core.ui.R.drawable.ic_danars_128
Sources.DanaR -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaR -> app.aaps.core.ui.R.drawable.ic_danars_128
Sources.DanaRC -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaRC -> app.aaps.core.ui.R.drawable.ic_danars_128
Sources.DanaRv2 -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaRv2 -> app.aaps.core.ui.R.drawable.ic_danars_128
Sources.DanaRS -> info.nightscout.core.ui.R.drawable.ic_danars_128 Sources.DanaRS -> app.aaps.core.ui.R.drawable.ic_danars_128
Sources.DanaI -> info.nightscout.core.ui.R.drawable.ic_danai_128 Sources.DanaI -> app.aaps.core.ui.R.drawable.ic_danai_128
Sources.DiaconnG8 -> info.nightscout.core.ui.R.drawable.ic_diaconn_g8 Sources.DiaconnG8 -> app.aaps.core.ui.R.drawable.ic_diaconn_g8
Sources.Insight -> info.nightscout.core.ui.R.drawable.ic_insight_128 Sources.Insight -> app.aaps.core.ui.R.drawable.ic_insight_128
Sources.Combo -> info.nightscout.core.ui.R.drawable.ic_combo_128 Sources.Combo -> app.aaps.core.ui.R.drawable.ic_combo_128
Sources.Medtronic -> info.nightscout.core.ui.R.drawable.ic_veo_128 Sources.Medtronic -> app.aaps.core.ui.R.drawable.ic_veo_128
Sources.Omnipod -> R.drawable.ic_patch_pump_outline Sources.Omnipod -> R.drawable.ic_patch_pump_outline
Sources.OmnipodEros -> R.drawable.ic_patch_pump_outline Sources.OmnipodEros -> R.drawable.ic_patch_pump_outline
Sources.OmnipodDash -> R.drawable.ic_patch_pump_outline Sources.OmnipodDash -> R.drawable.ic_patch_pump_outline
Sources.EOPatch2 -> info.nightscout.core.ui.R.drawable.ic_eopatch2_128 Sources.EOPatch2 -> app.aaps.core.ui.R.drawable.ic_eopatch2_128
Sources.Medtrum -> info.nightscout.core.ui.R.drawable.ic_medtrum_128 Sources.Medtrum -> app.aaps.core.ui.R.drawable.ic_medtrum_128
Sources.MDI -> R.drawable.ic_ict Sources.MDI -> R.drawable.ic_ict
Sources.VirtualPump -> R.drawable.ic_virtual_pump Sources.VirtualPump -> R.drawable.ic_virtual_pump
Sources.SMS -> R.drawable.ic_sms Sources.SMS -> R.drawable.ic_sms
@ -105,10 +105,10 @@ class UserEntryPresentationHelperImpl @Inject constructor(
Sources.Wear -> R.drawable.ic_watch Sources.Wear -> R.drawable.ic_watch
Sources.Food -> R.drawable.ic_food Sources.Food -> R.drawable.ic_food
Sources.Stats -> R.drawable.ic_cp_stats Sources.Stats -> R.drawable.ic_cp_stats
Sources.ConfigBuilder -> info.nightscout.core.ui.R.drawable.ic_cogs Sources.ConfigBuilder -> app.aaps.core.ui.R.drawable.ic_cogs
Sources.Overview -> info.nightscout.core.ui.R.drawable.ic_home Sources.Overview -> app.aaps.core.ui.R.drawable.ic_home
Sources.Aaps -> R.drawable.ic_aaps Sources.Aaps -> R.drawable.ic_aaps
Sources.Unknown -> info.nightscout.core.ui.R.drawable.ic_generic_icon Sources.Unknown -> app.aaps.core.ui.R.drawable.ic_generic_icon
} }
override fun actionToColoredString(action: Action): Spanned = when (action) { override fun actionToColoredString(action: Action): Spanned = when (action) {
@ -137,13 +137,13 @@ class UserEntryPresentationHelperImpl @Inject constructor(
is ValueWithUnit.Timestamp -> dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value) is ValueWithUnit.Timestamp -> dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
is ValueWithUnit.Mgdl -> { is ValueWithUnit.Mgdl -> {
if (profileUtil.units == GlucoseUnit.MGDL) decimalFormatter.to0Decimal(valueWithUnit.value) + rh.gs(info.nightscout.core.ui.R.string.mgdl) if (profileUtil.units == GlucoseUnit.MGDL) decimalFormatter.to0Decimal(valueWithUnit.value) + rh.gs(app.aaps.core.ui.R.string.mgdl)
else decimalFormatter.to1Decimal(valueWithUnit.value * Constants.MGDL_TO_MMOLL) + rh.gs(info.nightscout.core.ui.R.string.mmol) else decimalFormatter.to1Decimal(valueWithUnit.value * Constants.MGDL_TO_MMOLL) + rh.gs(app.aaps.core.ui.R.string.mmol)
} }
is ValueWithUnit.Mmoll -> { is ValueWithUnit.Mmoll -> {
if (profileUtil.units == GlucoseUnit.MMOL) decimalFormatter.to1Decimal(valueWithUnit.value) + rh.gs(info.nightscout.core.ui.R.string.mmol) if (profileUtil.units == GlucoseUnit.MMOL) decimalFormatter.to1Decimal(valueWithUnit.value) + rh.gs(app.aaps.core.ui.R.string.mmol)
else decimalFormatter.to0Decimal(valueWithUnit.value * Constants.MMOLL_TO_MGDL) + rh.gs(info.nightscout.core.ui.R.string.mgdl) else decimalFormatter.to0Decimal(valueWithUnit.value * Constants.MMOLL_TO_MGDL) + rh.gs(app.aaps.core.ui.R.string.mgdl)
} }
ValueWithUnit.UNKNOWN -> "" ValueWithUnit.UNKNOWN -> ""
@ -155,24 +155,24 @@ class UserEntryPresentationHelperImpl @Inject constructor(
} }
private fun getCsvHeader() = rh.gs( private fun getCsvHeader() = rh.gs(
info.nightscout.core.ui.R.string.ue_csv_header, app.aaps.core.ui.R.string.ue_csv_header,
csvString(info.nightscout.core.ui.R.string.ue_timestamp), csvString(app.aaps.core.ui.R.string.ue_timestamp),
csvString(info.nightscout.core.ui.R.string.date), csvString(app.aaps.core.ui.R.string.date),
csvString(info.nightscout.core.ui.R.string.ue_utc_offset), csvString(app.aaps.core.ui.R.string.ue_utc_offset),
csvString(info.nightscout.core.ui.R.string.ue_action), csvString(app.aaps.core.ui.R.string.ue_action),
csvString(info.nightscout.core.ui.R.string.event_type), csvString(app.aaps.core.ui.R.string.event_type),
csvString(info.nightscout.core.ui.R.string.ue_source), csvString(app.aaps.core.ui.R.string.ue_source),
csvString(info.nightscout.core.ui.R.string.careportal_note), csvString(app.aaps.core.ui.R.string.careportal_note),
csvString(info.nightscout.core.ui.R.string.ue_string), csvString(app.aaps.core.ui.R.string.ue_string),
csvString(info.nightscout.core.ui.R.string.event_time_label), csvString(app.aaps.core.ui.R.string.event_time_label),
csvString(if (profileUtil.units == GlucoseUnit.MGDL) info.nightscout.core.ui.R.string.mgdl else info.nightscout.core.ui.R.string.mmol), csvString(if (profileUtil.units == GlucoseUnit.MGDL) app.aaps.core.ui.R.string.mgdl else app.aaps.core.ui.R.string.mmol),
csvString(info.nightscout.core.ui.R.string.shortgram), csvString(app.aaps.core.ui.R.string.shortgram),
csvString(info.nightscout.core.ui.R.string.insulin_unit_shortname), csvString(app.aaps.core.ui.R.string.insulin_unit_shortname),
csvString(info.nightscout.core.ui.R.string.profile_ins_units_per_hour), csvString(app.aaps.core.ui.R.string.profile_ins_units_per_hour),
csvString(info.nightscout.core.ui.R.string.shortpercent), csvString(app.aaps.core.ui.R.string.shortpercent),
csvString(app.aaps.core.interfaces.R.string.shorthour), csvString(app.aaps.core.interfaces.R.string.shorthour),
csvString(app.aaps.core.interfaces.R.string.shortminute), csvString(app.aaps.core.interfaces.R.string.shortminute),
csvString(info.nightscout.core.ui.R.string.ue_none) csvString(app.aaps.core.ui.R.string.ue_none)
) + "\n" ) + "\n"
private fun getCsvEntry(entry: UserEntry): String { private fun getCsvEntry(entry: UserEntry): String {

View file

@ -26,7 +26,7 @@ class DecimalFormatterImpl @Inject constructor(
override fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit override fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit
override fun toPumpSupportedBolus(value: Double, bolusStep: Double): String = if (bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value) override fun toPumpSupportedBolus(value: Double, bolusStep: Double): String = if (bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value)
override fun toPumpSupportedBolusWithUnits(value: Double, bolusStep: Double): String = override fun toPumpSupportedBolusWithUnits(value: Double, bolusStep: Double): String =
if (bolusStep <= 0.051) rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, value) else rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, value) if (bolusStep <= 0.051) rh.gs(app.aaps.core.ui.R.string.format_insulin_units, value) else rh.gs(app.aaps.core.ui.R.string.format_insulin_units1, value)
override fun pumpSupportedBolusFormat(bolusStep: Double): DecimalFormat = if (bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0") override fun pumpSupportedBolusFormat(bolusStep: Double): DecimalFormat = if (bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0")
} }

View file

@ -149,9 +149,9 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
`when`(constraintChecker.applyBasalConstraints(anyObject(), anyObject())).thenReturn(rateConstraint) `when`(constraintChecker.applyBasalConstraints(anyObject(), anyObject())).thenReturn(rateConstraint)
val percentageConstraint = ConstraintObject(0, aapsLogger) val percentageConstraint = ConstraintObject(0, aapsLogger)
`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint) `when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint)
`when`(rh.gs(info.nightscout.core.ui.R.string.connectiontimedout)).thenReturn("Connection timed out") `when`(rh.gs(app.aaps.core.ui.R.string.connectiontimedout)).thenReturn("Connection timed out")
`when`(rh.gs(info.nightscout.core.ui.R.string.format_insulin_units)).thenReturn("%1\$.2f U") `when`(rh.gs(app.aaps.core.ui.R.string.format_insulin_units)).thenReturn("%1\$.2f U")
`when`(rh.gs(info.nightscout.core.ui.R.string.goingtodeliver)).thenReturn("Going to deliver %1\$.2f U") `when`(rh.gs(app.aaps.core.ui.R.string.goingtodeliver)).thenReturn("Going to deliver %1\$.2f U")
} }
@Test @Test

View file

@ -74,7 +74,7 @@ class QueueThreadTest : TestBaseWithProfile() {
val percentageConstraint = ConstraintObject(0, aapsLogger) val percentageConstraint = ConstraintObject(0, aapsLogger)
Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())) Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject()))
.thenReturn(percentageConstraint) .thenReturn(percentageConstraint)
Mockito.`when`(rh.gs(ArgumentMatchers.eq(info.nightscout.core.ui.R.string.temp_basal_absolute), anyObject(), anyObject())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min") Mockito.`when`(rh.gs(ArgumentMatchers.eq(app.aaps.core.ui.R.string.temp_basal_absolute), anyObject(), anyObject())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min")
sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config) sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config)
} }

View file

@ -26,16 +26,16 @@ class PumpEnactResultTest : TestBaseWithProfile() {
@BeforeEach @BeforeEach
fun mock() { fun mock() {
`when`(rh.gs(info.nightscout.core.ui.R.string.success)).thenReturn("Success") `when`(rh.gs(app.aaps.core.ui.R.string.success)).thenReturn("Success")
`when`(rh.gs(info.nightscout.core.ui.R.string.enacted)).thenReturn("Enacted") `when`(rh.gs(app.aaps.core.ui.R.string.enacted)).thenReturn("Enacted")
`when`(rh.gs(info.nightscout.core.ui.R.string.comment)).thenReturn("Comment") `when`(rh.gs(app.aaps.core.ui.R.string.comment)).thenReturn("Comment")
`when`(rh.gs(info.nightscout.core.ui.R.string.configbuilder_insulin)).thenReturn("Insulin") `when`(rh.gs(app.aaps.core.ui.R.string.configbuilder_insulin)).thenReturn("Insulin")
`when`(rh.gs(info.nightscout.core.ui.R.string.smb_shortname)).thenReturn("SMB") `when`(rh.gs(app.aaps.core.ui.R.string.smb_shortname)).thenReturn("SMB")
`when`(rh.gs(info.nightscout.core.ui.R.string.insulin_unit_shortname)).thenReturn("U") `when`(rh.gs(app.aaps.core.ui.R.string.insulin_unit_shortname)).thenReturn("U")
`when`(rh.gs(info.nightscout.core.ui.R.string.cancel_temp)).thenReturn("Cancel temp basal") `when`(rh.gs(app.aaps.core.ui.R.string.cancel_temp)).thenReturn("Cancel temp basal")
`when`(rh.gs(info.nightscout.core.ui.R.string.duration)).thenReturn("Duration") `when`(rh.gs(app.aaps.core.ui.R.string.duration)).thenReturn("Duration")
`when`(rh.gs(info.nightscout.core.ui.R.string.percent)).thenReturn("Percent") `when`(rh.gs(app.aaps.core.ui.R.string.percent)).thenReturn("Percent")
`when`(rh.gs(info.nightscout.core.ui.R.string.absolute)).thenReturn("Absolute") `when`(rh.gs(app.aaps.core.ui.R.string.absolute)).thenReturn("Absolute")
} }
@Test fun successTest() { @Test fun successTest() {

Some files were not shown because too many files have changed in this diff Show more