fix NaN in statistics
This commit is contained in:
parent
760261e258
commit
bb2fced905
20 changed files with 156 additions and 149 deletions
|
@ -113,7 +113,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize screen wake lock
|
// 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() {
|
binding.mainPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
|
||||||
override fun onPageScrollStateChanged(state: Int) {}
|
override fun onPageScrollStateChanged(state: Int) {}
|
||||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
||||||
|
@ -173,8 +173,8 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
|
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
|
||||||
UIRunnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed)) { finish() } },
|
UIRunnable { OKDialog.show(this, "", rh.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() } }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,8 +184,8 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processPreferenceChange(ev: EventPreferenceChange) {
|
private fun processPreferenceChange(ev: EventPreferenceChange) {
|
||||||
if (ev.isChanged(resourceHelper, R.string.key_keep_screen_on)) setWakeLock()
|
if (ev.isChanged(rh, R.string.key_keep_screen_on)) setWakeLock()
|
||||||
if (ev.isChanged(resourceHelper, R.string.key_skin)) recreate()
|
if (ev.isChanged(rh, R.string.key_skin)) recreate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
|
@ -259,7 +259,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
private fun setPluginPreferenceMenuName() {
|
private fun setPluginPreferenceMenuName() {
|
||||||
if (binding.mainPager.currentItem >= 0) {
|
if (binding.mainPager.currentItem >= 0) {
|
||||||
val plugin = (binding.mainPager.adapter as TabPageAdapter).getPluginAt(binding.mainPager.currentItem)
|
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 -> {
|
R.id.nav_about -> {
|
||||||
var message = "Build: ${BuildConfig.BUILDVERSION}\n"
|
var message = "Build: ${BuildConfig.BUILDVERSION}\n"
|
||||||
message += "Flavor: ${BuildConfig.FLAVOR}${BuildConfig.BUILD_TYPE}\n"
|
message += "Flavor: ${BuildConfig.FLAVOR}${BuildConfig.BUILD_TYPE}\n"
|
||||||
message += "${resourceHelper.gs(R.string.configbuilder_nightscoutversion_label)} ${nsSettingsStatus.getVersion()}"
|
message += "${rh.gs(R.string.configbuilder_nightscoutversion_label)} ${nsSettingsStatus.getVersion()}"
|
||||||
if (buildHelper.isEngineeringMode()) message += "\n${resourceHelper.gs(R.string.engineering_mode_enabled)}"
|
if (buildHelper.isEngineeringMode()) message += "\n${rh.gs(R.string.engineering_mode_enabled)}"
|
||||||
if (!fabricPrivacy.fabricEnabled()) message += "\n${resourceHelper.gs(R.string.fabric_upload_disabled)}"
|
if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(R.string.fabric_upload_disabled)}"
|
||||||
message += resourceHelper.gs(R.string.about_link_urls)
|
message += rh.gs(R.string.about_link_urls)
|
||||||
val messageSpanned = SpannableString(message)
|
val messageSpanned = SpannableString(message)
|
||||||
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS)
|
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS)
|
||||||
AlertDialog.Builder(this)
|
AlertDialog.Builder(this)
|
||||||
.setTitle(resourceHelper.gs(R.string.app_name) + " " + BuildConfig.VERSION)
|
.setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION)
|
||||||
.setIcon(iconsProvider.getIcon())
|
.setIcon(iconsProvider.getIcon())
|
||||||
.setMessage(messageSpanned)
|
.setMessage(messageSpanned)
|
||||||
.setPositiveButton(resourceHelper.gs(R.string.ok), null)
|
.setPositiveButton(rh.gs(R.string.ok), null)
|
||||||
.setNeutralButton(resourceHelper.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) }
|
.setNeutralButton(rh.gs(R.string.cta_dont_kill_my_app_info)) { _, _ -> DokiActivity.start(context = this@MainActivity) }
|
||||||
.create().apply {
|
.create().apply {
|
||||||
show()
|
show()
|
||||||
findViewById<TextView>(android.R.id.message)?.movementMethod = LinkMovementMethod.getInstance()
|
findViewById<TextView>(android.R.id.message)?.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
|
|
@ -89,8 +89,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
// We don't want to use injected singletons but own instance working on top of different data
|
// 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)
|
iobCobCalculator = IobCobCalculatorPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, rh, 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)
|
overviewData = OverviewData(injector, aapsLogger, rh, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, config, loopPlugin, nsDeviceStatus, repository, overviewMenus, iobCobCalculator, translator)
|
||||||
|
|
||||||
binding.left.setOnClickListener {
|
binding.left.setOnClickListener {
|
||||||
adjustTimeRange(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
|
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
|
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?.reloadStyles()
|
||||||
binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
||||||
|
|
||||||
|
@ -241,8 +241,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
||||||
relativeLayout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
relativeLayout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
val graph = GraphView(this)
|
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.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(100)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
|
||||||
graph.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid)
|
graph.gridLabelRenderer?.gridColor = rh.gc(R.color.graphgrid)
|
||||||
graph.gridLabelRenderer?.reloadStyles()
|
graph.gridLabelRenderer?.reloadStyles()
|
||||||
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
|
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
|
||||||
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
||||||
|
@ -251,7 +251,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
||||||
relativeLayout.addView(graph)
|
relativeLayout.addView(graph)
|
||||||
|
|
||||||
val label = TextView(this)
|
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_TOP)
|
||||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
|
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
|
||||||
label.layoutParams = layoutParams
|
label.layoutParams = layoutParams
|
||||||
|
|
|
@ -31,7 +31,7 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa
|
||||||
override fun afterTextChanged(s: Editable) {}
|
override fun afterTextChanged(s: Editable) {}
|
||||||
})
|
})
|
||||||
|
|
||||||
title = resourceHelper.gs(R.string.nav_preferences)
|
title = rh.gs(R.string.nav_preferences)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
myPreferenceFragment = MyPreferenceFragment()
|
myPreferenceFragment = MyPreferenceFragment()
|
||||||
|
|
|
@ -140,7 +140,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
val profile = if (typeSelected[tabSelected] == ProfileType.MOTOL_DEFAULT) defaultProfile.profile(age, tdd, weight, profileFunction.getUnits())
|
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())
|
else defaultProfileDPV.profile(age, tdd, pct / 100.0, profileFunction.getUnits())
|
||||||
profile?.let {
|
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 " +
|
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(it, "DefaultProfile " +
|
||||||
dateUtil.dateAndTimeAndSecondsString(dateUtil.now())
|
dateUtil.dateAndTimeAndSecondsString(dateUtil.now())
|
||||||
.replace(".", "/")
|
.replace(".", "/")
|
||||||
|
@ -242,8 +242,8 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun getProfileName(age: Double, tdd: Double, weight: Double, basalSumPct: Double, tab: Int): String =
|
private fun getProfileName(age: Double, tdd: Double, weight: Double, basalSumPct: Double, tab: Int): String =
|
||||||
when (typeSelected[tab]) {
|
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.MOTOL_DEFAULT -> if (tdd > 0) rh.gs(R.string.formatwithtdd, age, tdd) else rh.gs(R.string.formatwithweight, age, weight)
|
||||||
ProfileType.DPV_DEFAULT -> resourceHelper.gs(R.string.formatwittddandpct, age, tdd, (basalSumPct * 100).toInt())
|
ProfileType.DPV_DEFAULT -> rh.gs(R.string.formatwittddandpct, age, tdd, (basalSumPct * 100).toInt())
|
||||||
ProfileType.CURRENT -> profileFunction.getProfileName()
|
ProfileType.CURRENT -> profileFunction.getProfileName()
|
||||||
ProfileType.AVAILABLE_PROFILE -> profileList[profileUsed[tab]].toString()
|
ProfileType.AVAILABLE_PROFILE -> profileList[profileUsed[tab]].toString()
|
||||||
ProfileType.PROFILE_SWITCH -> profileSwitch[profileSwitchUsed[tab]].originalCustomizedName
|
ProfileType.PROFILE_SWITCH -> profileSwitch[profileSwitchUsed[tab]].originalCustomizedName
|
||||||
|
@ -263,16 +263,16 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
tabSelected = tab
|
tabSelected = tab
|
||||||
typeSelected[tabSelected] = newContent
|
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
|
// show new content
|
||||||
binding.profiletype.setText(
|
binding.profiletype.setText(
|
||||||
when (typeSelected[tabSelected]) {
|
when (typeSelected[tabSelected]) {
|
||||||
ProfileType.MOTOL_DEFAULT -> resourceHelper.gs(R.string.motoldefaultprofile)
|
ProfileType.MOTOL_DEFAULT -> rh.gs(R.string.motoldefaultprofile)
|
||||||
ProfileType.DPV_DEFAULT -> resourceHelper.gs(R.string.dpvdefaultprofile)
|
ProfileType.DPV_DEFAULT -> rh.gs(R.string.dpvdefaultprofile)
|
||||||
ProfileType.CURRENT -> resourceHelper.gs(R.string.currentprofile)
|
ProfileType.CURRENT -> rh.gs(R.string.currentprofile)
|
||||||
ProfileType.AVAILABLE_PROFILE -> resourceHelper.gs(R.string.availableprofile)
|
ProfileType.AVAILABLE_PROFILE -> rh.gs(R.string.availableprofile)
|
||||||
ProfileType.PROFILE_SWITCH -> resourceHelper.gs(R.string.careportal_profileswitch)
|
ProfileType.PROFILE_SWITCH -> rh.gs(R.string.careportal_profileswitch)
|
||||||
})
|
})
|
||||||
binding.defaultProfile.visibility = (newContent == ProfileType.MOTOL_DEFAULT || newContent == ProfileType.DPV_DEFAULT).toVisibility()
|
binding.defaultProfile.visibility = (newContent == ProfileType.MOTOL_DEFAULT || newContent == ProfileType.DPV_DEFAULT).toVisibility()
|
||||||
binding.currentProfile.visibility = (newContent == ProfileType.CURRENT).toVisibility()
|
binding.currentProfile.visibility = (newContent == ProfileType.CURRENT).toVisibility()
|
||||||
|
@ -293,7 +293,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBackgroundColorOnSelected(tab: Int) {
|
private fun setBackgroundColorOnSelected(tab: Int) {
|
||||||
binding.menu1.setBackgroundColor(resourceHelper.gc(if (tab == 1) R.color.defaultbackground else R.color.tempbasal))
|
binding.menu1.setBackgroundColor(rh.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.menu2.setBackgroundColor(rh.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.utils.ActivityMonitor
|
import info.nightscout.androidaps.utils.ActivityMonitor
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
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.TddCalculator
|
||||||
import info.nightscout.androidaps.utils.stats.TirCalculator
|
import info.nightscout.androidaps.utils.stats.TirCalculator
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -28,9 +29,9 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
||||||
binding = ActivityStatsBinding.inflate(layoutInflater)
|
binding = ActivityStatsBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
binding.tdds.text = getString(R.string.tdd) + ": " + 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) + ": " + getString(R.string.calculation_in_progress)
|
binding.tir.text = getString(R.string.tir) + ": " + rh.gs(R.string.calculation_in_progress)
|
||||||
binding.activity.text = getString(R.string.activitymonitor) + ": " + getString(R.string.calculation_in_progress)
|
binding.activity.text = rh.gs(R.string.activitymonitor) + ": " + rh.gs(R.string.calculation_in_progress)
|
||||||
|
|
||||||
Thread {
|
Thread {
|
||||||
val tdds = tddCalculator.stats()
|
val tdds = tddCalculator.stats()
|
||||||
|
@ -47,7 +48,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.ok.setOnClickListener { finish() }
|
binding.ok.setOnClickListener { finish() }
|
||||||
binding.reset.setOnClickListener {
|
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)
|
uel.log(Action.STAT_RESET, Sources.Stats)
|
||||||
activityMonitor.reset()
|
activityMonitor.reset()
|
||||||
recreate()
|
recreate()
|
||||||
|
|
|
@ -67,14 +67,14 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBackgroundColorOnSelected(selected: View) {
|
private fun setBackgroundColorOnSelected(selected: View) {
|
||||||
binding.treatments.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.treatments.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.extendedBoluses.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.extendedBoluses.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.tempBasals.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.tempBasals.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.tempTargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.tempTargets.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.profileSwitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.profileSwitches.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.careportal.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.careportal.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
binding.userentry.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
|
binding.userentry.setBackgroundColor(rh.gc(R.color.defaultbackground))
|
||||||
selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected))
|
selected.setBackgroundColor(rh.gc(R.color.tabBgColorSelected))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() {
|
||||||
holder.from.text = dateUtil.timeString(quickWizard[position].validFromDate())
|
holder.from.text = dateUtil.timeString(quickWizard[position].validFromDate())
|
||||||
holder.to.text = dateUtil.timeString(quickWizard[position].validToDate())
|
holder.to.text = dateUtil.timeString(quickWizard[position].validToDate())
|
||||||
holder.buttonText.text = quickWizard[position].buttonText()
|
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()
|
override fun getItemCount(): Int = quickWizard.size()
|
||||||
|
|
|
@ -71,25 +71,25 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.otpReset.setOnClickListener {
|
binding.otpReset.setOnClickListener {
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
|
rh.gs(R.string.smscommunicator_otp_reset_title),
|
||||||
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
|
rh.gs(R.string.smscommunicator_otp_reset_prompt),
|
||||||
Runnable {
|
Runnable {
|
||||||
uel.log(Action.OTP_RESET, Sources.SMS)
|
uel.log(Action.OTP_RESET, Sources.SMS)
|
||||||
otp.ensureKey(true)
|
otp.ensureKey(true)
|
||||||
updateGui()
|
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 {
|
binding.otpProvisioning.setOnLongClickListener {
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
resourceHelper.gs(R.string.smscommunicator_otp_export_title),
|
rh.gs(R.string.smscommunicator_otp_export_title),
|
||||||
resourceHelper.gs(R.string.smscommunicator_otp_export_prompt),
|
rh.gs(R.string.smscommunicator_otp_export_prompt),
|
||||||
Runnable {
|
Runnable {
|
||||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
|
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
|
||||||
clipboard.setPrimaryClip(clip)
|
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)
|
uel.log(Action.OTP_EXPORT, Sources.SMS)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -145,13 +145,13 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
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")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun exitPressed(view: View?) {
|
fun exitPressed(view: View?) {
|
||||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
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")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
|
|
|
@ -15,7 +15,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
||||||
|
|
||||||
@Inject lateinit var resourceHelper: ResourceHelperImplementation
|
@Inject lateinit var rh: ResourceHelperImplementation
|
||||||
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
||||||
|
|
||||||
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
|
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
|
||||||
|
@ -35,7 +35,7 @@ open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
||||||
when (it.key) {
|
when (it.key) {
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE ->
|
Manifest.permission.WRITE_EXTERNAL_STORAGE ->
|
||||||
//show dialog after permission is granted
|
//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
|
// ignore the rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,23 +94,23 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
trHead.setBackgroundColor(Color.DKGRAY)
|
trHead.setBackgroundColor(Color.DKGRAY)
|
||||||
trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
trHead.addView(TextView(this).also { labelDate ->
|
trHead.addView(TextView(this).also { labelDate ->
|
||||||
labelDate.text = resourceHelper.gs(R.string.date)
|
labelDate.text = rh.gs(R.string.date)
|
||||||
labelDate.setTextColor(Color.WHITE)
|
labelDate.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
trHead.addView(TextView(this).also { labelBasalRate ->
|
trHead.addView(TextView(this).also { labelBasalRate ->
|
||||||
labelBasalRate.text = resourceHelper.gs(R.string.basalrate)
|
labelBasalRate.text = rh.gs(R.string.basalrate)
|
||||||
labelBasalRate.setTextColor(Color.WHITE)
|
labelBasalRate.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
trHead.addView(TextView(this).also { labelBolus ->
|
trHead.addView(TextView(this).also { labelBolus ->
|
||||||
labelBolus.text = resourceHelper.gs(R.string.bolus)
|
labelBolus.text = rh.gs(R.string.bolus)
|
||||||
labelBolus.setTextColor(Color.WHITE)
|
labelBolus.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
trHead.addView(TextView(this).also { labelTdd ->
|
trHead.addView(TextView(this).also { labelTdd ->
|
||||||
labelTdd.text = resourceHelper.gs(R.string.tdd)
|
labelTdd.text = rh.gs(R.string.tdd)
|
||||||
labelTdd.setTextColor(Color.WHITE)
|
labelTdd.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
trHead.addView(TextView(this).also { labelRatio ->
|
trHead.addView(TextView(this).also { labelRatio ->
|
||||||
labelRatio.text = resourceHelper.gs(R.string.ratio)
|
labelRatio.text = rh.gs(R.string.ratio)
|
||||||
labelRatio.setTextColor(Color.WHITE)
|
labelRatio.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
|
@ -122,15 +122,15 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
ctrHead.setBackgroundColor(Color.DKGRAY)
|
ctrHead.setBackgroundColor(Color.DKGRAY)
|
||||||
ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
ctrHead.addView(TextView(this).also { labelCumAmountDays ->
|
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)
|
labelCumAmountDays.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
ctrHead.addView(TextView(this).also { labelCumTdd ->
|
ctrHead.addView(TextView(this).also { labelCumTdd ->
|
||||||
labelCumTdd.text = resourceHelper.gs(R.string.tdd)
|
labelCumTdd.text = rh.gs(R.string.tdd)
|
||||||
labelCumTdd.setTextColor(Color.WHITE)
|
labelCumTdd.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
ctrHead.addView(TextView(this).also { labelCumRatio ->
|
ctrHead.addView(TextView(this).also { labelCumRatio ->
|
||||||
labelCumRatio.text = resourceHelper.gs(R.string.ratio)
|
labelCumRatio.text = rh.gs(R.string.ratio)
|
||||||
labelCumRatio.setTextColor(Color.WHITE)
|
labelCumRatio.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
|
@ -142,15 +142,15 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
etrHead.setBackgroundColor(Color.DKGRAY)
|
etrHead.setBackgroundColor(Color.DKGRAY)
|
||||||
etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
etrHead.addView(TextView(this).also { labelExpWeight ->
|
etrHead.addView(TextView(this).also { labelExpWeight ->
|
||||||
labelExpWeight.text = resourceHelper.gs(R.string.weight)
|
labelExpWeight.text = rh.gs(R.string.weight)
|
||||||
labelExpWeight.setTextColor(Color.WHITE)
|
labelExpWeight.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
etrHead.addView(TextView(this).also { labelExpTdd ->
|
etrHead.addView(TextView(this).also { labelExpTdd ->
|
||||||
labelExpTdd.text = resourceHelper.gs(R.string.tdd)
|
labelExpTdd.text = rh.gs(R.string.tdd)
|
||||||
labelExpTdd.setTextColor(Color.WHITE)
|
labelExpTdd.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
etrHead.addView(TextView(this).also { labelExpRatio ->
|
etrHead.addView(TextView(this).also { labelExpRatio ->
|
||||||
labelExpRatio.text = resourceHelper.gs(R.string.ratio)
|
labelExpRatio.text = rh.gs(R.string.ratio)
|
||||||
labelExpRatio.setTextColor(Color.WHITE)
|
labelExpRatio.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
|
||||||
|
@ -160,7 +160,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
binding.reload.visibility = View.GONE
|
binding.reload.visibility = View.GONE
|
||||||
binding.connectionStatus.visibility = View.VISIBLE
|
binding.connectionStatus.visibility = View.VISIBLE
|
||||||
binding.message.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() {
|
commandQueue.loadTDDs(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
loadDataFromDB()
|
loadDataFromDB()
|
||||||
|
@ -195,12 +195,14 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
disposable.add(rxBus
|
disposable.add(
|
||||||
|
rxBus
|
||||||
.toObservable(EventPumpStatusChanged::class.java)
|
.toObservable(EventPumpStatusChanged::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(resourceHelper) }, fabricPrivacy::logException)
|
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(rh) }, fabricPrivacy::logException)
|
||||||
)
|
)
|
||||||
disposable.add(rxBus
|
disposable.add(
|
||||||
|
rxBus
|
||||||
.toObservable(EventDanaRSyncStatus::class.java)
|
.toObservable(EventDanaRSyncStatus::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ event ->
|
.subscribe({ event ->
|
||||||
|
@ -292,7 +294,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
tr.id = 100 + i
|
tr.id = 100 + i
|
||||||
tr.layoutParams = TableLayout.LayoutParams(
|
tr.layoutParams = TableLayout.LayoutParams(
|
||||||
TableLayout.LayoutParams.MATCH_PARENT,
|
TableLayout.LayoutParams.MATCH_PARENT,
|
||||||
TableLayout.LayoutParams.WRAP_CONTENT)
|
TableLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
|
||||||
// Here create the TextView dynamically
|
// Here create the TextView dynamically
|
||||||
tr.addView(TextView(this@TDDStatsActivity).also { labelDATE ->
|
tr.addView(TextView(this@TDDStatsActivity).also { labelDATE ->
|
||||||
|
@ -302,17 +305,17 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
})
|
})
|
||||||
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
|
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
|
||||||
labelBASAL.id = 300 + i
|
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)
|
labelBASAL.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
|
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
|
||||||
labelBOLUS.id = 400 + i
|
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)
|
labelBOLUS.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
|
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
|
||||||
labelTDD.id = 500 + i
|
labelTDD.id = 500 + i
|
||||||
labelTDD.text = resourceHelper.gs(R.string.formatinsulinunits, tdd)
|
labelTDD.text = rh.gs(R.string.formatinsulinunits, tdd)
|
||||||
labelTDD.setTextColor(Color.WHITE)
|
labelTDD.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
|
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
|
||||||
|
@ -320,7 +323,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%"
|
labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%"
|
||||||
labelRATIO.setTextColor(Color.WHITE)
|
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++
|
||||||
}
|
}
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -349,7 +353,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
|
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
|
||||||
labelCUMTDD.id = 900 + i
|
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)
|
labelCUMTDD.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -363,7 +367,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) {
|
if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) {
|
||||||
binding.message.visibility = View.VISIBLE
|
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)
|
} else binding.mainTable.setBackgroundColor(Color.TRANSPARENT)
|
||||||
if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) {
|
if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) {
|
||||||
//Today should not be included
|
//Today should not be included
|
||||||
|
@ -401,9 +405,9 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
|
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
|
||||||
labelEXPTDD.id = 1300 + i
|
labelEXPTDD.id = 1300 + i
|
||||||
labelEXPTDD.text = """
|
labelEXPTDD.text = """
|
||||||
${resourceHelper.gs(R.string.formatinsulinunits, weighted03)}
|
${rh.gs(R.string.formatinsulinunits, weighted03)}
|
||||||
${resourceHelper.gs(R.string.formatinsulinunits, weighted05)}
|
${rh.gs(R.string.formatinsulinunits, weighted05)}
|
||||||
${resourceHelper.gs(R.string.formatinsulinunits, weighted07)}
|
${rh.gs(R.string.formatinsulinunits, weighted07)}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
labelEXPTDD.setTextColor(Color.WHITE)
|
labelEXPTDD.setTextColor(Color.WHITE)
|
||||||
})
|
})
|
||||||
|
@ -429,7 +433,8 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
|
private fun isOldData(historyList: List<TotalDailyDose>): Boolean {
|
||||||
val type = activePlugin.activePump.pumpDescription.pumpType
|
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())
|
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))
|
return historyList.size < 3 || df.format(Date(historyList[0].timestamp)) != df.format(Date(System.currentTimeMillis() - if (startsYesterday) 1000 * 60 * 60 * 24 else 0))
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.database.entities.TotalDailyDose
|
import info.nightscout.androidaps.database.entities.TotalDailyDose
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
val TotalDailyDose.total
|
val TotalDailyDose.total
|
||||||
get() = if (totalAmount > 0) totalAmount else basalAmount + bolusAmount
|
get() = if (totalAmount > 0) totalAmount else basalAmount + bolusAmount
|
||||||
|
@ -12,10 +11,12 @@ val TotalDailyDose.total
|
||||||
val TotalDailyDose.basalPct: Double
|
val TotalDailyDose.basalPct: Double
|
||||||
get() = if (total > 0) basalAmount / total * 100 else 0.0
|
get() = if (total > 0) basalAmount / total * 100 else 0.0
|
||||||
|
|
||||||
fun TotalDailyDose.toText(resourceHelper: ResourceHelper, dateUtil: DateUtil, includeCarbs: Boolean): String =
|
fun TotalDailyDose.toText(rh: ResourceHelper, dateUtil: DateUtil, includeCarbs: Boolean): String =
|
||||||
if (includeCarbs) resourceHelper.gs(R.string.tddwithcarbsformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct, carbs)
|
if (total.isNaN() || bolusAmount.isNaN() || basalAmount.isNaN() || carbs.isNaN()) ""
|
||||||
else resourceHelper.gs(R.string.tddformat, dateUtil.dateStringShort(timestamp), total, bolusAmount, basalAmount, basalPct)
|
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 =
|
fun TotalDailyDose.toText(rh: 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)
|
if (total.isNaN() || bolusAmount.isNaN() || basalAmount.isNaN() || carbs.isNaN()) ""
|
||||||
else resourceHelper.gs(R.string.tddformat, String.format(Locale.getDefault(), "%d ", days) + resourceHelper.gs(R.string.days), total, bolusAmount, basalAmount, basalAmount / total * 100)
|
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)
|
||||||
|
|
|
@ -65,7 +65,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventPumpStatusChanged::class.java)
|
.toObservable(EventPumpStatusChanged::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ binding.status.text = it.getStatus(resourceHelper) }, fabricPrivacy::logException)
|
.subscribe({ binding.status.text = it.getStatus(rh) }, fabricPrivacy::logException)
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventDanaRSyncStatus::class.java)
|
.toObservable(EventDanaRSyncStatus::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
|
@ -96,19 +96,19 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
val typeList = ArrayList<TypeList>()
|
val typeList = ArrayList<TypeList>()
|
||||||
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, resourceHelper.gs(R.string.danar_history_alarm)))
|
typeList.add(TypeList(RecordTypes.RECORD_TYPE_ALARM, rh.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_BASALHOUR, rh.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_BOLUS, rh.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_CARBO, rh.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_DAILY, rh.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_GLUCOSE, rh.gs(R.string.danar_history_glucose)))
|
||||||
if (!isKorean && !isRS) {
|
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) {
|
if (!isKorean) {
|
||||||
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, resourceHelper.gs(R.string.danar_history_refill)))
|
typeList.add(TypeList(RecordTypes.RECORD_TYPE_REFILL, rh.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_SUSPEND, rh.gs(R.string.danar_history_syspend)))
|
||||||
}
|
}
|
||||||
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
||||||
|
|
||||||
|
@ -180,9 +180,9 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordTypes.RECORD_TYPE_DAILY -> {
|
RecordTypes.RECORD_TYPE_DAILY -> {
|
||||||
holder.binding.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBasal)
|
holder.binding.dailyBasal.text = rh.gs(R.string.formatinsulinunits, record.dailyBasal)
|
||||||
holder.binding.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus)
|
holder.binding.dailyBolus.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus)
|
||||||
holder.binding.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
|
holder.binding.dailyTotal.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
|
||||||
holder.binding.time.text = dateUtil.dateString(record.timestamp)
|
holder.binding.time.text = dateUtil.dateString(record.timestamp)
|
||||||
holder.binding.time.visibility = View.VISIBLE
|
holder.binding.time.visibility = View.VISIBLE
|
||||||
holder.binding.value.visibility = View.GONE
|
holder.binding.value.visibility = View.GONE
|
||||||
|
|
|
@ -153,7 +153,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.setUserOptions(object : Callback() {
|
commandQueue.setUserOptions(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,12 +39,12 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
val p1 = DefaultEditTextValidator(binding.rsV3Pin1, this)
|
val p1 = DefaultEditTextValidator(binding.rsV3Pin1, this)
|
||||||
.setTestErrorString(resourceHelper.gs(R.string.error_mustbe12hexadidits), this)
|
.setTestErrorString(rh.gs(R.string.error_mustbe12hexadidits), this)
|
||||||
.setCustomRegexp(resourceHelper.gs(R.string.twelvehexanumber), this)
|
.setCustomRegexp(rh.gs(R.string.twelvehexanumber), this)
|
||||||
.setTestType(EditTextValidator.TEST_REGEXP, this)
|
.setTestType(EditTextValidator.TEST_REGEXP, this)
|
||||||
val p2 = DefaultEditTextValidator(binding.rsV3Pin2, this)
|
val p2 = DefaultEditTextValidator(binding.rsV3Pin2, this)
|
||||||
.setTestErrorString(resourceHelper.gs(R.string.error_mustbe8hexadidits), this)
|
.setTestErrorString(rh.gs(R.string.error_mustbe8hexadidits), this)
|
||||||
.setCustomRegexp(resourceHelper.gs(R.string.eighthexanumber), this)
|
.setCustomRegexp(rh.gs(R.string.eighthexanumber), this)
|
||||||
.setTestType(EditTextValidator.TEST_REGEXP, this)
|
.setTestType(EditTextValidator.TEST_REGEXP, this)
|
||||||
|
|
||||||
binding.okcancel.ok.setOnClickListener {
|
binding.okcancel.ok.setOnClickListener {
|
||||||
|
@ -56,7 +56,7 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
|
||||||
if (result) {
|
if (result) {
|
||||||
bleComm.finishV3Pairing()
|
bleComm.finishV3Pairing()
|
||||||
finish()
|
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() }
|
binding.okcancel.cancel.setOnClickListener { finish() }
|
||||||
|
@ -86,12 +86,12 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
|
||||||
for (i in pairingKey.indices)
|
for (i in pairingKey.indices)
|
||||||
pairingKeyCheckSum = pairingKeyCheckSum xor pairingKey[i]
|
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)
|
for (i in randomPairingKey.indices)
|
||||||
pairingKeyCheckSum = pairingKeyCheckSum xor randomPairingKey[i]
|
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
|
return checksum[0] == pairingKeyCheckSum
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventPumpStatusChanged::class.java)
|
.toObservable(EventPumpStatusChanged::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.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)
|
swapAdapter(showingType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
val typeList = ArrayList<TypeList>()
|
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_ALARM, rh.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_BASALHOUR, rh.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_BOLUS, rh.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_TB, rh.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_DAILY, rh.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_REFILL, rh.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_SUSPEND, rh.gs(R.string.diaconn_g8_history_suspend)))
|
||||||
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
binding.spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, typeList)
|
||||||
|
|
||||||
binding.reload.setOnClickListener {
|
binding.reload.setOnClickListener {
|
||||||
|
@ -163,9 +163,9 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordTypes.RECORD_TYPE_DAILY -> {
|
RecordTypes.RECORD_TYPE_DAILY -> {
|
||||||
holder.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBasal)
|
holder.dailyBasal.text = rh.gs(R.string.formatinsulinunits, record.dailyBasal)
|
||||||
holder.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus)
|
holder.dailyBolus.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus)
|
||||||
holder.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
|
holder.dailyTotal.text = rh.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
|
||||||
holder.time.text = dateUtil.dateString(record.timestamp)
|
holder.time.text = dateUtil.dateString(record.timestamp)
|
||||||
holder.time.visibility = View.VISIBLE
|
holder.time.visibility = View.VISIBLE
|
||||||
holder.value.visibility = View.GONE
|
holder.value.visibility = View.GONE
|
||||||
|
|
|
@ -158,7 +158,7 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||||
i.putExtra("soundid", R.raw.boluserror)
|
i.putExtra("soundid", R.raw.boluserror)
|
||||||
i.putExtra("status", result.comment)
|
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)
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
context.startActivity(i)
|
context.startActivity(i)
|
||||||
}
|
}
|
||||||
|
@ -169,9 +169,9 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun fillSoundCategory() {
|
private fun fillSoundCategory() {
|
||||||
val categories = ArrayList<String>()
|
val categories = ArrayList<String>()
|
||||||
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_sound))
|
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_sound))
|
||||||
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_vibrate))
|
categories.add(rh.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_silent))
|
||||||
context.let { context ->
|
context.let { context ->
|
||||||
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
|
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
|
||||||
binding.beepAndAlarm.adapter = adapterCategories
|
binding.beepAndAlarm.adapter = adapterCategories
|
||||||
|
@ -180,9 +180,9 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun fillSoundSubCategory() {
|
private fun fillSoundSubCategory() {
|
||||||
val categories = ArrayList<String>()
|
val categories = ArrayList<String>()
|
||||||
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_intensity_low))
|
categories.add(rh.gs(R.string.diaconn_g8_pumpalarm_intensity_low))
|
||||||
categories.add(resourceHelper.gs(R.string.diaconn_g8_pumpalarm_intensity_middle))
|
categories.add(rh.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_high))
|
||||||
context.let { context ->
|
context.let { context ->
|
||||||
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
|
val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories)
|
||||||
binding.alarmIntesity.adapter = adapterCategories
|
binding.alarmIntesity.adapter = adapterCategories
|
||||||
|
|
|
@ -153,7 +153,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
statusView?.run { visibility = View.GONE }
|
statusView?.run { visibility = View.GONE }
|
||||||
|
|
||||||
historyTypeSpinner = findViewById(R.id.omnipod_historytype)
|
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!!)
|
val spinnerAdapter: ArrayAdapter<TypeList> = ArrayAdapter<TypeList>(this, R.layout.spinner_centered, typeListFull!!)
|
||||||
historyTypeSpinner?.run {
|
historyTypeSpinner?.run {
|
||||||
adapter = spinnerAdapter
|
adapter = spinnerAdapter
|
||||||
|
@ -248,7 +248,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setType(record: HistoryRecord, typeView: TextView) {
|
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
|
// Set some color, include result
|
||||||
setTextViewColor(check_result = true, typeView, record)
|
setTextViewColor(check_result = true, typeView, record)
|
||||||
}
|
}
|
||||||
|
@ -257,21 +257,21 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
||||||
valueView.text = historyEntry.toString()
|
valueView.text = historyEntry.toString()
|
||||||
// val entryType = historyEntry.commandType
|
// val entryType = historyEntry.commandType
|
||||||
if (!historyEntry.isSuccess()) {
|
if (!historyEntry.isSuccess()) {
|
||||||
valueView.text = resourceHelper.gs(translatedFailure(historyEntry))
|
valueView.text = rh.gs(translatedFailure(historyEntry))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
valueView.text = when (historyEntry.commandType) {
|
valueView.text = when (historyEntry.commandType) {
|
||||||
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
|
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
|
||||||
val tbr = historyEntry.record as TempBasalRecord
|
val tbr = historyEntry.record as TempBasalRecord
|
||||||
tbr.let {
|
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
|
val bolus = historyEntry.record as BolusRecord
|
||||||
bolus.let {
|
bolus.let {
|
||||||
resourceHelper.gs(R.string.omnipod_common_history_bolus_value, it.amout)
|
rh.gs(R.string.omnipod_common_history_bolus_value, it.amout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
binding.buttonDiscardPod.setOnClickListener {
|
binding.buttonDiscardPod.setOnClickListener {
|
||||||
OKDialog.showConfirmation(
|
OKDialog.showConfirmation(
|
||||||
this,
|
this,
|
||||||
resourceHelper.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation),
|
rh.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation),
|
||||||
Thread {
|
Thread {
|
||||||
podStateManager.reset()
|
podStateManager.reset()
|
||||||
}
|
}
|
||||||
|
@ -83,10 +83,10 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
displayErrorDialog(
|
displayErrorDialog(
|
||||||
resourceHelper.gs(R.string.omnipod_common_warning),
|
rh.gs(R.string.omnipod_common_warning),
|
||||||
resourceHelper.gs(
|
rh.gs(
|
||||||
R.string.omnipod_common_two_strings_concatenated_by_colon,
|
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
|
result.comment
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.buttonDiscardPod.setOnClickListener {
|
binding.buttonDiscardPod.setOnClickListener {
|
||||||
OKDialog.showConfirmation(this,
|
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()
|
aapsOmnipodManager.discardPodState()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.customCommand(CommandPlayTestBeep(), object : Callback() {
|
commandQueue.customCommand(CommandPlayTestBeep(), object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
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() {
|
commandQueue.customCommand(CommandReadPulseLog(), object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
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() {
|
private fun displayNotConfiguredDialog() {
|
||||||
context.let {
|
context.let {
|
||||||
UIRunnable {
|
UIRunnable {
|
||||||
OKDialog.show(it, resourceHelper.gs(R.string.omnipod_common_warning),
|
OKDialog.show(it, rh.gs(R.string.omnipod_common_warning),
|
||||||
resourceHelper.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null)
|
rh.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null)
|
||||||
}.run()
|
}.run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue