Widget: white text

This commit is contained in:
Milos Kozak 2022-04-06 17:16:36 +02:00
parent fbddfa6dee
commit b06b65f692
3 changed files with 32 additions and 21 deletions

View file

@ -182,11 +182,6 @@ class OverviewData @Inject constructor(
} }
} ?: R.drawable.ic_cp_basal_no_tbr } ?: 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) } fun temporaryBasalColor(context: Context?, iobCobCalculator: IobCobCalculator): Int = iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now())?.let { rh.gac(context , R.attr.basal) }
?: rh.gac(context, R.attr.textAppearancemediumColor) ?: rh.gac(context, R.attr.textAppearancemediumColor)

View file

@ -140,7 +140,8 @@ class Widget : AppWidgetProvider() {
private fun updateTemporaryBasal(views: RemoteViews) { private fun updateTemporaryBasal(views: RemoteViews) {
views.setTextViewText(R.id.base_basal, overviewData.temporaryBasalText(iobCobCalculator)) 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)) views.setImageViewResource(R.id.base_basal_icon, overviewData.temporaryBasalIcon(iobCobCalculator))
} }

View file

@ -21,7 +21,8 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<TextView <TextView
@ -32,7 +33,8 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -77,7 +79,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -104,7 +107,8 @@
android:contentDescription="last delta" android:contentDescription="last delta"
android:text="Δ: " android:text="Δ: "
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<TextView <TextView
@ -114,7 +118,8 @@
android:layout_gravity="end" android:layout_gravity="end"
android:text="n/a" android:text="n/a"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -132,7 +137,8 @@
android:contentDescription="15 minutes delta" android:contentDescription="15 minutes delta"
android:text="15m Δ: " android:text="15m Δ: "
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<TextView <TextView
@ -142,7 +148,8 @@
android:layout_gravity="end" android:layout_gravity="end"
android:text="n/a" android:text="n/a"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -160,7 +167,8 @@
android:contentDescription="40 minutes delta" android:contentDescription="40 minutes delta"
android:text="40m Δ: " android:text="40m Δ: "
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<TextView <TextView
@ -170,7 +178,8 @@
android:layout_gravity="end" android:layout_gravity="end"
android:text="n/a" android:text="n/a"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
@ -210,7 +219,8 @@
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -242,7 +252,8 @@
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -273,7 +284,8 @@
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -303,7 +315,8 @@
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -335,7 +348,8 @@
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
@ -347,7 +361,8 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
android:visibility="visible" android:visibility="visible"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />