mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 02:01:51 +01:00
LTR support on recycler item dividers
This commit is contained in:
parent
d47a8c6ed9
commit
cd7e4efa5e
@ -6,6 +6,7 @@ import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.isLTR
|
||||
|
||||
class ExtensionDividerItemDecoration(context: Context) : androidx.recyclerview.widget.RecyclerView.ItemDecoration() {
|
||||
|
||||
@ -27,8 +28,9 @@ class ExtensionDividerItemDecoration(context: Context) : androidx.recyclerview.w
|
||||
val params = child.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams
|
||||
val top = child.bottom + params.bottomMargin
|
||||
val bottom = top + divider.intrinsicHeight
|
||||
val left = parent.paddingStart + 12.dpToPx
|
||||
val right = parent.width - parent.paddingEnd
|
||||
val left = parent.paddingStart + if (parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
val right =
|
||||
parent.width - parent.paddingEnd - if (!parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
|
||||
divider.setBounds(left, top, right, bottom)
|
||||
divider.draw(c)
|
||||
|
@ -6,6 +6,7 @@ import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.isLTR
|
||||
|
||||
class MangaDetailsDivider(context: Context) : androidx.recyclerview.widget.RecyclerView.ItemDecoration() {
|
||||
|
||||
@ -29,8 +30,9 @@ class MangaDetailsDivider(context: Context) : androidx.recyclerview.widget.Recyc
|
||||
child.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams
|
||||
val top = child.bottom + params.bottomMargin
|
||||
val bottom = top + divider.intrinsicHeight
|
||||
val left = parent.paddingStart + 12.dpToPx
|
||||
val right = parent.width - parent.paddingEnd
|
||||
val left = parent.paddingStart + if (parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
val right =
|
||||
parent.width - parent.paddingEnd - if (!parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
|
||||
divider.setBounds(left, top, right, bottom)
|
||||
divider.draw(c)
|
||||
|
@ -6,6 +6,7 @@ import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.isLTR
|
||||
|
||||
class RecentMangaDivider(context: Context) : androidx.recyclerview.widget.RecyclerView.ItemDecoration() {
|
||||
|
||||
@ -25,11 +26,13 @@ class RecentMangaDivider(context: Context) : androidx.recyclerview.widget.Recycl
|
||||
if (holder is RecentMangaHolder &&
|
||||
parent.getChildViewHolder(parent.getChildAt(i + 1)) is RecentMangaHolder
|
||||
) {
|
||||
val params = child.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams
|
||||
val params =
|
||||
child.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams
|
||||
val top = child.bottom + params.bottomMargin
|
||||
val bottom = top + divider.intrinsicHeight
|
||||
val left = parent.paddingStart + 12.dpToPx
|
||||
val right = parent.width - parent.paddingEnd
|
||||
val left = parent.paddingStart + if (parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
val right =
|
||||
parent.width - parent.paddingEnd - if (!parent.context.resources.isLTR) 12.dpToPx else 0
|
||||
|
||||
divider.setBounds(left, top, right, bottom)
|
||||
divider.draw(c)
|
||||
|
Loading…
Reference in New Issue
Block a user