diff --git a/app/jacoco.gradle b/app/jacoco.gradle index 48a8fed96..e9abfb613 100644 --- a/app/jacoco.gradle +++ b/app/jacoco.gradle @@ -1,7 +1,7 @@ apply plugin: "jacoco" jacoco { - toolVersion "0.8.4" + toolVersion "0.8.5" reportsDir = file("$buildDir/reports") } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsDialog.kt index 0abeaeea0..a8f8a8653 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsDialog.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsDialog.kt @@ -10,6 +10,7 @@ import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Grade import io.github.wulkanowy.utils.colorStringId import io.github.wulkanowy.utils.getBackgroundColor +import io.github.wulkanowy.utils.getGradeColor import io.github.wulkanowy.utils.toFormattedString import kotlinx.android.synthetic.main.dialog_grade.* @@ -50,7 +51,12 @@ class GradeDetailsDialog : DialogFragment() { super.onActivityCreated(savedInstanceState) gradeDialogSubject.text = grade.subject - gradeDialogWeightValue.text = grade.weight + + gradeDialogColorAndWeightValue.run { + text = context.getString(R.string.grade_weight_value, grade.weight) + setBackgroundResource(grade.getGradeColor()) + } + gradeDialogDateValue.text = grade.date.toFormattedString() gradeDialogColorValue.text = getString(grade.colorStringId) diff --git a/app/src/main/java/io/github/wulkanowy/utils/GradeExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/GradeExtension.kt index c1e182ba2..c57b62470 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/GradeExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/GradeExtension.kt @@ -24,14 +24,7 @@ fun List.calcAverage(): Double { fun Grade.getBackgroundColor(theme: String): Int { return when (theme) { - "grade_color" -> when (color) { - "000000" -> R.color.grade_black - "F04C4C" -> R.color.grade_red - "20A4F7" -> R.color.grade_blue - "6ECD07" -> R.color.grade_green - "B16CF1" -> R.color.grade_purple - else -> R.color.grade_material_default - } + "grade_color" -> getGradeColor() "material" -> when (value.toInt()) { 6 -> R.color.grade_material_six 5 -> R.color.grade_material_five @@ -53,6 +46,17 @@ fun Grade.getBackgroundColor(theme: String): Int { } } +fun Grade.getGradeColor(): Int { + return when (color) { + "000000" -> R.color.grade_black + "F04C4C" -> R.color.grade_red + "20A4F7" -> R.color.grade_blue + "6ECD07" -> R.color.grade_green + "B16CF1" -> R.color.grade_purple + else -> R.color.grade_material_default + } +} + inline val Grade.colorStringId: Int get() { return when (color) { diff --git a/app/src/main/res/layout/dialog_grade.xml b/app/src/main/res/layout/dialog_grade.xml index f95b9cfdb..fad7bae57 100644 --- a/app/src/main/res/layout/dialog_grade.xml +++ b/app/src/main/res/layout/dialog_grade.xml @@ -17,90 +17,83 @@ android:padding="20dp" tools:ignore="UselessParent"> - + android:orientation="vertical"> - + + + + + + android:layout_marginRight="12dp" + android:layout_marginEnd="12dp" + android:orientation="vertical"> + - - - - - - - + + Zmień semestr Brak ocen Waga + Waga: %s Komentarz Brak nowych ocen Ilość nowych ocen: %1$d diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c8b94bff5..1b07a9fea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -68,6 +68,7 @@ Change semester No grades Weight + Weight: %s Comment No new grades Number of new ratings: %1$d