Skip to content

Commit

Permalink
fix splash overscoll bug
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Aug 26, 2023
1 parent 885c954 commit a929666
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/src/main/java/phone/vishnu/quotes/fragment/TourFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat

private boolean settled = false;

private int position = 0;

@Override
public void onPageScrolled(
int position, float positionOffset, int positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
this.position = position;
}

@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
Expand All @@ -130,7 +139,9 @@ public void onPageScrollStateChanged(int state) {

if (state == ViewPager2.SCROLL_STATE_SETTLING) settled = true;

if (state == ViewPager2.SCROLL_STATE_IDLE && !settled)
if (state == ViewPager2.SCROLL_STATE_IDLE
&& !settled
&& position == adapter.getItemCount() - 1)
checkDownloadStatusAndMoveToNext();
}
});
Expand Down

0 comments on commit a929666

Please sign in to comment.