Merge branch 'dev' into chore/shared-action-helper

This commit is contained in:
Milos Kozak 2022-03-28 21:52:41 +02:00 committed by GitHub
commit 357b3abd67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 301 additions and 195 deletions

View file

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

View file

@ -20,11 +20,10 @@ import android.widget.EditText
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.google.firebase.crashlytics.FirebaseCrashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.joanzapata.iconify.Iconify import com.joanzapata.iconify.Iconify
@ -335,7 +334,7 @@ class MainActivity : NoSplashAppCompatActivity() {
message += rh.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, R.style.DialogTheme) MaterialAlertDialogBuilder(this, R.style.DialogTheme)
.setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION) .setTitle(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION)
.setIcon(iconsProvider.getIcon()) .setIcon(iconsProvider.getIcon())
.setMessage(messageSpanned) .setMessage(messageSpanned)

View file

@ -196,7 +196,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 = rh.gc(R.color.graphgrid) binding.bgGraph.gridLabelRenderer?.gridColor = rh.gac(this, R.attr.graphgrid)
binding.bgGraph.gridLabelRenderer?.reloadStyles() binding.bgGraph.gridLabelRenderer?.reloadStyles()
binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth binding.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
@ -280,12 +280,12 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
val graph = GraphView(this) val graph = GraphView(this)
graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(100)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) } graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(100)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
graph.gridLabelRenderer?.gridColor = rh.gc(R.color.graphgrid) graph.gridLabelRenderer?.gridColor = rh.gac( R.attr.graphgrid)
graph.gridLabelRenderer?.reloadStyles() graph.gridLabelRenderer?.reloadStyles()
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
graph.gridLabelRenderer?.numVerticalLabels = 3 graph.gridLabelRenderer?.numVerticalLabels = 3
graph.viewport.backgroundColor = Color.argb(20, 255, 255, 255) // 8% of gray graph.viewport.backgroundColor =rh.gac(this , R.attr.viewPortbackgroundColor)
relativeLayout.addView(graph) relativeLayout.addView(graph)
val label = TextView(this) val label = TextView(this)

View file

@ -286,7 +286,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
tabSelected = tab tabSelected = tab
typeSelected[tabSelected] = newContent typeSelected[tabSelected] = newContent
binding.profileTypeTitle.defaultHintTextColor = ColorStateList.valueOf(rh.gc(if (tab == 0) R.color.helperProfile else R.color.examinedProfile)) binding.profileTypeTitle.defaultHintTextColor = ColorStateList.valueOf(rh.gac( this, if (tab == 0) R.attr.helperProfileColor else R.attr.examinedProfileColor))
// show new content // show new content
binding.profileType.setText( binding.profileType.setText(
@ -317,7 +317,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
} }
private fun setBackgroundColorOnSelected(tab: Int) { private fun setBackgroundColorOnSelected(tab: Int) {
binding.menu1.setBackgroundColor(rh.gc(if (tab == 1) R.color.defaultbackground else R.color.helperProfile)) binding.menu1.setBackgroundColor(rh.gac(this, if (tab == 1) R.attr.defaultbackground else R.attr.helperProfileColor))
binding.menu2.setBackgroundColor(rh.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile)) binding.menu2.setBackgroundColor(rh.gac(this, if (tab == 0) R.attr.defaultbackground else R.attr.examinedProfileColor))
} }
} }

View file

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

View file

