[Android] "New articles found" will toast many times


#1

I’m using Google Play version 1.243, when scrolling down in headline page, it will give me “New articles found” hint to let reload sometime, I know it’s normal behavior.

But this hint will toast many times at the same, check log below, headline is requested many times at the same time.

The request will be sent many times even in lazy load.

Logs:

07-05 21:22:34.573: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.573: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.603: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.603: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.620: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.621: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.639: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.639: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.659: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.659: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.659: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.660: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:34.687: D/HeadlinesFragment(3050): allowForceUpdate=false userInitiated=false
07-05 21:22:34.688: D/HeadlinesFragment(3050): [HP] request more headlines, firstId=62002
07-05 21:22:35.490: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:36.195: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:36.300: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:36.367: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:36.923: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:37.300: D/(3050): firstID=62002 firstIdChanged=false
07-05 21:22:37.302: D/(3050): firstID=62002 firstIdChanged=false

#2

if firstidchanged is false that toast shouldn’t even be shown. also, i’m not sure what would cause so many requests (on scroll i presume). strange.

device, os version, anything?


#3

Device is Google Pixel, OS is 7.1, also I can reproduce this on Genymotion Android 7.1

I traced a while, they are triggered on scroll.

The HeadlinesFragment.onScrolled() will be called many times, due to refresh() will be called in delay, so m_refreshInProgress will not be set to true immediately, that’s why request will be sent many times from refresh().

if (!m_refreshInProgress && !m_lazyLoadDisabled && lastVisibleItem >= m_articles.size() - 5) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refresh(true);
}
}, 100);
}


#4

this makes sense, i guess m_refreshInProgress should be set before handler is created

can you file a PR?


#5

PR is submitted, please check. I tested and passed, please also test by yourself before next release.


#6

thanks, i don’t think this change can really break anything, even though on android anything is possible