Theme switcher preparation: gac for treatments, profilehelper and localprofile - minor theme preperation
This commit is contained in:
parent
59d6f146d2
commit
d585540b38
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 ->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
)
|
||||
|
|
|
@ -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 ->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
android:viewportHeight="24">
|
||||
<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:fillColor="#FFFFFF"/>
|
||||
android:fillColor="?attr/colorControlNormal"/>
|
||||
</vector>
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
<item name="actionModeCloseDrawable">@drawable/ic_close</item>
|
||||
<!---bolus color -->
|
||||
<item name="bolusColor">@color/bolus</item>
|
||||
<!---Treatment button color -->
|
||||
<item name="treatmentButton">@color/colorTreatmentButton</item>
|
||||
<!---Number Picker text color -->
|
||||
<item name="numPickerText">@color/black</item>
|
||||
<!---NS Client action text color -->
|
||||
|
@ -59,12 +57,14 @@
|
|||
<item name="tempTargetConfirmation">@color/tempTargetConfirmation</item>
|
||||
<!-- Treatments -->
|
||||
<item name="setExtendedButtonColor">@color/colorSetExtendedButton</item>
|
||||
<item name="activeColor">@color/colorActive</item>
|
||||
<item name="scheduledColor">@color/colorScheduled</item>
|
||||
<!-- Carbs Button -->
|
||||
<item name="carbsButtonColor">@color/colorCarbsButton</item>
|
||||
<!-- Temp Button Button -->
|
||||
<item name="acceptTempButtonColor">@color/colorAcceptTempButton</item>
|
||||
<!-- Treatment Button -->
|
||||
<item name="treatmentButtonColor">@color/colorTreatmentButton</item>
|
||||
<item name="treatmentButton">@color/colorTreatmentButton</item>
|
||||
<!-- Insulin Button -->
|
||||
<item name="insulinButtonColor">@color/colorInsulinButton</item>
|
||||
<!-- Calculator Button -->
|
||||
|
@ -127,6 +127,12 @@
|
|||
<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 name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<resources>
|
||||
<!---bolus color -->
|
||||
<attr name="bolusColor" format="reference|color" />
|
||||
<!---Treatment button color -->
|
||||
<attr name="treatmentButton" format="reference|color" />
|
||||
<!---Number Picker text color -->
|
||||
<attr name="numPickerText" format="reference|color" />
|
||||
<!---NS Client action text color -->
|
||||
|
@ -31,8 +29,10 @@
|
|||
<attr name="carbsButtonColor" format="reference|color" />
|
||||
<!-- Temp Button Button -->
|
||||
<attr name="acceptTempButtonColor" format="reference|color" />
|
||||
<!-- Treatment Button -->
|
||||
<attr name="treatmentButtonColor" format="reference|color" />
|
||||
<!---Treatment -->
|
||||
<attr name="treatmentButton" format="reference|color" />
|
||||
<attr name="activeColor" format="reference|color" />
|
||||
<attr name="scheduledColor" format="reference|color" />
|
||||
<!-- Insulin Button -->
|
||||
<attr name="insulinButtonColor" format="reference|color" />
|
||||
<!-- Calculator Button -->
|
||||
|
@ -101,4 +101,10 @@
|
|||
<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>
|
|
@ -8,7 +8,7 @@
|
|||
<color name="mdtp_white">#ffffff</color>
|
||||
<color name="mdtp_line_dark">#808080</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="gray">#BBBBBB</color>
|
||||
<color name="black">#FF000000</color>
|
||||
|
@ -25,8 +25,8 @@
|
|||
<color name="overviewPillColorDefault">#1c171c</color>
|
||||
<color name="colorOnPrimaryDefault">#FFFFFF</color>
|
||||
|
||||
<color name="defaultbackground">#424242</color>
|
||||
<color name="defaulttextcolor">#B3FFFFFF</color>
|
||||
<color name="defaultbackground">#FFFFFF</color>
|
||||
<color name="defaulttextcolor">#000000</color>
|
||||
|
||||
<!---Android Dark ans Light Theme Base colors-->
|
||||
<color name="background_dark">#262626</color>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<color name="warning">#ff1a1a</color>
|
||||
<color name="info">#77dd77</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="exercise">#67DFE8</color>
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
<item name="actionModeCloseDrawable">@drawable/ic_close</item>
|
||||
<!---bolus color -->
|
||||
<item name="bolusColor">@color/bolus</item>
|
||||
<!---Treatment button color -->
|
||||
<item name="treatmentButton">@color/colorTreatmentButton</item>
|
||||
<!---Number Picker text color -->
|
||||
<item name="numPickerText">@color/black</item>
|
||||
<!---NS Client action text color -->
|
||||
|
@ -58,12 +56,14 @@
|
|||
<item name="tempTargetConfirmation">@color/tempTargetConfirmation</item>
|
||||
<!-- Treatments -->
|
||||
<item name="setExtendedButtonColor">@color/colorSetExtendedButton</item>
|
||||
<item name="activeColor">@color/colorActive</item>
|
||||
<item name="scheduledColor">@color/colorScheduled</item>
|
||||
<!-- Carbs Button -->
|
||||
<item name="carbsButtonColor">@color/colorCarbsButton</item>
|
||||
<!-- Temp Button Button -->
|
||||
<item name="acceptTempButtonColor">@color/colorAcceptTempButton</item>
|
||||
<!-- Treatment Button -->
|
||||
<item name="treatmentButtonColor">@color/colorTreatmentButton</item>
|
||||
<item name="treatmentButton">@color/colorTreatmentButton</item>
|
||||
<!-- Insulin Button -->
|
||||
<item name="insulinButtonColor">@color/colorInsulinButton</item>
|
||||
<!-- Calculator Button -->
|
||||
|
@ -126,6 +126,12 @@
|
|||
<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 name="Theme.MaterialComponents.DayNight.DarkActionBar" parent="Theme.MaterialComponents.DayNight.Bridge"/>
|
||||
|
|
Loading…
Reference in a new issue