diff --git a/app/src/main/java/at/techbee/jtx/widgets/ListWidget.kt b/app/src/main/java/at/techbee/jtx/widgets/ListWidget.kt index 3b7507616..2fd749650 100644 --- a/app/src/main/java/at/techbee/jtx/widgets/ListWidget.kt +++ b/app/src/main/java/at/techbee/jtx/widgets/ListWidget.kt @@ -184,6 +184,19 @@ class ListWidget : GlanceAppWidget() { ) } + val defaultOnSurfaceVariantColor = GlanceTheme.colors.onSurfaceVariant + val entryHeaderTextColor = remember(listWidgetConfig) { + if (listWidgetConfig.widgetColorEntries == null) + defaultOnSurfaceVariantColor + else + FixedColorProvider( + if(UiUtil.isDarkColor(entryColor.getColor(context))) + Color.White.copy(alpha = if(listWidgetConfig.widgetAlphaEntries < MIN_ALPHA_FOR_TEXT) MIN_ALPHA_FOR_TEXT else listWidgetConfig.widgetAlphaEntries) + else + Color.Black.copy(alpha = if(listWidgetConfig.widgetAlphaEntries < MIN_ALPHA_FOR_TEXT) MIN_ALPHA_FOR_TEXT else listWidgetConfig.widgetAlphaEntries) + ) + } + GlanceTheme { ListWidgetContent( listWidgetConfig, @@ -194,6 +207,7 @@ class ListWidget : GlanceAppWidget() { textColor = textColor, entryColor = entryColor, entryTextColor = entryTextColor, + entryHeaderTextColor = entryHeaderTextColor, onCheckedChange = { iCalObjectId, checked -> scope.launch(Dispatchers.IO) { val settingsStateHolder = SettingsStateHolder(context) diff --git a/app/src/main/java/at/techbee/jtx/widgets/ListWidgetContent.kt b/app/src/main/java/at/techbee/jtx/widgets/ListWidgetContent.kt index 45761015e..3f66a75e9 100644 --- a/app/src/main/java/at/techbee/jtx/widgets/ListWidgetContent.kt +++ b/app/src/main/java/at/techbee/jtx/widgets/ListWidgetContent.kt @@ -50,6 +50,7 @@ fun ListWidgetContent( textColor: ColorProvider, entryColor: ColorProvider, entryTextColor: ColorProvider, + entryHeaderTextColor: ColorProvider, onCheckedChange: (iCalObjectId: Long, checked: Boolean) -> Unit, onOpenWidgetConfig: () -> Unit, onAddNew: () -> Unit, @@ -149,6 +150,7 @@ fun ListWidgetContent( obj = entry.iCal4List, entryColor = entryColor, textColor = entryTextColor, + headerTextColor = entryHeaderTextColor, checkboxPosition = listWidgetConfig.checkboxPosition, showDescription = listWidgetConfig.showDescription, onCheckedChange = onCheckedChange, @@ -177,6 +179,7 @@ fun ListWidgetContent( obj = subtask.iCal4List, entryColor = entryColor, textColor = entryTextColor, + headerTextColor = entryHeaderTextColor, checkboxPosition = listWidgetConfig.checkboxPosition, showDescription = listWidgetConfig.showDescription, onCheckedChange = onCheckedChange, @@ -204,6 +207,7 @@ fun ListWidgetContent( obj = subnote.iCal4List, entryColor = entryColor, textColor = entryTextColor, + headerTextColor = entryHeaderTextColor, checkboxPosition = listWidgetConfig.checkboxPosition, showDescription = listWidgetConfig.showDescription, onCheckedChange = onCheckedChange, diff --git a/app/src/main/java/at/techbee/jtx/widgets/ListWidgetEntry.kt b/app/src/main/java/at/techbee/jtx/widgets/ListWidgetEntry.kt index 1d45c04cc..53af4b4af 100644 --- a/app/src/main/java/at/techbee/jtx/widgets/ListWidgetEntry.kt +++ b/app/src/main/java/at/techbee/jtx/widgets/ListWidgetEntry.kt @@ -50,6 +50,7 @@ fun ListEntry( obj: ICal4List, entryColor: ColorProvider, textColor: ColorProvider, + headerTextColor: ColorProvider, checkboxPosition: CheckboxPosition, showDescription: Boolean, onCheckedChange: (iCalObjectId: Long, checked: Boolean) -> Unit, @@ -57,8 +58,7 @@ fun ListEntry( ) { val context = LocalContext.current - val metaBarColor = ColorProvider(textColor.getColor(context).copy(alpha = 0.7f)) - val textStyleMetaInfo = TextStyle(fontStyle = FontStyle.Italic, fontSize = 12.sp, color = metaBarColor) + val textStyleMetaInfo = TextStyle(fontStyle = FontStyle.Italic, fontSize = 12.sp, color = headerTextColor) val textStyleDateOverdue = textStyleMetaInfo.copy(color = ColorProvider(Color.Red), fontWeight = FontWeight.Bold) val textStyleSummary = TextStyle(fontWeight = FontWeight.Bold, fontSize = 14.sp, color = textColor) val textStyleDescription = TextStyle(color = textColor, fontSize = 12.sp) @@ -108,7 +108,7 @@ fun ListEntry( provider = ImageProvider(if (obj.module == Module.TODO.name) R.drawable.ic_widget_start else R.drawable.ic_start2), contentDescription = context.getString(R.string.started), modifier = GlanceModifier.size(imageSize).padding(end = 4.dp), - colorFilter = ColorFilter.tint(metaBarColor) + colorFilter = ColorFilter.tint(textStyleMetaInfo.color) ) Text( text = ICalObject.getDtstartTextInfo( @@ -128,7 +128,7 @@ fun ListEntry( provider = ImageProvider(R.drawable.ic_widget_due), contentDescription = context.getString(R.string.due), modifier = GlanceModifier.size(imageSize).padding(end = 4.dp), - colorFilter = ColorFilter.tint(metaBarColor) + colorFilter = ColorFilter.tint(textStyleMetaInfo.color) ) Text( text = ICalObject.getDueTextInfo( @@ -149,7 +149,7 @@ fun ListEntry( provider = ImageProvider(R.drawable.ic_priority), contentDescription = context.getString(R.string.priority), modifier = GlanceModifier.size(imageSize).padding(end = 4.dp), - colorFilter = ColorFilter.tint(metaBarColor) + colorFilter = ColorFilter.tint(textStyleMetaInfo.color) ) Text( text = obj.priority.toString(), @@ -164,7 +164,7 @@ fun ListEntry( provider = ImageProvider(R.drawable.ic_status), contentDescription = context.getString(R.string.status), modifier = GlanceModifier.size(imageSize).padding(end = 4.dp), - colorFilter = ColorFilter.tint(metaBarColor) + colorFilter = ColorFilter.tint(textStyleMetaInfo.color) ) Text( text = obj.xstatus @@ -181,7 +181,7 @@ fun ListEntry( provider = ImageProvider(R.drawable.ic_classification), contentDescription = context.getString(R.string.classification), modifier = GlanceModifier.size(imageSize).padding(end = 4.dp), - colorFilter = ColorFilter.tint(metaBarColor) + colorFilter = ColorFilter.tint(textStyleMetaInfo.color) ) Text( text = Classification.getClassificationFromString(obj.classification)?.let { context.getString(it.stringResource) } ?: "",