@ -227,7 +227,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility() holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility()
val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia) val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia)
if (iob.iobContrib > 0.01) { if (iob.iobContrib > 0.01) {
holder.binding.iob.setTextColor(rh.gc(R.color.colorActive)) holder.binding.iob.setTextColor(rh.gac(context , R.attr.activeColor))
holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iobContrib) holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iobContrib)
holder.binding.iobLabel.visibility = View.VISIBLE holder.binding.iobLabel.visibility = View.VISIBLE
holder.binding.iob.visibility = View.VISIBLE holder.binding.iob.visibility = View.VISIBLE
@ -237,7 +237,8 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
holder.binding.iobLabel.visibility = View.GONE holder.binding.iobLabel.visibility = View.GONE
holder.binding.iob.visibility = View.GONE holder.binding.iob.visibility = View.GONE
} }
if (bolus.timestamp > dateUtil.now()) holder.binding.date.setTextColor(rh.gc(R.color.colorScheduled)) else holder.binding.date.setTextColor(holder.binding.carbs.currentTextColor) if (bolus.timestamp > dateUtil.now()) holder.binding.date.setTextColor(rh.gac(context, R.attr.scheduledColor)) else holder.binding.date.setTextColor(holder.binding.carbs
.currentTextColor)
holder.binding.mealOrCorrection.text = holder.binding.mealOrCorrection.text =
when (ml.bolus.type) { when (ml.bolus.type) {
Bolus.Type.SMB -> "SMB" Bolus.Type.SMB -> "SMB"

View file

@ -143,7 +143,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(extendedBolus.timestamp, rh) else "" holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(extendedBolus.timestamp, rh) else ""
if (extendedBolus.isInProgress(dateUtil)) { if (extendedBolus.isInProgress(dateUtil)) {
holder.binding.time.text = dateUtil.timeString(extendedBolus.timestamp) holder.binding.time.text = dateUtil.timeString(extendedBolus.timestamp)
holder.binding.time.setTextColor(rh.gc(R.color.colorActive)) holder.binding.time.setTextColor(rh.gac(context , R.attr.activeColor))
} else { } else {
holder.binding.time.text = dateUtil.timeRangeString(extendedBolus.timestamp, extendedBolus.end) holder.binding.time.text = dateUtil.timeRangeString(extendedBolus.timestamp, extendedBolus.end)
holder.binding.time.setTextColor(holder.binding.insulin.currentTextColor) holder.binding.time.setTextColor(holder.binding.insulin.currentTextColor)
@ -154,7 +154,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
val iob = extendedBolus.iobCalc(System.currentTimeMillis(), profile, activePlugin.activeInsulin) val iob = extendedBolus.iobCalc(System.currentTimeMillis(), profile, activePlugin.activeInsulin)
holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iob) holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iob)
holder.binding.ratio.text = rh.gs(R.string.pump_basebasalrate, extendedBolus.rate) holder.binding.ratio.text = rh.gs(R.string.pump_basebasalrate, extendedBolus.rate)
if (iob.iob != 0.0) holder.binding.iob.setTextColor(rh.gc(R.color.colorActive)) else holder.binding.iob.setTextColor(holder.binding.insulin.currentTextColor) if (iob.iob != 0.0) holder.binding.iob.setTextColor(rh.gac(context , R.attr.activeColor)) else holder.binding.iob.setTextColor(holder.binding.insulin.currentTextColor)
holder.binding.cbRemove.visibility = (extendedBolus.isValid && actionHelper.isRemoving).toVisibility() holder.binding.cbRemove.visibility = (extendedBolus.isValid && actionHelper.isRemoving).toVisibility()
if (actionHelper.isRemoving) { if (actionHelper.isRemoving) {
holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> holder.binding.cbRemove.setOnCheckedChangeListener { _, value ->

View file

@ -199,7 +199,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
holder.binding.duration.text = rh.gs(R.string.format_mins, T.msecs(profileSwitch.duration ?: 0L).mins()) holder.binding.duration.text = rh.gs(R.string.format_mins, T.msecs(profileSwitch.duration ?: 0L).mins())
holder.binding.name.text = holder.binding.name.text =
if (profileSwitch is ProfileSealed.PS) profileSwitch.value.getCustomizedName() else if (profileSwitch is ProfileSealed.EPS) profileSwitch.value.originalCustomizedName else "" if (profileSwitch is ProfileSealed.PS) profileSwitch.value.getCustomizedName() else if (profileSwitch is ProfileSealed.EPS) profileSwitch.value.originalCustomizedName else ""
if (profileSwitch.isInProgress(dateUtil)) holder.binding.date.setTextColor(rh.gc(R.color.colorActive)) if (profileSwitch.isInProgress(dateUtil)) holder.binding.date.setTextColor(rh.gac(context , R.attr.activeColor))
else holder.binding.date.setTextColor(holder.binding.duration.currentTextColor) else holder.binding.date.setTextColor(holder.binding.duration.currentTextColor)
holder.binding.clone.tag = profileSwitch holder.binding.clone.tag = profileSwitch
holder.binding.name.tag = profileSwitch holder.binding.name.tag = profileSwitch

View file

@ -190,8 +190,8 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
holder.binding.reason.text = translator.translate(tempTarget.reason) holder.binding.reason.text = translator.translate(tempTarget.reason)
holder.binding.time.setTextColor( holder.binding.time.setTextColor(
when { when {
tempTarget.id == currentlyActiveTarget?.id -> rh.gc(R.color.colorActive) tempTarget.id == currentlyActiveTarget?.id -> rh.gac(context , R.attr.activeColor)
tempTarget.timestamp > dateUtil.now() -> rh.gc(R.color.colorScheduled) tempTarget.timestamp > dateUtil.now() -> rh.gac(context , R.attr.scheduledColor)
else -> holder.binding.reasonColon.currentTextColor else -> holder.binding.reasonColon.currentTextColor
} }
) )

View file

@ -183,7 +183,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(tempBasal.timestamp, rh) else "" holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(tempBasal.timestamp, rh) else ""
if (tempBasal.isInProgress) { if (tempBasal.isInProgress) {
holder.binding.time.text = dateUtil.timeString(tempBasal.timestamp) holder.binding.time.text = dateUtil.timeString(tempBasal.timestamp)
holder.binding.time.setTextColor(rh.gc(R.color.colorActive)) holder.binding.time.setTextColor(rh.gac(context , R.attr.activeColor))
} else { } else {
holder.binding.time.text = dateUtil.timeRangeString(tempBasal.timestamp, tempBasal.end) holder.binding.time.text = dateUtil.timeRangeString(tempBasal.timestamp, tempBasal.end)
holder.binding.time.setTextColor(holder.binding.duration.currentTextColor) holder.binding.time.setTextColor(holder.binding.duration.currentTextColor)
@ -200,7 +200,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
holder.binding.suspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.PUMP_SUSPEND).toVisibility() holder.binding.suspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.PUMP_SUSPEND).toVisibility()
holder.binding.emulatedSuspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.EMULATED_PUMP_SUSPEND).toVisibility() holder.binding.emulatedSuspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.EMULATED_PUMP_SUSPEND).toVisibility()
holder.binding.superBolusFlag.visibility = (tempBasal.type == TemporaryBasal.Type.SUPERBOLUS).toVisibility() holder.binding.superBolusFlag.visibility = (tempBasal.type == TemporaryBasal.Type.SUPERBOLUS).toVisibility()
if (abs(iob.basaliob) > 0.01) holder.binding.iob.setTextColor(rh.gc(R.color.colorActive)) else holder.binding.iob.setTextColor(holder.binding.duration.currentTextColor) if (abs(iob.basaliob) > 0.01) holder.binding.iob.setTextColor(rh.gac(context , R.attr.activeColor)) else holder.binding.iob.setTextColor(holder.binding.duration.currentTextColor)
holder.binding.cbRemove.visibility = (tempBasal.isValid && actionHelper.isRemoving).toVisibility() holder.binding.cbRemove.visibility = (tempBasal.isValid && actionHelper.isRemoving).toVisibility()
if (actionHelper.isRemoving) { if (actionHelper.isRemoving) {
holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> holder.binding.cbRemove.setOnCheckedChangeListener { _, value ->

View file

@ -59,7 +59,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
@Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var protectionCheck: ProtectionCheck
private var queryingProtection = false private var queryingProtection = false
private var profileIndex: Int? = null private var profileName: String? = null
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
private var _binding: DialogProfileswitchBinding? = null private var _binding: DialogProfileswitchBinding? = null
@ -90,7 +90,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
): View { ): View {
onCreateViewGeneral() onCreateViewGeneral()
arguments?.let { bundle -> arguments?.let { bundle ->
profileIndex = bundle.getInt("profileIndex", 0) profileName = bundle.getString("profileName", null)
} }
_binding = DialogProfileswitchBinding.inflate(inflater, container, false) _binding = DialogProfileswitchBinding.inflate(inflater, container, false)
return binding.root return binding.root
@ -130,8 +130,8 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
} }
binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList)) binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList))
// set selected to actual profile // set selected to actual profile
if (profileIndex != null) if (profileName != null)
binding.profileList.setText(profileList[profileIndex as Int], false) binding.profileList.setText(profileName, false)
else { else {
binding.profileList.setText(profileList[0], false) binding.profileList.setText(profileList[0], false)
for (p in profileList.indices) for (p in profileList.indices)

View file

@ -302,6 +302,7 @@ class WizardDialog : DaggerDialogFragment() {
binding.trendCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility() binding.trendCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.iobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility() binding.iobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.cobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility() binding.cobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.checkboxRow.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
} }
private fun saveCheckedStates() { private fun saveCheckedStates() {

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.overview package info.nightscout.androidaps.plugins.general.overview
import android.content.Context
import android.graphics.DashPathEffect import android.graphics.DashPathEffect
import android.graphics.Paint import android.graphics.Paint
import com.jjoe64.graphview.series.BarGraphSeries import com.jjoe64.graphview.series.BarGraphSeries
@ -138,12 +139,13 @@ class OverviewData @Inject constructor(
lastBg.valueToUnits(profileFunction.getUnits()) > defaultValueHelper.determineHighLine() lastBg.valueToUnits(profileFunction.getUnits()) > defaultValueHelper.determineHighLine()
} ?: false } ?: false
val lastBgColor: Int fun lastBgColor(context: Context?): Int {
get() = when { return when {
isLow -> rh.gc(R.color.low) isLow -> rh.gac(context, R.attr.bgLow)
isHigh -> rh.gc(R.color.high) isHigh -> rh.gac(context, R.attr.bgHigh)
else -> rh.gc(R.color.inrange) else -> rh.gac(context, R.attr.bgInRange)
} }
}
val lastBgDescription: String val lastBgDescription: String
get() = when { get() = when {

View file

@ -173,7 +173,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.notifications.setHasFixedSize(false) binding.notifications.setHasFixedSize(false)
binding.notifications.layoutManager = LinearLayoutManager(view.context) binding.notifications.layoutManager = LinearLayoutManager(view.context)
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.graphsLayout.bgGraph.gridLabelRenderer?.gridColor = rh.gc(R.color.graphgrid) binding.graphsLayout.bgGraph.gridLabelRenderer?.gridColor = rh.gac(context, R.attr.graphgrid)
binding.graphsLayout.bgGraph.gridLabelRenderer?.reloadStyles() binding.graphsLayout.bgGraph.gridLabelRenderer?.reloadStyles()
binding.graphsLayout.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth binding.graphsLayout.bgGraph.gridLabelRenderer?.labelVerticalWidth = axisWidth
binding.graphsLayout.bgGraph.layoutParams?.height = rh.dpToPx(skinProvider.activeSkin().mainGraphHeight) binding.graphsLayout.bgGraph.layoutParams?.height = rh.dpToPx(skinProvider.activeSkin().mainGraphHeight)
@ -416,14 +416,15 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
loop.invoke("Accept temp button", false) loop.invoke("Accept temp button", false)
if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) { if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) {
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
OKDialog.showConfirmation(activity, rh.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned() if (isAdded)
?: "".toSpanned(), { OKDialog.showConfirmation(activity, rh.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
uel.log(Action.ACCEPTS_TEMP_BASAL, Sources.Overview) ?: "".toSpanned(), {
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?)?.cancel(Constants.notificationID) uel.log(Action.ACCEPTS_TEMP_BASAL, Sources.Overview)
rxBus.send(EventWearInitiateAction("cancelChangeRequest")) (context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?)?.cancel(Constants.notificationID)
Thread { loop.acceptChangeRequest() }.run() rxBus.send(EventWearInitiateAction("cancelChangeRequest"))
binding.buttonsLayout.acceptTempButton.visibility = View.GONE Thread { loop.acceptChangeRequest() }.run()
}) binding.buttonsLayout.acceptTempButton.visibility = View.GONE
})
}) })
} }
} }
@ -559,10 +560,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.buttonsLayout.calibrationButton.visibility = (xDripIsBgSource && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility() binding.buttonsLayout.calibrationButton.visibility = (xDripIsBgSource && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility()
if (dexcomIsSource) { if (dexcomIsSource) {
binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_byoda), null, null) binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_byoda), null, null)
binding.buttonsLayout.cgmButton.setTextColor(rh.gc(R.color.colorLightGray)) binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmdexColor))
} else if (xDripIsBgSource) { } else if (xDripIsBgSource) {
binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_xdrip), null, null) binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_xdrip), null, null)
binding.buttonsLayout.cgmButton.setTextColor(rh.gc(R.color.colorCalibrationButton)) binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmxdripColor))
} }
binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility() binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility()
@ -574,7 +575,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
if (event.isEnabled && event.trigger.shouldRun()) if (event.isEnabled && event.trigger.shouldRun())
context?.let { context -> context?.let { context ->
SingleClickButton(context).also { SingleClickButton(context).also {
it.setTextColor(rh.gc(R.color.colorTreatmentButton)) it.setTextColor(rh.gac(context, R.attr.treatmentButton))
it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f) it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l -> it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l ->
l.setMargins(0, 0, rh.dpToPx(-4), 0) l.setMargins(0, 0, rh.dpToPx(-4), 0)
@ -583,11 +584,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
it.text = event.title it.text = event.title
it.setOnClickListener { it.setOnClickListener {
OKDialog.showConfirmation( OKDialog.showConfirmation(context, rh.gs(R.string.run_question, event.title), { handler.post { automationPlugin.processEvent(event) } })
context,
rh.gs(R.string.run_question, event.title),
{ handler.post { automationPlugin.processEvent(event) } }
)
} }
binding.buttonsLayout.userButtonsLayout.addView(it) binding.buttonsLayout.userButtonsLayout.addView(it)
} }
@ -722,12 +719,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val graph = GraphView(context) val graph = GraphView(context)
graph.layoutParams = graph.layoutParams =
LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) } LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
graph.gridLabelRenderer?.gridColor = rh.gc(R.color.graphgrid) graph.gridLabelRenderer?.gridColor = rh.gac(context, R.attr.graphgrid)
graph.gridLabelRenderer?.reloadStyles() graph.gridLabelRenderer?.reloadStyles()
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
graph.gridLabelRenderer?.labelVerticalWidth = axisWidth graph.gridLabelRenderer?.labelVerticalWidth = axisWidth
graph.gridLabelRenderer?.numVerticalLabels = 3 graph.gridLabelRenderer?.numVerticalLabels = 3
graph.viewport.backgroundColor = Color.argb(20, 255, 255, 255) // 8% of gray graph.viewport.backgroundColor = rh.gac(context, R.attr.viewPortbackgroundColor)
relativeLayout.addView(graph) relativeLayout.addView(graph)
val label = TextView(context) val label = TextView(context)
@ -765,15 +762,15 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val units = profileFunction.getUnits() val units = profileFunction.getUnits()
binding.infoLayout.bg.text = overviewData.lastBg?.valueToUnitsString(units) binding.infoLayout.bg.text = overviewData.lastBg?.valueToUnitsString(units)
?: rh.gs(R.string.notavailable) ?: rh.gs(R.string.notavailable)
binding.infoLayout.bg.setTextColor(overviewData.lastBgColor) binding.infoLayout.bg.setTextColor(overviewData.lastBgColor(context))
binding.infoLayout.arrow.setImageResource(trendCalculator.getTrendArrow(overviewData.lastBg).directionToIcon()) binding.infoLayout.arrow.setImageResource(trendCalculator.getTrendArrow(overviewData.lastBg).directionToIcon())
binding.infoLayout.arrow.setColorFilter(overviewData.lastBgColor) binding.infoLayout.arrow.setColorFilter(overviewData.lastBgColor(context))
binding.infoLayout.arrow.contentDescription = overviewData.lastBgDescription + " " + rh.gs(R.string.and) + " " + trendCalculator.getTrendDescription(overviewData.lastBg) binding.infoLayout.arrow.contentDescription = overviewData.lastBgDescription + " " + rh.gs(R.string.and) + " " + trendCalculator.getTrendDescription(overviewData.lastBg)
val glucoseStatus = glucoseStatusProvider.glucoseStatusData val glucoseStatus = glucoseStatusProvider.glucoseStatusData
if (glucoseStatus != null) { if (glucoseStatus != null) {
binding.infoLayout.deltaLarge.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) binding.infoLayout.deltaLarge.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)
binding.infoLayout.deltaLarge.setTextColor(overviewData.lastBgColor) binding.infoLayout.deltaLarge.setTextColor(overviewData.lastBgColor(context))
binding.infoLayout.delta.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) binding.infoLayout.delta.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)
binding.infoLayout.avgDelta.text = Profile.toSignedUnitsString(glucoseStatus.shortAvgDelta, glucoseStatus.shortAvgDelta * Constants.MGDL_TO_MMOLL, units) binding.infoLayout.avgDelta.text = Profile.toSignedUnitsString(glucoseStatus.shortAvgDelta, glucoseStatus.shortAvgDelta * Constants.MGDL_TO_MMOLL, units)
binding.infoLayout.longAvgDelta.text = Profile.toSignedUnitsString(glucoseStatus.longAvgDelta, glucoseStatus.longAvgDelta * Constants.MGDL_TO_MMOLL, units) binding.infoLayout.longAvgDelta.text = Profile.toSignedUnitsString(glucoseStatus.longAvgDelta, glucoseStatus.longAvgDelta * Constants.MGDL_TO_MMOLL, units)
@ -816,27 +813,27 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
profileFunction.getProfile()?.let { profileFunction.getProfile()?.let {
if (it is ProfileSealed.EPS) { if (it is ProfileSealed.EPS) {
if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L) if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L)
rh.gc(R.color.ribbonWarning) rh.gac(context, R.attr.ribbonWarningColor)
else rh.gc(R.color.ribbonDefault) else rh.gac(context, R.attr.ribbonDefaultColor)
} else if (it is ProfileSealed.PS) { } else if (it is ProfileSealed.PS) {
rh.gc(R.color.ribbonDefault) rh.gac(context, R.attr.ribbonDefaultColor)
} else { } else {
rh.gc(R.color.ribbonDefault) rh.gac(context, R.attr.ribbonDefaultColor)
} }
} ?: rh.gc(R.color.ribbonCritical) } ?: rh.gac(context, R.attr.ribbonCriticalColor)
val profileTextColor = val profileTextColor =
profileFunction.getProfile()?.let { profileFunction.getProfile()?.let {
if (it is ProfileSealed.EPS) { if (it is ProfileSealed.EPS) {
if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L) if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L)
rh.gc(R.color.ribbonTextWarning) rh.gac(context, R.attr.ribbonTextWarningColor)
else rh.gc(R.color.ribbonTextDefault) else rh.gac(context, R.attr.ribbonTextDefaultColor)
} else if (it is ProfileSealed.PS) { } else if (it is ProfileSealed.PS) {
rh.gc(R.color.ribbonTextDefault) rh.gac(context, R.attr.ribbonTextDefaultColor)
} else { } else {
rh.gc(R.color.ribbonTextDefault) rh.gac(context, R.attr.ribbonTextDefaultColor)
} }
} ?: rh.gc(R.color.ribbonTextDefault) } ?: rh.gac(context, R.attr.ribbonTextDefaultColor)
binding.activeProfile.text = profileFunction.getProfileNameWithRemainingTime() binding.activeProfile.text = profileFunction.getProfileNameWithRemainingTime()
binding.activeProfile.setBackgroundColor(profileBackgroundColor) binding.activeProfile.setBackgroundColor(profileBackgroundColor)
@ -929,8 +926,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
if (overviewData.temporaryTarget?.isInProgress(dateUtil) == false) overviewData.temporaryTarget = null if (overviewData.temporaryTarget?.isInProgress(dateUtil) == false) overviewData.temporaryTarget = null
val tempTarget = overviewData.temporaryTarget val tempTarget = overviewData.temporaryTarget
if (tempTarget != null) { if (tempTarget != null) {
binding.tempTarget.setTextColor(rh.gc(R.color.ribbonTextWarning)) binding.tempTarget.setTextColor(rh.gac(context, R.attr.ribbonTextWarningColor))
binding.tempTarget.setBackgroundColor(rh.gc(R.color.ribbonWarning)) binding.tempTarget.setBackgroundColor(rh.gac(context, R.attr.ribbonWarningColor))
binding.tempTarget.text = Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, rh) binding.tempTarget.text = Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, rh)
} else { } else {
// If the target is not the same as set in the profile then oref has overridden it // If the target is not the same as set in the profile then oref has overridden it
@ -940,11 +937,11 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) { if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) {
aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed") aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed")
binding.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units) binding.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units)
binding.tempTarget.setTextColor(rh.gc(R.color.ribbonTextWarning)) binding.tempTarget.setTextColor(rh.gac(context, R.attr.ribbonTextWarningColor))
binding.tempTarget.setBackgroundColor(rh.gc(R.color.tempTargetBackground)) binding.tempTarget.setBackgroundColor(rh.gac(context, R.attr.tempTargetBackgroundColor))
} else { } else {
binding.tempTarget.setTextColor(rh.gc(R.color.ribbonTextDefault)) binding.tempTarget.setTextColor(rh.gac(context, R.attr.ribbonTextDefaultColor))
binding.tempTarget.setBackgroundColor(rh.gc(R.color.ribbonDefault)) binding.tempTarget.setBackgroundColor(rh.gac(context, R.attr.ribbonDefaultColor))
binding.tempTarget.text = Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units) binding.tempTarget.text = Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units)
} }
} }

