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
// 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)

View file

@ -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))
}

View file

@ -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" />
<TextView
@ -32,7 +33,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" />
</LinearLayout>
@ -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" />
</LinearLayout>
@ -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" />
<TextView
@ -114,7 +118,8 @@
android:layout_gravity="end"
android:text="n/a"
android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
@ -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" />
<TextView
@ -142,7 +148,8 @@
android:layout_gravity="end"
android:text="n/a"
android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
@ -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" />
<TextView
@ -170,7 +178,8 @@
android:layout_gravity="end"
android:text="n/a"
android:textAlignment="textEnd"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/white"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
@ -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" />