Convert Figma logo to code with AI

Devlight logoInfiniteCycleViewPager

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

5,748
830
5,748
57

Top Related Projects

Render After Effects animations natively on Android and iOS, Web, and React Native

An easy, flexible way to add a shimmering effect to any view in an Android app.

An Android Animation library which easily add itemanimator to RecyclerView items.

Android loading animations

8,512

Epoxy is an Android library for building complex screens in a RecyclerView

A Material Design ViewPager easy to use library

Quick Overview

InfiniteCycleViewPager is an Android library that provides a custom ViewPager with infinite cycling capabilities. It allows for smooth, continuous scrolling through pages in both horizontal and vertical directions, with customizable page transformations and animations.

Pros

  • Supports both horizontal and vertical scrolling
  • Offers smooth infinite cycling through pages
  • Highly customizable with various animation and transformation options
  • Easy integration with existing Android projects

Cons

  • May have performance issues with a large number of pages
  • Limited documentation and examples for advanced use cases
  • Not actively maintained (last update was in 2017)
  • Might not be fully compatible with the latest Android versions

Code Examples

  1. Basic initialization of InfiniteCycleViewPager:
val infiniteCycleViewPager = findViewById<InfiniteCycleViewPager>(R.id.infinite_cycle_view_pager)
infiniteCycleViewPager.adapter = MyPagerAdapter(supportFragmentManager)
  1. Setting up vertical scrolling:
infiniteCycleViewPager.orientation = InfiniteCycleViewPager.VERTICAL
  1. Applying a custom page transformer:
infiniteCycleViewPager.setPageTransformer(false, MyCustomPageTransformer())
  1. Listening for page changes:
infiniteCycleViewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
    override fun onPageSelected(position: Int) {
        // Handle page selection
    }
    override fun onPageScrollStateChanged(state: Int) {}
})

Getting Started

  1. Add the JitPack repository to your project's build.gradle:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle:
dependencies {
    implementation 'com.github.devlight:InfiniteCycleViewPager:1.0.2'
}
  1. Add the InfiniteCycleViewPager to your layout XML:
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
    android:id="@+id/infinite_cycle_view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  1. Initialize and use the InfiniteCycleViewPager in your Activity or Fragment as shown in the code examples above.

Competitor Comparisons

Render After Effects animations natively on Android and iOS, Web, and React Native

Pros of lottie-android

  • Supports complex animations created in Adobe After Effects
  • Extensive documentation and community support
  • Seamless integration with design tools and workflows

Cons of lottie-android

  • Larger file size and potential performance impact for complex animations
  • Limited runtime manipulation of animations
  • Steeper learning curve for designers and developers

Code Comparison

InfiniteCycleViewPager:

InfiniteCycleViewPager infiniteCycleViewPager = findViewById(R.id.infinite_cycle_view_pager);
infiniteCycleViewPager.setAdapter(new MyPagerAdapter(this));
infiniteCycleViewPager.setScrollDuration(500);
infiniteCycleViewPager.setInterpolator(new AccelerateDecelerateInterpolator());

lottie-android:

LottieAnimationView animationView = findViewById(R.id.animation_view);
animationView.setAnimation(R.raw.animation);
animationView.setRepeatCount(LottieDrawable.INFINITE);
animationView.playAnimation();

While InfiniteCycleViewPager focuses on creating infinite scrolling view pagers with customizable transitions, lottie-android specializes in rendering complex vector animations. InfiniteCycleViewPager is more suitable for creating interactive UI components, whereas lottie-android excels in displaying high-quality animations with minimal code. The choice between the two depends on the specific requirements of your project, whether you need interactive scrolling or rich animations.

An easy, flexible way to add a shimmering effect to any view in an Android app.

Pros of shimmer-android

  • More focused and specialized library for creating shimmer effects
  • Backed by Facebook, potentially offering better support and documentation
  • Lightweight and easy to integrate into existing projects

Cons of shimmer-android

  • Limited to shimmer animations, less versatile than InfiniteCycleViewPager
  • Less active development and updates compared to InfiniteCycleViewPager
  • May require additional libraries or custom implementations for advanced features

Code Comparison

shimmer-android:

<com.facebook.shimmer.ShimmerFrameLayout
    android:id="@+id/shimmer_view_container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <!-- Add shimmer placeholder layout here -->
</com.facebook.shimmer.ShimmerFrameLayout>

InfiniteCycleViewPager:

<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
    android:id="@+id/hicvp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:icvp_interpolator="@android:anim/accelerate_decelerate_interpolator"
    app:icvp_scroll_duration="250"/>

