From f204264d2da69c1ca5a9a373c5927d3df8ef995c Mon Sep 17 00:00:00 2001 From: Dominik Korsa Date: Sat, 4 Jan 2020 01:46:43 +0100 Subject: [PATCH] Change grade header note to unread count (#634) --- .../modules/grade/details/GradeDetailsHeader.kt | 1 + .../res/drawable/background_header_note.xml | 5 +++++ .../main/res/layout/header_grade_details.xml | 17 +++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/background_header_note.xml diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt index e5f6e8249..9ed412808 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsHeader.kt @@ -38,6 +38,7 @@ class GradeDetailsHeader( gradeHeaderAverage.text = average gradeHeaderNumber.text = number gradeHeaderNote.visibility = if (newGrades > 0) VISIBLE else GONE + if (newGrades > 0) gradeHeaderNote.text = newGrades.toString(10) gradeHeaderContainer.isEnabled = isExpandable isViewExpandable = isExpandable diff --git a/app/src/main/res/drawable/background_header_note.xml b/app/src/main/res/drawable/background_header_note.xml new file mode 100644 index 000000000..b6555847b --- /dev/null +++ b/app/src/main/res/drawable/background_header_note.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/header_grade_details.xml b/app/src/main/res/layout/header_grade_details.xml index 40f486cf5..0fa3872e1 100644 --- a/app/src/main/res/layout/header_grade_details.xml +++ b/app/src/main/res/layout/header_grade_details.xml @@ -7,7 +7,7 @@ android:background="?selectableItemBackground" android:paddingLeft="16dp" android:paddingTop="10dp" - android:paddingRight="12dp" + android:paddingRight="14dp" android:paddingBottom="10dp" tools:context=".ui.modules.grade.details.GradeDetailsHeader" android:paddingEnd="12dp" @@ -50,14 +50,19 @@ android:textSize="12sp" tools:text="12 grades" /> - + android:background="@drawable/background_header_note" + android:textColor="?colorOnPrimary" + android:textSize="14sp" + tools:text="255" />