This commit is contained in:
Milos Kozak 2021-11-04 09:32:16 +01:00
commit b592054c18
99 changed files with 664 additions and 370 deletions

View file

@ -109,7 +109,7 @@ android {
defaultConfig {
multiDexEnabled true
versionCode 1500
version "2.8.2.8-dev"
version "2.8.2.9-dev"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'

View file

@ -113,7 +113,7 @@ class MainActivity : NoSplashAppCompatActivity() {
}
// initialize screen wake lock
processPreferenceChange(EventPreferenceChange(resourceHelper.gs(R.string.key_keep_screen_on)))
processPreferenceChange(EventPreferenceChange(rh.gs(R.string.key_keep_screen_on)))
binding.mainPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageScrollStateChanged(state: Int) {}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
@ -173,8 +173,8 @@ class MainActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
UIRunnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed)) { finish() } },
UIRunnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed)) { finish() } }
UIRunnable { OKDialog.show(this, "", rh.gs(R.string.authorizationfailed)) { finish() } },
UIRunnable { OKDialog.show(this, "", rh.gs(R.string.authorizationfailed)) { finish() } }
)
}
@ -184,8 +184,8 @@ class MainActivity : NoSplashAppCompatActivity() {
}
private fun processPreferenceChange(ev: EventPreferenceChange) {
if (ev.isChanged(resourceHelper, R.string.key_keep_screen_on)) setWakeLock()
if (ev.isChanged(resourceHelper, R.string.key_skin)) recreate()
if (ev.isChanged(rh, R.string.key_keep_screen_on)) setWakeLock()
if (ev.isChanged(rh, R.string.key_skin)) recreate()
}
private fun setupViews() {
@ -259,7 +259,7 @@ class MainActivity : NoSplashAppCompatActivity() {
private fun setPluginPreferenceMenuName() {
if (binding.mainPager.currentItem >= 0) {
val plugin = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(binding.mainPager.currentItem)
this.menu?.findItem(R.id.nav_plugin_preferences)?.title = resourceHelper.gs(R.string.nav_preferences_plugin, plugin.name)
this.menu?.findItem(R.id.nav_plugin_preferences)?.title = rh.gs(R.string.nav_preferences_plugin, plugin.name)
}
}
@ -309,18 +309,18 @@ class MainActivity : NoSplashAppCompatActivity() {
R.id.nav_about -> {
var message = "Build: ${BuildConfig.BUILDVERSION}\n"
message += "Flavor: ${BuildConfig.FLAVOR}${BuildConfig.BUILD_TYPE}\n"
message += "${resourceHelper.gs(R.string.configbuilder_nightscoutversion_label)} ${nsSettingsStatus.getVersion()}"
if (buildHelper.isEngineeringMode()) message += "\n${resourceHelper.gs(R.string.engineering_mode_enabled)}"
if (!fabricPrivacy.fabricEnabled()) message += "\n${resourceHelper.gs(R.string.fabric_upload_disabled)}"
message += resourceHelper.gs(R.string.about_link_urls)
message += "${rh.gs(R.string.configbuilder_nightscoutversion_label)} ${nsSettingsStatus.getVersion()}"
if (buildHelper.isEngineeringMode()) message += "\n${rh.gs(R.string.engineering_mode_enabled)}"
if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(R.string.fabric_upload_disabled)}"
message += rh.gs(R.string.about_link_urls)
val messageSpanned = SpannableString(message)
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS)
AlertDialog.Builder(this)
.setTitle(resourceHelper.gs(R.string.app_name) + " " + BuildConfig.VERSION)
.setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION)
.setIcon(iconsProvider.getIcon())
.setMessage(messageSpanned)
.setPositiveButton(resourceHelper.gs(R.string.ok), null)
.setNeutralButton(resourceHelper.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) }
.setPositiveButton(rh.gs(R.string.ok), null)
.setNeutralButton(rh.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) }
.create().apply {
show()
findViewById<TextView>(android.R.id.message)?.movementMethod = LinkMovementMethod.getInstance()

View file

@ -89,8 +89,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
setContentView(binding.root)
// We don't want to use injected singletons but own instance working on top of different data
iobCobCalculator = IobCobCalculatorPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, resourceHelper, profileFunction, activePlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy, dateUtil, repository)
overviewData = OverviewData(injector, aapsLogger, resourceHelper, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loopPlugin, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
iobCobCalculator = IobCobCalculatorPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, rh, profileFunction, activePlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy, dateUtil, repository)
overviewData = OverviewData(injector, aapsLogger, rh, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loopPlugin, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
binding.left.setOnClickListener {
adjustTimeRange(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
@ -158,7 +158,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
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 = resourceHelper.gc(R.color.graphgrid)
binding.bgGraph.gridLabelRenderer?.gridColor = rh.gc(R.color.graphgrid)
binding.bgGraph.gridLabelRenderer?.reloadStyles()
binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
@ -241,8 +241,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
relativeLayout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
val graph = GraphView(this)
graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resourceHelper.dpToPx(100)).also { it.setMargins(0, resourceHelper.dpToPx(15), 0, resourceHelper.dpToPx(10)) }
graph.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid)
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.gc(R.color.graphgrid)
graph.gridLabelRenderer?.reloadStyles()
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
@ -251,7 +251,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
relativeLayout.addView(graph)
val label = TextView(this)
val layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).also { it.setMargins(resourceHelper.dpToPx(30), resourceHelper.dpToPx(25), 0, 0) }
val layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).also { it.setMargins(rh.dpToPx(30), rh.dpToPx(25), 0, 0) }
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP)
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
label.layoutParams = layoutParams

View file

@ -31,7 +31,7 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa
override fun afterTextChanged(s: Editable) {}
})
title = resourceHelper.gs(R.string.nav_preferences)
title = rh.gs(R.string.nav_preferences)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
myPreferenceFragment = MyPreferenceFragment()

View file

