Coder Social home page Coder Social logo

infiniteviewpager's Introduction

THIS REPOSITORY IS DEPRACATED AND WILL BE READ-ONLY!

Google released the ViewPager2 and replaces the original ViewPager. Since this project is based on the old ViewPager, this repository is now read-only. If you want to have in "infinite" implementation of ViewPager2, you can check out Infinite-ViewPager2.

Thank you everyone for using this library.

InfiniteViewPager

InfiniteViewPager is a modified ViewPager that allows infinite paging.

Usage

Bind it in your layout:

<com.thehayro.view.InfiniteViewPager 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

Setup the adapter:

public class MyInfinitePagerAdapter<T> extends InfinitePagerAdapter {  // ...
}

And initialize with any init value:

MyInfinitePagerAdapter<Integer> adapter = 
                    new MyInfinitePagerAdapter<Integer>(0);

Bind the adapter to the InfiniteViewPager with:

// ...
InfiniteViewPager pager = (InfiniteViewPager) findViewById(R.id...);
pager.setAdapter(adapter);

Also see website for further details.

Changelog

  • 0.4.1 fix #1 (thanks to RogerParis)
  • 0.4 added OnInfinitePageChangeListener
  • 0.3 fixed some errors
  • 0.2 Added custom 'setCurrentItem()'
  • 0.1 initial release

License

Apache Licence

infiniteviewpager's People

Contributors

hayribakici avatar rogerparis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infiniteviewpager's Issues

Issues with adding your library to my android project's build.gradle

I tried to add your library with the follow line I found on mavenreposetory

which gives me the following gradle error when I build:

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.google.android:support-v4:r13.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.pom
         https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.jar
         https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.pom
         https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.jar
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
         file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
     Required by:           
         xkcdexplain:app:unspecified
         xkcdexplain:app:unspecified > com.thehayro:infiniteviewpager:0.4

The support library the error is referring to is ancient and is nowhere to be found on the internet.

Any idea how I can fix this?

First time page autochange

Hello,

First of all thanks for your library, works great and helped me create a Calendar :)

I have to say I noticed that first time you run it, you are in page 0, then if you scroll a little bit (right or left it doesn't matter), not enough to be in another page, the instance of the page -1 will be anyway created and the page 0 will now be the page -1. This bug continues till you open correctly a page like scrolling completely.

I hope you understand where is the problem. But I actually don't know if you will consider this a problem anyway haha.

Keep up with the good job!

Roger.

Allow user to specify an end page

It would be very helpful to allow users of the lib to be able to specify if a particular page is the last page in that direction.

My use case is I want to have infinite paging to the right, but not be able to go back to the left beyond a certain point.

I may actually take a crack at adding this my self, any tips on where to look in code to implement something like this?

Could not find com.google.android:support-v4:r13

Using maven returns...

Could not find com.google.android:support-v4:r13.
           Required by:
           DMSKiosk:app:unspecified > com.thehayro:infiniteviewpager:0.4

It appears that the Android SDK repo has changed to com.android.support:support-v4:13.0.0

How to auto scroll it with animation?

FYI . With method viewPagerInstance.setCurrentIndicator(index) , it scrolls with no animation. Can anyone help me how to achieve it ? Thanks a lot !

call setCurrentIndicator NullPointer Exception

Hi, I've implemented your nice lib, and during the implementation I've found that if you call pager.setCurrentIndicator(int) just after you create the pager, It throws nullpointer exception in the reset() call in InfinitePagerAdapter class, so I've modified the Adapter class with this code:

void reset() {
    for (PageModel<T> pageModel : mPageModels) {
       if (pageModel!=null) pageModel.removeAllChildren();
    }
}

Maybe it helps others...
thanks!

InfiniteViewPager setCurrentItem not display fragment content

After swipe the infiniteviewpager fragments number of times,For navigate on particulate fragment programatically we call the setCurrentItem , It show the fragment with blank, sometime come the fragment with out layout when we try to touch the fragment it show the content of current fragment.

Allow user to set current item

Let the user explicitly set the current item by providing an Indicator:

adapter.setCurrentIndicator(indicator)

There is already a package private method with this signature but it's not accessible publicly and it looks to require some added implementation. I changed it to the following and everything is working for me:

/**
  * Sets {@code indicator} as the current visible indicator.
  * @param indicator a indicator value.
  */
public void setCurrentIndicator(final T indicator) {
  mCurrentIndicator = indicator;
  fillPage(PAGE_POSITION_CENTER);
  fillPage(PAGE_POSITION_LEFT);
  fillPage(PAGE_POSITION_RIGHT);
  notifyDataSetChanged();
}

Allow support of Fragments

There has been some request to allow Fragment support. It should be possible with this infiniteViewPager configuration (the viewPager always switching to the middle page).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.