Fix scroll to bottom button visibility (#1219)

This commit is contained in:
Andrew
2023-05-30 11:44:20 +09:30
committed by GitHub
parent 22ed2dd8aa
commit e8d26222b9
2 changed files with 29 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import android.util.TypedValue
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
import androidx.recyclerview.widget.RecyclerView
import kotlin.math.max
@ColorInt
fun Context.getColorFromAttr(
@@ -17,4 +18,4 @@ fun Context.getColorFromAttr(
}
val RecyclerView.isScrolledToBottom: Boolean
get() = computeVerticalScrollOffset() + computeVerticalScrollExtent() >= computeVerticalScrollRange()
get() = max(0, computeVerticalScrollOffset()) + computeVerticalScrollExtent() >= computeVerticalScrollRange()