From b2efe0d981c2890859b24e4ae0123cbe46a7c63b Mon Sep 17 00:00:00 2001 From: Mateusz Idziejczak Date: Sun, 2 May 2021 12:33:27 +0200 Subject: [PATCH] Probably fix list divider color (#1270) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RafaƂ Borcz --- .../ui/widgets/DividerItemDecoration.kt | 9 ++-- .../res/drawable-night/ic_all_divider.xml | 9 ---- app/src/main/res/drawable/ic_all_divider.xml | 6 +-- app/src/main/res/layout/dialog_error.xml | 14 ++++--- app/src/main/res/layout/dialog_homework.xml | 6 ++- .../res/layout/item_attendance_summary.xml | 42 +++++++++++++++---- .../main/res/layout/item_grade_summary.xml | 18 ++++++-- 7 files changed, 69 insertions(+), 35 deletions(-) delete mode 100644 app/src/main/res/drawable-night/ic_all_divider.xml diff --git a/app/src/main/java/io/github/wulkanowy/ui/widgets/DividerItemDecoration.kt b/app/src/main/java/io/github/wulkanowy/ui/widgets/DividerItemDecoration.kt index b0b6999eb..ca2bda268 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/widgets/DividerItemDecoration.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/widgets/DividerItemDecoration.kt @@ -2,7 +2,6 @@ package io.github.wulkanowy.ui.widgets import android.content.Context import android.graphics.Canvas -import android.view.View import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.RecyclerView @@ -12,13 +11,13 @@ class DividerItemDecoration(context: Context) : DividerItemDecoration(context, V canvas.save() val dividerLeft = parent.paddingLeft val dividerRight = parent.width - parent.paddingRight - val childCount = parent.childCount - for (i in 0..childCount - 2) { - val child: View = parent.getChildAt(i) + for (i in 0..parent.childCount - 2) { + val child = parent.getChildAt(i) val params = child.layoutParams as RecyclerView.LayoutParams - val dividerTop: Int = child.bottom + params.bottomMargin + val dividerTop = child.bottom + params.bottomMargin val dividerBottom = dividerTop + drawable!!.intrinsicHeight + drawable?.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom) drawable?.draw(canvas) } diff --git a/app/src/main/res/drawable-night/ic_all_divider.xml b/app/src/main/res/drawable-night/ic_all_divider.xml deleted file mode 100644 index cd444a285..000000000 --- a/app/src/main/res/drawable-night/ic_all_divider.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_all_divider.xml b/app/src/main/res/drawable/ic_all_divider.xml index 61e964979..922882c21 100644 --- a/app/src/main/res/drawable/ic_all_divider.xml +++ b/app/src/main/res/drawable/ic_all_divider.xml @@ -1,9 +1,5 @@ - + diff --git a/app/src/main/res/layout/dialog_error.xml b/app/src/main/res/layout/dialog_error.xml index 0d79e19e2..a78790bce 100644 --- a/app/src/main/res/layout/dialog_error.xml +++ b/app/src/main/res/layout/dialog_error.xml @@ -13,7 +13,7 @@ android:paddingTop="24dp" android:text="@string/all_details" android:textSize="21sp" - android:textStyle="bold"/> + android:textStyle="bold" /> + + @@ -71,6 +75,7 @@ style="@style/Widget.MaterialComponents.Button.TextButton.Dialog" android:layout_width="wrap_content" android:layout_height="36dp" + android:layout_gravity="center_vertical" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" @@ -79,7 +84,6 @@ android:insetRight="0dp" android:insetBottom="0dp" android:minWidth="88dp" - android:layout_gravity="center_vertical" android:text="@string/about_feedback" /> diff --git a/app/src/main/res/layout/dialog_homework.xml b/app/src/main/res/layout/dialog_homework.xml index 69c02d5a4..22a03cb21 100644 --- a/app/src/main/res/layout/dialog_homework.xml +++ b/app/src/main/res/layout/dialog_homework.xml @@ -15,10 +15,14 @@ tools:itemCount="1" tools:listitem="@layout/item_homework_dialog_details" /> + + diff --git a/app/src/main/res/layout/item_attendance_summary.xml b/app/src/main/res/layout/item_attendance_summary.xml index 155526299..340ea8928 100644 --- a/app/src/main/res/layout/item_attendance_summary.xml +++ b/app/src/main/res/layout/item_attendance_summary.xml @@ -37,7 +37,6 @@ @@ -62,10 +61,14 @@ tools:text="50" /> + + @@ -90,10 +93,14 @@ tools:text="0" /> + + @@ -118,10 +125,14 @@ tools:text="25" /> + + @@ -146,10 +157,14 @@ tools:text="0" /> + + @@ -174,10 +189,14 @@ tools:text="6" /> + + @@ -202,10 +221,14 @@ tools:text="0" /> + + @@ -229,4 +252,9 @@ android:textSize="12sp" tools:text="0" /> + + diff --git a/app/src/main/res/layout/item_grade_summary.xml b/app/src/main/res/layout/item_grade_summary.xml index 85a78571e..30aa6e77b 100644 --- a/app/src/main/res/layout/item_grade_summary.xml +++ b/app/src/main/res/layout/item_grade_summary.xml @@ -38,7 +38,6 @@ android:id="@+id/gradeSummaryItemPointsContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/ic_all_divider" android:minHeight="35dp" android:orientation="horizontal"> @@ -63,10 +62,14 @@ tools:text="123/150" /> + + @@ -91,10 +94,14 @@ tools:text="5" /> + + @@ -118,4 +125,9 @@ android:textSize="12sp" tools:text="5" /> + +