gitmyhub

InfiniteCycleViewPager

Java ★ 5.7k updated 3y ago

Infinite cycle ViewPager with two-way orientation and interactive effect.

An Android library for building a scrollable card gallery that loops infinitely in either direction, with a scaling zoom effect on the focused card and built-in auto-scroll.

JavaAndroidXamarinsetup: easycomplexity 2/5

InfiniteCycleViewPager is an Android library that lets you build a scrollable card-swiping screen that loops forever. Instead of hitting a dead end at the last card, the list wraps back around to the beginning, giving users a continuous swiping experience in either direction. The library supports both horizontal and vertical orientations, so you can build a left-right swipe gallery or a top-down scrolling one using the same codebase.

The visual effect is a scaling animation: the card currently in focus appears larger, while the cards on either side shrink down. You can control exactly how large the center card gets, how small the side cards become, and how much offset exists between them. There is also an option for a three-step scale (small, medium, large) rather than jumping straight between minimum and maximum sizes. Auto-scroll is built in, letting the cards advance on their own at a set interval in either the forward or backward direction.

Setting it up in code involves pointing it at a data adapter and then calling a handful of methods to configure scroll speed, scale values, and an optional animation interpolator. The same options are also available as XML attributes, so you can configure the widget entirely in your layout file without touching Java code. A Xamarin bindings package is available on NuGet for developers working in that ecosystem.

One important note: the README states plainly that this library is no longer maintained. The authors are not adding new features or fixing bugs. If you need changes, the recommendation is to copy the source code and modify it yourself. For production Android apps, this is worth keeping in mind before building a dependency on it. The minimum required Android SDK version is 11.

Where it fits