View file

@ -44,6 +44,9 @@ class ActivityGraph : GraphView {
viewport.isXAxisBoundsManual = true viewport.isXAxisBoundsManual = true
viewport.setMinX(0.0) viewport.setMinX(0.0)
viewport.setMaxX((hours * 60).toDouble()) viewport.setMaxX((hours * 60).toDouble())
viewport.isYAxisBoundsManual = true
viewport.setMinY(0.0)
viewport.setMaxY(0.01)
gridLabelRenderer.numHorizontalLabels = (hours + 1).toInt() gridLabelRenderer.numHorizontalLabels = (hours + 1).toInt()
gridLabelRenderer.horizontalAxisTitle = "[min]" gridLabelRenderer.horizontalAxisTitle = "[min]"
secondScale.addSeries(LineGraphSeries(Array(iobArray.size) { i -> iobArray[i] }).also { secondScale.addSeries(LineGraphSeries(Array(iobArray.size) { i -> iobArray[i] }).also {

View file

@ -308,7 +308,7 @@ class LocalProfileFragment : DaggerFragment() {
binding.profileswitch.setOnClickListener { binding.profileswitch.setOnClickListener {
ProfileSwitchDialog() ProfileSwitchDialog()
.also { it.arguments = Bundle().also { bundle -> bundle.putInt("profileIndex", localProfilePlugin.currentProfileIndex) } } .also { it.arguments = Bundle().also { bundle -> bundle.putString("profileName", localProfilePlugin.currentProfile()?.name) } }
.show(childFragmentManager, "ProfileSwitchDialog") .show(childFragmentManager, "ProfileSwitchDialog")
} }
@ -374,7 +374,7 @@ class LocalProfileFragment : DaggerFragment() {
val isValid = localProfilePlugin.isValidEditState(activity) val isValid = localProfilePlugin.isValidEditState(activity)
val isEdited = localProfilePlugin.isEdited val isEdited = localProfilePlugin.isEdited
if (isValid) { if (isValid) {
this.view?.setBackgroundColor(rh.gc(R.color.ok_background)) this.view?.setBackgroundColor(rh.gac(context, R.attr.okBackgroundColor))
binding.profileList.isEnabled = true binding.profileList.isEnabled = true
if (isEdited) { if (isEdited) {
@ -386,7 +386,7 @@ class LocalProfileFragment : DaggerFragment() {
binding.save.visibility = View.GONE binding.save.visibility = View.GONE
} }
} else { } else {
this.view?.setBackgroundColor(rh.gc(R.color.error_background)) this.view?.setBackgroundColor(rh.gac(context, R.attr.errorBackgroundColor))
binding.profileList.isEnabled = false binding.profileList.isEnabled = false
binding.profileswitch.visibility = View.GONE binding.profileswitch.visibility = View.GONE
binding.save.visibility = View.GONE //don't save an invalid profile binding.save.visibility = View.GONE //don't save an invalid profile
@ -401,12 +401,12 @@ class LocalProfileFragment : DaggerFragment() {
} }
private fun processVisibilityOnClick(selected: View) { private fun processVisibilityOnClick(selected: View) {
binding.diaTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) binding.diaTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground))
binding.icTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) binding.icTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground))
binding.isfTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) binding.isfTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground))
binding.basalTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) binding.basalTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground))
binding.targetTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) binding.targetTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground))
selected.setBackgroundColor(rh.gc(R.color.tabBgColorSelected)) selected.setBackgroundColor(rh.gac(context, R.attr.tabBgColorSelected))
binding.diaPlaceholder.visibility = View.GONE binding.diaPlaceholder.visibility = View.GONE
binding.ic.visibility = View.GONE binding.ic.visibility = View.GONE
binding.isf.visibility = View.GONE binding.isf.visibility = View.GONE

View file