@ -140,7 +140,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
val profile = if (typeSelected[tabSelected] == ProfileType.MOTOL_DEFAULT) defaultProfile.profile(age, tdd, weight, profileFunction.getUnits())
else defaultProfileDPV.profile(age, tdd, pct / 100.0, profileFunction.getUnits())
profile?.let {
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile), Runnable {
OKDialog.showConfirmation(this, rh.gs(R.string.careportal_profileswitch), rh.gs(R.string.copytolocalprofile), Runnable {
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(it, "DefaultProfile " +
dateUtil.dateAndTimeAndSecondsString(dateUtil.now())
.replace(".", "/")
@ -242,8 +242,8 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
private fun getProfileName(age: Double, tdd: Double, weight: Double, basalSumPct: Double, tab: Int): String =
when (typeSelected[tab]) {
ProfileType.MOTOL_DEFAULT -> if (tdd > 0) resourceHelper.gs(R.string.formatwithtdd, age, tdd) else resourceHelper.gs(R.string.formatwithweight, age, weight)
ProfileType.DPV_DEFAULT -> resourceHelper.gs(R.string.formatwittddandpct, age, tdd, (basalSumPct * 100).toInt())
ProfileType.MOTOL_DEFAULT -> if (tdd > 0) rh.gs(R.string.formatwithtdd, age, tdd) else rh.gs(R.string.formatwithweight, age, weight)
ProfileType.DPV_DEFAULT -> rh.gs(R.string.formatwittddandpct, age, tdd, (basalSumPct * 100).toInt())
ProfileType.CURRENT -> profileFunction.getProfileName()
ProfileType.AVAILABLE_PROFILE -> profileList[profileUsed[tab]].toString()
ProfileType.PROFILE_SWITCH -> profileSwitch[profileSwitchUsed[tab]].originalCustomizedName
@ -263,16 +263,16 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
tabSelected = tab
typeSelected[tabSelected] = newContent
binding.profiletypeTitle.defaultHintTextColor = ColorStateList.valueOf(resourceHelper.gc(if (tab == 0) R.color.tabBgColorSelected else R.color.examinedProfile))
binding.profiletypeTitle.defaultHintTextColor = ColorStateList.valueOf(rh.gc(if (tab == 0) R.color.tabBgColorSelected else R.color.examinedProfile))
// show new content
binding.profiletype.setText(
when (typeSelected[tabSelected]) {
ProfileType.MOTOL_DEFAULT -> resourceHelper.gs(R.string.motoldefaultprofile)
ProfileType.DPV_DEFAULT -> resourceHelper.gs(R.string.dpvdefaultprofile)
ProfileType.CURRENT -> resourceHelper.gs(R.string.currentprofile)
ProfileType.AVAILABLE_PROFILE -> resourceHelper.gs(R.string.availableprofile)
ProfileType.PROFILE_SWITCH -> resourceHelper.gs(R.string.careportal_profileswitch)
ProfileType.MOTOL_DEFAULT -> rh.gs(R.string.motoldefaultprofile)
ProfileType.DPV_DEFAULT -> rh.gs(R.string.dpvdefaultprofile)
ProfileType.CURRENT -> rh.gs(R.string.currentprofile)
ProfileType.AVAILABLE_PROFILE -> rh.gs(R.string.availableprofile)
ProfileType.PROFILE_SWITCH -> rh.gs(R.string.careportal_profileswitch)
})
binding.defaultProfile.visibility = (newContent == ProfileType.MOTOL_DEFAULT || newContent == ProfileType.DPV_DEFAULT).toVisibility()
binding.currentProfile.visibility = (newContent == ProfileType.CURRENT).toVisibility()
@ -293,7 +293,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
}
private fun setBackgroundColorOnSelected(tab: Int) {
binding.menu1.setBackgroundColor(resourceHelper.gc(if (tab == 1) R.color.defaultbackground else R.color.tempbasal))
binding.menu2.setBackgroundColor(resourceHelper.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile))
binding.menu1.setBackgroundColor(rh.gc(if (tab == 1) R.color.defaultbackground else R.color.tempbasal))
binding.menu2.setBackgroundColor(rh.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile))
}
}

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.databinding.ActivityStatsBinding
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.stats.TddCalculator
import info.nightscout.androidaps.utils.stats.TirCalculator
import javax.inject.Inject
@ -28,9 +29,9 @@ class StatsActivity : NoSplashAppCompatActivity() {
binding = ActivityStatsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.tdds.text = getString(R.string.tdd) + ": " + getString(R.string.calculation_in_progress)
binding.tir.text = getString(R.string.tir) + ": " + getString(R.string.calculation_in_progress)
binding.activity.text = getString(R.string.activitymonitor) + ": " + getString(R.string.calculation_in_progress)
binding.tdds.text = getString(R.string.tdd) + ": " + rh.gs(R.string.calculation_in_progress)
binding.tir.text = getString(R.string.tir) + ": " + rh.gs(R.string.calculation_in_progress)
binding.activity.text = rh.gs(R.string.activitymonitor) + ": " + rh.gs(R.string.calculation_in_progress)
Thread {
val tdds = tddCalculator.stats()
@ -47,7 +48,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
binding.ok.setOnClickListener { finish() }
binding.reset.setOnClickListener {
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
OKDialog.showConfirmation(this, rh.gs(R.string.doyouwantresetstats)) {
uel.log(Action.STAT_RESET, Sources.Stats)
activityMonitor.reset()
recreate()

View file

@ -67,14 +67,14 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
}
private fun setBackgroundColorOnSelected(selected: View) {
binding.treatments.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.extendedBoluses.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.tempBasals.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.tempTargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.profileSwitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.careportal.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
binding.userentry.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected))
binding.treatments.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.extendedBoluses.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.tempBasals.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.tempTargets.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.profileSwitches.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.careportal.setBackgroundColor(rh.gc(R.color.defaultbackground))
binding.userentry.setBackgroundColor(rh.gc(R.color.defaultbackground))
selected.setBackgroundColor(rh.gc(R.color.tabBgColorSelected))
}
}

View file

@ -38,6 +38,7 @@ import java.text.DecimalFormat
import java.util.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import kotlin.collections.ArrayList
class ProfileSwitchDialog : DialogFragmentWithDate() {
@ -113,7 +114,17 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
context?.let { context ->
val profileStore = activePlugin.activeProfileSource.profile
?: return
val profileList = profileStore.getProfileList()
val profileListToCheck = profileStore.getProfileList()
val profileList = ArrayList<CharSequence>()
for (profileName in profileListToCheck) {
val profileToCheck = activePlugin.activeProfileSource.profile?.getSpecificProfile(profileName.toString())
if (profileToCheck != null && ProfileSealed.Pure(profileToCheck).isValid("ProfileSwitch", activePlugin.activePump, config, resourceHelper, rxBus, hardLimits, false).isValid)
profileList.add(profileName)
}
if (profileList.isEmpty()) {
dismiss()
return
}
val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
binding.profile.adapter = adapter
// set selected to actual profile
@ -123,7 +134,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
for (p in profileList.indices)
if (profileList[p] == profileFunction.getOriginalProfileName())
binding.profile.setSelection(p)
} ?: return
}
profileFunction.getProfile()?.let { profile ->
if (profile is ProfileSealed.EPS)
@ -137,6 +148,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
} else {
binding.reuselayout.visibility = View.GONE
}
else binding.reuselayout.visibility = View.GONE
}
binding.ttLayout.visibility = View.GONE
}
@ -177,47 +189,49 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
actions.add(resourceHelper.gs(R.string.careportal_temporarytarget) + ": " + resourceHelper.gs(R.string.activity))
activity?.let { activity ->
val ps = profileFunction.buildProfileSwitch(profileStore, profileName, duration, percent, timeShift, eventTime)
val ps = profileFunction.buildProfileSwitch(profileStore, profileName, duration, percent, timeShift, eventTime) ?: return@let
val validity = ProfileSealed.PS(ps).isValid(resourceHelper.gs(R.string.careportal_profileswitch), activePlugin.activePump, config, resourceHelper, rxBus, hardLimits, false)
if (validity.isValid)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
profileFunction.createProfileSwitch(
profileStore,
profileName = profileName,
durationInMinutes = duration,
percentage = percent,
timeShiftInHours = timeShift,
timestamp = eventTime
)
uel.log(Action.PROFILE_SWITCH,
Sources.ProfileSwitchDialog,
notes,
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
ValueWithUnit.SimpleString(profileName),
ValueWithUnit.Percent(percent),
ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 },
ValueWithUnit.Minute(duration).takeIf { duration != 0 })
if (percent == 90 && duration == 10) sp.putBoolean(R.string.key_objectiveuseprofileswitch, true)
if (isTT) {
disposable += repository.runTransactionForResult(
InsertAndCancelCurrentTemporaryTargetTransaction(
timestamp = eventTime,
duration = TimeUnit.MINUTES.toMillis(duration.toLong()),
reason = TemporaryTarget.Reason.ACTIVITY,
lowTarget = Profile.toMgdl(target, profileFunction.getUnits()),
highTarget = Profile.toMgdl(target, profileFunction.getUnits())
)
).subscribe({ result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
})
uel.log(
Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
TemporaryTarget.Reason.ACTIVITY
), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration)
if (profileFunction.createProfileSwitch(
profileStore,
profileName = profileName,
durationInMinutes = duration,
percentage = percent,
timeShiftInHours = timeShift,
timestamp = eventTime
)
) {
uel.log(Action.PROFILE_SWITCH,
Sources.ProfileSwitchDialog,
notes,
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
ValueWithUnit.SimpleString(profileName),
ValueWithUnit.Percent(percent),
ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 },
ValueWithUnit.Minute(duration).takeIf { duration != 0 })
if (percent == 90 && duration == 10) sp.putBoolean(R.string.key_objectiveuseprofileswitch, true)
if (isTT) {
disposable += repository.runTransactionForResult(
InsertAndCancelCurrentTemporaryTargetTransaction(
timestamp = eventTime,
duration = TimeUnit.MINUTES.toMillis(duration.toLong()),
reason = TemporaryTarget.Reason.ACTIVITY,
lowTarget = Profile.toMgdl(target, profileFunction.getUnits()),
highTarget = Profile.toMgdl(target, profileFunction.getUnits())
)
).subscribe({ result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
})
uel.log(
Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
TemporaryTarget.Reason.ACTIVITY
), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration)
)
}
}
})
else {

View file

@ -114,9 +114,9 @@ class OpenAPSAMAPlugin @Inject constructor(
val maxIob = constraintChecker.getMaxIOBAllowed().also { maxIOBAllowedConstraint ->
inputConstraints.copyReasons(maxIOBAllowedConstraint)
}.value()
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1])
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_MAX_BG[1])
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TARGET_BG[1])
var isTempTarget = false
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
if (tempTarget is ValueWrapper.Existing) {

View file

@ -119,9 +119,9 @@ class OpenAPSSMBPlugin @Inject constructor(
inputConstraints.copyReasons(maxIOBAllowedConstraint)
}.value()
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble())
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble())
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble())
var minBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetLowMgdl(), 0.1), R.string.profile_low_target, HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1])
var maxBg = hardLimits.verifyHardLimits(Round.roundTo(profile.getTargetHighMgdl(), 0.1), R.string.profile_high_target, HardLimits.VERY_HARD_LIMIT_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_MAX_BG[1])
var targetBg = hardLimits.verifyHardLimits(profile.getTargetMgdl(), R.string.temp_target_value, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TARGET_BG[1])
var isTempTarget = false
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
if (tempTarget is ValueWrapper.Existing) {

View file

@ -141,9 +141,8 @@ class ProfileFunctionImplementation @Inject constructor(
if (sp.getString(R.string.key_units, Constants.MGDL) == Constants.MGDL) GlucoseUnit.MGDL
else GlucoseUnit.MMOL
override fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch {
val pureProfile = profileStore.getSpecificProfile(profileName)
?: throw InvalidParameterSpecException(profileName)
override fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch? {
val pureProfile = profileStore.getSpecificProfile(profileName) ?: return null
return ProfileSwitch(
timestamp = timestamp,
basalBlocks = pureProfile.basalBlocks,
@ -161,8 +160,8 @@ class ProfileFunctionImplementation @Inject constructor(
)
}
override fun createProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long) {
val ps = buildProfileSwitch(profileStore, profileName, durationInMinutes, percentage, timeShiftInHours, timestamp)
override fun createProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): Boolean {
val ps = buildProfileSwitch(profileStore, profileName, durationInMinutes, percentage, timeShiftInHours, timestamp) ?: return false
disposable += repository.runTransactionForResult(InsertOrUpdateProfileSwitch(ps))
.subscribe({ result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted ProfileSwitch $it") }
@ -170,12 +169,13 @@ class ProfileFunctionImplementation @Inject constructor(
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving ProfileSwitch", it)
})
return true
}
override fun createProfileSwitch(durationInMinutes: Int, percentage: Int, timeShiftInHours: Int): Boolean {
val profile = repository.getPermanentProfileSwitch(dateUtil.now()) ?: return false
val profileStore = activePlugin.activeProfileSource.profile ?: return false
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now())
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
val validity = ProfileSealed.PS(ps).isValid(
resourceHelper.gs(info.nightscout.androidaps.automation.R.string.careportal_profileswitch),
activePlugin.activePump,

View file

@ -18,7 +18,6 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import java.util.*
import javax.inject.Inject
import javax.inject.Singleton
@ -195,7 +194,7 @@ class NSDeviceStatus @Inject constructor(
if (clock == 0L || deviceStatusData.pumpData != null && clock < deviceStatusData.pumpData!!.clock) return
// create new status and process data
var deviceStatusPumpData = DeviceStatusData.PumpData()
val deviceStatusPumpData = DeviceStatusData.PumpData()
deviceStatusPumpData.clock = clock
if (pump.has("status") && pump.getJSONObject("status").has("status")) deviceStatusPumpData.status = pump.getJSONObject("status").getString("status")
if (pump.has("reservoir")) deviceStatusPumpData.reservoir = pump.getDouble("reservoir")

View file

@ -326,6 +326,7 @@ class OverviewData @Inject constructor(
if (bg.value > maxBgValue) maxBgValue = bg.value
bgListArray.add(GlucoseValueDataPoint(bg, defaultValueHelper, profileFunction, resourceHelper))
}
bgListArray.sortWith { o1: DataPointWithLabelInterface, o2: DataPointWithLabelInterface -> o1.x.compareTo(o2.x) }
bgReadingGraphSeries = PointsWithLabelGraphSeries(Array(bgListArray.size) { i -> bgListArray[i] })
maxBgValue = Profile.fromMgdlToUnits(maxBgValue, profileFunction.getUnits())
if (defaultValueHelper.determineHighLine() > maxBgValue) maxBgValue = defaultValueHelper.determineHighLine()
@ -388,6 +389,7 @@ class OverviewData @Inject constructor(
if (inMemoryGlucoseValue.timestamp < fromTime || inMemoryGlucoseValue.timestamp > toTime) continue
bucketedListArray.add(InMemoryGlucoseValueDataPoint(inMemoryGlucoseValue, profileFunction, resourceHelper))
}
bucketedListArray.sortWith { o1: DataPointWithLabelInterface, o2: DataPointWithLabelInterface -> o1.x.compareTo(o2.x) }
bucketedGraphSeries = PointsWithLabelGraphSeries(Array(bucketedListArray.size) { i -> bucketedListArray[i] })
// profiler.log(LTag.UI, "prepareBucketedData() $from", start)
}

View file

@ -45,7 +45,7 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() {
holder.from.text = dateUtil.timeString(quickWizard[position].validFromDate())
holder.to.text = dateUtil.timeString(quickWizard[position].validToDate())
holder.buttonText.text = quickWizard[position].buttonText()
holder.carbs.text = resourceHelper.gs(R.string.format_carbs, quickWizard[position].carbs())
holder.carbs.text = rh.gs(R.string.format_carbs, quickWizard[position].carbs())
}
override fun getItemCount(): Int = quickWizard.size()

View file

@ -14,6 +14,7 @@ import androidx.core.app.NotificationCompat
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OverviewNotificationItemBinding
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.IconsProvider
import info.nightscout.androidaps.interfaces.NotificationHolder
import info.nightscout.androidaps.logging.AAPSLogger
@ -150,7 +151,8 @@ class NotificationStore @Inject constructor(
}
}
inner class NotificationRecyclerViewAdapter internal constructor(private val notificationsList: List<Notification>) : RecyclerView.Adapter<NotificationRecyclerViewAdapter.NotificationsViewHolder>() {
inner class NotificationRecyclerViewAdapter internal constructor(private val notificationsList: List<Notification>) :
RecyclerView.Adapter<NotificationRecyclerViewAdapter.NotificationsViewHolder>() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): NotificationsViewHolder =
NotificationsViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.overview_notification_item, viewGroup, false))
@ -182,8 +184,9 @@ class NotificationStore @Inject constructor(
init {
binding.dismiss.setOnClickListener {
val notification = it.tag as Notification
rxBus.send(EventDismissNotification(notification.id))
notification.contextForAction = itemView.context
notification.action?.run()
if (remove(notification.id)) rxBus.send(EventRefreshOverview("NotificationCleared"))
}
}
}

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.plusAssign
import javax.inject.Inject
import javax.inject.Singleton
@ -42,14 +43,15 @@ class PersistentNotificationPlugin @Inject constructor(
private val dummyServiceHelper: DummyServiceHelper,
private val iconsProvider: IconsProvider,
private val glucoseStatusProvider: GlucoseStatusProvider
) : PluginBase(PluginDescription()
.mainType(PluginType.GENERAL)
.neverVisible(true)
.pluginName(R.string.ongoingnotificaction)
.enableByDefault(true)
.alwaysEnabled(true)
.showInList(false)
.description(R.string.description_persistent_notification),
) : PluginBase(
PluginDescription()
.mainType(PluginType.GENERAL)
.neverVisible(true)
.pluginName(R.string.ongoingnotificaction)
.enableByDefault(true)
.alwaysEnabled(true)
.showInList(false)
.description(R.string.description_persistent_notification),
aapsLogger, resourceHelper, injector
) {
@ -63,49 +65,48 @@ class PersistentNotificationPlugin @Inject constructor(
// End Android auto
private val disposable = CompositeDisposable()
private var channel: NotificationChannel? = null
override fun onStart() {
super.onStart()
createNotificationChannel() // make sure channels exist before triggering updates through the bus
disposable.add(rxBus
disposable += rxBus
.toObservable(EventRefreshOverview::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventExtendedBolusChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventTempBasalChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventTreatmentChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventInitializationChanged::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventEffectiveProfileSwitchChanged::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventAutosensCalculationFinished::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
disposable.add(rxBus
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException))
triggerNotificationUpdate()
.subscribe({ triggerNotificationUpdate() }, fabricPrivacy::logException)
}
private fun createNotificationChannel() {
val mNotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channel = NotificationChannel(notificationHolder.channelID, notificationHolder.channelID as CharSequence, NotificationManager.IMPORTANCE_HIGH)
mNotificationManager.createNotificationChannel(channel)
channel = NotificationChannel(notificationHolder.channelID, notificationHolder.channelID as CharSequence, NotificationManager.IMPORTANCE_HIGH)
channel?.let { mNotificationManager.createNotificationChannel(it) }
}
override fun onStop() {
@ -115,6 +116,8 @@ class PersistentNotificationPlugin @Inject constructor(
}
private fun triggerNotificationUpdate() {
if (channel == null)
createNotificationChannel() // make sure channels exist before triggering updates through the bus
updateNotification()
dummyServiceHelper.startService(context)
}
@ -155,8 +158,16 @@ class PersistentNotificationPlugin @Inject constructor(
//IOB
val bolusIob = iobCobCalculator.calculateIobFromBolus().round()
val basalIob = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round()
line2 = resourceHelper.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + resourceHelper.gs(R.string.cob) + ": " + iobCobCalculator.getCobInfo(false, "PersistentNotificationPlugin").generateCOBString()
val line2aa = resourceHelper.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U. " + resourceHelper.gs(R.string.cob) + ": " + iobCobCalculator.getCobInfo(false, "PersistentNotificationPlugin").generateCOBString() + "."
line2 =
resourceHelper.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + resourceHelper.gs(R.string.cob) + ": " + iobCobCalculator.getCobInfo(
false,
"PersistentNotificationPlugin"
).generateCOBString()
val line2aa =
resourceHelper.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U. " + resourceHelper.gs(R.string.cob) + ": " + iobCobCalculator.getCobInfo(
false,
"PersistentNotificationPlugin"
).generateCOBString() + "."
line3 = DecimalFormatter.to2Decimal(pump.baseBasalRate) + " U/h"
var line3aa = DecimalFormatter.to2Decimal(pump.baseBasalRate) + " U/h."
line3 += " - " + profileFunction.getProfileName()
@ -167,10 +178,12 @@ class PersistentNotificationPlugin @Inject constructor(
.setAction(READ_ACTION)
.putExtra(CONVERSATION_ID, notificationHolder.notificationID)
.setPackage(PACKAGE)
val msgReadPendingIntent = PendingIntent.getBroadcast(context,
val msgReadPendingIntent = PendingIntent.getBroadcast(
context,
notificationHolder.notificationID,
msgReadIntent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
val msgReplyIntent = Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(REPLY_ACTION)
@ -180,7 +193,8 @@ class PersistentNotificationPlugin @Inject constructor(
context,
notificationHolder.notificationID,
msgReplyIntent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
// Build a RemoteInput for receiving voice input from devices
val remoteInput = RemoteInput.Builder(EXTRA_VOICE_REPLY).build()
// Create the UnreadConversation
@ -205,8 +219,10 @@ class PersistentNotificationPlugin @Inject constructor(
if (line3 != null) builder.setSubText(line3)
/// Android Auto
if (unreadConversationBuilder != null) {
builder.extend(NotificationCompat.CarExtender()
.setUnreadConversation(unreadConversationBuilder.build()))
builder.extend(
NotificationCompat.CarExtender()
.setUnreadConversation(unreadConversationBuilder.build())
)
}
/// End Android Auto
builder.setContentIntent(notificationHolder.openAppIntent(context))

View file

@ -605,11 +605,16 @@ class SmsCommunicatorPlugin @Inject constructor(
val finalPercentage = percentage
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = true, list[pIndex - 1] as String, finalPercentage) {
override fun run() {
profileFunction.createProfileSwitch(store, list[pIndex - 1] as String, 0, finalPercentage, 0, dateUtil.now())
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.PROFILE_SWITCH, Sources.SMS, resourceHelper.gs(R.string.profileswitchcreated),
ValueWithUnit.SimpleString(resourceHelper.gsNotLocalised(R.string.profileswitchcreated)))
if (profileFunction.createProfileSwitch(store, list[pIndex - 1] as String, 0, finalPercentage, 0, dateUtil.now())) {
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(
Action.PROFILE_SWITCH, Sources.SMS, resourceHelper.gs(R.string.profileswitchcreated),
ValueWithUnit.SimpleString(resourceHelper.gsNotLocalised(R.string.profileswitchcreated))
)
} else {
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.invalidprofile)))
}
}
})
}
@ -1127,6 +1132,7 @@ class SmsCommunicatorPlugin @Inject constructor(
var s = str
s = Normalizer.normalize(s, Normalizer.Form.NFD)
s = s.replace("[\\p{InCombiningDiacriticalMarks}]".toRegex(), "")
s = s.replace("ł", "l") // hack for Polish language (bug in libs)
return s
}

View file

@ -71,25 +71,25 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
binding.otpReset.setOnClickListener {
OKDialog.showConfirmation(this,
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
rh.gs(R.string.smscommunicator_otp_reset_title),
rh.gs(R.string.smscommunicator_otp_reset_prompt),
Runnable {
uel.log(Action.OTP_RESET, Sources.SMS)
otp.ensureKey(true)
updateGui()
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_reset_successful))
ToastUtils.Long.infoToast(this, rh.gs(R.string.smscommunicator_otp_reset_successful))
})
}
binding.otpProvisioning.setOnLongClickListener {
OKDialog.showConfirmation(this,
resourceHelper.gs(R.string.smscommunicator_otp_export_title),
resourceHelper.gs(R.string.smscommunicator_otp_export_prompt),
rh.gs(R.string.smscommunicator_otp_export_title),
rh.gs(R.string.smscommunicator_otp_export_prompt),
Runnable {
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
clipboard.setPrimaryClip(clip)
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_export_successful))
ToastUtils.Long.infoToast(this, rh.gs(R.string.smscommunicator_otp_export_successful))
uel.log(Action.OTP_EXPORT, Sources.SMS)
})

View file

@ -126,16 +126,16 @@ class LocalProfileFragment : DaggerFragment() {
binding.name.removeTextChangedListener(textWatch)
binding.name.setText(currentProfile.name)
binding.name.addTextChangedListener(textWatch)
binding.dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, binding.save, textWatch)
binding.dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, null, textWatch)
binding.dia.tag = "LP_DIA"
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.basal_holder, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, pumpDescription.basalMaximumRate, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, HardLimits.MIN_ISF, HardLimits.MAX_ISF, 1.0, DecimalFormat("0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, HardLimits.VERY_HARD_LIMIT_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TARGET_BG[1], 1.0, DecimalFormat("0"), save)
} else {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, Profile.fromMgdlToUnits(HardLimits.MIN_ISF, GlucoseUnit.MMOL), Profile.fromMgdlToUnits(HardLimits.MAX_ISF, GlucoseUnit.MMOL), 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), GlucoseUnit.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), GlucoseUnit.MMOL), 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0], GlucoseUnit.MMOL), Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1], GlucoseUnit.MMOL), 0.1, DecimalFormat("0.0"), save)
}
// Spinner

View file

@ -18,13 +18,12 @@ import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.receivers.DataWorker
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.JsonHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -48,7 +47,8 @@ class LocalProfilePlugin @Inject constructor(
private val profileFunction: ProfileFunction,
private val activePlugin: ActivePlugin,
private val hardLimits: HardLimits,
private val dateUtil: DateUtil
private val dateUtil: DateUtil,
private val config: Config
) : PluginBase(PluginDescription()
.mainType(PluginType.PROFILE)
.fragmentClass(LocalProfileFragment::class.java.name)
@ -122,25 +122,25 @@ class LocalProfilePlugin @Inject constructor(
}
val low = blockFromJsonArray(targetLow, dateUtil)
val high = blockFromJsonArray(targetHigh, dateUtil)
if (profileFunction.getUnits() == GlucoseUnit.MGDL) {
if (blockFromJsonArray(isf, dateUtil)?.any { it.amount < HardLimits.MIN_ISF || it.amount > HardLimits.MAX_ISF } != false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_isf_values))
if (mgdl) {
if (blockFromJsonArray(isf, dateUtil)?.any { hardLimits.isInRange(it.amount, HardLimits.MIN_ISF, HardLimits.MAX_ISF) } == false) {
ToastUtils.errorToast(activity, resourceHelper.gs(R.string.error_in_isf_values))
return false
}
if (blockFromJsonArray(basal, dateUtil)?.any { it.amount < pumpDescription.basalMinimumRate || it.amount > 10.0 } != false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_basal_values))
return false
}
if (low?.any { it.amount < HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble() || it.amount > HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble() } != false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
if (low?.any { hardLimits.isInRange(it.amount, HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1]) } == false) {
ToastUtils.errorToast(activity, resourceHelper.gs(R.string.error_in_target_values))
return false
}
if (high?.any { it.amount < HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble() || it.amount > HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble() } != false) {
if (high?.any { hardLimits.isInRange(it.amount, HardLimits.VERY_HARD_LIMIT_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_MAX_BG[1]) } == false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
return false
}
} else {
if (blockFromJsonArray(isf, dateUtil)?.any { it.amount < Profile.fromMgdlToUnits(HardLimits.MIN_ISF, GlucoseUnit.MMOL) || it.amount > Profile.fromMgdlToUnits(HardLimits.MAX_ISF, GlucoseUnit.MMOL) } != false) {
if (blockFromJsonArray(isf, dateUtil)?.any { hardLimits.isInRange(Profile.toMgdl(it.amount, GlucoseUnit.MMOL), HardLimits.MIN_ISF, HardLimits.MAX_ISF) } == false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_isf_values))
return false
}
@ -148,18 +148,22 @@ class LocalProfilePlugin @Inject constructor(
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_basal_values))
return false
}
if (low?.any { it.amount < Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), GlucoseUnit.MMOL) || it.amount > Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), GlucoseUnit.MMOL) } != false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
if (low?.any { hardLimits.isInRange(Profile.toMgdl(it.amount, GlucoseUnit.MMOL), HardLimits.VERY_HARD_LIMIT_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_MIN_BG[1]) } == false) {
ToastUtils.errorToast(activity, resourceHelper.gs(R.string.error_in_target_values))
return false
}
if (high?.any { it.amount < Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), GlucoseUnit.MMOL) || it.amount > Profile.fromMgdlToUnits(HardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), GlucoseUnit.MMOL) } != false) {
if (high?.any { hardLimits.isInRange(Profile.toMgdl(it.amount, GlucoseUnit.MMOL), HardLimits.VERY_HARD_LIMIT_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_MAX_BG[1]) } == false) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
return false
}
}
for (i in low.indices) if (low[i].amount > high[i].amount) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
return false
low?.let {
high?.let {
for (i in low.indices) if (low[i].amount > high[i].amount) {
ToastUtils.errorToast(activity,resourceHelper.gs(R.string.error_in_target_values))
return false
}
}
}
}
return true
@ -251,10 +255,25 @@ class LocalProfilePlugin @Inject constructor(
try {
val newProfiles: ArrayList<SingleProfile> = ArrayList()
for (p in store.getProfileList()) {
store.getSpecificProfile(p.toString())?.let {
val sp = copyFrom(it, p.toString())
val profile = store.getSpecificProfile(p.toString())
val validityCheck = profile?.let { ProfileSealed.Pure(profile).isValid("NS", activePlugin.activePump, config, resourceHelper, rxBus, hardLimits, false) } ?: Profile.ValidityCheck()
if (profile != null && validityCheck.isValid) {
val sp = copyFrom(profile, p.toString())
sp.name = p.toString()
newProfiles.add(sp)
} else {
val n = NotificationWithAction(
injector,
Notification.INVALID_PROFILE_NOT_ACCEPTED,
resourceHelper.gs(R.string.invalid_profile_not_accepted, p.toString()),
Notification.NORMAL
)
n.action(R.string.view) {
n.contextForAction?.let {
OKDialog.show(it, resourceHelper.gs(R.string.errors), validityCheck.reasons.joinToString(separator = "\n"), null)
}
}
rxBus.send(EventNewNotification(n))
}
}
if (newProfiles.size > 0) {
@ -458,7 +477,7 @@ class LocalProfilePlugin @Inject constructor(
?: return Result.failure(workDataOf("Error" to "missing input data"))
if (sp.getBoolean(R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) {
val store = ProfileStore(injector, profileJson, dateUtil)
val createdAt = store.getCreatedAt()
val createdAt = store.getStartDate()
val lastLocalChange = sp.getLong(R.string.key_local_profile_last_change, 0)
aapsLogger.debug(LTag.PROFILE, "Received profileStore: createdAt: $createdAt Local last modification: $lastLocalChange")
@Suppress("LiftReturnOrAssignment")

View file

@ -145,13 +145,13 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
}
override fun onBackPressed() {
if (currentWizardPage == 0) OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
if (currentWizardPage == 0) OKDialog.showConfirmation(this, rh.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
}
@Suppress("UNUSED_PARAMETER")
fun exitPressed(view: View?) {
sp.putBoolean(R.string.key_setupwizard_processed, true)
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.exitwizard)) { finish() }
OKDialog.showConfirmation(this, rh.gs(R.string.exitwizard)) { finish() }
}
@Suppress("UNUSED_PARAMETER")

View file

@ -892,4 +892,5 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="error_in_basal_values">Erreur dans les valeurs de basal</string>
<string name="error_in_target_values">Erreur dans les valeurs cibles</string>
<string name="error_in_isf_values">Erreur dans les valeurs de SI</string>
<string name="run_question">Exécuter %s?</string>
</resources>

View file

@ -678,6 +678,7 @@
<string name="resettodefaults">Ripristina valori predefiniti</string>
<string name="nsmalfunction">Malfunzionamento NSClient. Considera il riavvio di NS e NSClient.</string>
<string name="time_offset">Offset</string>
<string name="bolus_reminder">Ricorda di fare il bolo</string>
<string name="setupwizard_preferred_aps_mode">Modalità APS preferita</string>
<string name="treatments_wizard_total_label">Totale</string>
<string name="calculation_short">Calc</string>
@ -844,6 +845,9 @@
<string name="enablebolusadvisor_summary">Usa un promemoria per iniziare a mangiare invece del risultato del calcolatore durante la glicemia alta (\"pre-bolo\")</string>
<string name="time_to_eat">Tempo di mangiare!\nEsegui il calcolatore e fai di nuovi i calcoli.</string>
<string name="timetoeat">Tempo di mangiare</string>
<string name="bolusreminder">Promemoria bolo</string>
<string name="enablebolusreminder">Abilita promemoria bolo</string>
<string name="time_to_bolus">Tempo di fare un bolo!\nEsegui il calcolatore e fai di nuovi i calcoli.</string>
<string name="fabric_upload_disabled">Caricamento log dei crash disabilitato!</string>
<string name="graph_menu_divider_header">Grafico</string>
<string name="chart_menu">Menu grafico</string>
@ -886,4 +890,5 @@
<string name="error_in_basal_values">Errore nei valori della basale</string>
<string name="error_in_target_values">Errore nei valori del target</string>
<string name="error_in_isf_values">Errore nei valori ISF</string>
<string name="run_question">Eseguire %s?</string>
</resources>

View file

@ -247,7 +247,7 @@
<string name="wear">Wear</string>
<string name="resend_all_data">שלח מחדש את כל הנתונים</string>
<string name="open_settings_on_wear">פתיחת הגדרות Wear</string>
<string name="basal_rate">ערכים בזאליים:</string>
<string name="basal_rate">מינונים בזאליים:</string>
<string name="basalvaluebelowminimum">ערך הבסיס מתחת למינימום. פרופיל אינו מוגדר!</string>
<string name="sms_actualbg">ערכי סוכר בדם:</string>
<string name="sms_lastbg">ערכי סוכר אחרונים:</string>
@ -892,4 +892,5 @@
<string name="error_in_basal_values">שגיאה בערכי המינון הבזאלי</string>
<string name="error_in_target_values">שגיאה בערכי המטרה</string>
<string name="error_in_isf_values">שגיאה בערכי יחס התיקון</string>
<string name="run_question">להפעיל %s?</string>
</resources>

View file

@ -432,7 +432,7 @@
<string name="mdtp_cancel">Afbreken</string>
<string name="notloadedplugins">Niet alle profielen zijn geladen!</string>
<string name="valuesnotstored">Waarden niet opgeslagen!</string>
<string name="ns_localbroadcasts">Schakel lokaal data delen naar andere apps (zoals xDrip) in. Schakel dit niet in als je NSClient of meer dan één installatie van AAPS op je telefoon hebt staan!</string>
<string name="ns_localbroadcasts">Schakel lokaal data delen met andere apps (zoals xDrip) in. Schakel dit niet in als er meer dan één installatie van AAPS of NSClient zijn geinstalleerd!</string>
<string name="ns_localbroadcasts_title">Activeer locaal delen.</string>
<string name="openapssmb">OpenAPS SMB</string>
<string name="enableuam">Activeer UAM</string>
@ -678,6 +678,7 @@
<string name="resettodefaults">Terug naar standaardinstellingen</string>
<string name="nsmalfunction">NSClient werkt niet goed. Overweg een herstart van NS en NSClient.</string>
<string name="time_offset">Tijdverschuiving</string>
<string name="bolus_reminder">Herinner later te bolussen</string>
<string name="setupwizard_preferred_aps_mode">Voorkeur APS-modus</string>
<string name="treatments_wizard_total_label">Totaal</string>
<string name="calculation_short">Calc</string>
@ -844,6 +845,11 @@
<string name="enablebolusadvisor_summary">Gebruik bij een hoge bloedglucose niet het resultaat van de wizard, maar een herinnering om later met eten te beginnen (\"pre-bolus\")</string>
<string name="time_to_eat">Tijd om te eten!\nVoer de boluswizard opnieuw uit.</string>
<string name="timetoeat">Tijd om te eten</string>
<string name="bolusreminder">Bolus herinnering</string>
<string name="enablebolusreminder">Bolus herinnering inschakelen</string>
<string name="enablebolusreminder_summary">Gebruik herinnering om later te bolussen met de wizard
(\"post-bolus\")</string>
<string name="time_to_bolus">Tijd om te bolussen!\nVoer de boluswizard uit en maak de berekening opnieuw.</string>
<string name="fabric_upload_disabled">Upload van crashrapporten is uitgeschakeld!</string>
<string name="graph_menu_divider_header">Grafiek</string>
<string name="chart_menu">Grafiek menu</string>

View file

@ -678,6 +678,7 @@
<string name="resettodefaults">Gjenopprett standardinnstillinger</string>
<string name="nsmalfunction">NSClient feil. Vurder omstart av NS og NSClient.</string>
<string name="time_offset">Tidsforskyvning</string>
<string name="bolus_reminder">Påminnelse til å gi bolus senere</string>
<string name="setupwizard_preferred_aps_mode">Foretrukket APS modus</string>
<string name="treatments_wizard_total_label">Total</string>
<string name="calculation_short">Kalkyle</string>
@ -844,6 +845,11 @@
<string name="enablebolusadvisor_summary">Bruk en påminnelse om å spise senere enn kalkulator resultatet fra wizard ved høyt blodsukker (\"pre-bolus\")</string>
<string name="time_to_eat">Nå må du spise!\Bruk bolus veiviseren og beregn på nytt.</string>
<string name="timetoeat">Nå må du spise</string>
<string name="bolusreminder">Bolus påminnelse</string>
<string name="enablebolusreminder">Aktiver bolus påminnelse</string>
<string name="enablebolusreminder_summary">Bruk påminnelse for å sette bolus dosen senere med veiviseren
(«post bolus»)</string>
<string name="time_to_bolus">Tid for bolus!\nStart bolus-veiviser og gjør beregning på nytt.</string>
<string name="fabric_upload_disabled">Opplast av krasj logger er deaktivert!</string>
<string name="graph_menu_divider_header">Graf</string>
<string name="chart_menu">Diagram meny</string>
@ -886,4 +892,5 @@
<string name="error_in_basal_values">Feil i basalverdiene</string>
<string name="error_in_target_values">Feil i BS mål verdiene</string>
<string name="error_in_isf_values">Feil i IF verdien</string>
<string name="run_question">Kjør %s?</string>
</resources>

View file

@ -893,4 +893,5 @@ Context | Edit Context</string>
<string name="error_in_basal_values">Ошибка в величине базала</string>
<string name="error_in_target_values">Ошибка в целевых значениях</string>
<string name="error_in_isf_values">Ошибка в значении фактора чувствительности к инсулину ISF</string>
<string name="run_question">Запустить %s?</string>
</resources>

View file

@ -1125,5 +1125,8 @@
<string name="error_in_target_values">Error in target values</string>
<string name="error_in_isf_values">Error in ISF values</string>
<string name="run_question">Run %s?</string>
<string name="invalid_profile_not_accepted">Invalid profile %1$s not accepted from NS</string>
<string name="view">View</string>
<string name="errors">Errors</string>
</resources>

View file

@ -225,6 +225,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
`when`(resourceHelper.gs(R.string.smscommunicator_pumpdisconnected)).thenReturn("Pump disconnected")
`when`(resourceHelper.gs(R.string.smscommunicator_code_from_authenticator_for)).thenReturn("from Authenticator app for: %1\$s followed by PIN")
`when`(resourceHelper.gs(R.string.patient_name_default)).thenReturn("User")
`when`(resourceHelper.gs(R.string.invalidprofile)).thenReturn("Invalid profile !!!")
`when`(resourceHelper.gsNotLocalised(R.string.loopsuspended)).thenReturn("Loop suspended")
`when`(resourceHelper.gsNotLocalised(R.string.smscommunicator_stoppedsms)).thenReturn("SMS Remote Service stopped. To reactivate it, use AAPS on master smartphone.")
`when`(resourceHelper.gsNotLocalised(R.string.profileswitchcreated)).thenReturn("Profile switch created")
@ -707,6 +708,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
Assert.assertTrue(smsCommunicatorPlugin.messages[1].text.contains("To switch profile to someProfile 100% reply with code"))
//PROFILE 1 90(OK)
`when`(profileFunction.createProfileSwitch(anyObject(), Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), anyLong())).thenReturn(true)
smsCommunicatorPlugin.messages = ArrayList()
sms = Sms("1234", "PROFILE 1 90")
smsCommunicatorPlugin.processSms(sms)

View file

@ -62,8 +62,8 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation, title,
ValueWithUnit.SimpleString(inputProfileName.value),
ValueWithUnit.Percent(100))
profileFunction.createProfileSwitch(profileStore, inputProfileName.value, 0, 100, 0, dateUtil.now())
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
val result = profileFunction.createProfileSwitch(profileStore, inputProfileName.value, 0, 100, 0, dateUtil.now())
callback.result(PumpEnactResult(injector).success(result).comment(R.string.ok))?.run()
}
override fun generateDialog(root: LinearLayout) {

View file

@ -52,10 +52,11 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
ValueWithUnit.Percent(pct.value.toInt()),
ValueWithUnit.Minute(duration.value)
)
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
} else {
aapsLogger.error(LTag.AUTOMATION, "Final profile not valid")
callback.result(PumpEnactResult(injector).success(false).comment(R.string.ok))?.run()
}
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
}
override fun generateDialog(root: LinearLayout) {

View file

@ -105,9 +105,11 @@
<string name="edit_short">ÉDITER</string>
<string name="please_choose_an_action_type">Choisir un type d\'action</string>
<string name="please_choose_a_trigger_type">Choisir un type de déclencheur</string>
<string name="please_choose_a_operation_type">Choisissez un type d\'opération</string>
<string name="triggers">Déclencheurs :</string>
<string name="remove_label">SUPPRIMER</string>
<string name="preconditions">Conditions préalables :</string>
<string name="automation_event">Evénement auto.</string>
<string name="reorder_label">Réordonner</string>
<string name="user_action">Actions utilisateur</string>
</resources>

View file

@ -105,9 +105,11 @@
<string name="edit_short">MODIFICA</string>
<string name="please_choose_an_action_type">Scegli un tipo di azione</string>
<string name="please_choose_a_trigger_type">Scegli un tipo di trigger</string>
<string name="please_choose_a_operation_type">Scegli un tipo di operazione</string>
<string name="triggers">Trigger:</string>
<string name="remove_label">RIMUOVI</string>
<string name="preconditions">Presupposti:</string>
<string name="automation_event">Evento di automazione</string>
<string name="reorder_label">Riordina</string>
<string name="user_action">Azione utente</string>
</resources>

View file

@ -105,9 +105,11 @@
<string name="edit_short">עריכה</string>
<string name="please_choose_an_action_type">בחרו סוג פעולה</string>
<string name="please_choose_a_trigger_type">בחירת סוג הטריגר</string>
<string name="please_choose_a_operation_type">נא לבחור סוג פעולה</string>
<string name="triggers">טריגרים:</string>
<string name="remove_label">הסר</string>
<string name="preconditions">תנאים מוקדמים:</string>
<string name="automation_event">אירוע אוטומציה</string>
<string name="reorder_label">סדר מחדש</string>
<string name="user_action">פעולות משתמש</string>
</resources>

View file

@ -105,9 +105,11 @@
<string name="edit_short">REDIGER</string>
<string name="please_choose_an_action_type">Velg en handling</string>
<string name="please_choose_a_trigger_type">Velg en trigger type</string>
<string name="please_choose_a_operation_type">Velg en handling</string>
<string name="triggers">Triggere:</string>
<string name="remove_label">FJERN</string>
<string name="preconditions">Forutsetninger:</string>
<string name="automation_event">Automasjons hendelse</string>
<string name="reorder_label">Endre rekkefølge</string>
<string name="user_action">Bruker handling</string>
</resources>

View file

@ -105,9 +105,11 @@
<string name="edit_short">РЕДАКТ</string>
<string name="please_choose_an_action_type">Выберите тип действия</string>
<string name="please_choose_a_trigger_type">Выберите тип триггера</string>
<string name="please_choose_a_operation_type">Выберите тип действия</string>
<string name="triggers">Триггеры:</string>
<string name="remove_label">УДАЛИТЬ</string>
<string name="preconditions">Предусловия:</string>
<string name="automation_event">Автоматизированное событие</string>
<string name="reorder_label">Повторный заказ</string>
<string name="user_action">Действия пользователя</string>
</resources>

View file

@ -34,7 +34,7 @@ open class TestBaseWithProfile : TestBase() {
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
private val profileInjector = HasAndroidInjector {
AndroidInjector {
}
}

View file

@ -7,6 +7,7 @@ import info.nightscout.androidaps.queue.Callback
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito
import org.mockito.Mockito.`when`
@ -38,6 +39,7 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
}
@Test fun doActionTest() {
`when`(profileFunction.createProfileSwitch(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(true)
sut.pct = InputPercent(110.0)
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
sut.doAction(object : Callback() {

View file

@ -80,6 +80,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
// do profile switch
`when`(profileFunction.getProfileName()).thenReturn("Test")
`when`(profileFunction.createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())).thenReturn(true)
sut.inputProfileName = InputProfileName(resourceHelper, activePlugin, TESTPROFILENAME)
sut.doAction(object : Callback() {
override fun run() {

View file

@ -43,7 +43,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View file

@ -15,7 +15,7 @@ import javax.inject.Inject
open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
@Inject lateinit var resourceHelper: ResourceHelperImplementation
@Inject lateinit var rh: ResourceHelperImplementation
@Inject lateinit var importExportPrefs: ImportExportPrefs
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
@ -35,7 +35,7 @@ open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
when (it.key) {
Manifest.permission.WRITE_EXTERNAL_STORAGE ->
//show dialog after permission is granted
OKDialog.show(this, "", resourceHelper.gs(R.string.alert_dialog_storage_permission_text))
OKDialog.show(this, "", rh.gs(R.string.alert_dialog_storage_permission_text))
// ignore the rest
}
}

View file

@ -94,23 +94,23 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
trHead.setBackgroundColor(Color.DKGRAY)
trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
trHead.addView(TextView(this).also { labelDate ->
labelDate.text = resourceHelper.gs(R.string.date)
labelDate.text = rh.gs(R.string.date)
labelDate.setTextColor(Color.WHITE)
})
trHead.addView(TextView(this).also { labelBasalRate ->
labelBasalRate.text = resourceHelper.gs(R.string.basalrate)
labelBasalRate.text = rh.gs(R.string.basalrate)
labelBasalRate.setTextColor(Color.WHITE)
})
trHead.addView(TextView(this).also { labelBolus ->
labelBolus.text = resourceHelper.gs(R.string.bolus)
labelBolus.text = rh.gs(R.string.bolus)
labelBolus.setTextColor(Color.WHITE)
})
trHead.addView(TextView(this).also { labelTdd ->
labelTdd.text = resourceHelper.gs(R.string.tdd)
labelTdd.text = rh.gs(R.string.tdd)
labelTdd.setTextColor(Color.WHITE)
})
trHead.addView(TextView(this).also { labelRatio ->
labelRatio.text = resourceHelper.gs(R.string.ratio)
labelRatio.text = rh.gs(R.string.ratio)
labelRatio.setTextColor(Color.WHITE)
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@ -122,15 +122,15 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
ctrHead.setBackgroundColor(Color.DKGRAY)
ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
ctrHead.addView(TextView(this).also { labelCumAmountDays ->
labelCumAmountDays.text = resourceHelper.gs(R.string.amount_days)
labelCumAmountDays.text = rh.gs(R.string.amount_days)
labelCumAmountDays.setTextColor(Color.WHITE)
})
ctrHead.addView(TextView(this).also { labelCumTdd ->
labelCumTdd.text = resourceHelper.gs(R.string.tdd)
labelCumTdd.text = rh.gs(R.string.tdd)
labelCumTdd.setTextColor(Color.WHITE)
})
ctrHead.addView(TextView(this).also { labelCumRatio ->
labelCumRatio.text = resourceHelper.gs(R.string.ratio)
labelCumRatio.text = rh.gs(R.string.ratio)
labelCumRatio.setTextColor(Color.WHITE)
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@ -142,15 +142,15 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
etrHead.setBackgroundColor(Color.DKGRAY)
etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
etrHead.addView(TextView(this).also { labelExpWeight ->
labelExpWeight.text = resourceHelper.gs(R.string.weight)
labelExpWeight.text = rh.gs(R.string.weight)
labelExpWeight.setTextColor(Color.WHITE)
})
etrHead.addView(TextView(this).also { labelExpTdd ->
labelExpTdd.text = resourceHelper.gs(R.string.tdd)
labelExpTdd.text = rh.gs(R.string.tdd)
labelExpTdd.setTextColor(Color.WHITE)
})
etrHead.addView(TextView(this).also { labelExpRatio ->
labelExpRatio.text = resourceHelper.gs(R.string.ratio)
labelExpRatio.text = rh.gs(R.string.ratio)
labelExpRatio.setTextColor(Color.WHITE)
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@ -160,7 +160,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
binding.reload.visibility = View.GONE
binding.connectionStatus.visibility = View.VISIBLE
binding.message.visibility = View.VISIBLE
binding.message.text = resourceHelper.gs(R.string.warning_Message)
binding.message.text = rh.gs(R.string.warning_Message)
commandQueue.loadTDDs(object : Callback() {
override fun run() {
loadDataFromDB()
@ -195,18 +195,20 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
disposable.add(rxBus
.toObservable(EventPumpStatusChanged::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(resourceHelper) }, fabricPrivacy::logException)
disposable.add(
rxBus
.toObservable(EventPumpStatusChanged::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(rh) }, fabricPrivacy::logException)
)
disposable.add(rxBus
.toObservable(EventDanaRSyncStatus::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ event ->
aapsLogger.debug("EventDanaRSyncStatus: " + event.message)
binding.connectionStatus.text = event.message
}, fabricPrivacy::logException)
disposable.add(
rxBus
.toObservable(EventDanaRSyncStatus::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ event ->
aapsLogger.debug("EventDanaRSyncStatus: " + event.message)
binding.connectionStatus.text = event.message
}, fabricPrivacy::logException)
)
}
@ -292,7 +294,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
tr.id = 100 + i
tr.layoutParams = TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT,
TableLayout.LayoutParams.WRAP_CONTENT)
TableLayout.LayoutParams.WRAP_CONTENT
)
// Here create the TextView dynamically
tr.addView(TextView(this@TDDStatsActivity).also { labelDATE ->
@ -302,17 +305,17 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
labelBASAL.id = 300 + i
labelBASAL.text = resourceHelper.gs(R.string.formatinsulinunits, record.basalAmount)
labelBASAL.text = rh.gs(R.string.formatinsulinunits, record.basalAmount)
labelBASAL.setTextColor(Color.WHITE)
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
labelBOLUS.id = 400 + i
labelBOLUS.text = resourceHelper.gs(R.string.formatinsulinunits, record.bolusAmount)
labelBOLUS.text = rh.gs(R.string.formatinsulinunits, record.bolusAmount)
labelBOLUS.setTextColor(Color.WHITE)
})
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
labelTDD.id = 500 + i
labelTDD.text = resourceHelper.gs(R.string.formatinsulinunits, tdd)
labelTDD.text = rh.gs(R.string.formatinsulinunits, tdd)
labelTDD.setTextColor(Color.WHITE)
})
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
@ -320,7 +323,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%"
labelRATIO.setTextColor(Color.WHITE)
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT))
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
i++
}
i = 0
@ -349,7 +353,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
labelCUMTDD.id = 900 + i
labelCUMTDD.text = resourceHelper.gs(R.string.formatinsulinunits, sum / i)
labelCUMTDD.text = rh.gs(R.string.formatinsulinunits, sum / i)
labelCUMTDD.setTextColor(Color.WHITE)
})
@ -363,7 +367,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
}
if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) {
binding.message.visibility = View.VISIBLE
binding.message.text = resourceHelper.gs(R.string.olddata_Message)
binding.message.text = rh.gs(R.string.olddata_Message)
} else binding.mainTable.setBackgroundColor(Color.TRANSPARENT)
if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) {
//Today should not be included
@ -401,9 +405,9 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
labelEXPTDD.id = 1300 + i
labelEXPTDD.text = """
${resourceHelper.gs(R.string.formatinsulinunits, weighted03)}
${resourceHelper.gs(R.string.formatinsulinunits, weighted05)}
${resourceHelper.gs(R.string.formatinsulinunits, weighted07)}
${rh.gs(R.string.formatinsulinunits, weighted03)}
${rh.gs(R.string.formatinsulinunits, weighted05)}
${rh.gs(R.string.formatinsulinunits, weighted07)}
""".trimIndent()
labelEXPTDD.setTextColor(Color.WHITE)
})
@ -429,7 +433,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
val type = activePlugin.activePump.pumpDescription.pumpType
val startsYesterday = type == PumpType.DANA_R || type == PumpType.DANA_RS || type == PumpType.DANA_RV2 || type == PumpType.DANA_R_KOREAN || type == PumpType.ACCU_CHEK_INSIGHT_VIRTUAL || type == PumpType.DIACONN_G8
val startsYesterday =
type == PumpType.DANA_R || type == PumpType.DANA_RS || type == PumpType.DANA_RV2 || type == PumpType.DANA_R_KOREAN || type == PumpType.ACCU_CHEK_INSIGHT_VIRTUAL || type == PumpType.DIACONN_G8
val df: DateFormat = SimpleDateFormat("dd.MM.", Locale.getDefault())
return historyList.size < 3 || df.format(Date(historyList[0].timestamp)) != df.format(Date(System.currentTimeMillis() - if (startsYesterday) 1000 * 60 * 60 * 24 else 0))
}

View file

@ -122,6 +122,11 @@ sealed class ProfileSealed(
break
}
}
if (!hardLimits.isInRange(basalAmount, 0.01, hardLimits.maxBasal())) {
validityCheck.isValid = false
validityCheck.reasons.add(resourceHelper.gs(R.string.value_out_of_hard_limits, resourceHelper.gs(R.string.basal_value), basalAmount))
break
}
// Check for minimal basal value
if (basalAmount < description.basalMinimumRate) {
basal.amount = description.basalMinimumRate
@ -136,11 +141,6 @@ sealed class ProfileSealed(
validityCheck.reasons.add(resourceHelper.gs(R.string.maximumbasalvaluereplaced, from))
break
}
if (!hardLimits.isInRange(basalAmount, 0.01, hardLimits.maxBasal())) {
validityCheck.isValid = false
validityCheck.reasons.add(resourceHelper.gs(R.string.value_out_of_hard_limits, resourceHelper.gs(R.string.basal_value), basalAmount))
break
}
}
if (!hardLimits.isInRange(dia, hardLimits.minDia(), hardLimits.maxDia())) {
validityCheck.isValid = false
@ -160,9 +160,9 @@ sealed class ProfileSealed(
}
for (target in targetBlocks) {
if (!hardLimits.isInRange(
Profile.toMgdl(target.lowTarget, units),
HardLimits.VERY_HARD_LIMIT_MIN_BG[0].toDouble(),
HardLimits.VERY_HARD_LIMIT_MIN_BG[1].toDouble()
toMgdl(target.lowTarget, units),
HardLimits.VERY_HARD_LIMIT_MIN_BG[0],
HardLimits.VERY_HARD_LIMIT_MIN_BG[1]
)
) {
validityCheck.isValid = false
@ -170,9 +170,9 @@ sealed class ProfileSealed(
break
}
if (!hardLimits.isInRange(
Profile.toMgdl(target.highTarget, units),
HardLimits.VERY_HARD_LIMIT_MAX_BG[0].toDouble(),
HardLimits.VERY_HARD_LIMIT_MAX_BG[1].toDouble()
toMgdl(target.highTarget, units),
HardLimits.VERY_HARD_LIMIT_MAX_BG[0],
HardLimits.VERY_HARD_LIMIT_MAX_BG[1]
)
) {
validityCheck.isValid = false
@ -212,6 +212,7 @@ sealed class ProfileSealed(
if (getTargetLowMgdlTimeFromMidnight(seconds) != profile.getTargetLowMgdlTimeFromMidnight(seconds)) return false
if (getTargetHighMgdlTimeFromMidnight(seconds) != profile.getTargetHighMgdlTimeFromMidnight(seconds)) return false
if (dia != profile.dia) return false
if ((profile is EPS) && profileName != profile.value.originalProfileName) return false // handle profile name change too
}
return true
}

View file

@ -4,7 +4,6 @@ import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.TotalDailyDose
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper
import java.util.*
val TotalDailyDose.total
get() = if (totalAmount > 0) totalAmount else basalAmount + bolusAmount
@ -12,10 +11,12 @@ val TotalDailyDose.total
val TotalDailyDose.basalPct: Double
get() = if (total > 0) basalAmount / total * 100 else 0.0
fun TotalDailyDose.toText(resourceHelper: ResourceHelper, dateUtil: DateUtil, includeCarbs: Boolean): String =
if (includeCarbs) resourceHelper.gs(R.string.tddwithcarbsformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct, carbs)
else resourceHelper.gs(R.string.tddformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct)
fun TotalDailyDose.toText(rh: ResourceHelper, dateUtil: DateUtil, includeCarbs: Boolean): String =
if (total.isNaN() || bolusAmount.isNaN() || basalAmount.isNaN() || carbs.isNaN()) ""
else if (includeCarbs) rh.gs(R.string.tddwithcarbsformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct, carbs)
else rh.gs(R.string.tddformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct)
fun TotalDailyDose.toText(resourceHelper: ResourceHelper, days: Int, includeCarbs: Boolean): String =
if (includeCarbs) resourceHelper.gs(R.string.tddwithcarbsformat, String.format(Locale.getDefault(), "%d ", days) + resourceHelper.gs(R.string.days), total, bolusAmount, basalAmount, basalAmount / total * 100, carbs)
else resourceHelper.gs(R.string.tddformat, String.format(Locale.getDefault(), "%d ", days) + resourceHelper.gs(R.string.days), total, bolusAmount, basalAmount, basalAmount / total * 100)
fun TotalDailyDose.toText(rh: ResourceHelper, days: Int, includeCarbs: Boolean): String =
if (total.isNaN() || bolusAmount.isNaN() || basalAmount.isNaN() || carbs.isNaN()) ""
else if (includeCarbs) rh.gs(R.string.tddwithcarbsformat, days.toString() + rh.gs(R.string.days), total, bolusAmount, basalAmount, basalAmount / total * 100, carbs)
else rh.gs(R.string.tddformat, days.toString() + rh.gs(R.string.days), total, bolusAmount, basalAmount, basalAmount / total * 100)

View file

@ -55,8 +55,9 @@ interface ProfileFunction {
* @param percentage 100 = no modification
* @param timeShiftInHours 0 = no modification
* @param timestamp expected time
* @return null if profile cannot be created from profile store
*/
fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch
fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes:Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch?
/**
* Create a new circadian profile switch request based on provided profile
@ -67,8 +68,9 @@ interface ProfileFunction {
* @param percentage 100 = no modification
* @param timeShiftInHours 0 = no modification
* @param timestamp expected time
* @return true if profile was created from store
*/
fun createProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long)
fun createProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): Boolean
/**
* Create a new circadian profile switch request based on currently selected profile interface and default profile

View file

@ -31,8 +31,8 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject, val d
return null
}
fun getCreatedAt(): Long {
val iso = JsonHelper.safeGetString(data, "created_at") ?: return 0
fun getStartDate(): Long {
val iso = JsonHelper.safeGetString(data, "startDate") ?: return 0
return try {
dateUtil.fromISODateString(iso)
} catch (e: Exception) {
@ -68,7 +68,7 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject, val d
if (profile == null) {
JsonHelper.safeGetJSONObject(store, profileName, null)?.let { profileObject ->
profile = pureProfileFromJson(profileObject, dateUtil, defaultUnits)
cachedObjects[profileName] = profile
profile?.let { cachedObjects[profileName] = profile }
}
}
}

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.overview.notifications
import android.content.Context
import androidx.annotation.RawRes
import info.nightscout.androidaps.utils.T
@ -14,6 +15,8 @@ open class Notification {
var action: Runnable? = null
var buttonText = 0
var contextForAction: Context? = null
constructor()
constructor(id: Int, date: Long, text: String, level: Int, validTo: Long) {
this.id = id
@ -55,6 +58,7 @@ open class Notification {
const val LOW = 2
const val INFO = 3
const val ANNOUNCEMENT = 4
const val PROFILE_SET_FAILED = 0
const val PROFILE_SET_OK = 1
const val EASY_MODE_ENABLED = 2
@ -122,6 +126,7 @@ open class Notification {
const val WRONG_PUMP_DATA = 72
const val NSCLIENT_VERSION_DOES_NOT_MATCH = 73
const val VERSION_EXPIRE = 74
const val INVALID_PROFILE_NOT_ACCEPTED = 75
const val USER_MESSAGE = 1000

View file

@ -51,7 +51,7 @@ class PumpSyncImplementation @Inject constructor(
* @param serialNumber serial number of of pump
* @return true if data is allowed
*/
private fun confirmActivePump(timestamp: Long, type: PumpType, serialNumber: String): Boolean {
private fun confirmActivePump(timestamp: Long, type: PumpType, serialNumber: String, showNotification: Boolean = true): Boolean {
val storedType = sp.getString(R.string.key_active_pump_type, "")
val storedSerial = sp.getString(R.string.key_active_pump_serial_number, "")
val storedTimestamp = sp.getLong(R.string.key_active_pump_change_timestamp, 0L)
@ -70,7 +70,7 @@ class PumpSyncImplementation @Inject constructor(
return true
}
if ((type.description != storedType || serialNumber != storedSerial) && timestamp >= storedTimestamp)
if (showNotification && (type.description != storedType || serialNumber != storedSerial) && timestamp >= storedTimestamp)
rxBus.send(EventNewNotification(Notification(Notification.WRONG_PUMP_DATA, resourceHelper.gs(R.string.wrong_pump_data), Notification.URGENT)))
aapsLogger.error(LTag.PUMP, "Ignoring pump history record Allowed: ${dateUtil.dateAndTimeAndSecondsString(storedTimestamp)} $storedType $storedSerial Received: $timestamp ${dateUtil.dateAndTimeAndSecondsString(timestamp)} ${type.description} $serialNumber")
return false
@ -397,7 +397,8 @@ class PumpSyncImplementation @Inject constructor(
}
override fun createOrUpdateTotalDailyDose(timestamp: Long, bolusAmount: Double, basalAmount: Double, totalAmount: Double, pumpId: Long?, pumpType: PumpType, pumpSerial: String): Boolean {
if (!confirmActivePump(timestamp, pumpType, pumpSerial)) return false
// there are probably old data in pump -> do not show notification, just ignore
if (!confirmActivePump(timestamp, pumpType, pumpSerial, showNotification = false)) return false
val tdd = TotalDailyDose(
timestamp = timestamp,
bolusAmount = bolusAmount,

View file

@ -40,9 +40,9 @@ class HardLimits @Inject constructor(
// Very Hard Limits Ranges
// First value is the Lowest and second value is the Highest a Limit can define
val VERY_HARD_LIMIT_MIN_BG = intArrayOf(80, 180)
val VERY_HARD_LIMIT_MAX_BG = intArrayOf(90, 270)
val VERY_HARD_LIMIT_TARGET_BG = intArrayOf(80, 200)
val VERY_HARD_LIMIT_MIN_BG = doubleArrayOf(80.0, 180.0)
val VERY_HARD_LIMIT_MAX_BG = doubleArrayOf(90.0, 200.0)
val VERY_HARD_LIMIT_TARGET_BG = doubleArrayOf(80.0, 200.0)
// Very Hard Limits Ranges for Temp Targets
val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180)

View file

@ -22,6 +22,8 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
public class ToastUtils {
private static Toast lastToast = null;
public static class Long {
public static void warnToast(final Context ctx, final String string) {
@ -76,10 +78,11 @@ public class ToastUtils {
ImageView toastIcon = toastRoot.findViewById(android.R.id.icon);
toastIcon.setImageResource(iconId);
Toast toast = new Toast(ctx);
toast.setDuration(isShort ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG);
toast.setView(toastRoot);
toast.show();
if (lastToast != null) lastToast.cancel();
lastToast = new Toast(ctx);
lastToast.setDuration(isShort ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG);
lastToast.setView(toastRoot);
lastToast.show();
});
}

View file

@ -167,7 +167,7 @@
<TextView
android:id="@+id/message"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/pillborder"

View file

@ -385,7 +385,7 @@
<string name="uel_plugin_disabled">PLUGIN DISABILITATO</string>
<string name="uel_unknown">SCONOSCIUTO</string>
<string name="ue_string">Stringa</string>
<string name="ue_source">Fonte</string>
<string name="ue_source">Origine</string>
<string name="ue_utc_offset">Offset UTC</string>
<string name="ue_action">Azione</string>
<string name="ue_timestamp">Data e ora</string>

View file

@ -54,7 +54,7 @@
<string name="lastconnection_label">התחברות אחרונה</string>
<string name="lastbolus_label">בולוס אחרון</string>
<string name="dailyunits">יחידות יומיות</string>
<string name="basebasalrate_label">בזאלי בסיסי</string>
<string name="basebasalrate_label">מינון בזאלי בסיסי</string>
<string name="tempbasal_label">בזאלי זמני</string>
<string name="virtualpump_extendedbolus_label">בולוס ממושך</string>
<string name="reservoir_label">מכל</string>
@ -245,7 +245,7 @@
<string name="ratio">יחס</string>
<string name="amount_days"># ימים</string>
<string name="weight">משקל</string>
<string name="warning_Message">שימוש בבולוס למילוי / פריימינג עשוי לגרום לחוסר דיוק!</string>
<string name="warning_Message">שימוש בבולוס למילוי \\ תיחול עשוי לגרום לחוסר דיוק!</string>
<string name="olddata_Message">הנתונים ישנים. לרענון לחצו \"טען מחדש\"</string>
<string name="tbb">סה\"כ בזאלי בסיסי</string>
<string name="tbb2">סה\"כ בזאלי בסיסי * 2</string>

View file

@ -304,6 +304,7 @@
<string name="sunday_short">S</string>
<!-- User Entry -->
<string name="uel_bolus">BOLUS</string>
<string name="uel_bolus_calculator">BOLUS KALKULATOR</string>
<string name="uel_bolus_advisor">BOLUS ASSISTENT</string>
<string name="uel_extended_bolus">FORLENGET BOLUS</string>
<string name="uel_superbolus_tbr">SUPERBOLUS TBR</string>

View file

@ -65,7 +65,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
disposable += rxBus
.toObservable(EventPumpStatusChanged::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ binding.status.text = it.getStatus(resourceHelper) }, fabricPrivacy::logException)
.subscribe({ binding.status.text = it.getStatus(rh) }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventDanaRSyncStatus::class.java)
.observeOn(aapsSchedulers.main)
@ -96,19 +96,19 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
// Types
val typeList = ArrayList<TypeList>()
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, resourceHelper.gs(R.string.danar_history_alarm)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, resourceHelper.gs(R.string.danar_history_basalhours)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BOLUS, resourceHelper.gs(R.string.danar_history_bolus)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_CARBO, resourceHelper.gs(R.string.danar_history_carbohydrates)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_DAILY, resourceHelper.gs(R.string.danar_history_dailyinsulin)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, resourceHelper.gs(R.string.danar_history_glucose)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, rh.gs(R.string.danar_history_alarm)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, rh.gs(R.string.danar_history_basalhours)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BOLUS, rh.gs(R.string.danar_history_bolus)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_CARBO, rh.gs(R.string.danar_history_carbohydrates)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_DAILY, rh.gs(R.string.danar_history_dailyinsulin)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, rh.gs(R.string.danar_history_glucose)))
if (!isKorean && !isRS) {
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ERROR, resourceHelper.gs(R.string.danar_history_errors)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ERROR, rh.gs(R.string.danar_history_errors)))
}
if (isRS) typeList.add(TypeList(RecordTypes.RECORD_TYPE_PRIME, resourceHelper.gs(R.string.danar_history_prime)))
if (isRS) typeList.add(TypeList(RecordTypes.RECORD_TYPE_PRIME, rh.gs(R.string.danar_history_prime)))
if (!isKorean) {
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, resourceHelper.gs(R.string.danar_history_refill)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_SUSPEND, resourceHelper.gs(R.string.danar_history_syspend)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, rh.gs(R.string.danar_history_refill)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_SUSPEND, rh.gs(R.string.danar_history_syspend)))
}
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
@ -180,9 +180,9 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
}
RecordTypes.RECORD_TYPE_DAILY -> {
holder.binding.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBasal)
holder.binding.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus)
holder.binding.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
holder.binding.dailyBasal.text = rh.gs(R.string.formatinsulinunits, record.dailyBasal)
holder.binding.dailyBolus.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus)
holder.binding.dailyTotal.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
holder.binding.time.text = dateUtil.dateString(record.timestamp)
holder.binding.time.visibility = View.VISIBLE
holder.binding.value.visibility = View.GONE