The code comparison shows that shimmer-android focuses on creating shimmer effects within a specific layout, while InfiniteCycleViewPager provides a more complex view pager with infinite scrolling capabilities. The implementation and use cases for these libraries differ significantly, with shimmer-android being more suitable for loading animations and InfiniteCycleViewPager for creating interactive, scrollable content.

An Android Animation library which easily add itemanimator to RecyclerView items.

Pros of recyclerview-animators

  • Offers a wide variety of pre-built animations for RecyclerView items
  • Easy to implement and customize animations with minimal code
  • Supports both item animations and add/remove animations

Cons of recyclerview-animators

  • Limited to RecyclerView animations, while InfiniteCycleViewPager offers a complete ViewPager solution
  • May require additional performance optimization for complex animations in large lists
  • Doesn't provide infinite scrolling functionality out of the box

Code Comparison

recyclerview-animators:

val animator = SlideInLeftAnimator()
recyclerView.itemAnimator = animator

InfiniteCycleViewPager:

val infiniteCycleViewPager = InfiniteCycleViewPager.Builder(this)
    .setViewPager(viewPager)
    .setScrollDuration(500)
    .setOrientation(InfiniteCycleViewPager.HORIZONTAL)
    .build()

The code snippets demonstrate the simplicity of implementing animations with recyclerview-animators compared to the more comprehensive setup required for InfiniteCycleViewPager. While recyclerview-animators focuses on item animations, InfiniteCycleViewPager provides a full-featured ViewPager with infinite scrolling capabilities.

Android loading animations

Pros of Android-SpinKit

  • Offers a wide variety of loading animations (8 different styles with multiple variations)
  • Lightweight and easy to implement in Android projects
  • Supports both programmatic and XML-based implementation

Cons of Android-SpinKit

  • Limited to loading animations, whereas InfiniteCycleViewPager provides a more versatile view paging solution
  • Less customizable in terms of content and layout compared to InfiniteCycleViewPager
  • May require additional work to integrate with complex UI designs

Code Comparison

Android-SpinKit:

<com.github.ybq.android.spinkit.SpinKitView
    android:id="@+id/spin_kit"
    style="@style/SpinKitView.Large.Circle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" />

InfiniteCycleViewPager:

<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
    android:id="@+id/hicvp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:icvp_interpolator="@android:anim/accelerate_decelerate_interpolator"
    app:icvp_scroll_duration="250" />

Both libraries offer easy-to-use XML implementations, but they serve different purposes. Android-SpinKit focuses on loading animations, while InfiniteCycleViewPager provides a customizable infinite scrolling view pager.

8,512

Epoxy is an Android library for building complex screens in a RecyclerView

Pros of epoxy

  • More comprehensive and feature-rich library for building complex RecyclerView layouts
  • Supports data binding and view binding out of the box
  • Offers automatic diffing and efficient updates for better performance

Cons of epoxy

  • Steeper learning curve due to its extensive feature set
  • Requires more setup and configuration compared to simpler libraries
  • May be overkill for basic RecyclerView implementations

Code Comparison

InfiniteCycleViewPager:

InfiniteCycleViewPager infiniteCycleViewPager = findViewById(R.id.infinite_cycle_view_pager);
infiniteCycleViewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
infiniteCycleViewPager.setScrollDuration(500);
infiniteCycleViewPager.setInterpolator(new AccelerateDecelerateInterpolator());

epoxy:

class MyEpoxyController : EpoxyController() {
    override fun buildModels() {
        header {
            id("header")
            title("My Header")
        }
        for (item in items) {
            itemView {
                id(item.id)
                content(item.content)
            }
        }
    }
}

A Material Design ViewPager easy to use library

Pros of MaterialViewPager

  • Implements Material Design guidelines for ViewPager
  • Provides a header with parallax effect and tabs
  • Offers easy customization of colors and animations

Cons of MaterialViewPager

  • Less flexibility for custom layouts compared to InfiniteCycleViewPager
  • May have performance issues with large datasets
  • Limited to Material Design aesthetic, which may not fit all app styles

Code Comparison

MaterialViewPager:

mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
mViewPager.getViewPager().setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
    // Adapter implementation
});
mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {
    // Listener implementation
});

InfiniteCycleViewPager:

InfiniteCycleViewPager infiniteCycleViewPager = (InfiniteCycleViewPager) findViewById(R.id.icvp);
infiniteCycleViewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
infiniteCycleViewPager.setScrollDuration(500);
infiniteCycleViewPager.setInterpolator(new AccelerateDecelerateInterpolator());
infiniteCycleViewPager.setMediumScaled(true);

