ticket.40292, ticket.40637: InfiniteViewPager code refactoring and fix flash issue.