Probably fix list divider color (#1270)

Co-authored-by: Rafał Borcz <RafalBO99@outlook.com>
This commit is contained in:
Mateusz Idziejczak 2021-05-02 12:33:27 +02:00 committed by GitHub
parent 2a7f846d3f
commit b2efe0d981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 35 deletions

View File

@ -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)
}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:centerColor="@android:color/transparent"
android:centerX="0.01"
android:startColor="@color/colorDividerInverse" />
</shape>

View File

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:centerColor="@android:color/transparent"
android:centerX="0.01"
android:startColor="@color/colorDivider" />
<solid android:color="?colorDivider" />
</shape>

View File

@ -13,7 +13,7 @@
android:paddingTop="24dp"
android:text="@string/all_details"
android:textSize="21sp"
android:textStyle="bold"/>
android:textStyle="bold" />
<TextView
android:id="@+id/errorDialogMessage"
@ -58,10 +58,14 @@
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/ic_all_divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:gravity="end"
android:minHeight="52dp"
android:orientation="horizontal">
@ -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" />
<Space
@ -92,6 +96,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"
@ -100,7 +105,6 @@
android:insetRight="0dp"
android:insetBottom="0dp"
android:minWidth="88dp"
android:layout_gravity="center_vertical"
android:text="@android:string/cancel" />
<com.google.android.material.button.MaterialButton
@ -108,6 +112,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"
@ -116,7 +121,6 @@
android:insetRight="0dp"
android:insetBottom="0dp"
android:minWidth="88dp"
android:layout_gravity="center_vertical"
android:text="@android:string/copy" />
</LinearLayout>
</LinearLayout>

View File

@ -15,10 +15,14 @@
tools:itemCount="1"
tools:listitem="@layout/item_homework_dialog_details" />
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:gravity="end"
android:minHeight="52dp"
android:orientation="horizontal">

View File

@ -37,7 +37,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -62,10 +61,14 @@
tools:text="50" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -90,10 +93,14 @@
tools:text="0" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -118,10 +125,14 @@
tools:text="25" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -146,10 +157,14 @@
tools:text="0" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -174,10 +189,14 @@
tools:text="6" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -202,10 +221,14 @@
tools:text="0" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -229,4 +252,9 @@
android:textSize="12sp"
tools:text="0" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
</LinearLayout>

View File

@ -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" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -91,10 +94,14 @@
tools:text="5" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_all_divider"
android:minHeight="35dp"
android:orientation="horizontal">
@ -118,4 +125,9 @@
android:textSize="12sp"
tools:text="5" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:background="@drawable/ic_all_divider"
android:layout_height="1dp" />
</LinearLayout>