View file

@ -153,7 +153,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
commandQueue.setUserOptions(object : Callback() {
override fun run() {
if (!result.success) {
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.pumperror), R.raw.boluserror)
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
}
}
})

View file

@ -51,7 +51,7 @@
<string name="stoppingtempbasal">הפסקת בזאלי זמני</string>
<string name="settingextendedbolus">מגדיר בולוס ממושך</string>
<string name="stoppingextendedbolus">מפסיק בולוס ממושך</string>
<string name="updatingbasalrates">מעדכן את הקצב הבזאלי</string>
<string name="updatingbasalrates">מעדכן את המינון הבזאלי</string>
<string name="settingtempbasal">הגדרת בזאלי זמני</string>
<string name="waitingfortimesynchronization">ממתין לסינכרון השעון (%1$d שנ\')</string>
<string name="wrongpumppassword">סיסמת משאבה שגויה!</string>

View file

@ -39,12 +39,12 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
setContentView(binding.root)
val p1 = DefaultEditTextValidator(binding.rsV3Pin1, this)
.setTestErrorString(resourceHelper.gs(R.string.error_mustbe12hexadidits), this)
.setCustomRegexp(resourceHelper.gs(R.string.twelvehexanumber), this)
.setTestErrorString(rh.gs(R.string.error_mustbe12hexadidits), this)
.setCustomRegexp(rh.gs(R.string.twelvehexanumber), this)
.setTestType(EditTextValidator.TEST_REGEXP, this)
val p2 = DefaultEditTextValidator(binding.rsV3Pin2, this)
.setTestErrorString(resourceHelper.gs(R.string.error_mustbe8hexadidits), this)
.setCustomRegexp(resourceHelper.gs(R.string.eighthexanumber), this)
.setTestErrorString(rh.gs(R.string.error_mustbe8hexadidits), this)
.setCustomRegexp(rh.gs(R.string.eighthexanumber), this)
.setTestType(EditTextValidator.TEST_REGEXP, this)
binding.okcancel.ok.setOnClickListener {
@ -56,7 +56,7 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
if (result) {
bleComm.finishV3Pairing()
finish()
} else OKDialog.show(this, resourceHelper.gs(R.string.error), resourceHelper.gs(R.string.invalidinput))
} else OKDialog.show(this, rh.gs(R.string.error), rh.gs(R.string.invalidinput))
}
}
binding.okcancel.cancel.setOnClickListener { finish() }
@ -86,12 +86,12 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
for (i in pairingKey.indices)
pairingKeyCheckSum = pairingKeyCheckSum xor pairingKey[i]
sp.putString(resourceHelper.gs(R.string.key_danars_v3_pairingkey) + danaRSPlugin.mDeviceName, Base64.encodeToString(pairingKey, Base64.DEFAULT))
sp.putString(rh.gs(R.string.key_danars_v3_pairingkey) + danaRSPlugin.mDeviceName, Base64.encodeToString(pairingKey, Base64.DEFAULT))
for (i in randomPairingKey.indices)
pairingKeyCheckSum = pairingKeyCheckSum xor randomPairingKey[i]
sp.putString(resourceHelper.gs(R.string.key_danars_v3_randompairingkey) + danaRSPlugin.mDeviceName, Base64.encodeToString(randomPairingKey, Base64.DEFAULT))
sp.putString(rh.gs(R.string.key_danars_v3_randompairingkey) + danaRSPlugin.mDeviceName, Base64.encodeToString(randomPairingKey, Base64.DEFAULT))
return checksum[0] == pairingKeyCheckSum
}

