diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt index a7b6864b8a..22322c5bb9 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt @@ -286,7 +286,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { tabSelected = tab 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 binding.profileType.setText( @@ -317,7 +317,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { } private fun setBackgroundColorOnSelected(tab: Int) { - binding.menu1.setBackgroundColor(rh.gc(if (tab == 1) R.color.defaultbackground else R.color.helperProfile)) - binding.menu2.setBackgroundColor(rh.gc(if (tab == 0) R.color.defaultbackground else R.color.examinedProfile)) + binding.menu1.setBackgroundColor(rh.gac(this, if (tab == 1) R.attr.defaultbackground else R.attr.helperProfileColor)) + binding.menu2.setBackgroundColor(rh.gac(this, if (tab == 0) R.attr.defaultbackground else R.attr.examinedProfileColor)) } } diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt index 5290b48711..53659297d7 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt @@ -87,14 +87,14 @@ class TreatmentsActivity : NoSplashAppCompatActivity() { } private fun setBackgroundColorOnSelected(selected: View) { - binding.treatments.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.extendedBoluses.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.tempBasals.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.tempTargets.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.profileSwitches.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.careportal.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.userentry.setBackgroundColor(rh.gc(R.color.defaultbackground)) - selected.setBackgroundColor(rh.gc(R.color.tabBgColorSelected)) + binding.treatments.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.extendedBoluses.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.tempBasals.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.tempTargets.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.profileSwitches.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.careportal.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + binding.userentry.setBackgroundColor(rh.gac(this, R.attr.defaultbackground)) + selected.setBackgroundColor(rh.gac(this, R.attr.tabBgColorSelected)) } } diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt index c4a23113bf..e9108341f6 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt @@ -225,7 +225,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() { holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility() val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia) 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.iobLabel.visibility = View.VISIBLE holder.binding.iob.visibility = View.VISIBLE @@ -235,7 +235,8 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() { holder.binding.iobLabel.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 = when (ml.bolus.type) { Bolus.Type.SMB -> "SMB" diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt index a9ccda548c..10d09ca04d 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt @@ -135,7 +135,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() { holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(extendedBolus.timestamp, rh) else "" if (extendedBolus.isInProgress(dateUtil)) { 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 { holder.binding.time.text = dateUtil.timeRangeString(extendedBolus.timestamp, extendedBolus.end) holder.binding.time.setTextColor(holder.binding.insulin.currentTextColor) @@ -146,7 +146,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() { val iob = extendedBolus.iobCalc(System.currentTimeMillis(), profile, activePlugin.activeInsulin) holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iob) 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 && removeActionMode != null).toVisibility() if (removeActionMode != null) { holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt index 7fa2063e64..c825194033 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt @@ -191,7 +191,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() { holder.binding.duration.text = rh.gs(R.string.format_mins, T.msecs(profileSwitch.duration ?: 0L).mins()) holder.binding.name.text = 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) holder.binding.clone.tag = profileSwitch holder.binding.name.tag = profileSwitch diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt index f022fae27d..9a66a04dd6 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt @@ -195,8 +195,8 @@ class TreatmentsTempTargetFragment : DaggerFragment() { holder.binding.reason.text = translator.translate(tempTarget.reason) holder.binding.time.setTextColor( when { - tempTarget.id == currentlyActiveTarget?.id -> rh.gc(R.color.colorActive) - tempTarget.timestamp > dateUtil.now() -> rh.gc(R.color.colorScheduled) + tempTarget.id == currentlyActiveTarget?.id -> rh.gac(context , R.attr.activeColor) + tempTarget.timestamp > dateUtil.now() -> rh.gac(context , R.attr.scheduledColor) else -> holder.binding.reasonColon.currentTextColor } ) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt index b1ac871b5a..2a4f3cee26 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -176,7 +176,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() { holder.binding.date.text = if (newDay) dateUtil.dateStringRelative(tempBasal.timestamp, rh) else "" if (tempBasal.isInProgress) { 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 { holder.binding.time.text = dateUtil.timeRangeString(tempBasal.timestamp, tempBasal.end) holder.binding.time.setTextColor(holder.binding.duration.currentTextColor) @@ -193,7 +193,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() { 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.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 && removeActionMode != null).toVisibility() if (removeActionMode != null) { holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt index 60e785708d..6621b784dc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt @@ -374,7 +374,7 @@ class LocalProfileFragment : DaggerFragment() { val isValid = localProfilePlugin.isValidEditState(activity) val isEdited = localProfilePlugin.isEdited if (isValid) { - this.view?.setBackgroundColor(rh.gc(R.color.ok_background)) + this.view?.setBackgroundColor(rh.gac(context, R.attr.okBackgroundColor)) binding.profileList.isEnabled = true if (isEdited) { @@ -386,7 +386,7 @@ class LocalProfileFragment : DaggerFragment() { binding.save.visibility = View.GONE } } else { - this.view?.setBackgroundColor(rh.gc(R.color.error_background)) + this.view?.setBackgroundColor(rh.gac(context, R.attr.errorBackgroundColor)) binding.profileList.isEnabled = false binding.profileswitch.visibility = View.GONE binding.save.visibility = View.GONE //don't save an invalid profile @@ -401,12 +401,12 @@ class LocalProfileFragment : DaggerFragment() { } private fun processVisibilityOnClick(selected: View) { - binding.diaTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.icTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.isfTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.basalTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) - binding.targetTab.setBackgroundColor(rh.gc(R.color.defaultbackground)) - selected.setBackgroundColor(rh.gc(R.color.tabBgColorSelected)) + binding.diaTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground)) + binding.icTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground)) + binding.isfTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground)) + binding.basalTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground)) + binding.targetTab.setBackgroundColor(rh.gac(context, R.attr.defaultbackground)) + selected.setBackgroundColor(rh.gac(context, R.attr.tabBgColorSelected)) binding.diaPlaceholder.visibility = View.GONE binding.ic.visibility = View.GONE binding.isf.visibility = View.GONE diff --git a/app/src/main/res/drawable/ic_actions_profileswitch.xml b/app/src/main/res/drawable/ic_actions_profileswitch.xml index 31c93c3483..6f16a3bf09 100644 --- a/app/src/main/res/drawable/ic_actions_profileswitch.xml +++ b/app/src/main/res/drawable/ic_actions_profileswitch.xml @@ -5,5 +5,5 @@ android:viewportHeight="24"> + android:fillColor="?attr/colorControlNormal"/> diff --git a/app/src/main/res/layout/overview_buttons_layout.xml b/app/src/main/res/layout/overview_buttons_layout.xml index e356e89efb..872963859e 100644 --- a/app/src/main/res/layout/overview_buttons_layout.xml +++ b/app/src/main/res/layout/overview_buttons_layout.xml @@ -45,7 +45,7 @@ android:layout_weight="0.5" android:drawableTop="@drawable/icon_insulin_carbs" android:text="@string/overview_treatment_label" - android:textColor="?attr/treatmentButtonColor" + android:textColor="?attr/treatmentButton" android:textSize="10sp" android:visibility="gone" tools:ignore="SmallSp" /> diff --git a/app/src/main/res/layout/treatments_bolus_carbs_item.xml b/app/src/main/res/layout/treatments_bolus_carbs_item.xml index 137c5f2b77..0197277ba3 100644 --- a/app/src/main/res/layout/treatments_bolus_carbs_item.xml +++ b/app/src/main/res/layout/treatments_bolus_carbs_item.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" + card_view:cardElevation="0dp" card_view:cardBackgroundColor="?attr/cardItemBackgroundColor"> @drawable/ic_close @color/bolus - - @color/colorTreatmentButton @color/black @@ -59,12 +57,14 @@ @color/tempTargetConfirmation @color/colorSetExtendedButton + @color/colorActive + @color/colorScheduled @color/colorCarbsButton @color/colorAcceptTempButton - @color/colorTreatmentButton + @color/colorTreatmentButton @color/colorInsulinButton @@ -127,6 +127,12 @@ @color/low @color/high @color/inrange + + @color/helperProfile + @color/examinedProfile + + @color/ok_background + @color/error_background