mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-13 10:07:36 +00:00
Add 50 dp buffer to isScrolledToBottom (#1228)
This commit is contained in:
@@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.util
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlin.math.max
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
fun Resources.getColorWithID(@ColorRes id: Int, theme: Resources.Theme?): Int {
|
||||
@@ -30,3 +32,8 @@ fun toDp(px: Float, resources: Resources): Float {
|
||||
val scale = resources.displayMetrics.density
|
||||
return (px / scale)
|
||||
}
|
||||
|
||||
val RecyclerView.isScrolledToBottom: Boolean
|
||||
get() = computeVerticalScrollOffset().coerceAtLeast(0) +
|
||||
computeVerticalScrollExtent() +
|
||||
toPx(50, resources) >= computeVerticalScrollRange()
|
||||
|
Reference in New Issue
Block a user