View file

@ -77,7 +77,7 @@ abstract class DanaRSPacketHistory(
dataIndex += dataSize
dataSize = 2
totalCount = byteArrayToInt(getBytes(data, dataIndex, dataSize))
aapsLogger.debug(LTag.PUMPCOMM, "History end. Code: " + error + " Success: " + (error == 0x00) + " Toatal count: " + totalCount)
aapsLogger.debug(LTag.PUMPCOMM, "History end. Code: " + error + " Success: " + (error == 0x00) + " Total count: " + totalCount)
} else {
val recordCode = byteArrayToInt(getBytes(data, DATA_START, 1))
val historyYear = byteArrayToInt(getBytes(data, DATA_START + 1, 1))

View file

@ -64,23 +64,23 @@ data class UserEntry(
CALIBRATION (ColorGroup.Careportal),
PRIME_BOLUS (ColorGroup.Pump),
TREATMENT (ColorGroup.InsulinTreatment),
CAREPORTAL_NS_REFRESH (ColorGroup.Aaps),
PROFILE_SWITCH_NS_REFRESH (ColorGroup.Aaps),
TREATMENTS_NS_REFRESH (ColorGroup.Aaps),
TT_NS_REFRESH (ColorGroup.Aaps),
CAREPORTAL_NS_REFRESH (ColorGroup.Careportal),
PROFILE_SWITCH_NS_REFRESH (ColorGroup.Profile),
TREATMENTS_NS_REFRESH (ColorGroup.InsulinTreatment),
TT_NS_REFRESH (ColorGroup.TT),
AUTOMATION_REMOVED (ColorGroup.Aaps),
BG_REMOVED (ColorGroup.Aaps),
CAREPORTAL_REMOVED (ColorGroup.Aaps),
EXTENDED_BOLUS_REMOVED (ColorGroup.Aaps),
CAREPORTAL_REMOVED (ColorGroup.Careportal),
EXTENDED_BOLUS_REMOVED (ColorGroup.InsulinTreatment),
FOOD_REMOVED (ColorGroup.CarbTreatment),
PROFILE_REMOVED (ColorGroup.Profile),
PROFILE_SWITCH_REMOVED (ColorGroup.Aaps),
PROFILE_SWITCH_REMOVED (ColorGroup.Profile),
RESTART_EVENTS_REMOVED (ColorGroup.Aaps),
TREATMENT_REMOVED (ColorGroup.Aaps),
BOLUS_REMOVED (ColorGroup.Aaps),
CARBS_REMOVED (ColorGroup.Aaps),
TEMP_BASAL_REMOVED (ColorGroup.Aaps),
TT_REMOVED (ColorGroup.Aaps),
TREATMENT_REMOVED (ColorGroup.InsulinTreatment),
BOLUS_REMOVED (ColorGroup.InsulinTreatment),
CARBS_REMOVED (ColorGroup.CarbTreatment),
TEMP_BASAL_REMOVED (ColorGroup.BasalTreatment),
TT_REMOVED (ColorGroup.TT),
NS_PAUSED (ColorGroup.Aaps),
NS_RESUME (ColorGroup.Aaps),
NS_QUEUE_CLEARED (ColorGroup.Aaps),

View file

@ -63,7 +63,7 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
disposable += rxBus
.toObservable(EventPumpStatusChanged::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ binding.status.text = it.getStatus(resourceHelper) }) { fabricPrivacy.logException(it) }
.subscribe({ binding.status.text = it.getStatus(rh) }) { fabricPrivacy.logException(it) }
swapAdapter(showingType)
}
@ -84,13 +84,13 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
// Types
val typeList = ArrayList<TypeList>()
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, resourceHelper.gs(R.string.diaconn_g8_history_alarm)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, resourceHelper.gs(R.string.diaconn_g8_history_basalhours)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BOLUS, resourceHelper.gs(R.string.diaconn_g8_history_bolus)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_TB, resourceHelper.gs(R.string.diaconn_g8_history_tempbasal)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_DAILY, resourceHelper.gs(R.string.diaconn_g8_history_dailyinsulin)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, resourceHelper.gs(R.string.diaconn_g8_history_refill)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_SUSPEND, resourceHelper.gs(R.string.diaconn_g8_history_suspend)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, rh.gs(R.string.diaconn_g8_history_alarm)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BASALHOUR, rh.gs(R.string.diaconn_g8_history_basalhours)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_BOLUS, rh.gs(R.string.diaconn_g8_history_bolus)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_TB, rh.gs(R.string.diaconn_g8_history_tempbasal)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_DAILY, rh.gs(R.string.diaconn_g8_history_dailyinsulin)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, rh.gs(R.string.diaconn_g8_history_refill)))
typeList.add(TypeList(RecordTypes.RECORD_TYPE_SUSPEND, rh.gs(R.string.diaconn_g8_history_suspend)))
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
binding.reload.setOnClickListener {
@ -163,9 +163,9 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
}
RecordTypes.RECORD_TYPE_DAILY -> {
holder.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBasal)
holder.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus)
holder.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
holder.dailyBasal.text = rh.gs(R.string.formatinsulinunits, record.dailyBasal)
holder.dailyBolus.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus)
holder.dailyTotal.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
holder.time.text = dateUtil.dateString(record.timestamp)
holder.time.visibility = View.VISIBLE
holder.value.visibility = View.GONE