@ -23,7 +23,7 @@ class TIR(val date: Long, val lowThreshold: Double, val highThreshold: Double) {
fun above() = run { above++; count++ } fun above() = run { above++; count++ }
private fun belowPct() = if (count > 0) below.toDouble() / count * 100.0 else 0.0 private fun belowPct() = if (count > 0) below.toDouble() / count * 100.0 else 0.0
private fun inRangePct() = if (count > 0) 100 - belowPct() - abovePct() else 0 private fun inRangePct() = if (count > 0) 100 - belowPct() - abovePct() else 0.0
private fun abovePct() = if (count > 0) above.toDouble() / count * 100.0 else 0.0 private fun abovePct() = if (count > 0) above.toDouble() / count * 100.0 else 0.0
companion object { companion object {

View file

@ -5,5 +5,5 @@
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:pathData="M19.744,9.7c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581L13.03,4.714c-0.387,-0.786 -1.675,-0.786 -2.061,0L9.181,8.336L5.183,8.918C4.751,8.98 4.39,9.284 4.255,9.7c-0.135,0.416 -0.023,0.873 0.291,1.178l2.894,2.819L6.757,17.68c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133L12,17.013l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C19.766,10.573 19.881,10.116 19.744,9.7zM18.689,10.261l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35l-3.162,-3.081c-0.063,-0.061 -0.085,-0.153 -0.058,-0.236c0.027,-0.083 0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959l4.369,0.634c0.087,0.013 0.158,0.073 0.185,0.156S18.753,10.2 18.689,10.261z" android:pathData="M19.744,9.7c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581L13.03,4.714c-0.387,-0.786 -1.675,-0.786 -2.061,0L9.181,8.336L5.183,8.918C4.751,8.98 4.39,9.284 4.255,9.7c-0.135,0.416 -0.023,0.873 0.291,1.178l2.894,2.819L6.757,17.68c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133L12,17.013l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C19.766,10.573 19.881,10.116 19.744,9.7zM18.689,10.261l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35l-3.162,-3.081c-0.063,-0.061 -0.085,-0.153 -0.058,-0.236c0.027,-0.083 0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959l4.369,0.634c0.087,0.013 0.158,0.073 0.185,0.156S18.753,10.2 18.689,10.261z"
android:fillColor="#FFFFFF"/> android:fillColor="?attr/colorControlNormal"/>
</vector> </vector>

View file

@ -10,7 +10,7 @@
android:scaleX="0.8" android:scaleX="0.8"
android:scaleY="0.8"> android:scaleY="0.8">
<path <path
android:fillColor="#000" android:fillColor="?attr/colorControlNormal"
android:pathData="M15,20A1,1 0 0,0 16,19V4H8A1,1 0 0,0 7,5V16H5V5A3,3 0 0,1 8,2H19A3,3 0 0,1 22,5V6H20V5A1,1 0 0,0 19,4A1,1 0 0,0 18,5V9L18,19A3,3 0 0,1 15,22H5A3,3 0 0,1 2,19V18H13A2,2 0 0,0 15,20M9,6H14V8H9V6M9,10H14V12H9V10M9,14H14V16H9V14Z" /> android:pathData="M15,20A1,1 0 0,0 16,19V4H8A1,1 0 0,0 7,5V16H5V5A3,3 0 0,1 8,2H19A3,3 0 0,1 22,5V6H20V5A1,1 0 0,0 19,4A1,1 0 0,0 18,5V9L18,19A3,3 0 0,1 15,22H5A3,3 0 0,1 2,19V18H13A2,2 0 0,0 15,20M9,6H14V8H9V6M9,10H14V12H9V10M9,14H14V16H9V14Z" />
</group> </group>
</vector> </vector>

View file

@ -241,6 +241,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/checkbox_row"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="45dp"
android:paddingHorizontal="10dp"> android:paddingHorizontal="10dp">

View file

@ -11,7 +11,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:background="@color/transparent" android:background="@color/transparent"
android:src="@drawable/ic_minus" /> android:src="@drawable/ic_plus" />
<EditText <EditText
android:id="@+id/display" android:id="@+id/display"
@ -29,6 +29,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:background="@color/transparent" android:background="@color/transparent"
android:src="@drawable/ic_plus" /> android:src="@drawable/ic_minus" />
</LinearLayout> </LinearLayout>

View file

@ -45,7 +45,7 @@
android:layout_weight="0.5" android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs" android:drawableTop="@drawable/icon_insulin_carbs"
android:text="@string/overview_treatment_label" android:text="@string/overview_treatment_label"
android:textColor="?attr/treatmentButtonColor" android:textColor="?attr/treatmentButton"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" android:visibility="gone"
tools:ignore="SmallSp" /> tools:ignore="SmallSp" />

View file

@ -5,6 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
card_view:cardElevation="0dp"
card_view:cardBackgroundColor="?attr/cardItemBackgroundColor"> card_view:cardBackgroundColor="?attr/cardItemBackgroundColor">
<LinearLayout <LinearLayout

View file

@ -150,8 +150,10 @@ class AutomationPlugin @Inject constructor(
private fun storeToSP() { private fun storeToSP() {
val array = JSONArray() val array = JSONArray()
val iterator = automationEvents.iterator()
try { try {
for (event in automationEvents) { while (iterator.hasNext()) {
val event = iterator.next()
array.put(JSONObject(event.toJSON())) array.put(JSONObject(event.toJSON()))
} }
} catch (e: JSONException) { } catch (e: JSONException) {
@ -292,8 +294,10 @@ class AutomationPlugin @Inject constructor(
@Synchronized @Synchronized
fun removeAt(index: Int) { fun removeAt(index: Int) {
automationEvents.removeAt(index) if (index >= 0 && index < automationEvents.size) {
rxBus.send(EventAutomationDataChanged()) automationEvents.removeAt(index)
rxBus.send(EventAutomationDataChanged())
}
} }
@Synchronized @Synchronized

View file

@ -30,7 +30,7 @@
android:contentDescription="@string/system_automation" android:contentDescription="@string/system_automation"
android:scaleX="0.9" android:scaleX="0.9"
android:scaleY="0.9" android:scaleY="0.9"
android:src="@drawable/ic_notif_aaps" android:src="@drawable/ic_aaps"
app:layout_constraintBottom_toTopOf="@+id/iconLayout" app:layout_constraintBottom_toTopOf="@+id/iconLayout"
app:layout_constraintEnd_toStartOf="@+id/eventTitle" app:layout_constraintEnd_toStartOf="@+id/eventTitle"
app:layout_constraintStart_toEndOf="@+id/enabled" app:layout_constraintStart_toEndOf="@+id/enabled"

View file

@ -8,7 +8,6 @@ import android.widget.TextView
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.annotation.StyleRes import androidx.annotation.StyleRes
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.view.ContextThemeWrapper import androidx.appcompat.view.ContextThemeWrapper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.androidaps.core.R import info.nightscout.androidaps.core.R
@ -22,7 +21,7 @@ object AlertDialogHelper {
fun buildCustomTitle(context: Context, title: String, fun buildCustomTitle(context: Context, title: String,
@DrawableRes iconResource: Int = R.drawable.ic_check_while_48dp, @DrawableRes iconResource: Int = R.drawable.ic_check_while_48dp,
@StyleRes themeResId: Int = R.style.AppTheme, @StyleRes themeResId: Int = R.style.AppTheme,
@LayoutRes layoutResource: Int = R.layout.dialog_alert_custom): View? { @LayoutRes layoutResource: Int = R.layout.dialog_alert_custom_title): View? {
val titleLayout = LayoutInflater.from(ContextThemeWrapper(context, themeResId)).inflate(layoutResource, null) val titleLayout = LayoutInflater.from(ContextThemeWrapper(context, themeResId)).inflate(layoutResource, null)
(titleLayout.findViewById<View>(R.id.alertdialog_title) as TextView).text = title (titleLayout.findViewById<View>(R.id.alertdialog_title) as TextView).text = title
(titleLayout.findViewById<View>(R.id.alertdialog_icon) as ImageView).setImageResource(iconResource) (titleLayout.findViewById<View>(R.id.alertdialog_icon) as ImageView).setImageResource(iconResource)

View file

@ -32,5 +32,5 @@ interface ResourceHelper {
/** /**
* Get Attribute Color based on theme style for specified context * Get Attribute Color based on theme style for specified context
*/ */
@ColorInt fun gac(context: Context, @AttrRes attributeId: Int): Int @ColorInt fun gac(context: Context?, @AttrRes attributeId: Int): Int
} }

View file

@ -85,8 +85,8 @@ class ResourceHelperImplementation @Inject constructor(private val context: Cont
override fun shortTextMode(): Boolean = !gb(R.bool.isTablet) override fun shortTextMode(): Boolean = !gb(R.bool.isTablet)
override fun gac(context: Context, attributeId: Int): Int = override fun gac(context: Context?, attributeId: Int): Int =
context.getThemeColor(attributeId) (context ?: ContextThemeWrapper(this.context, R.style.AppTheme)).getThemeColor(attributeId)
override fun gac(attributeId: Int): Int = override fun gac(attributeId: Int): Int =
ContextThemeWrapper(this.context, R.style.AppTheme).getThemeColor(attributeId) ContextThemeWrapper(this.context, R.style.AppTheme).getThemeColor(attributeId)

View file

@ -101,7 +101,7 @@ class UserEntryPresentationHelper @Inject constructor(
Sources.Stats -> R.drawable.ic_cp_stats Sources.Stats -> R.drawable.ic_cp_stats
Sources.ConfigBuilder -> R.drawable.ic_cogs Sources.ConfigBuilder -> R.drawable.ic_cogs
Sources.Overview -> R.drawable.ic_home Sources.Overview -> R.drawable.ic_home
Sources.Aaps -> R.drawable.ic_notif_aaps Sources.Aaps -> R.drawable.ic_aaps
Sources.Unknown -> R.drawable.ic_generic_icon Sources.Unknown -> R.drawable.ic_generic_icon
} }

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M22.107,7.852c-1.11,-2.694 -3.265,-4.849 -5.959,-5.959C14.869,1.365 13.468,1.074 12,1.074c-1.468,0 -2.869,0.292 -4.148,0.819c-2.694,1.11 -4.849,3.265 -5.959,5.959C1.365,9.131 1.074,10.532 1.074,12c0,1.468 0.292,2.869 0.819,4.148c1.11,2.694 3.265,4.849 5.959,5.959c1.28,0.527 2.681,0.819 4.148,0.819c1.468,0 2.869,-0.292 4.148,-0.819c2.694,-1.11 4.849,-3.265 5.959,-5.959c0.527,-1.28 0.819,-2.681 0.819,-4.148C22.926,10.532 22.635,9.131 22.107,7.852zM18.837,7.97c-0.694,-1.216 -1.645,-2.172 -2.852,-2.866c-0.527,-0.303 -1.079,-0.539 -1.658,-0.71c-0.638,-0.188 -1.274,0.312 -1.274,0.977v0c0,0.449 0.3,0.831 0.727,0.969c0.386,0.125 0.755,0.293 1.108,0.503c0.874,0.523 1.564,1.236 2.068,2.139c0.504,0.904 0.756,1.916 0.756,3.037c0,1.122 -0.252,2.134 -0.756,3.037c-0.504,0.903 -1.193,1.611 -2.068,2.125c-0.236,0.138 -0.481,0.253 -0.732,0.354v-4.045c0,-0.32 -0.104,-0.584 -0.311,-0.791c-0.208,-0.207 -0.471,-0.311 -0.792,-0.311c-0.302,0 -0.561,0.104 -0.778,0.311c-0.217,0.208 -0.325,0.471 -0.325,0.791v5.246c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.171,0 0.325,-0.033 0.464,-0.096c0.558,-0.131 1.091,-0.322 1.598,-0.581c1.027,-0.523 1.872,-1.24 2.538,-2.153v1.711c0,0.174 0.031,0.33 0.092,0.468c-1.576,1.262 -3.574,2.018 -5.745,2.018c-5.077,0 -9.208,-4.131 -9.208,-9.208S6.923,2.792 12,2.792S21.208,6.923 21.208,12c0,1.742 -0.486,3.372 -1.33,4.762V12.02C19.878,10.537 19.531,9.187 18.837,7.97z"
android:fillColor="?attr/colorControlNormal"/>
<path
android:pathData="M10.847,4.131c-0.135,0 -0.26,0.024 -0.378,0.066C9.559,4.353 8.705,4.649 7.914,5.104C6.707,5.798 5.756,6.754 5.062,7.97c-0.694,1.217 -1.041,2.567 -1.041,4.05c0,1.483 0.337,2.829 1.012,4.035c0.675,1.208 1.597,2.158 2.766,2.852c0.545,0.324 1.12,0.571 1.725,0.742c0.661,0.188 1.321,-0.302 1.321,-0.989c0,-0.459 -0.309,-0.849 -0.746,-0.989c-0.383,-0.122 -0.751,-0.285 -1.103,-0.489c-0.884,-0.514 -1.578,-1.222 -2.082,-2.125C6.412,14.154 6.16,13.142 6.16,12.02c0,-1.122 0.252,-2.134 0.756,-3.037C7.42,8.08 8.114,7.367 8.998,6.844c0.241,-0.142 0.491,-0.26 0.746,-0.363v3.999c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.32,0 0.584,-0.108 0.792,-0.325c0.207,-0.216 0.311,-0.475 0.311,-0.778V5.233c0,-0.32 -0.104,-0.584 -0.311,-0.791C11.431,4.235 11.167,4.131 10.847,4.131z"
android:fillColor="?attr/colorControlNormal"/>
</vector>

View file

@ -1,5 +1,6 @@
<vector android:height="48dp" android:tint="#FFFFFF" <vector android:height="48dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0" android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/> <path android:fillColor="?attr/colorControlNormal"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
</vector> </vector>

View file

@ -5,8 +5,8 @@
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:pathData="M22.107,7.852c-1.11,-2.694 -3.265,-4.849 -5.959,-5.959C14.869,1.365 13.468,1.074 12,1.074c-1.468,0 -2.869,0.292 -4.148,0.819c-2.694,1.11 -4.849,3.265 -5.959,5.959C1.365,9.131 1.074,10.532 1.074,12c0,1.468 0.292,2.869 0.819,4.148c1.11,2.694 3.265,4.849 5.959,5.959c1.28,0.527 2.681,0.819 4.148,0.819c1.468,0 2.869,-0.292 4.148,-0.819c2.694,-1.11 4.849,-3.265 5.959,-5.959c0.527,-1.28 0.819,-2.681 0.819,-4.148C22.926,10.532 22.635,9.131 22.107,7.852zM18.837,7.97c-0.694,-1.216 -1.645,-2.172 -2.852,-2.866c-0.527,-0.303 -1.079,-0.539 -1.658,-0.71c-0.638,-0.188 -1.274,0.312 -1.274,0.977v0c0,0.449 0.3,0.831 0.727,0.969c0.386,0.125 0.755,0.293 1.108,0.503c0.874,0.523 1.564,1.236 2.068,2.139c0.504,0.904 0.756,1.916 0.756,3.037c0,1.122 -0.252,2.134 -0.756,3.037c-0.504,0.903 -1.193,1.611 -2.068,2.125c-0.236,0.138 -0.481,0.253 -0.732,0.354v-4.045c0,-0.32 -0.104,-0.584 -0.311,-0.791c-0.208,-0.207 -0.471,-0.311 -0.792,-0.311c-0.302,0 -0.561,0.104 -0.778,0.311c-0.217,0.208 -0.325,0.471 -0.325,0.791v5.246c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.171,0 0.325,-0.033 0.464,-0.096c0.558,-0.131 1.091,-0.322 1.598,-0.581c1.027,-0.523 1.872,-1.24 2.538,-2.153v1.711c0,0.174 0.031,0.33 0.092,0.468c-1.576,1.262 -3.574,2.018 -5.745,2.018c-5.077,0 -9.208,-4.131 -9.208,-9.208S6.923,2.792 12,2.792S21.208,6.923 21.208,12c0,1.742 -0.486,3.372 -1.33,4.762V12.02C19.878,10.537 19.531,9.187 18.837,7.97z" android:pathData="M22.107,7.852c-1.11,-2.694 -3.265,-4.849 -5.959,-5.959C14.869,1.365 13.468,1.074 12,1.074c-1.468,0 -2.869,0.292 -4.148,0.819c-2.694,1.11 -4.849,3.265 -5.959,5.959C1.365,9.131 1.074,10.532 1.074,12c0,1.468 0.292,2.869 0.819,4.148c1.11,2.694 3.265,4.849 5.959,5.959c1.28,0.527 2.681,0.819 4.148,0.819c1.468,0 2.869,-0.292 4.148,-0.819c2.694,-1.11 4.849,-3.265 5.959,-5.959c0.527,-1.28 0.819,-2.681 0.819,-4.148C22.926,10.532 22.635,9.131 22.107,7.852zM18.837,7.97c-0.694,-1.216 -1.645,-2.172 -2.852,-2.866c-0.527,-0.303 -1.079,-0.539 -1.658,-0.71c-0.638,-0.188 -1.274,0.312 -1.274,0.977v0c0,0.449 0.3,0.831 0.727,0.969c0.386,0.125 0.755,0.293 1.108,0.503c0.874,0.523 1.564,1.236 2.068,2.139c0.504,0.904 0.756,1.916 0.756,3.037c0,1.122 -0.252,2.134 -0.756,3.037c-0.504,0.903 -1.193,1.611 -2.068,2.125c-0.236,0.138 -0.481,0.253 -0.732,0.354v-4.045c0,-0.32 -0.104,-0.584 -0.311,-0.791c-0.208,-0.207 -0.471,-0.311 -0.792,-0.311c-0.302,0 -0.561,0.104 -0.778,0.311c-0.217,0.208 -0.325,0.471 -0.325,0.791v5.246c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.171,0 0.325,-0.033 0.464,-0.096c0.558,-0.131 1.091,-0.322 1.598,-0.581c1.027,-0.523 1.872,-1.24 2.538,-2.153v1.711c0,0.174 0.031,0.33 0.092,0.468c-1.576,1.262 -3.574,2.018 -5.745,2.018c-5.077,0 -9.208,-4.131 -9.208,-9.208S6.923,2.792 12,2.792S21.208,6.923 21.208,12c0,1.742 -0.486,3.372 -1.33,4.762V12.02C19.878,10.537 19.531,9.187 18.837,7.97z"
android:fillColor="?attr/colorControlNormal"/> android:fillColor="@color/white"/>
<path <path
android:pathData="M10.847,4.131c-0.135,0 -0.26,0.024 -0.378,0.066C9.559,4.353 8.705,4.649 7.914,5.104C6.707,5.798 5.756,6.754 5.062,7.97c-0.694,1.217 -1.041,2.567 -1.041,4.05c0,1.483 0.337,2.829 1.012,4.035c0.675,1.208 1.597,2.158 2.766,2.852c0.545,0.324 1.12,0.571 1.725,0.742c0.661,0.188 1.321,-0.302 1.321,-0.989c0,-0.459 -0.309,-0.849 -0.746,-0.989c-0.383,-0.122 -0.751,-0.285 -1.103,-0.489c-0.884,-0.514 -1.578,-1.222 -2.082,-2.125C6.412,14.154 6.16,13.142 6.16,12.02c0,-1.122 0.252,-2.134 0.756,-3.037C7.42,8.08 8.114,7.367 8.998,6.844c0.241,-0.142 0.491,-0.26 0.746,-0.363v3.999c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.32,0 0.584,-0.108 0.792,-0.325c0.207,-0.216 0.311,-0.475 0.311,-0.778V5.233c0,-0.32 -0.104,-0.584 -0.311,-0.791C11.431,4.235 11.167,4.131 10.847,4.131z" android:pathData="M10.847,4.131c-0.135,0 -0.26,0.024 -0.378,0.066C9.559,4.353 8.705,4.649 7.914,5.104C6.707,5.798 5.756,6.754 5.062,7.97c-0.694,1.217 -1.041,2.567 -1.041,4.05c0,1.483 0.337,2.829 1.012,4.035c0.675,1.208 1.597,2.158 2.766,2.852c0.545,0.324 1.12,0.571 1.725,0.742c0.661,0.188 1.321,-0.302 1.321,-0.989c0,-0.459 -0.309,-0.849 -0.746,-0.989c-0.383,-0.122 -0.751,-0.285 -1.103,-0.489c-0.884,-0.514 -1.578,-1.222 -2.082,-2.125C6.412,14.154 6.16,13.142 6.16,12.02c0,-1.122 0.252,-2.134 0.756,-3.037C7.42,8.08 8.114,7.367 8.998,6.844c0.241,-0.142 0.491,-0.26 0.746,-0.363v3.999c0,0.302 0.108,0.561 0.325,0.778c0.217,0.217 0.476,0.325 0.778,0.325c0.32,0 0.584,-0.108 0.792,-0.325c0.207,-0.216 0.311,-0.475 0.311,-0.778V5.233c0,-0.32 -0.104,-0.584 -0.311,-0.791C11.431,4.235 11.167,4.131 10.847,4.131z"
android:fillColor="?attr/colorControlNormal"/> android:fillColor="@color/white"/>
</vector> </vector>

View file

@ -4,9 +4,9 @@
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/StyleDialog"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout <RelativeLayout
style="@style/StyleDialogHeader" style="@style/StyleDialogHeader"

View file

@ -8,7 +8,7 @@
<item name="dialogTitleBackground">@color/dialog_title_background</item> <item name="dialogTitleBackground">@color/dialog_title_background</item>
<item name="dialogTitleColor">@color/dialog_title_color</item> <item name="dialogTitleColor">@color/dialog_title_color</item>
<item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item> <item name="dialogTitleIconTint">@color/dialog_title_icon_tint</item>
<!-- New MaterialComponents attributes. -->dialogTitleBackground <!-- New MaterialComponents attributes. -->
<item name="colorSecondary">@color/secondaryColorDefault</item> <item name="colorSecondary">@color/secondaryColorDefault</item>
<item name="colorPrimaryVariant">@color/primaryLightColorDefault</item> <item name="colorPrimaryVariant">@color/primaryLightColorDefault</item>
<item name="colorSecondaryVariant">@color/secondaryLightColorDefault</item> <item name="colorSecondaryVariant">@color/secondaryLightColorDefault</item>
@ -19,9 +19,6 @@
<item name="colorOnBackground">@color/white</item> <item name="colorOnBackground">@color/white</item>
<item name="colorOnError">@color/black</item> <item name="colorOnError">@color/black</item>
<item name="scrimBackground">@color/mtrl_scrim_color</item> <item name="scrimBackground">@color/mtrl_scrim_color</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColor">@color/white</item>
<item name="popupMenuStyle">@style/Widget.MaterialComponents.PopupMenu</item> <item name="popupMenuStyle">@style/Widget.MaterialComponents.PopupMenu</item>
<item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow</item> <item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow</item>
<!-- Fragment background for some themes default transparent --> <!-- Fragment background for some themes default transparent -->
@ -36,8 +33,6 @@
<item name="actionModeCloseDrawable">@drawable/ic_close</item> <item name="actionModeCloseDrawable">@drawable/ic_close</item>
<!---bolus color --> <!---bolus color -->
<item name="bolusColor">@color/bolus</item> <item name="bolusColor">@color/bolus</item>
<!---Treatment button color -->
<item name="treatmentButton">@color/colorTreatmentButton</item>
<!---Number Picker text color --> <!---Number Picker text color -->
<item name="numPickerText">@color/black</item> <item name="numPickerText">@color/black</item>
<!---NS Client action text color --> <!---NS Client action text color -->
@ -62,12 +57,14 @@
<item name="tempTargetConfirmation">@color/tempTargetConfirmation</item> <item name="tempTargetConfirmation">@color/tempTargetConfirmation</item>
<!-- Treatments --> <!-- Treatments -->
<item name="setExtendedButtonColor">@color/colorSetExtendedButton</item> <item name="setExtendedButtonColor">@color/colorSetExtendedButton</item>
<item name="activeColor">@color/colorActive</item>
<item name="scheduledColor">@color/colorScheduled</item>
<!-- Carbs Button --> <!-- Carbs Button -->
<item name="carbsButtonColor">@color/colorCarbsButton</item> <item name="carbsButtonColor">@color/colorCarbsButton</item>
<!-- Temp Button Button --> <!-- Temp Button Button -->
<item name="acceptTempButtonColor">@color/colorAcceptTempButton</item> <item name="acceptTempButtonColor">@color/colorAcceptTempButton</item>
<!-- Treatment Button --> <!-- Treatment Button -->
<item name="treatmentButtonColor">@color/colorTreatmentButton</item> <item name="treatmentButton">@color/colorTreatmentButton</item>
<!-- Insulin Button --> <!-- Insulin Button -->
<item name="insulinButtonColor">@color/colorInsulinButton</item> <item name="insulinButtonColor">@color/colorInsulinButton</item>
<!-- Calculator Button --> <!-- Calculator Button -->
@ -92,6 +89,10 @@
<item name="activity_title_backgroundColor">@color/activity_title_background</item> <item name="activity_title_backgroundColor">@color/activity_title_background</item>
<!---Automation --> <!---Automation -->
<item name="ribbonDefaultColor">@color/ribbonDefault</item> <item name="ribbonDefaultColor">@color/ribbonDefault</item>
<item name="ribbonWarningColor">@color/ribbonWarning</item>
<item name="ribbonCriticalColor">@color/ribbonCritical</item>
<item name="ribbonTextDefaultColor">@color/ribbonTextDefault</item>
<item name="ribbonTextWarningColor">@color/ribbonTextWarning</item>
<!---Main Activity Tab --> <!---Main Activity Tab -->
<item name="tabSelectedTextColor">@color/tabSelectedText</item> <item name="tabSelectedTextColor">@color/tabSelectedText</item>
<item name="tabTextColor">@color/tabText</item> <item name="tabTextColor">@color/tabText</item>
@ -115,6 +116,23 @@
<item name="android:windowBackground">@color/black</item> <item name="android:windowBackground">@color/black</item>
<!---Dialogfragment Background Color --> <!---Dialogfragment Background Color -->
<item name="android:dialogCornerRadius">12dp</item> <item name="android:dialogCornerRadius">12dp</item>
<!---Overview and Historybrowser -->
<item name="graphgrid">@color/graphgrid</item>
<item name="viewPortbackgroundColor">@color/white_alpha_20</item>
<item name="tempTargetBackgroundColor">@color/tempTargetBackground</item>
<!---CGM source-->
<item name="cgmdexColor">@color/colorLightGray</item>
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
<!---BG color-->
<item name="bgLow">@color/low</item>
<item name="bgHigh">@color/high</item>
<item name="bgInRange">@color/inrange</item>
<!---Profile Helper -->
<item name="helperProfileColor">@color/helperProfile</item>
<item name="examinedProfileColor">@color/examinedProfile</item>
<!---Local profile -->
<item name="okBackgroundColor">@color/ok_background</item>
<item name="errorBackgroundColor">@color/error_background</item>
</style> </style>
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/> <style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
@ -205,7 +223,7 @@
<!-- Alert Dialogs --> <!-- Alert Dialogs -->
<style name="DialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert"> <style name="DialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="backgroundColor">@color/background_dark</item> <item name="colorSurface">#212121</item> <!-- workaround; color compensated elevation -->
<item name="buttonBarNegativeButtonStyle">@style/DialogOkCancelButtonStyle</item> <item name="buttonBarNegativeButtonStyle">@style/DialogOkCancelButtonStyle</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogOkCancelButtonStyle</item> <item name="buttonBarPositiveButtonStyle">@style/DialogOkCancelButtonStyle</item>
<item name="buttonBarNeutralButtonStyle">@style/DialogOkCancelButtonStyle</item> <item name="buttonBarNeutralButtonStyle">@style/DialogOkCancelButtonStyle</item>

View file

@ -1,8 +1,6 @@
<resources> <resources>
<!---bolus color --> <!---bolus color -->
<attr name="bolusColor" format="reference|color" /> <attr name="bolusColor" format="reference|color" />
<!---Treatment button color -->
<attr name="treatmentButton" format="reference|color" />
<!---Number Picker text color --> <!---Number Picker text color -->
<attr name="numPickerText" format="reference|color" /> <attr name="numPickerText" format="reference|color" />
<!---NS Client action text color --> <!---NS Client action text color -->
@ -31,8 +29,10 @@
<attr name="carbsButtonColor" format="reference|color" /> <attr name="carbsButtonColor" format="reference|color" />
<!-- Temp Button Button --> <!-- Temp Button Button -->
<attr name="acceptTempButtonColor" format="reference|color" /> <attr name="acceptTempButtonColor" format="reference|color" />
<!-- Treatment Button --> <!---Treatment -->
<attr name="treatmentButtonColor" format="reference|color" /> <attr name="treatmentButton" format="reference|color" />
<attr name="activeColor" format="reference|color" />
<attr name="scheduledColor" format="reference|color" />
<!-- Insulin Button --> <!-- Insulin Button -->
<attr name="insulinButtonColor" format="reference|color" /> <attr name="insulinButtonColor" format="reference|color" />
<!-- Calculator Button --> <!-- Calculator Button -->
@ -60,6 +60,10 @@
<attr name="activity_title_backgroundColor" format="reference|color" /> <attr name="activity_title_backgroundColor" format="reference|color" />
<!---Automation --> <!---Automation -->
<attr name="ribbonDefaultColor" format="reference|color" /> <attr name="ribbonDefaultColor" format="reference|color" />
<attr name="ribbonWarningColor" format="reference|color" />
<attr name="ribbonCriticalColor" format="reference|color" />
<attr name="ribbonTextDefaultColor" format="reference|color" />
<attr name="ribbonTextWarningColor" format="reference|color" />
<!---Main Activity Tab --> <!---Main Activity Tab -->
<attr name="tabSelectedTextColor" format="reference|color" /> <attr name="tabSelectedTextColor" format="reference|color" />
<attr name="tabTextColor" format="reference|color" /> <attr name="tabTextColor" format="reference|color" />
@ -86,5 +90,21 @@
<attr name="splashBackgroundColor" format="reference|color" /> <attr name="splashBackgroundColor" format="reference|color" />
<!---Disabled Text Color --> <!---Disabled Text Color -->
<attr name="disabledTextColor" format="reference|color" /> <attr name="disabledTextColor" format="reference|color" />
<!---Overview and Historybrowser -->
<attr name="graphgrid" format="reference|color" />
<attr name="viewPortbackgroundColor" format="reference|color" />
<attr name="tempTargetBackgroundColor" format="reference|color" />
<!---CGM source-->
<attr name="cgmdexColor" format="reference|color" />
<attr name="cgmxdripColor" format="reference|color" />
<!---BG color-->
<attr name="bgLow" format="reference|color" />
<attr name="bgHigh" format="reference|color" />
<attr name="bgInRange" format="reference|color" />
<!---Profile Helper -->
<attr name="helperProfileColor" format="reference|color" />
<attr name="examinedProfileColor" format="reference|color" />
<!---Local profile -->
<attr name="okBackgroundColor" format="reference|color" />
<attr name="errorBackgroundColor" format="reference|color" />
</resources> </resources>

View file

@ -8,7 +8,7 @@
<color name="mdtp_white">#ffffff</color> <color name="mdtp_white">#ffffff</color>
<color name="mdtp_line_dark">#808080</color> <color name="mdtp_line_dark">#808080</color>
<color name="colorLightGray">#d8d8d8</color> <color name="colorLightGray">#d8d8d8</color>
<color name="cardColorBackground">#999999</color> <color name="cardColorBackground">@color/lightgray</color>
<color name="black_overlay">#66000000</color> <color name="black_overlay">#66000000</color>
<color name="gray">#BBBBBB</color> <color name="gray">#BBBBBB</color>
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
@ -25,8 +25,8 @@
<color name="overviewPillColorDefault">#1c171c</color> <color name="overviewPillColorDefault">#1c171c</color>
<color name="colorOnPrimaryDefault">#FFFFFF</color> <color name="colorOnPrimaryDefault">#FFFFFF</color>
<color name="defaultbackground">#424242</color> <color name="defaultbackground">#FFFFFF</color>
<color name="defaulttextcolor">#B3FFFFFF</color> <color name="defaulttextcolor">#000000</color>
<!---Android Dark ans Light Theme Base colors--> <!---Android Dark ans Light Theme Base colors-->
<color name="background_dark">#262626</color> <color name="background_dark">#262626</color>
@ -150,7 +150,7 @@
<color name="ribbonWarning">#f4d700</color> <color name="ribbonWarning">#f4d700</color>
<color name="ribbonCritical">#ff0400</color> <color name="ribbonCritical">#ff0400</color>
<color name="ribbonTextDefault">#FFFFFF</color> <color name="ribbonTextDefault">#000000</color>
<color name="ribbonTextWarning">#303030</color> <color name="ribbonTextWarning">#303030</color>
<color name="tempTargetConfirmation">#77dd77</color> <color name="tempTargetConfirmation">#77dd77</color>
@ -172,7 +172,7 @@
<color name="warning">#ff1a1a</color> <color name="warning">#ff1a1a</color>
<color name="info">#77dd77</color> <color name="info">#77dd77</color>
<color name="error_background">#66FC0000</color> <color name="error_background">#66FC0000</color>
<color name="ok_background">@color/black</color> <color name="ok_background">@color/white</color>
<color name="tempTargetBackground">#77dd77</color> <color name="tempTargetBackground">#77dd77</color>
<color name="exercise">#67DFE8</color> <color name="exercise">#67DFE8</color>

View file

@ -19,9 +19,6 @@
<item name="colorOnBackground">@color/white</item> <item name="colorOnBackground">@color/white</item>
<item name="colorOnError">@color/black</item> <item name="colorOnError">@color/black</item>
<item name="scrimBackground">@color/white</item> <item name="scrimBackground">@color/white</item>
<item name="android:textColorSecondary">@color/black</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:textColor">@color/black</item>
<item name="popupMenuStyle">@style/Widget.MaterialComponents.PopupMenu</item> <item name="popupMenuStyle">@style/Widget.MaterialComponents.PopupMenu</item>
<item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow</item> <item name="actionOverflowMenuStyle">@style/Widget.MaterialComponents.PopupMenu.Overflow</item>
<!---Notification --> <!---Notification -->
@ -35,8 +32,6 @@
<item name="actionModeCloseDrawable">@drawable/ic_close</item> <item name="actionModeCloseDrawable">@drawable/ic_close</item>
<!---bolus color --> <!---bolus color -->
<item name="bolusColor">@color/bolus</item> <item name="bolusColor">@color/bolus</item>
<!---Treatment button color -->
<item name="treatmentButton">@color/colorTreatmentButton</item>
<!---Number Picker text color --> <!---Number Picker text color -->
<item name="numPickerText">@color/black</item> <item name="numPickerText">@color/black</item>
<!---NS Client action text color --> <!---NS Client action text color -->
@ -61,12 +56,14 @@
<item name="tempTargetConfirmation">@color/tempTargetConfirmation</item> <item name="tempTargetConfirmation">@color/tempTargetConfirmation</item>
<!-- Treatments --> <!-- Treatments -->
<item name="setExtendedButtonColor">@color/colorSetExtendedButton</item> <item name="setExtendedButtonColor">@color/colorSetExtendedButton</item>
<item name="activeColor">@color/colorActive</item>
<item name="scheduledColor">@color/colorScheduled</item>
<!-- Carbs Button --> <!-- Carbs Button -->
<item name="carbsButtonColor">@color/colorCarbsButton</item> <item name="carbsButtonColor">@color/colorCarbsButton</item>
<!-- Temp Button Button --> <!-- Temp Button Button -->
<item name="acceptTempButtonColor">@color/colorAcceptTempButton</item> <item name="acceptTempButtonColor">@color/colorAcceptTempButton</item>
<!-- Treatment Button --> <!-- Treatment Button -->
<item name="treatmentButtonColor">@color/colorTreatmentButton</item> <item name="treatmentButton">@color/colorTreatmentButton</item>
<!-- Insulin Button --> <!-- Insulin Button -->
<item name="insulinButtonColor">@color/colorInsulinButton</item> <item name="insulinButtonColor">@color/colorInsulinButton</item>
<!-- Calculator Button --> <!-- Calculator Button -->
@ -91,6 +88,10 @@
<item name="activity_title_backgroundColor">@color/activity_title_background</item> <item name="activity_title_backgroundColor">@color/activity_title_background</item>
<!---Automation --> <!---Automation -->
<item name="ribbonDefaultColor">@color/ribbonDefault</item> <item name="ribbonDefaultColor">@color/ribbonDefault</item>
<item name="ribbonWarningColor">@color/ribbonWarning</item>
<item name="ribbonCriticalColor">@color/ribbonCritical</item>
<item name="ribbonTextDefaultColor">@color/ribbonTextDefault</item>
<item name="ribbonTextWarningColor">@color/ribbonTextWarning</item>
<!---Main Activity Tab --> <!---Main Activity Tab -->
<item name="tabSelectedTextColor">@color/tabSelectedText</item> <item name="tabSelectedTextColor">@color/tabSelectedText</item>
<item name="tabTextColor">@color/tabText</item> <item name="tabTextColor">@color/tabText</item>
@ -114,6 +115,23 @@
<item name="android:windowBackground">@color/white</item> <item name="android:windowBackground">@color/white</item>
<!---Dialogfragment Background Color --> <!---Dialogfragment Background Color -->
<item name="android:dialogCornerRadius">12dp</item> <item name="android:dialogCornerRadius">12dp</item>
<!---Overview and Historybrowser -->
<item name="graphgrid">@color/graphgrid</item>
<item name="viewPortbackgroundColor">@color/white_alpha_20</item>
<item name="tempTargetBackgroundColor">@color/tempTargetBackground</item>
<!---CGM source-->
<item name="cgmdexColor">@color/colorLightGray</item>
<item name="cgmxdripColor">@color/colorCalibrationButton</item>
<!---BG color-->
<item name="bgLow">@color/low</item>
<item name="bgHigh">@color/high</item>
<item name="bgInRange">@color/inrange</item>
<!---Profile Helper -->
<item name="helperProfileColor">@color/helperProfile</item>
<item name="examinedProfileColor">@color/examinedProfile</item>
<!---Local profile -->
<item name="okBackgroundColor">@color/ok_background</item>
<item name="errorBackgroundColor">@color/error_background</item>
</style> </style>
<style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/> <style name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
@ -212,7 +230,6 @@
<!-- Alert Dialogs --> <!-- Alert Dialogs -->
<style name="DialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert"> <style name="DialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="backgroundColor">@color/dialog_title_background</item>
<item name="buttonBarNegativeButtonStyle">@style/DialogOkCancelButtonStyle</item> <item name="buttonBarNegativeButtonStyle">@style/DialogOkCancelButtonStyle</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogOkCancelButtonStyle</item> <item name="buttonBarPositiveButtonStyle">@style/DialogOkCancelButtonStyle</item>
<item name="dialogTitleBackground">@color/dialog_title_background</item> <item name="dialogTitleBackground">@color/dialog_title_background</item>

View file

@ -4,6 +4,7 @@ import android.annotation.TargetApi;
import android.os.Build; import android.os.Build;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.IllegalInstantException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
@ -144,8 +145,7 @@ public class MessageBase {
} }
public int getCommand() { public int getCommand() {
int command = byteFromRawBuff(buffer, 5) | (byteFromRawBuff(buffer, 4) << 8); return byteFromRawBuff(buffer, 5) | (byteFromRawBuff(buffer, 4) << 8);
return command;
} }
public int byteFromRawBuff(byte[] buff, int offset) { public int byteFromRawBuff(byte[] buff, int offset) {
@ -180,15 +180,29 @@ public class MessageBase {
} }
public synchronized long dateTimeSecFromBuff(byte[] buff, int offset) { public synchronized long dateTimeSecFromBuff(byte[] buff, int offset) {
return
new DateTime( try {
2000 + intFromBuff(buff, offset, 1), return new DateTime(
intFromBuff(buff, offset + 1, 1), 2000 + intFromBuff(buff, offset, 1),
intFromBuff(buff, offset + 2, 1), intFromBuff(buff, offset + 1, 1),
intFromBuff(buff, offset + 3, 1), intFromBuff(buff, offset + 2, 1),
intFromBuff(buff, offset + 4, 1), intFromBuff(buff, offset + 3, 1),
intFromBuff(buff, offset + 5, 1) intFromBuff(buff, offset + 4, 1),
).getMillis(); intFromBuff(buff, offset + 5, 1)
).getMillis();
} catch (IllegalInstantException e) {
// expect
// org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap')
// add 1 hour
return new DateTime(
2000 + intFromBuff(buff, offset, 1),
intFromBuff(buff, offset + 1, 1),
intFromBuff(buff, offset + 2, 1),
intFromBuff(buff, offset + 3, 1) + 1,
intFromBuff(buff, offset + 4, 1),
intFromBuff(buff, offset + 5, 1)
).getMillis();
}
} }
public long dateFromBuff(byte[] buff, int offset) { public long dateFromBuff(byte[] buff, int offset) {
@ -204,18 +218,18 @@ public class MessageBase {
@TargetApi(Build.VERSION_CODES.KITKAT) @TargetApi(Build.VERSION_CODES.KITKAT)
public static String stringFromBuff(byte[] buff, int offset, int length) { public static String stringFromBuff(byte[] buff, int offset, int length) {
byte[] strbuff = new byte[length]; byte[] strBuff = new byte[length];
System.arraycopy(buff, offset + 6, strbuff, 0, length); System.arraycopy(buff, offset + 6, strBuff, 0, length);
return new String(strbuff, StandardCharsets.UTF_8); return new String(strBuff, StandardCharsets.UTF_8);
} }
@TargetApi(Build.VERSION_CODES.KITKAT) @TargetApi(Build.VERSION_CODES.KITKAT)
public static String asciiStringFromBuff(byte[] buff, int offset, int length) { public static String asciiStringFromBuff(byte[] buff, int offset, int length) {
byte[] strbuff = new byte[length]; byte[] strBuff = new byte[length];
System.arraycopy(buff, offset + 6, strbuff, 0, length); System.arraycopy(buff, offset + 6, strBuff, 0, length);
for (int pos = 0; pos < length; pos++) for (int pos = 0; pos < length; pos++)
strbuff[pos] += 65; // "A" strBuff[pos] += 65; // "A"
return new String(strbuff, StandardCharsets.UTF_8); return new String(strBuff, StandardCharsets.UTF_8);
} }
public static String toHexString(byte[] buff) { public static String toHexString(byte[] buff) {

View file

@ -5,6 +5,7 @@ import info.nightscout.androidaps.danars.encryption.BleEncryption
import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
import org.joda.time.IllegalInstantException
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import javax.inject.Inject import javax.inject.Inject
@ -69,15 +70,30 @@ open class DanaRSPacket(protected var injector: HasAndroidInjector) {
else -> -1 else -> -1
} }
@Synchronized fun dateTimeSecFromBuff(buff: ByteArray, offset: Int): Long = @Synchronized
DateTime( fun dateTimeSecFromBuff(buff: ByteArray, offset: Int): Long =
2000 + intFromBuff(buff, offset, 1), try {
intFromBuff(buff, offset + 1, 1), DateTime(
intFromBuff(buff, offset + 2, 1), 2000 + intFromBuff(buff, offset, 1),
intFromBuff(buff, offset + 3, 1), intFromBuff(buff, offset + 1, 1),
intFromBuff(buff, offset + 4, 1), intFromBuff(buff, offset + 2, 1),
intFromBuff(buff, offset + 5, 1) intFromBuff(buff, offset + 3, 1),
).millis intFromBuff(buff, offset + 4, 1),
intFromBuff(buff, offset + 5, 1)
).millis
} catch (e: IllegalInstantException) {
// expect
// org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap')
// add 1 hour
DateTime(
2000 + intFromBuff(buff, offset, 1),
intFromBuff(buff, offset + 1, 1),
intFromBuff(buff, offset + 2, 1),
intFromBuff(buff, offset + 3, 1) + 1,
intFromBuff(buff, offset + 4, 1),
intFromBuff(buff, offset + 5, 1)
).millis
}
protected fun intFromBuff(b: ByteArray, srcStart: Int, srcLength: Int): Int = protected fun intFromBuff(b: ByteArray, srcStart: Int, srcLength: Int): Int =
when (srcLength) { when (srcLength) {

View file

@ -406,7 +406,8 @@ class MedtronicHistoryData @Inject constructor(
if (lastPrimeRecord != null) { if (lastPrimeRecord != null) {
uploadCareportalEventIfFoundInHistory(lastPrimeRecord, uploadCareportalEventIfFoundInHistory(lastPrimeRecord,
MedtronicConst.Statistics.LastPrime, MedtronicConst.Statistics.LastPrime,
DetailedBolusInfo.EventType.CANNULA_CHANGE) DetailedBolusInfo.EventType.CANNULA_CHANGE
)
} }
} }
@ -889,17 +890,23 @@ class MedtronicHistoryData @Inject constructor(
"pumpId=${tempBasalProcess.itemOne.pumpId}, " + "pumpId=${tempBasalProcess.itemOne.pumpId}, " +
"pumpSerial=${medtronicPumpStatus.serialNumber}]") "pumpSerial=${medtronicPumpStatus.serialNumber}]")
val result = pumpSync.syncTemporaryBasalWithPumpId( if (tempBasalProcess.durationAsSeconds <= 0) {
tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime), rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
0.0, aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
tempBasalProcess.durationAsSeconds * 1000L, } else {
true, val result = pumpSync.syncTemporaryBasalWithPumpId(
PumpSync.TemporaryBasalType.PUMP_SUSPEND, tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime),
tempBasalProcess.itemOne.pumpId, 0.0,
medtronicPumpStatus.pumpType, tempBasalProcess.durationAsSeconds * 1000L,
medtronicPumpStatus.serialNumber) true,
PumpSync.TemporaryBasalType.PUMP_SUSPEND,
tempBasalProcess.itemOne.pumpId,
medtronicPumpStatus.pumpType,
medtronicPumpStatus.serialNumber
)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result")
}
} }
} }

View file

@ -10,7 +10,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.f
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
abstract class PodActivationActionFragmentBase : ActionFragmentBase() { abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
/*
* Removed by Milos. It's causing
* android.content.ActivityNotFoundException: Unable to find explicit activity class {info.nightscout.androidaps/info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity}; have you declared this activity in your AndroidManifest.xml?
*
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
@ -21,7 +24,7 @@ abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
} }
} }
} }
*/
override fun onFailure() { override fun onFailure() {
(viewModel as? PodActivationActionViewModelBase)?.let { viewModel -> (viewModel as? PodActivationActionViewModelBase)?.let { viewModel ->
if (viewModel.isPodDeactivatable() and (viewModel.isPodInAlarm() or viewModel.isPodActivationTimeExceeded())) { if (viewModel.isPodDeactivatable() and (viewModel.isPodInAlarm() or viewModel.isPodActivationTimeExceeded())) {

View file

@ -19,7 +19,6 @@
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:gravity="center" android:gravity="center"
android:text="@string/omnipod_common_pod_management_title" android:text="@string/omnipod_common_pod_management_title"
android:textAlignment="center" android:textAlignment="center"
@ -35,7 +34,6 @@
android:text="@string/omnipod_common_pod_management_heading_actions" /> android:text="@string/omnipod_common_pod_management_heading_actions" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/Actions_Row_1" android:id="@+id/Actions_Row_1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -49,7 +47,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_activate_pod" android:id="@+id/button_activate_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_activate_pod" android:drawableTop="@drawable/ic_pod_management_activate_pod"
@ -70,7 +67,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_deactivate_pod" android:id="@+id/button_deactivate_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_deactivate_pod" android:drawableTop="@drawable/ic_pod_management_deactivate_pod"
@ -99,7 +95,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_play_test_beep" android:id="@+id/button_play_test_beep"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_play_test_beep" android:drawableTop="@drawable/ic_pod_management_play_test_beep"
@ -111,9 +106,8 @@
app:layout_constraintRight_toLeftOf="@+id/Actions_Col_1_Row_2_vertical_guideline" app:layout_constraintRight_toLeftOf="@+id/Actions_Col_1_Row_2_vertical_guideline"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pod_history" android:id="@+id/button_pod_history"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pod_history" android:drawableTop="@drawable/ic_pod_management_pod_history"
@ -132,9 +126,8 @@
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" /> app:layout_constraintGuide_percent="0.5" />
<androidx.appcompat.widget.AppCompatButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_discard_pod" android:id="@+id/button_discard_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_discard_pod" android:drawableTop="@drawable/ic_pod_management_discard_pod"
@ -148,5 +141,7 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -599,6 +599,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@NonNull @NonNull
@Override @Override
public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) { public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) {
if (!podStateManager.hasPodState())
return new PumpEnactResult(getInjector()).enacted(false).success(false).comment("Null pod state");
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodErosManager.setBasalProfile(profile, true)); PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodErosManager.setBasalProfile(profile, true));
aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.getSuccess()); aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.getSuccess());
@ -850,6 +852,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@Override @Override
public PumpEnactResult executeCustomCommand(@NonNull CustomCommand command) { public PumpEnactResult executeCustomCommand(@NonNull CustomCommand command) {
if (!podStateManager.hasPodState())
return new PumpEnactResult(getInjector()).enacted(false).success(false).comment("Null pod state");
if (command instanceof CommandSilenceAlerts) { if (command instanceof CommandSilenceAlerts) {
return executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodErosManager::acknowledgeAlerts); return executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodErosManager::acknowledgeAlerts);
} }
@ -980,7 +984,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodErosManager.isTimeChangeEventEnabled() + "]"); aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodErosManager.isTimeChangeEventEnabled() + "]");
Instant now = Instant.now(); Instant now = Instant.now();
if (timeChangeType == TimeChangeType.TimeChanged && now.isBefore(lastTimeDateOrTimeZoneUpdate.plus(Duration.standardDays(1L)))){ if (timeChangeType == TimeChangeType.TimeChanged && now.isBefore(lastTimeDateOrTimeZoneUpdate.plus(Duration.standardDays(1L)))) {
aapsLogger.info(LTag.PUMP, "Ignoring time change because not a TZ or DST time change and the last one happened less than 24 hours ago."); aapsLogger.info(LTag.PUMP, "Ignoring time change because not a TZ or DST time change and the last one happened less than 24 hours ago.");
return; return;
} }

View file

@ -19,7 +19,6 @@
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:gravity="center" android:gravity="center"
android:text="@string/omnipod_common_pod_management_title" android:text="@string/omnipod_common_pod_management_title"
android:textAlignment="center" android:textAlignment="center"
@ -51,6 +50,7 @@
android:text="@string/omnipod_eros_pod_management_waiting_for_riley_link_connection" android:text="@string/omnipod_eros_pod_management_waiting_for_riley_link_connection"
android:textAlignment="center" android:textAlignment="center"
android:textSize="8pt" /> android:textSize="8pt" />
</LinearLayout> </LinearLayout>
<TextView <TextView
@ -62,7 +62,6 @@
android:text="@string/omnipod_common_pod_management_heading_actions" /> android:text="@string/omnipod_common_pod_management_heading_actions" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/Actions_Row_1" android:id="@+id/Actions_Row_1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -76,7 +75,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_activate_pod" android:id="@+id/button_activate_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_activate_pod" android:drawableTop="@drawable/ic_pod_management_activate_pod"
@ -97,7 +95,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_deactivate_pod" android:id="@+id/button_deactivate_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_deactivate_pod" android:drawableTop="@drawable/ic_pod_management_deactivate_pod"
@ -124,9 +121,8 @@
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintGuide_percent="0" /> app:layout_constraintGuide_percent="0" />
<androidx.appcompat.widget.AppCompatButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_play_test_beep" android:id="@+id/button_play_test_beep"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_play_test_beep" android:drawableTop="@drawable/ic_pod_management_play_test_beep"
@ -147,7 +143,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_discard_pod" android:id="@+id/button_discard_pod"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_discard_pod" android:drawableTop="@drawable/ic_pod_management_discard_pod"
@ -162,7 +157,6 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -186,7 +180,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_reset_rileylink_config" android:id="@+id/button_reset_rileylink_config"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_activity_reset_rileylink_config" android:drawableTop="@drawable/ic_pod_activity_reset_rileylink_config"
@ -207,7 +200,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pod_history" android:id="@+id/button_pod_history"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pod_history" android:drawableTop="@drawable/ic_pod_management_pod_history"
@ -222,7 +214,6 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/Tools_Row_2" android:id="@+id/Tools_Row_2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -236,7 +227,6 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_rileylink_stats" android:id="@+id/button_rileylink_stats"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_rl_stats" android:drawableTop="@drawable/ic_pod_management_rl_stats"
@ -255,9 +245,8 @@
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" /> app:layout_constraintGuide_percent="0.5" />
<androidx.appcompat.widget.AppCompatButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pulse_log" android:id="@+id/button_pulse_log"
style="?android:attr/buttonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pulse_log" android:drawableTop="@drawable/ic_pod_management_pulse_log"
@ -270,5 +259,7 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
</ScrollView>