mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 05:48:26 +00:00
Fix scroll to bottom button always visible if last item is taller than RecyclerView
This commit is contained in:
commit
57476cd56e
@ -211,10 +211,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
var searchViewItem: MenuItem? = null
|
var searchViewItem: MenuItem? = null
|
||||||
|
|
||||||
private val isScrolledToBottom: Boolean
|
private val isScrolledToBottom: Boolean
|
||||||
get() {
|
get() = binding?.conversationRecyclerView?.isScrolledToBottom ?: true
|
||||||
val position = layoutManager?.findFirstCompletelyVisibleItemPosition() ?: 0
|
|
||||||
return position == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
private val layoutManager: LinearLayoutManager?
|
private val layoutManager: LinearLayoutManager?
|
||||||
get() { return binding?.conversationRecyclerView?.layoutManager as LinearLayoutManager? }
|
get() { return binding?.conversationRecyclerView?.layoutManager as LinearLayoutManager? }
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun Context.getColorFromAttr(
|
fun Context.getColorFromAttr(
|
||||||
@ -13,4 +14,10 @@ fun Context.getColorFromAttr(
|
|||||||
): Int {
|
): Int {
|
||||||
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
|
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
|
||||||
return typedValue.data
|
return typedValue.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val RecyclerView.isScrolledToBottom: Boolean
|
||||||
|
get() {
|
||||||
|
val contentHeight = height - (paddingTop + paddingBottom)
|
||||||
|
return computeVerticalScrollRange() == computeVerticalScrollOffset() + contentHeight
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user