diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt index c4249955ed..264a999eb8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt @@ -143,7 +143,7 @@ class BGSourceFragment : DaggerFragment() { val previous = glucoseValues[position - 1] val diff = previous.timestamp - glucoseValue.timestamp if (diff < T.secs(20).msecs()) - holder.binding.root.setBackgroundColor(rh.gc(R.color.errorAlertBackground)) + holder.binding.root.setBackgroundColor(rh.gac(context, R.attr.bgsourceError)) } holder.binding.root.setOnLongClickListener { diff --git a/app/src/main/res/drawable/ic_byoda.xml b/app/src/main/res/drawable/ic_byoda.xml index 1bf06ca7d8..97edb8f9d5 100644 --- a/app/src/main/res/drawable/ic_byoda.xml +++ b/app/src/main/res/drawable/ic_byoda.xml @@ -5,5 +5,5 @@ android:viewportHeight="24"> + android:fillColor="?attr/cgmdexColor"/> diff --git a/app/src/main/res/layout/activity_setupwizard.xml b/app/src/main/res/layout/activity_setupwizard.xml index d70bd1063c..c84e5f652d 100644 --- a/app/src/main/res/layout/activity_setupwizard.xml +++ b/app/src/main/res/layout/activity_setupwizard.xml @@ -62,7 +62,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" - android:background="@color/black_overlay" + android:background="@color/black_alpha_40" android:orientation="horizontal" android:paddingLeft="16dp" android:paddingRight="16dp"> diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt index 15d72f6682..c27f843e97 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt @@ -173,10 +173,10 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener { override fun onBindViewHolder(holder: ViewHolder, position: Int) { val automation = automationPlugin.at(position) holder.binding.rootLayout.setBackgroundColor( - rh.gc( - if (automation.userAction) R.color.mdtp_line_dark - else if (automation.areActionsValid()) R.color.ribbonDefault - else R.color.errorAlertBackground + rh.gac( context, + if (automation.userAction) R.attr.userAction + else if (automation.areActionsValid()) R.attr.validActions + else R.attr.actionsError ) ) holder.binding.eventTitle.text = automation.title diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt index 57ef1c09c7..2e31509ff8 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt @@ -4,6 +4,7 @@ import android.graphics.Typeface import android.view.ViewGroup import android.widget.LinearLayout import android.widget.TextView +import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -28,7 +29,7 @@ class StaticLabel(private val rh: ResourceHelper) : Element() { LinearLayout(root.context).apply { orientation = LinearLayout.HORIZONTAL layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - setBackgroundColor(rh.gc(android.R.color.black)) + setBackgroundColor(rh.gac(context, R.attr.automationBackgroundColor)) addView( TextView(root.context).apply { text = label diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt index 31de36e247..65f910a658 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt @@ -165,7 +165,7 @@ class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) { text = rh.gs(connectorType.stringRes) gravity = gravity or Gravity.CENTER_VERTICAL setTypeface(typeface, Typeface.BOLD) - setBackgroundColor(rh.gc(R.color.black_overlay)) + setBackgroundColor(rh.gac(context, R.attr.automationOverlayColor)) layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT).also { ll -> ll.setMargins(rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3)) } diff --git a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt index c5bfd4a69b..11c1954b55 100644 --- a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt @@ -89,27 +89,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // add stats headers to tables binding.mainTable.addView( TableRow(this).also { trHead -> - trHead.setBackgroundColor(Color.DKGRAY) + trHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) trHead.addView(TextView(this).also { labelDate -> labelDate.text = rh.gs(R.string.date) - labelDate.setTextColor(Color.WHITE) + labelDate.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) trHead.addView(TextView(this).also { labelBasalRate -> labelBasalRate.text = rh.gs(R.string.basalrate) - labelBasalRate.setTextColor(Color.WHITE) + labelBasalRate.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) trHead.addView(TextView(this).also { labelBolus -> labelBolus.text = rh.gs(R.string.bolus) - labelBolus.setTextColor(Color.WHITE) + labelBolus.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) trHead.addView(TextView(this).also { labelTdd -> labelTdd.text = rh.gs(R.string.tdd) - labelTdd.setTextColor(Color.WHITE) + labelTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) trHead.addView(TextView(this).also { labelRatio -> labelRatio.text = rh.gs(R.string.ratio) - labelRatio.setTextColor(Color.WHITE) + labelRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) @@ -117,19 +117,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // cumulative table binding.cumulativeTable.addView( TableRow(this).also { ctrHead -> - ctrHead.setBackgroundColor(Color.DKGRAY) + ctrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ctrHead.addView(TextView(this).also { labelCumAmountDays -> labelCumAmountDays.text = rh.gs(R.string.amount_days) - labelCumAmountDays.setTextColor(Color.WHITE) + labelCumAmountDays.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) ctrHead.addView(TextView(this).also { labelCumTdd -> labelCumTdd.text = rh.gs(R.string.tdd) - labelCumTdd.setTextColor(Color.WHITE) + labelCumTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) ctrHead.addView(TextView(this).also { labelCumRatio -> labelCumRatio.text = rh.gs(R.string.ratio) - labelCumRatio.setTextColor(Color.WHITE) + labelCumRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) @@ -137,19 +137,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // exponential table binding.expweightTable.addView( TableRow(this).also { etrHead -> - etrHead.setBackgroundColor(Color.DKGRAY) + etrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) etrHead.addView(TextView(this).also { labelExpWeight -> labelExpWeight.text = rh.gs(R.string.weight) - labelExpWeight.setTextColor(Color.WHITE) + labelExpWeight.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) etrHead.addView(TextView(this).also { labelExpTdd -> labelExpTdd.text = rh.gs(R.string.tdd) - labelExpTdd.setTextColor(Color.WHITE) + labelExpTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) etrHead.addView(TextView(this).also { labelExpRatio -> labelExpRatio.text = rh.gs(R.string.ratio) - labelExpRatio.setTextColor(Color.WHITE) + labelExpRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) @@ -285,9 +285,9 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // Create the table row binding.mainTable.addView( TableRow(this@TDDStatsActivity).also { tr -> - if (i % 2 != 0) tr.setBackgroundColor(Color.DKGRAY) + if (i % 2 != 0) tr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) if (dummies.contains(record)) - tr.setBackgroundColor(Color.argb(125, 255, 0, 0)) + tr.setBackgroundColor(rh.gac(this, R.attr.dummyBackground)) tr.id = 100 + i tr.layoutParams = TableLayout.LayoutParams( @@ -299,27 +299,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { tr.addView(TextView(this@TDDStatsActivity).also { labelDATE -> labelDATE.id = 200 + i labelDATE.text = df1.format(Date(record.timestamp)) - labelDATE.setTextColor(Color.WHITE) + labelDATE.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL -> labelBASAL.id = 300 + i labelBASAL.text = rh.gs(R.string.formatinsulinunits, record.basalAmount) - labelBASAL.setTextColor(Color.WHITE) + labelBASAL.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS -> labelBOLUS.id = 400 + i labelBOLUS.text = rh.gs(R.string.formatinsulinunits, record.bolusAmount) - labelBOLUS.setTextColor(Color.WHITE) + labelBOLUS.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelTDD -> labelTDD.id = 500 + i labelTDD.text = rh.gs(R.string.formatinsulinunits, tdd) - labelTDD.setTextColor(Color.WHITE) + labelTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO -> labelRATIO.id = 600 + i labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%" - labelRATIO.setTextColor(Color.WHITE) + labelRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) @@ -338,7 +338,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // Create the cumulative table row binding.cumulativeTable.addView( TableRow(this@TDDStatsActivity).also { ctr -> - if (i % 2 == 0) ctr.setBackgroundColor(Color.DKGRAY) + if (i % 2 == 0) ctr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) ctr.id = 700 + i ctr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) @@ -346,19 +346,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { ctr.addView(TextView(this@TDDStatsActivity).also { labelDAYS -> labelDAYS.id = 800 + i labelDAYS.text = i.toString() - labelDAYS.setTextColor(Color.WHITE) + labelDAYS.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD -> labelCUMTDD.id = 900 + i labelCUMTDD.text = rh.gs(R.string.formatinsulinunits, sum / i) - labelCUMTDD.setTextColor(Color.WHITE) + labelCUMTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMRATIO -> labelCUMRATIO.id = 1000 + i labelCUMRATIO.text = (100 * sum / i / magicNumber).roundToInt().toString() + "%" - labelCUMRATIO.setTextColor(Color.WHITE) + labelCUMRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) @@ -366,7 +366,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) { binding.message.visibility = View.VISIBLE binding.message.text = rh.gs(R.string.olddata_Message) - } else binding.mainTable.setBackgroundColor(Color.TRANSPARENT) + } else binding.mainTable.setBackgroundColor(rh.gac(this, R.attr.mainTableBackground)) if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) { //Today should not be included historyList.removeAt(0) @@ -390,7 +390,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { // Create the exponential table row binding.expweightTable.addView( TableRow(this@TDDStatsActivity).also { etr -> - if (i % 2 != 0) etr.setBackgroundColor(Color.DKGRAY) + if (i % 2 != 0) etr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground)) etr.id = 1100 + i etr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) @@ -398,7 +398,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { etr.addView(TextView(this@TDDStatsActivity).also { labelWEIGHT -> labelWEIGHT.id = 1200 + i labelWEIGHT.text = "0.3\n0.5\n0.7" - labelWEIGHT.setTextColor(Color.WHITE) + labelWEIGHT.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD -> labelEXPTDD.id = 1300 + i @@ -407,7 +407,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { ${rh.gs(R.string.formatinsulinunits, weighted05)} ${rh.gs(R.string.formatinsulinunits, weighted07)} """.trimIndent() - labelEXPTDD.setTextColor(Color.WHITE) + labelEXPTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) etr.addView(TextView(this@TDDStatsActivity).also { labelEXPRATIO -> labelEXPRATIO.id = 1400 + i @@ -416,7 +416,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() { ${(100 * weighted05 / magicNumber).roundToInt()}% ${(100 * weighted07 / magicNumber).roundToInt()}% """.trimIndent() - labelEXPRATIO.setTextColor(Color.WHITE) + labelEXPRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor)) }) }, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT) ) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt index 74be8377e4..040a3d65cd 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt @@ -87,8 +87,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() { prefFile.metadata[PrefsMetadataKey.AAPS_FLAVOUR]?.let { metaVariantFormat.text = it.value - val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning - metaVariantFormat.setTextColor(rh.gc(color)) + val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor + metaVariantFormat.setTextColor(rh.gac( metaVariantFormat.context, colorattr)) } prefFile.metadata[PrefsMetadataKey.CREATED_AT]?.let { @@ -97,8 +97,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() { prefFile.metadata[PrefsMetadataKey.AAPS_VERSION]?.let { metaAppVersion.text = it.value - val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning - metaAppVersion.setTextColor(rh.gc(color)) + val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor + metaAppVersion.setTextColor(rh.gac( metaVariantFormat.context, colorattr)) } prefFile.metadata[PrefsMetadataKey.DEVICE_NAME]?.let { diff --git a/core/src/main/res/drawable/ic_fortyfiveup.xml b/core/src/main/res/drawable/ic_fortyfiveup.xml index 930857ec66..cb3fa33a08 100644 --- a/core/src/main/res/drawable/ic_fortyfiveup.xml +++ b/core/src/main/res/drawable/ic_fortyfiveup.xml @@ -5,5 +5,5 @@ android:viewportHeight="24"> + android:fillColor="?attr/icCheckboxTrendColor"/> diff --git a/core/src/main/res/layout/activity_tdd_stats.xml b/core/src/main/res/layout/activity_tdd_stats.xml index 5f1d7dad33..850d7e0e3a 100644 --- a/core/src/main/res/layout/activity_tdd_stats.xml +++ b/core/src/main/res/layout/activity_tdd_stats.xml @@ -179,7 +179,7 @@ #808080 #d8d8d8 #212121 - #66000000 #BBBBBB #FF000000 #FFFFFFFF @@ -172,6 +171,7 @@ #77dd77 #66FC0000 @color/colorPrimaryDark + #7DFF0000 #77dd77 #67DFE8 diff --git a/core/src/main/res/values-night/styles.xml b/core/src/main/res/values-night/styles.xml index eeade48d19..9adb3ad930 100644 --- a/core/src/main/res/values-night/styles.xml +++ b/core/src/main/res/values-night/styles.xml @@ -155,6 +155,20 @@ @color/omni_yellow @color/alarm + + @color/mdtp_line_dark + @color/ribbonDefault + @color/errorAlertBackground + @color/black + @color/black_alpha_40 + + @color/errorAlertBackground + + @android:color/darker_gray + @android:color/transparent + @color/dummy_background + + @color/white