Commit 6e54396a authored by Joey's avatar Joey

glucose: suggestion: add icon to suggestions

Signed-off-by: Joey's avatarJoey <bevilacquajoey@gmail.com>
Change-Id: If6f9fdf576e488ec25596b86f7094a289ded5b15
parent 2639a0fb
......@@ -28,6 +28,8 @@ class CheckAgainSuggestion(
!suggestionsTimeFrames.contains(targetTimeFrame)
}
override val icon = R.drawable.ic_suggestion_remind
override fun validate(value: Int) = value <= lowThreshold
override fun getFailMessage(value: Int, res: Resources?): String? = null
......
......@@ -29,6 +29,8 @@ class InsulinSuggestion(
allowedTimeFrames.contains(glucose.timeFrame) && glucose.insulinId0 == -1L
}
override val icon = R.drawable.ic_suggestion_ml
override fun validate(value: Float) = value >= 0
override fun getFailMessage(value: Float, res: Resources?): String? {
......
......@@ -13,4 +13,6 @@ interface SuggestionConfig {
val shouldAnimate: Boolean
val isValid: Boolean
val icon: Int
}
\ No newline at end of file
......@@ -53,6 +53,7 @@ class SuggestionView : LinearLayout {
return false
}
textView.setCompoundDrawablesWithIntrinsicBounds(config.icon, 0, 0, 0)
if (config.shouldAnimate) {
showLoad()
}
......
<!--
Copyright (c) 2019 Bevilacqua Joey
Licensed under the GNU GPLv3 license
The text of the license can be found in the LICENSE file
or at https://www.gnu.org/licenses/gpl.txt
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/component_suggestion_fg"
android:pathData="M6,13c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM6,17c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM6,9c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM3,9.5c-0.28,0 -0.5,0.22 -0.5,0.5s0.22,0.5 0.5,0.5 0.5,-0.22 0.5,-0.5 -0.22,-0.5 -0.5,-0.5zM6,5c-0.55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.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM14,20.5c-0.28,0 -0.5,0.22 -0.5,0.5s0.22,0.5 0.5,0.5 0.5,-0.22 0.5,-0.5 -0.22,-0.5 -0.5,-0.5zM10,8.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM10,17c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM14,12.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM14,8.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5z" />
</vector>
<!--
Copyright (c) 2019 Bevilacqua Joey
Licensed under the GNU GPLv3 license
The text of the license can be found in the LICENSE file
or at https://www.gnu.org/licenses/gpl.txt
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/component_suggestion_fg"
android:pathData="M10.01,21.01c0,1.1 0.89,1.99 1.99,1.99s1.99,-0.89 1.99,-1.99h-3.98zM12,6c2.76,0 5,2.24 5,5v7L7,18v-7c0,-2.76 2.24,-5 5,-5zM12,1.5c-0.83,0 -1.5,0.67 -1.5,1.5v1.17C7.36,4.85 5,7.65 5,11v6l-2,2v1h18v-1l-2,-2v-6c0,-3.35 -2.36,-6.15 -5.5,-6.83L13.5,3c0,-0.83 -0.67,-1.5 -1.5,-1.5zM13,8h-2v3L8,11v2h3v3h2v-3h3v-2h-3z" />
</vector>
......@@ -24,7 +24,9 @@
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:stateListAnimator="@animator/lift_on_touch"
android:drawablePadding="8dp"
android:text="@string/glucose_editor_suggestion_loading"
android:textColor="@color/component_insulin_suggestion_fg"
android:textColor="@color/component_suggestion_fg"
android:textSize="16sp"
tools:drawableStart="@drawable/ic_suggestion_ml"
tools:text="Suggested insulin: 4.5" />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment