From b06b65f69210fd2694b1bedb1504cc13ce342b87 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 6 Apr 2022 17:16:36 +0200 Subject: [PATCH] Widget: white text --- .../plugins/general/overview/OverviewData.kt | 5 --- .../nightscout/androidaps/widget/Widget.kt | 3 +- app/src/main/res/layout/widget_layout.xml | 45 ++++++++++++------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index 8648b27428..834c546425 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -182,11 +182,6 @@ class OverviewData @Inject constructor( } } ?: R.drawable.ic_cp_basal_no_tbr - // will be removed if a solution of getting the right color for widget is solved - fun temporaryBasalColor(iobCobCalculator: IobCobCalculator): Int = - iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { rh.gc(R.color.basal) } - ?: rh.gc(R.color.textAppearancemediumDark) - fun temporaryBasalColor(context: Context?, iobCobCalculator: IobCobCalculator): Int = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { rh.gac(context , R.attr.basal) } ?: rh.gac(context, R.attr.textAppearancemediumColor) diff --git a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt index 4c3d145915..53b93ff5bc 100644 --- a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt +++ b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt @@ -140,7 +140,8 @@ class Widget : AppWidgetProvider() { private fun updateTemporaryBasal(views: RemoteViews) { views.setTextViewText(R.id.base_basal, overviewData.temporaryBasalText(iobCobCalculator)) - views.setTextColor(R.id.base_basal, overviewData.temporaryBasalColor(iobCobCalculator)) + views.setTextColor(R.id.base_basal, iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { rh.gc(R.color.basal) } + ?: rh.gc(R.color.white)) views.setImageViewResource(R.id.base_basal_icon, overviewData.temporaryBasalIcon(iobCobCalculator)) } diff --git a/app/src/main/res/layout/widget_layout.xml b/app/src/main/res/layout/widget_layout.xml index 7fa0fb9973..a15711a490 100644 --- a/app/src/main/res/layout/widget_layout.xml +++ b/app/src/main/res/layout/widget_layout.xml @@ -21,7 +21,8 @@ android:layout_weight="1" android:gravity="center_vertical|center_horizontal" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Small" + android:textColor="@color/white" + android:textSize="12sp" tools:ignore="HardcodedText" /> @@ -77,7 +79,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Small" + android:textColor="@color/white" + android:textSize="12sp" tools:ignore="HardcodedText" /> @@ -104,7 +107,8 @@ android:contentDescription="last delta" android:text="Δ: " android:textAlignment="textEnd" - android:textAppearance="@style/TextAppearance.AppCompat.Small" + android:textColor="@color/white" + android:textSize="12sp" tools:ignore="HardcodedText" /> @@ -132,7 +137,8 @@ android:contentDescription="15 minutes delta" android:text="15m Δ: " android:textAlignment="textEnd" - android:textAppearance="@style/TextAppearance.AppCompat.Small" + android:textColor="@color/white" + android:textSize="12sp" tools:ignore="HardcodedText" /> @@ -160,7 +167,8 @@ android:contentDescription="40 minutes delta" android:text="40m Δ: " android:textAlignment="textEnd" - android:textAppearance="@style/TextAppearance.AppCompat.Small" + android:textColor="@color/white" + android:textSize="12sp" tools:ignore="HardcodedText" /> @@ -210,7 +219,8 @@ android:paddingTop="3dp" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -242,7 +252,8 @@ android:paddingTop="3dp" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -273,7 +284,8 @@ android:paddingTop="3dp" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -303,7 +315,8 @@ android:paddingTop="3dp" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -335,7 +348,8 @@ android:paddingTop="3dp" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" tools:ignore="HardcodedText" /> @@ -347,7 +361,8 @@ android:gravity="center_horizontal" android:paddingBottom="3dp" android:text="n/a" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textColor="@color/white" + android:textSize="18sp" android:textStyle="bold" android:visibility="visible" tools:ignore="HardcodedText" />