zhihu / Matisse

:fireworks: A well-designed local image and video selector for Android
Apache License 2.0
12.52k stars 2.07k forks source link

Replace ViewPager with ViewPager2 to achieve better performance. #880

Open kn0w-n0thing opened 1 year ago

kn0w-n0thing commented 1 year ago

Above of all, please let me show the appreciation of this project. But a little problem came to me when I migrated the codes to my own project. That is, ViewPager's performance is not good enough. Whenever a preview page is slided in, a new PreviewItemFragment is crated. So I replace ViewPager with ViewPager2, which automatically caches one page on each side of the current preview page. I hope it will be helpful to the project :)