diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt
index 5e66ac8260..087ec2f2ee 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt
@@ -164,11 +164,11 @@ class NotificationStore @Inject constructor(
@Suppress("SetTextI18n")
holder.binding.text.text = dateUtil.timeString(notification.date) + " " + notification.text
when (notification.level) {
- Notification.URGENT -> holder.binding.cv.setBackgroundColor(rh.gc(R.color.notificationUrgent))
- Notification.NORMAL -> holder.binding.cv.setBackgroundColor(rh.gc(R.color.notificationNormal))
- Notification.LOW -> holder.binding.cv.setBackgroundColor(rh.gc(R.color.notificationLow))
- Notification.INFO -> holder.binding.cv.setBackgroundColor(rh.gc(R.color.notificationInfo))
- Notification.ANNOUNCEMENT -> holder.binding.cv.setBackgroundColor(rh.gc(R.color.notificationAnnouncement))
+ Notification.URGENT -> holder.binding.cv.setBackgroundColor(rh.gac(R.attr.notificationUrgent))
+ Notification.NORMAL -> holder.binding.cv.setBackgroundColor(rh.gac(R.attr.notificationNormal))
+ Notification.LOW -> holder.binding.cv.setBackgroundColor(rh.gac(R.attr.notificationLow))
+ Notification.INFO -> holder.binding.cv.setBackgroundColor(rh.gac(R.attr.notificationInfo))
+ Notification.ANNOUNCEMENT -> holder.binding.cv.setBackgroundColor(rh.gac(R.attr.notificationAnnouncement))
}
}
diff --git a/app/src/main/res/layout/overview_notification_item.xml b/app/src/main/res/layout/overview_notification_item.xml
index 0a4e809e92..23d103abeb 100644
--- a/app/src/main/res/layout/overview_notification_item.xml
+++ b/app/src/main/res/layout/overview_notification_item.xml
@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
- android:textColor="@color/black"
+ android:textColor="?attr/colorOnError"
android:maxLines="4"
android:textStyle="bold"
android:text="Notification text. Notification text. Notification text. Notification text. Notification text. Notification text. "
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index e9c677487b..96670d632b 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -40,11 +40,6 @@
#de7550
#25912e
- #ff0400
- #ff5e55
- #ff827c
- #24DF2B
-
#c8666666
#7200FF00
#72FF0000
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelper.kt
index 8f6379d657..bdfdb76a92 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelper.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelper.kt
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.utils.resources
+import android.content.Context
import android.content.res.AssetFileDescriptor
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
@@ -11,7 +12,7 @@ interface ResourceHelper {
fun gs(@StringRes id: Int, vararg args: Any?): String
fun gq(@PluralsRes id: Int, quantity: Int, vararg args: Any?): String
fun gsNotLocalised(@StringRes id: Int, vararg args: Any?): String
- fun gc(@ColorRes id: Int): Int
+ @ColorInt fun gc(@ColorRes id: Int): Int
fun gd(@DrawableRes id: Int): Drawable?
fun gb(@BoolRes id :Int) : Boolean
fun gcs(@ColorRes id: Int): String
@@ -23,4 +24,13 @@ interface ResourceHelper {
fun dpToPx(dp: Int): Int
fun dpToPx(dp: Float): Int
fun shortTextMode(): Boolean
-}
\ No newline at end of file
+
+ /**
+ * Get Attribute Color based on theme style
+ */
+ @ColorInt fun gac(@AttrRes attributeId: Int): Int
+ /**
+ * Get Attribute Color based on theme style for specified context
+ */
+ @ColorInt fun gac(context: Context, @AttrRes attributeId: Int): Int
+}
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt
new file mode 100644
index 0000000000..db31c42970
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperExtensions.kt
@@ -0,0 +1,13 @@
+package info.nightscout.androidaps.utils.resources
+
+import android.content.Context
+import android.util.TypedValue
+import androidx.annotation.AttrRes
+import androidx.annotation.ColorInt
+
+@ColorInt
+fun Context.getThemeColor(@AttrRes attribute: Int) =
+ TypedValue().let {
+ theme.resolveAttribute(attribute, it, true)
+ it.data
+ }
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperImplementation.kt b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperImplementation.kt
index 86673862f4..0c6cd537b9 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperImplementation.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/resources/ResourceHelperImplementation.kt
@@ -9,6 +9,7 @@ import android.graphics.BitmapFactory
import android.graphics.drawable.Drawable
import android.util.DisplayMetrics
import androidx.annotation.*
+import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.utils.FabricPrivacy
@@ -83,4 +84,10 @@ class ResourceHelperImplementation @Inject constructor(private val context: Cont
}
override fun shortTextMode(): Boolean = !gb(R.bool.isTablet)
-}
\ No newline at end of file
+
+ override fun gac(context: Context, attributeId: Int): Int =
+ context.getThemeColor(attributeId)
+
+ override fun gac(attributeId: Int): Int =
+ ContextThemeWrapper(this.context, R.style.AppTheme).getThemeColor(attributeId)
+}
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index 85a25abfed..918e9b7114 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -7,4 +7,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml
index a6a7245cba..69de6e1abb 100644
--- a/core/src/main/res/values/colors.xml
+++ b/core/src/main/res/values/colors.xml
@@ -92,8 +92,14 @@
#1ea3e5
#1e88e5
-
+
#FF8C00
+ #ff0400
+ #ff5e55
+ #ff827c
+
+
+ #009705
#666666
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index 31076be1d6..b22248a881 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -22,6 +22,12 @@
- @color/white
- @color/white
- @color/white
+
+ - @color/notificationUrgent
+ - @color/notificationNormal
+ - @color/notificationLow
+ - @color/notificationInfo
+ - @color/notificationAnnouncement