[android] Scroll to start list results.

This commit is contained in:
velichkomarija 2020-11-10 18:19:42 +03:00 committed by Alexander Boriskov
parent db059d77b6
commit 72daad486c
2 changed files with 7 additions and 0 deletions

View file

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?windowBackgroundForced"

View file

@ -18,6 +18,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
@ -96,6 +97,8 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
private RecyclerView mCollectionRecyclerView;
@NonNull
private BookmarkManager.BookmarksCatalogListener mCatalogListener;
@NonNull
private NestedScrollView mNestedScrollView;
@NonNull
private final RecyclerView.OnScrollListener mRecyclerListener = new RecyclerView.OnScrollListener()
@ -180,6 +183,8 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
mDescriptionView = view.findViewById(R.id.guide_info);
configureGuidesInfoLayout();
mNestedScrollView = view.findViewById(R.id.scroll_view);
setHasOptionsMenu(true);
ActionBar bar = ((AppCompatActivity) requireActivity()).getSupportActionBar();
@ -384,6 +389,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
BookmarkListAdapter adapter = getAdapter();
adapter.setSearchResults(bookmarkIds);
adapter.notifyDataSetChanged();
mNestedScrollView.smoothScrollTo(0, 0);
updateRecyclerVisibility();
}