View file

@ -158,7 +158,7 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", result.comment)
i.putExtra("title", resourceHelper.gs(R.string.pumperror))
i.putExtra("title", rh.gs(R.string.pumperror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
}
@ -169,9 +169,9 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
private fun fillSoundCategory() {
val categories = ArrayList<String>()
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_sound))
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_vibrate))
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_silent))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_sound))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_vibrate))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_silent))
context.let { context ->
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
binding.beepAndAlarm.adapter = adapterCategories
@ -180,9 +180,9 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
private fun fillSoundSubCategory() {
val categories = ArrayList<String>()
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_intensity_low))
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_intensity_middle))
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_intensity_high))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_intensity_low))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_intensity_middle))
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_intensity_high))
context.let { context ->
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
binding.alarmIntesity.adapter = adapterCategories

View file

@ -310,8 +310,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
)
private fun checkPodKaput(): Completable = Completable.defer {
val tbr = pumpSync.expectedPumpState().temporaryBasal
if (podStateManager.isPodKaput) {
val tbr = pumpSync.expectedPumpState().temporaryBasal
if (tbr == null || tbr.rate != 0.0) {
pumpSync.syncTemporaryBasalWithPumpId(
timestamp = System.currentTimeMillis(),
@ -340,20 +340,23 @@ class OmnipodDashPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, "syncBolusWithPumpId on CANCEL_BOLUS returned: $sync")
}
}
showNotification(
Notification.OMNIPOD_POD_FAULT,
podStateManager.alarmType.toString(),
Notification.URGENT,
R.raw.boluserror
)
if (!podStateManager.alarmSynced) {
pumpSync.insertAnnouncement(
error = podStateManager.alarmType?.toString() ?: "Unknown pod failure",
pumpId = Random.Default.nextLong(),
pumpType = PumpType.OMNIPOD_DASH,
pumpSerial = serialNumber()
podStateManager.alarmType?.let {
showNotification(
Notification.OMNIPOD_POD_FAULT,
it.toString(),
Notification.URGENT,
R.raw.boluserror
)
podStateManager.alarmSynced = true
if (!podStateManager.alarmSynced) {
pumpSync.insertAnnouncement(
error = it.toString(),
pumpId = Random.Default.nextLong(),
pumpType = PumpType.OMNIPOD_DASH,
pumpSerial = serialNumber()
)
podStateManager.alarmSynced = true
}
}
}
Completable.complete()
@ -1165,14 +1168,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
val ret = executeProgrammingCommand(
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
command = omnipodManager.deactivatePod().ignoreElements(),
checkNoActiveCommand = false,
post = createFakeTBRWhenNoActivePod(),
checkNoActiveCommand = false
).doOnComplete {
if (podStateManager.activeCommand != null) {
success = false
} else {
podStateManager.reset()
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_FAULT))
}
podStateManager.reset()
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_FAULT))
}.toPumpEnactResult()
if (!success) {
ret.success(false)

View file

@ -56,47 +56,48 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
private fun groupForCommandType(type: OmnipodCommandType): PumpHistoryEntryGroup {
return when (type) {
OmnipodCommandType.INITIALIZE_POD ->
OmnipodCommandType.INITIALIZE_POD ->
PumpHistoryEntryGroup.Prime
OmnipodCommandType.INSERT_CANNULA ->
OmnipodCommandType.INSERT_CANNULA ->
PumpHistoryEntryGroup.Prime
OmnipodCommandType.DEACTIVATE_POD ->
OmnipodCommandType.DEACTIVATE_POD ->
PumpHistoryEntryGroup.Prime
OmnipodCommandType.DISCARD_POD ->
OmnipodCommandType.DISCARD_POD ->
PumpHistoryEntryGroup.Prime
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
PumpHistoryEntryGroup.Basal
OmnipodCommandType.SET_BASAL_PROFILE ->
OmnipodCommandType.SET_BASAL_PROFILE ->
PumpHistoryEntryGroup.Basal
OmnipodCommandType.SET_TEMPORARY_BASAL ->
OmnipodCommandType.SET_TEMPORARY_BASAL ->
PumpHistoryEntryGroup.Basal
OmnipodCommandType.RESUME_DELIVERY ->
OmnipodCommandType.RESUME_DELIVERY ->
PumpHistoryEntryGroup.Basal
OmnipodCommandType.SUSPEND_DELIVERY ->
OmnipodCommandType.SUSPEND_DELIVERY ->
PumpHistoryEntryGroup.Basal
OmnipodCommandType.SET_BOLUS ->
OmnipodCommandType.SET_BOLUS ->
PumpHistoryEntryGroup.Bolus
OmnipodCommandType.CANCEL_BOLUS ->
OmnipodCommandType.CANCEL_BOLUS ->
PumpHistoryEntryGroup.Bolus
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
PumpHistoryEntryGroup.Alarm
OmnipodCommandType.CONFIGURE_ALERTS ->
OmnipodCommandType.CONFIGURE_ALERTS ->
PumpHistoryEntryGroup.Alarm
OmnipodCommandType.PLAY_TEST_BEEP ->
OmnipodCommandType.PLAY_TEST_BEEP ->
PumpHistoryEntryGroup.Alarm
OmnipodCommandType.GET_POD_STATUS ->
OmnipodCommandType.GET_POD_STATUS ->
PumpHistoryEntryGroup.Configuration
OmnipodCommandType.SET_TIME ->
OmnipodCommandType.SET_TIME ->
PumpHistoryEntryGroup.Configuration
OmnipodCommandType.READ_POD_PULSE_LOG ->
OmnipodCommandType.READ_POD_PULSE_LOG ->
PumpHistoryEntryGroup.Unknown
}
}
private fun filterHistory(group: PumpHistoryEntryGroup) {
filteredHistoryList.clear()
aapsLogger.debug(LTag.PUMP, "Items on full list: {}", fullHistoryList.size)
@ -152,12 +153,12 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
statusView?.run { visibility = View.GONE }
historyTypeSpinner = findViewById(R.id.omnipod_historytype)
typeListFull = getTypeList(PumpHistoryEntryGroup.Companion.getTranslatedList(resourceHelper))
typeListFull = getTypeList(PumpHistoryEntryGroup.Companion.getTranslatedList(rh))
val spinnerAdapter: ArrayAdapter<TypeList> = ArrayAdapter<TypeList>(this, R.layout.spinner_centered, typeListFull!!)
historyTypeSpinner?.run {
adapter = spinnerAdapter
onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (manualChange) return
val selected = selectedItem as TypeList
selectedGroup = selected.entryGroup
@ -208,40 +209,85 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
}
}
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
if (check_result && !record.isSuccess()) {
// Record says not success
textview.setTextColor(android.graphics.Color.YELLOW)
return
}
// On success set color
val textColor = when (record.commandType) {
// Operational
OmnipodCommandType.INITIALIZE_POD,
OmnipodCommandType.CONFIGURE_ALERTS,
OmnipodCommandType.INSERT_CANNULA,
OmnipodCommandType.DEACTIVATE_POD,
OmnipodCommandType.DISCARD_POD,
OmnipodCommandType.SUSPEND_DELIVERY,
OmnipodCommandType.RESUME_DELIVERY,
OmnipodCommandType.SET_BASAL_PROFILE -> {
android.graphics.Color.CYAN
}
// User action
OmnipodCommandType.PLAY_TEST_BEEP,
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
OmnipodCommandType.CANCEL_BOLUS -> {
android.graphics.Color.GREEN
}
// Insulin treatment
OmnipodCommandType.SET_BOLUS,
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
android.graphics.Color.WHITE
}
else ->
// Other
android.graphics.Color.LTGRAY
}
textview.setTextColor(textColor)
}
private fun setType(record: HistoryRecord, typeView: TextView) {
typeView.text = resourceHelper.gs(record.commandType.resourceId)
typeView.text = rh.gs(record.commandType.resourceId)
// Set some color, include result
setTextViewColor(check_result = true, typeView, record)
}
private fun setValue(historyEntry: HistoryRecord, valueView: TextView) {
valueView.text = historyEntry.toString()
// val entryType = historyEntry.commandType
if (!historyEntry.isSuccess()) {
valueView.text = resourceHelper.gs(translatedFailure(historyEntry))
valueView.text = rh.gs(translatedFailure(historyEntry))
return
}
valueView.text = when (historyEntry.commandType) {
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
val tbr = historyEntry.record as TempBasalRecord
tbr.let {
resourceHelper.gs(R.string.omnipod_common_history_tbr_value, it.rate, it.duration)
rh.gs(R.string.omnipod_common_history_tbr_value, it.rate, it.duration)
}
}
OmnipodCommandType.SET_BOLUS -> {
OmnipodCommandType.SET_BOLUS -> {
val bolus = historyEntry.record as BolusRecord
bolus.let {
resourceHelper.gs(R.string.omnipod_common_history_bolus_value, it.amout)
rh.gs(R.string.omnipod_common_history_bolus_value, it.amout)
}
}
OmnipodCommandType.SET_BASAL_PROFILE,
OmnipodCommandType.SET_TIME,
OmnipodCommandType.INSERT_CANNULA,
OmnipodCommandType.RESUME_DELIVERY -> {
OmnipodCommandType.RESUME_DELIVERY -> {
val basal = historyEntry.record as BasalValuesRecord
ProfileUtil.getBasalProfilesDisplayable(basal.segments.toTypedArray(), PumpType.OMNIPOD_DASH)
}
else ->
else ->
""
}
// Set some color
setTextViewColor(check_result = false, valueView, historyEntry)
}
override fun getItemCount(): Int {
@ -249,6 +295,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
}
inner class HistoryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val timeView: TextView = itemView.findViewById(R.id.omnipod_history_time)
val typeView: TextView = itemView.findViewById(R.id.omnipod_history_source)
val valueView: TextView = itemView.findViewById(R.id.omnipod_history_description)
@ -259,17 +306,18 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
return when {
historyEntry.initialResult == InitialResult.FAILURE_SENDING ->
R.string.omnipod_dash_failed_to_send
historyEntry.initialResult == InitialResult.NOT_SENT ->
historyEntry.initialResult == InitialResult.NOT_SENT ->
R.string.omnipod_dash_command_not_sent
historyEntry.initialResult == InitialResult.SENT &&
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
R.string.omnipod_dash_command_not_received_by_the_pod
else ->
else ->
R.string.omnipod_dash_unknown
}
}
companion object {
private var selectedGroup: PumpHistoryEntryGroup = PumpHistoryEntryGroup.All
const val DAYS_TO_DISPLAY = 5
}

