Merge pull request #7339 from weihuoya/cache-all-page

Android: cache all page, avoid image flicking when swipe from last page to first page
This commit is contained in:
Pierre Bourdon 2018-08-27 04:41:23 +02:00 committed by GitHub
commit eef47990d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
PlatformPagerAdapter platformPagerAdapter = new PlatformPagerAdapter(
getSupportFragmentManager(), this);
mViewPager.setAdapter(platformPagerAdapter);
mViewPager.setOffscreenPageLimit(platformPagerAdapter.getCount());
showGames();
GameFileCacheService.startLoad(this);
}
@ -188,6 +189,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
PlatformPagerAdapter platformPagerAdapter = new PlatformPagerAdapter(
getSupportFragmentManager(), this);
mViewPager.setAdapter(platformPagerAdapter);
mViewPager.setOffscreenPageLimit(platformPagerAdapter.getCount());
mTabLayout.setupWithViewPager(mViewPager);
mViewPager.setVisibility(View.VISIBLE);
GameFileCacheService.startLoad(this);