{"id":13641698,"url":"https://github.com/antonyt/InfiniteViewPager","last_synced_at":"2025-04-20T11:31:49.821Z","repository":{"id":2694808,"uuid":"3688003","full_name":"antonyt/InfiniteViewPager","owner":"antonyt","description":"Augment Android's ViewPager with wrap-around functionality.","archived":false,"fork":false,"pushed_at":"2018-04-11T11:09:23.000Z","size":132,"stargazers_count":693,"open_issues_count":31,"forks_count":194,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-08-03T01:24:28.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mongodb/mongo","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonyt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-11T16:44:58.000Z","updated_at":"2024-04-02T17:44:05.000Z","dependencies_parsed_at":"2022-09-04T07:51:23.765Z","dependency_job_id":null,"html_url":"https://github.com/antonyt/InfiniteViewPager","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyt%2FInfiniteViewPager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyt%2FInfiniteViewPager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyt%2FInfiniteViewPager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyt%2FInfiniteViewPager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonyt","download_url":"https://codeload.github.com/antonyt/InfiniteViewPager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223827564,"owners_count":17209805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:23.225Z","updated_at":"2024-11-09T12:30:50.855Z","avatar_url":"https://github.com/antonyt.png","language":"Java","readme":"Infinite View Pager\n===============\n\nAugment Android's ViewPager with wrap-around functionality. Original StackOverflow question: http://stackoverflow.com/questions/7546224/viewpager-as-a-circular-queue-wrapping\n\n## Problem\nWith a normal ViewPager, you can only scroll from the first page to second page (and so forth), from left-to-right. Once you reach the last page, your only option is to scroll backwards, right-to-left. In other words, 'wrap-around scrolling' (going from first-to-last, and last-to-first) is not possible.\n\n## Solution\nUse the `InfiniteViewPager` in your Activity/Fragment layout:\n\t\n``` xml\n\u003ccom.antonyt.infiniteviewpager.InfiniteViewPager\n\tandroid:id=\"@+id/pager\"\n\tandroid:layout_width=\"fill_parent\"\n\tandroid:layout_height=\"fill_parent\" /\u003e\n```\n\nWrap your existing `PagerAdapter` with the `InfinitePagerAdapter`:\n\n``` java\nPagerAdapter wrappedAdapter = new InfinitePagerAdapter(adapter);\nviewPager.setAdapter(wrappedAdapter);\n```\n\n\n### Gradle build\n\nTo install the demo application to your device run the following task:\n\n```\n$ ./gradlew installDebug\n```\n\nTo deploy the library to your local Maven repository run the following task:\n\n```\n$ ./gradlew install\n```\n\nThen, to use the library in your project add the following to your `build.gradle`:\n\n```groovy\ndependencies {\n    compile 'com.antonyt.infiniteviewpager:library:1.0.0'\n}\n```\n\nWrapped scrolling should now be possible with your `ViewPager`. The pages you see are not duplicates - each page from your `PagerAdapter` is only created once and then reused. This means you do not have to worry about managing multiple instances of the same `Fragment`.\n\n## Caveats\nIt is only possible to achieve wrapping when you have at least 4 pages. This is because of the way the `ViewPager` creates, destroys, and displays the pages. No fix for the general case has been found.","funding_links":[],"categories":["ViewPager","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyt%2FInfiniteViewPager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonyt%2FInfiniteViewPager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyt%2FInfiniteViewPager/lists"}