Search in sources :

Example 6 with ScrollState

use of eu.siacs.conversations.ui.util.ScrollState in project Conversations by siacs.

the class ConversationsOverviewFragment method getScrollState.

private ScrollState getScrollState() {
    if (this.binding == null) {
        return null;
    }
    LinearLayoutManager layoutManager = (LinearLayoutManager) this.binding.list.getLayoutManager();
    int position = layoutManager.findFirstVisibleItemPosition();
    final View view = this.binding.list.getChildAt(0);
    if (view != null) {
        return new ScrollState(position, view.getTop());
    } else {
        return new ScrollState(position, 0);
    }
}
Also used : ScrollState(eu.siacs.conversations.ui.util.ScrollState) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Paint(android.graphics.Paint)

Aggregations

ScrollState (eu.siacs.conversations.ui.util.ScrollState)6 View (android.view.View)2 Conversation (eu.siacs.conversations.entities.Conversation)2 Attachment (eu.siacs.conversations.ui.util.Attachment)2 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 Uri (android.net.Uri)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1