View file

@ -66,7 +66,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
binding.buttonDiscardPod.setOnClickListener {
OKDialog.showConfirmation(
this,
resourceHelper.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation),
rh.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation),
Thread {
podStateManager.reset()
}
@ -83,10 +83,10 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
override fun run() {
if (!result.success) {
displayErrorDialog(
resourceHelper.gs(R.string.omnipod_common_warning),
resourceHelper.gs(
rh.gs(R.string.omnipod_common_warning),
rh.gs(
R.string.omnipod_common_two_strings_concatenated_by_colon,
resourceHelper.gs(R.string.omnipod_common_error_failed_to_play_test_beep),
rh.gs(R.string.omnipod_common_error_failed_to_play_test_beep),
result.comment
),
false

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integrace pumpy pro Omnipod Dash (nový model s funkcí Bluetooth a modrým krytem).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Historie Podu</string>
<string name="omnipod_dash_history_item_description">Popis</string>
<string name="omnipod_dash_history_item_source">Zdroj</string>
<string name="omnipod_dash_history_item_date">Datum</string>
<string name="omnipod_dash_history_type">Typ:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f U</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f U, Sach=%2$.1f g</string>
<string name="omnipod_dash_history_tbr_value">Rychlost: %1$.2f U, doba trvání: %2$d minut</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Stav Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Adresa Bluetooth</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Nalezeno příliš mnoho Podů k aktivaci</string>
<string name="omnipod_dash_scan_failed">Nelze najít dostupný Pod k aktivaci</string>
<string name="omnipod_dash_generic_error">Obecná chyba: %1$s</string>
<string name="omnipod_dash_failed_to_send">Nezdařilo se odeslat příkaz</string>
<string name="omnipod_dash_command_not_sent">Příkaz nebyl odeslán</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Příkaz nebyl přijat podem</string>
<string name="omnipod_dash_unknown">Neznámý stav příkazu</string>
<string name="omnipod_common_history_tbr_value">Rychlost: %1$.2f U, doba trvání: %2$d minut</string>
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
</resources>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Pumpen-Integration für Omnipod Dash (das neue, bluetooth-fähige Modell mit blauer Nadelkappe).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Pod Historie</string>
<string name="omnipod_dash_history_item_description">Beschreibung</string>
<string name="omnipod_dash_history_item_source">Quelle</string>
<string name="omnipod_dash_history_item_date">Datum</string>
<string name="omnipod_dash_history_type">Typ:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f IE</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f IE, CH=%2$.1f g</string>
<string name="omnipod_dash_history_tbr_value">Rate: %1$.2f IE, Dauer: %2$d min.</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Bluetooth-Status</string>
<string name="omnipod_dash_overview_bluetooth_address">Bluetooth-Adresse</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Zu viele Pods für die Aktivierung gefunden</string>
<string name="omnipod_dash_scan_failed">Konnte keinen verfügbaren Pod für die Aktivierung finden</string>
<string name="omnipod_dash_generic_error">Allgemeiner Fehler: %1$s</string>
<string name="omnipod_dash_failed_to_send">Fehler beim Senden des Befehls</string>
<string name="omnipod_dash_command_not_sent">Befehl nicht gesendet</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Befehl nicht vom Pod empfangen</string>
<string name="omnipod_dash_unknown">Unbekannter Status für den Befehl</string>
<string name="omnipod_common_history_tbr_value">Rate: %1$.2f IE, Dauer: %2$d min.</string>
<string name="omnipod_common_history_bolus_value">%1$.2f IE</string>
</resources>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Intégration de la pompe Omnipod Dash (le nouveau modèle Bluetooth, avec un bouchon d\'aiguille bleue).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Historique du Pod</string>
<string name="omnipod_dash_history_item_description">Description</string>
<string name="omnipod_dash_history_item_source">Source</string>
<string name="omnipod_dash_history_item_date">Date</string>
<string name="omnipod_dash_history_type">Type :</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f U</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f U, Gluc=%2$.1f g</string>
<string name="omnipod_dash_history_tbr_value">Débit : %1$.2f U, durée : %2$d minutes</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">État Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Adresse Bluetooth</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Trop de pods trouvés pour l\'activation</string>
<string name="omnipod_dash_scan_failed">Impossible de trouver un pod disponible pour l\'activation</string>
<string name="omnipod_dash_generic_error">Erreur générique : %1$s</string>
<string name="omnipod_dash_failed_to_send">Échec d\'envoi de la commande</string>
<string name="omnipod_dash_command_not_sent">Commande non envoyée</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Commande non reçue par le pod</string>
<string name="omnipod_dash_unknown">État inconnu pour la commande</string>
<string name="omnipod_common_history_tbr_value">Débit : %1$.2f U, durée : %2$d minutes</string>
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
</resources>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integrazione del microinfusore Omnipod Dash (il nuovo modello, abilitato al Bluetooth e con la protezione ago di colore blu).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Storico pod</string>
<string name="omnipod_dash_history_item_description">Descrizione</string>
<string name="omnipod_dash_history_item_source">Origine</string>
<string name="omnipod_dash_history_item_date">Data</string>
<string name="omnipod_dash_history_type">Tipo:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f U</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f U, CHO=%2$.1f g</string>
<string name="omnipod_dash_history_tbr_value">Tasso: %1$.2f U, durata: %2$d minuti</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Stato bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Indirizzo bluetooth</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Trovati troppi pod per l\'attivazione</string>
<string name="omnipod_dash_scan_failed">Nessun pod disponibile per l\'attivazione</string>
<string name="omnipod_dash_generic_error">Errore generico: %1$s</string>
<string name="omnipod_dash_failed_to_send">Impossibile inviare il comando</string>
<string name="omnipod_dash_command_not_sent">Comando non inviato</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Comando non ricevuto dal pod</string>
<string name="omnipod_dash_unknown">Stato sconosciuto per il comando</string>
<string name="omnipod_common_history_tbr_value">Tasso: %1$.2f U, durata: %2$d minuti</string>
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
</resources>

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">חיבור משאבת Omnipod Dash (הדגם החדש, התומך בבלוטות\' ובעל מכסה מחט כחול).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">היסטוריית הפוד</string>
<string name="omnipod_dash_history_item_description">תיאור</string>
<string name="omnipod_dash_history_item_source">מקור</string>
<string name="omnipod_dash_history_item_date">תאריך</string>
<string name="omnipod_dash_history_type">סוג:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f יח\'</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f יח\', פחמ\'= %2$.1f גר\'</string>
<string name="omnipod_dash_history_tbr_value">מינון: %1$.2f יח\', משך: %2$d דק\'</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">מצב בלוטות\'</string>
<string name="omnipod_dash_overview_bluetooth_address">כתובת בלוטות\'</string>
@ -10,12 +19,18 @@
<string name="omnipod_dash_overview_bluetooth_connection_quality">איכות החיבור</string>
<string name="omnipod_dash_overview_delivery_status">סטטוס הזרקה</string>
<!-- Omnipod Dash - Pod Activation Wizard -->
<string name="omnipod_dash_pod_activation_wizard_start_pod_activation_text">מלאו פוד חדש עם מספיק אינסולין לשלושה ימים.\n\nהקשיבו לשני צפצופים מהפוד במהלך המילוי. הם מציינים שהכמות המינימלית של 80 יחידות הוכנסה. הקפידו לרוקן לחלוטין את מזרק המילוי, גם לאחר שמיעת שני הצפצופים.\n\nלאחר מילוי הפוד, יש ללחוץ <b>הבא</b>.\n\n<b>הערה:</b> נא לא להסיר עדיין את מכסה המחט.</string>
<string name="omnipod_dash_pod_activation_wizard_initialize_pod_text">מנסה לצמד את הפוד החדש ולתחל אותו.\n\nכאשר תהליך התחול יסתיים בהצלחה, תוכלו ללחוץ על <b>הבא</b>.</string>
<string name="omnipod_dash_pod_activation_wizard_start_pod_activation_text">מלאו פוד חדש עם מספיק אינסולין לשלושה ימים.\n\nהקשיבו לשני צפצופים מהפוד במהלך המילוי. הם מציינים שהכמות המינימלית של 80 יחידות הוכנסה. הקפידו לרוקן לחלוטין את מזרק המילוי לתוך הפוד, גם לאחר שמיעת שני הצפצופים.\n\nלאחר מילוי הפוד, יש ללחוץ <b>הבא</b>.\n\n<b>הערה:</b> נא לא להסיר עדיין את מכסה המחט.</string>
<string name="omnipod_dash_pod_activation_wizard_initialize_pod_text">מנסה לצמד את הפוד החדש ולתחל אותו.\n\nכאשר תהליך התיחול יסתיים בהצלחה, תוכלו ללחוץ על <b>הבא</b>.</string>
<string name="omnipod_common_preferences_notification_delivery_suspended_sound_enabled">השמע כשהתראת הפסקת ההזרקה מאופשרת</string>
<!-- Exceptions -->
<string name="omnipod_dash_failed_to_connect">הקישור לפוד נכשל</string>
<string name="omnipod_dash_found_too_many_pods">נמצאו יותר מדי פודים להפעלה</string>
<string name="omnipod_dash_scan_failed">לא נמצא פוד זמין להפעלה</string>
<string name="omnipod_dash_generic_error">שגיאה גנרית: %1$s</string>
<string name="omnipod_dash_failed_to_send">שליחת הפקודה נכשלה</string>
<string name="omnipod_dash_command_not_sent">הפקודה לא נשלחה</string>
<string name="omnipod_dash_command_not_received_by_the_pod">הפקודה לא התקבלה ע\"י הפוד</string>
<string name="omnipod_dash_unknown">מצב הפקודה לא ידוע</string>
<string name="omnipod_common_history_tbr_value">מינון: %1$.2f יח\', משך: %2$d דק\'</string>
<string name="omnipod_common_history_bolus_value">%1$.2f יח\'</string>
</resources>

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">옴니파드 대쉬(파란색 바늘 캡이 달린 새로운 블루투스 연결 모델)를 위한 펌프 통합</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Pompos integracija Omnipod Dash (naujas, Bluetooth palaikantis modelis su mėlynu adatos dangteliu).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Bluetooth būklė</string>
<string name="omnipod_dash_overview_bluetooth_address">Bluetooth adresas</string>

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Pomp integratie voor Omnipod Dash (het nieuwe, Bluetooth-enabled model met een blauwe naalddop).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Bluetooth status</string>
<string name="omnipod_dash_overview_bluetooth_address">Bluetooth adres</string>

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Pumpeintegrering for Omnipod Dash (den nye, Bluetooth-aktiverte modellen med en blå kanylehette).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Pod historikk</string>
<string name="omnipod_dash_history_item_description">Beskrivelse</string>
<string name="omnipod_dash_history_item_source">Kilde</string>
<string name="omnipod_dash_history_item_date">Dato</string>
<string name="omnipod_dash_history_type">Type:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f E</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f E, KH=%2$.1f g</string>
<string name="omnipod_dash_history_tbr_value">Dosering: %1$.2f E, varighet: %2$d min</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Bluetooth status</string>
<string name="omnipod_dash_overview_bluetooth_address">Bluetooth adresse</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Fant for mange podder for aktivering</string>
<string name="omnipod_dash_scan_failed">Fant ingen pod tilgjengelig for aktivering</string>
<string name="omnipod_dash_generic_error">Generell feil: %1$s</string>
<string name="omnipod_dash_failed_to_send">Feilet i å sende kommandoen</string>
<string name="omnipod_dash_command_not_sent">Kommando ikke sendt</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Kommandoen ikke mottatt av podden</string>
<string name="omnipod_dash_unknown">Ukjent tilstand for kommandoen</string>
<string name="omnipod_common_history_tbr_value">Dosering: %1$.2f E, varighet: %2$d min</string>
<string name="omnipod_common_history_bolus_value">%1$.2f E</string>
</resources>

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integracja dla pompy Omnipod Dash (nowy, posiadając Bluetooth model z niebieską osłonką na igłę).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Status Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Adres Bluetooth</string>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integração para a Omnipod Dash (o novo modelo, habilitado para o Bluetooth com uma proteção de agulha azul).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integrarea pompei pentru Omnipod Dash (modelul nou, cu Bluetooth, cu un capac de ac albastru).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Stare Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Adresă Bluetooth</string>

View file

@ -3,6 +3,15 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Интеграция с помпой Omnipod Dash (новая модель с поддержкой Bluetooth, с синим колпачком на игле).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Журнал помпы</string>
<string name="omnipod_dash_history_item_description">Описание</string>
<string name="omnipod_dash_history_item_source">Источник</string>
<string name="omnipod_dash_history_item_date">Дата</string>
<string name="omnipod_dash_history_type">Тип:</string>
<string name="omnipod_dash_history_bolus_value">%1$.2f ед</string>
<string name="omnipod_dash_history_bolus_value_with_carbs">%1$.2f ед %2$.1f ГУ</string>
<string name="omnipod_dash_history_tbr_value">Баз Скорость: %1$.2f ед, Продолжительность: %2$d мин</string>
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Состояние Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Адрес Bluetooth</string>
@ -18,4 +27,10 @@
<string name="omnipod_dash_found_too_many_pods">Cлишком много pod\'ов для активации</string>
<string name="omnipod_dash_scan_failed"> Pod для активации не найден</string>
<string name="omnipod_dash_generic_error">Общая ошибка: %1$s</string>
<string name="omnipod_dash_failed_to_send">Не удалось отправить команду</string>
<string name="omnipod_dash_command_not_sent">Команда не отправлена</string>
<string name="omnipod_dash_command_not_received_by_the_pod">Команда не получена помпой</string>
<string name="omnipod_dash_unknown">Состояние команды неясно</string>
<string name="omnipod_common_history_tbr_value">Баз Скорость: %1$.2f ед, Продолжительность: %2$d мин</string>
<string name="omnipod_common_history_bolus_value">%1$.2f ед</string>
</resources>

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integrácia pumpy pre Omnipod Dash (nový model s funkciou Bluetooth a modrým krytom).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Stav Bluetooth</string>
<string name="omnipod_dash_overview_bluetooth_address">Adresa Bluetooth</string>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -3,6 +3,7 @@
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Pumpintegration för Omnipod Dash (den nya, Bluetooth-aktiverade modellen med blå nålskydd).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<string name="omnipod_dash_overview_bluetooth_status">Bluetooth-status</string>
<string name="omnipod_dash_overview_bluetooth_address">Bluetooth-adress</string>

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -2,6 +2,7 @@
<resources>
<!-- Omnipod Dash - Description -->
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<!-- Omnipod Dash - Overview -->
<!-- Omnipod Dash - Pod Activation Wizard -->
<!-- Exceptions -->

View file

@ -385,7 +385,7 @@ public class AapsOmnipodErosManager {
if (detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB) {
showNotification(Notification.OMNIPOD_UNCERTAIN_SMB, getStringResource(R.string.omnipod_eros_error_bolus_failed_uncertain_smb, detailedBolusInfo.insulin), Notification.URGENT, isNotificationUncertainSmbSoundEnabled() ? R.raw.boluserror : null);
} else {
showErrorDialog(getStringResource(R.string.omnipod_eros_error_bolus_failed_uncertain), isNotificationUncertainBolusSoundEnabled() ? R.raw.boluserror : null);
showErrorDialog(getStringResource(R.string.omnipod_eros_error_bolus_failed_uncertain), isNotificationUncertainBolusSoundEnabled() ? R.raw.boluserror : 0);
}
}

View file

@ -19,8 +19,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;

View file

@ -85,7 +85,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
binding.buttonDiscardPod.setOnClickListener {
OKDialog.showConfirmation(this,
resourceHelper.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation), Thread {
rh.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation), Thread {
aapsOmnipodManager.discardPodState()
})
}
@ -110,7 +110,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
commandQueue.customCommand(CommandPlayTestBeep(), object : Callback() {
override fun run() {
if (!result.success) {
displayErrorDialog(resourceHelper.gs(R.string.omnipod_common_warning), resourceHelper.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, resourceHelper.gs(R.string.omnipod_common_error_failed_to_play_test_beep), result.comment), false)
displayErrorDialog(rh.gs(R.string.omnipod_common_warning), rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_common_error_failed_to_play_test_beep), result.comment), false)
}
}
})
@ -123,7 +123,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
commandQueue.customCommand(CommandReadPulseLog(), object : Callback() {
override fun run() {
if (!result.success) {
displayErrorDialog(resourceHelper.gs(R.string.omnipod_common_warning), resourceHelper.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, resourceHelper.gs(R.string.omnipod_eros_error_failed_to_read_pulse_log), result.comment), false)
displayErrorDialog(rh.gs(R.string.omnipod_common_warning), rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_eros_error_failed_to_read_pulse_log), result.comment), false)
}
}
})
@ -229,8 +229,8 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
private fun displayNotConfiguredDialog() {
context.let {
UIRunnable {
OKDialog.show(it, resourceHelper.gs(R.string.omnipod_common_warning),
resourceHelper.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null)
OKDialog.show(it, rh.gs(R.string.omnipod_common_warning),
rh.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null)
}.run()
}
}

