I want my app to only expand the app bar after pulling the screen 2 times when it reaches the beginning of the scroll
EDIT:
I will try to improve the question. How do I get the starting position of a recycle view or a viewpager2. So when the position is 0 (Starting position), I want the appbar not to expand, now to expand it has to pull down while in position 0
I got it through the following commands
AtomicBoolean firstBoot = new AtomicBoolean(true);
recycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (firstBoot.get) {
firstBoot.set(false);
return;
}
if (recyclerView.computeVerticalScrollOffset() == 0){
recyclerView.stopScroll();
bar.setExpanded(false);
}
}
});
The variable "firstBoot" is so that the method is not executed when the activity is created