{"id":13611664,"url":"https://github.com/sparrow007/CarouselRecyclerview","last_synced_at":"2025-04-13T05:33:14.535Z","repository":{"id":38891243,"uuid":"347477262","full_name":"sparrow007/CarouselRecyclerview","owner":"sparrow007","description":"Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.","archived":false,"fork":false,"pushed_at":"2023-01-12T11:05:37.000Z","size":16207,"stargazers_count":656,"open_issues_count":24,"forks_count":82,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-03T21:13:49.263Z","etag":null,"topics":["android","android-library","android-ui","carousel","carousel-layout","carousel-recyclerview","layout-manager","layoutmanager","recyclerview","reflection-imageview","xml-layout"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sparrow007.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":"2021-03-13T20:57:38.000Z","updated_at":"2025-03-31T08:19:25.000Z","dependencies_parsed_at":"2023-02-09T11:30:45.060Z","dependency_job_id":null,"html_url":"https://github.com/sparrow007/CarouselRecyclerview","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparrow007%2FCarouselRecyclerview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparrow007%2FCarouselRecyclerview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparrow007%2FCarouselRecyclerview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparrow007%2FCarouselRecyclerview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparrow007","download_url":"https://codeload.github.com/sparrow007/CarouselRecyclerview/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618223,"owners_count":21134199,"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":["android","android-library","android-ui","carousel","carousel-layout","carousel-recyclerview","layout-manager","layoutmanager","recyclerview","reflection-imageview","xml-layout"],"created_at":"2024-08-01T19:01:59.855Z","updated_at":"2025-04-13T05:33:14.528Z","avatar_url":"https://github.com/sparrow007.png","language":"Kotlin","readme":"\u003ch1 align=\"center\"\u003e  Carousel Recyclerview \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nCreate carousel effect in recyclerview with the CarouselRecyclerview in a simple way.\n\u003c/p\u003e\n\u003c/br\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/sparrow007/CarouselRecyclerview/actions\"\u003e\u003cimg alt=\"Build Status\"src=\"https://github.com/sparrow007/CarouselRecyclerview/workflows/Android%20CI/badge.svg\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"http://developer.android.com/index.html\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/platform-android-green.svg\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://android-arsenal.com/api?level=16\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/API-16%2B-brightgreen.svg\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://mailchi.mp/kotlinweekly/kotlin-weekly-242\"\u003e\u003cimg alt=\"AndroidWeekly\" src=\"https://skydoves.github.io/badges/kotlin-weekly.svg\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://androidweekly.net/issues/issue-468\"\u003e\u003cimage src=\"https://androidweekly.net/issues/issue-468/badge\"/\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\u003c/br\u003e\n\n![Layout manager](./preview/lm.jpg)\n\n\n## Including in your project\n\n[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.github.sparrow007/carouselrecyclerview/1.2.6)](https://search.maven.org/artifact/com.github.sparrow007/carouselrecyclerview/1.2.6/aar/)\n[![CarouselRecyclerview](https://jitpack.io/v/sparrow007/CarouselRecyclerview.svg)](https://jitpack.io/#sparrow007/CarouselRecyclerview)\n\n### Gradle \nAdd below codes to your **root** `build.gradle` file (not your module build.gradle file).\n```Gradle\nallprojects {\n    repositories {\n          mavenCentral()\n    }\n}\n```\nAnd add a dependency code to your **module**'s `build.gradle` file.\n```gradle\ndependencies {\n   implementation 'com.github.sparrow007:carouselrecyclerview:1.2.6'\n}\n```\n\n## Usage\n\n### Basic Example for Kotlin\nHere is a basic example of implementing carousel recyclerview in koltin files (activity or fragment) with attribute.\n\n```kotlin\n  binding.carouselRecyclerview.adapter = adapter\n  binding.carouselRecyclerview.apply {\n   set3DItem(true)\n   setAlpha(true)\n   setInfinite(true)\n  }\n```\n### Basic Example for XML\nHere is a basic example of implementing carousel recyclerview in layout xml.\n\n```xml\n\u003ccom.jackandphantom.carouselrecyclerview.CarouselRecyclerview\n     android:layout_width=\"match_parent\"\n     android:layout_height=\"wrap_content\"\n     android:id=\"@+id/carouselRecyclerview\"/\u003e\n```\n\nProperty infinite and 3D on Item enabled |Property infinite and alpha on Item enabled |\n| :---------------: | :---------------: |\n| \u003cimg src=\"./preview/3ditem.gif\" align=\"center\" width=\"70%\"/\u003e | \u003cimg src=\"./preview/alpha.gif\" align=\"center\" width=\"70%\"/\u003e |\n\n## API Methods\n\nMethod | Description | Default\n---|--- |---\n  fun set3DItem(is3DItem: Boolean) | Make the view tilt according to their position, middle position does not tilt. | false\n  fun setInfinite(isInfinite: Boolean) | Create the loop of the given view means there is no start or end, but provided position in the interface will be correct. | false\n  fun setFlat(isFlat: Boolean) | Make the flat layout in the layout manager of the reyclerview | false\n  fun setAlpha(isAlpha: Boolean) | Set the alpha for each item depends on the position in the layout manager | false\n  fun setIntervalRatio(ratio: Float) | Set the interval ratio which is gap between items (views) in layout manager | 0.5f (value of gap, it should in range (0.4f - 1f))\n  fun getCarouselLayoutManager(): CarouselLayoutManager | Get the carousel layout manager instance | \n  fun getSelectedPosition(): Int | Get selected position from the layout manager | center view Position\n  fun setIsScrollingEnabled(isScrollingEnabled: Boolean) | Set scrolling disabled or enabled | true\n  fun setOrientation(@Orientation orientation: Int) | Set layout orientation | RecyclerView.HORIZONTAL\n  \n  ## Vertical Orientation Preview\n  Property infinite and 3D on Item enabled |\n  | :---------------: |\n  | \u003cimg src=\"./preview/vertical_recyclerview.gif\" align=\"center\" width=\"70%\"/\u003e |\n\n  ## API Methods Usage\n  ```Kotlin\n  val carouselRecyclerview = findViewById\u003cCarouselRecyclerview\u003e(R.id.recycler)\n        carouselRecyclerview.adapter = adapter\n        carouselRecyclerview.set3DItem(true)\n        carouselRecyclerview.setInfinite(true)\n        carouselRecyclerview.setAlpha(true)\n        carouselRecyclerview.setFlat(true)\n        carouselRecyclerview.setIsScrollingEnabled(true)\n\n        val carouselLayoutManager = carouselRecyclerview.getCarouselLayoutManager()\n        val currentlyCenterPosition = carouselRecyclerview.getSelectedPosition()\n  \n  ```\n  ## Item Position Listener\n  You can listen to the position whenever the scroll happens you will get notified about the position, following are codes for listener\n\n  ```Kotlin\n   carouselRecyclerview.setItemSelectListener(object : OnSelected {\n            override fun onItemSelected(position: Int) {\n                //Cente item\n            }\n        })\n  \n  ```\n\n## Reflection ImageView\n\u003cimg src=\"./preview/reflectionImageVIew.jpg\" align=\"right\" width=\"22%\"/\u003e\nYou see in the demo that there is a mirror image (reflection imageview), for this i already created custom imageview for this.\n\n\nUse ReflectionImageView in xml layout and provide src\n\n```xml\n \u003ccom.jackandphantom.carouselrecyclerview.view.ReflectionImageView\n     android:layout_width=\"120dp\"\n     android:layout_height=\"120dp\"\n     android:scaleType=\"fitXY\"\n     android:src=\"@drawable/hacker\"\n    /\u003e\n```\n\n\u003cBr\u003e\n\n## Reflection Layout\n\n\u003cimg src= \"https://user-images.githubusercontent.com/7668602/114284225-14244980-9a6c-11eb-8e49-aa7b191a6d1d.png\" align=\"right\" width=\"22%\"/\u003e\n\nNow you can show reflection in more efficient way and 3x faster than ReflectionImageView see the codes below\n\n```XML\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003ccom.jackandphantom.carouselrecyclerview.view.ReflectionViewContainer\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    app:reflect_relativeDepth=\"0.5\"\n    app:reflect_gap=\"0dp\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    \u003e\n    \u003cImageView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:src=\"@drawable/guypro\"\n        android:scaleType=\"fitXY\"\n        android:id=\"@+id/image\" /\u003e\n\u003c/com.jackandphantom.carouselrecyclerview.view.ReflectionViewContainer\u003e\n\n```\n\u003cBr\u003e\n  \n### Notes about Reflection imageview\nI would recommend you to use image loading library like Glide for loading image in reflection image for better performance\n\u003cBR\u003e\n\n\n## Contribute 🤝\nIf you like the project and somehow wants to contribute, you are welcome to contribute by either submitting issues, refactor, pull request Thankyou.  \n  \n## Contributors ✨\n\nThanks go to these wonderful people :  \n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n  \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/snehilrx\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7668602?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSnehil\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#Contributor-Snehil\" title=\"Contributor\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/mattiasrosberg\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/261872?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMattias Rosberg\n\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#Contributor-Mattias\" title=\"Contributor\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n          \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/akashmi\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/11882168?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAKASH PATEL\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#Contributor-AKASH\" title=\"Contributor\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n     \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/nightwolf738\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/16029779?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNight Wolf\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#Contributor-egemenhamutcu\" title=\"Contributor\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003c/table\u003e  \n \n\n## Find this repository useful? ❤️\nSupport it by joining __[stargazers](https://github.com/sparrow007/CarouselRecyclerview/stargazers)__ for this repository. :star: \u003cbr\u003e\n And __[follow](https://github.com/sparrow007)__  me for next creation 🤩\n\n## License\n```xml\nCopyright 2021 Sparrow007 (Ankit kumar)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparrow007%2FCarouselRecyclerview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparrow007%2FCarouselRecyclerview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparrow007%2FCarouselRecyclerview/lists"}