View file

@ -17,7 +17,7 @@
<!-- Omnipod Eros - History -->
<string name="omnipod_eros_history_title">Storico pod</string>
<string name="omnipod_eros_history_item_description">Descrizione</string>
<string name="omnipod_eros_history_item_source">Fonte</string>
<string name="omnipod_eros_history_item_source">Origine</string>
<string name="omnipod_eros_history_item_date">Data</string>
<string name="omnipod_eros_history_type">Tipo:</string>
<string name="omnipod_eros_history_bolus_value">%1$.2f U</string>

View file

@ -22,7 +22,7 @@
<string name="omnipod_eros_history_type">סוג:</string>
<string name="omnipod_eros_history_bolus_value">%1$.2f יח\'</string>
<string name="omnipod_eros_history_bolus_value_with_carbs">%1$.2f יח\', פחמ\'= %2$.1f גר\'</string>
<string name="omnipod_eros_history_tbr_value">קצב: %1$.2f יח\', משך: %2$d דק\'</string>
<string name="omnipod_eros_history_tbr_value">מינון: %1$.2f יח\', משך: %2$d דק\'</string>
<!-- Omnipod Eros - Short Status -->
<string name="omnipod_eros_short_status_riley_link_battery">סול\' ריילי: %1$d</string>
<!-- Omnipod Eros - Error -->

View file

@ -26,7 +26,7 @@
<string name="pref_show_avgdelta">הצג דלתא ממוצעת</string>
<string name="pref_show_phone_battery">הצג את סוללת הטלפון</string>
<string name="pref_show_rig_battery">הצג את סוללת ה-Rig</string>
<string name="pref_show_basal_rate">הצג קצב בזאלי</string>
<string name="pref_show_basal_rate">הצג מינון בזאלי</string>
<string name="pref_show_loop_status">הצג סטטוס לולאה</string>
<string name="pref_show_bg">הצג רמת סוכר</string>
<string name="pref_show_direction_arrow">הצג חץ כיוון</string>