Both libraries offer easy integration with existing Android projects, but MaterialViewPager focuses on Material Design implementation, while InfiniteCycleViewPager provides more customization options for cycling through pages infinitely. The choice between the two depends on the specific design requirements and functionality needed in the application.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README


Devlight


InfiniteCycleViewPager

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

Android Arsenal       Android       Download       License       Codacy


 

U can check the sample app here.

Warn

This library is not more supported. 
If you want to add new feature or fix a bug, grab source code and do it. 
If you think your fix or feature would be useful to other developers, 
I can add link of your repository to this README file. 
Thank you for using our libraries.

Download

You can download a .aar from GitHub's releases page.

Or use Gradle:

compile 'com.github.devlight:infinitecycleviewpager:1.0.2'

Or Maven:

<dependency>
  <groupId>com.github.devlight</groupId>
  <artifactId>infinitecycleviewpager</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Or Ivy:

<dependency org='com.github.devlight' name='infinitecycleviewpager' rev='1.0.2'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

Android SDK Version

InfiniteCycleViewPager requires a minimum SDK version of 11.

Sample

Parameters

For InfiniteCycleViewPager you can set such parameters as:

  • min scale:
    allows you to set the minimum scale of left and right bottom pages.

  • max scale:
    allows you to set the maximum scale of center top page.

  • min scale offset:
    allows you to set offset from edge to minimum scaled pages.

  • center scale offset:
    allows you to set offset from center when two pages appears.

  • model selected icon:
    allows you to set selected icon when current model is active.

  • medium scaled:
    allows you to set is scaling would be min -> max or min -> medium -> max.

  • scroll duration:
    allows you to set snap scrolling duration.

  • scroll interpolator:
    allows you to set snap scrolling interpolator.

  • page transform listener:
    allows you to set page transform listener.

  • auto scroll:
    allows you to set auto scroll in positive and negative directions.

Tips

Two-way widget need a lot of memory.
Infinite scroll available when item count more then 2.
You can set vertical or horizontal infinite cycle ViewPager.

Init

Check out in code init:

//      final VerticalInfiniteCycleViewPager infiniteCycleViewPager =
//                (VerticalInfiniteCycleViewPager) view.findViewById(R.id.vicvp);
        final HorizontalInfiniteCycleViewPager infiniteCycleViewPager =
                (HorizontalInfiniteCycleViewPager) view.findViewById(R.id.hicvp);
        infiniteCycleViewPager.setAdapter(...);
        infiniteCycleViewPager.setScrollDuration(500);
        infiniteCycleViewPager.setInterpolator(...);
        infiniteCycleViewPager.setMediumScaled(true);
        infiniteCycleViewPager.setMaxPageScale(0.8F);
        infiniteCycleViewPager.setMinPageScale(0.5F);
        infiniteCycleViewPager.setCenterPageScaleOffset(30.0F);
        infiniteCycleViewPager.setMinPageScaleOffset(5.0F);
        infiniteCycleViewPager.setOnInfiniteCyclePageTransformListener(...);

If you want to get item position just call this method:

infiniteCycleViewPager.getRealItem();

To update your ViewPager after some adapter update or else, you can call this method:

infiniteCycleViewPager.notifyDataSetChanged();

If you want to start auto scroll or stop call this methods:

// true - positive
// false - negative
infiniteCycleViewPager.startAutoScroll(...);
infiniteCycleViewPager.stopAutoScroll();

Other methods check out in sample.

And XML init:


<!--<com.gigamole.infinitecycleviewpager.VerticalInfiniteCycleViewPager-->
<com.gigamole.infinitecycleviewpager.HorizontalInfiniteCycleViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:icvp_interpolator="..."
    app:icvp_center_page_scale_offset="30dp"
    app:icvp_max_page_scale="0.8"
    app:icvp_medium_scaled="true"
    app:icvp_min_page_scale="0.5"
    app:icvp_min_page_scale_offset="5dp"
    app:icvp_scroll_duration="500"/>

Getting Help

To report a specific problem or feature request, open a new issue on Github.

Xamarin

Thanks to Martijn van Dijk for developing Xamarin bindings library for InfiniteCycleViewPager.
Plugin is available on Nuget.

Credits

Yehor KosinovPrakhar Neel Sharma

Author

Created by Basil Miller - @gigamole

Company

Facebook     Twitter     LinkedIn

Here you can see open source work developed by Devlight LLC.
This and another works is an exclusive property of Devlight LLC.

If you want to use this library in applications which will be available on Google Play, please report us about it or author of the library.

Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.

You can contact us via info@devlight.io or opensource@devlight.io.
Thanks in advance.

Devlight LLC, 2016
devlight.io