Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seo-4d696b75/compose-loop-pager
Sample of loop pager implementation in Android Jetpack Compose.
https://github.com/seo-4d696b75/compose-loop-pager
Last synced: about 1 month ago
JSON representation
Sample of loop pager implementation in Android Jetpack Compose.
- Host: GitHub
- URL: https://github.com/seo-4d696b75/compose-loop-pager
- Owner: Seo-4d696b75
- License: mit
- Created: 2024-03-29T06:51:31.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T16:42:03.000Z (3 months ago)
- Last Synced: 2024-11-07T17:39:28.760Z (3 months ago)
- Language: Kotlin
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# compose-loop-pager
Sample of loop pager implementation in Jetpack Compose.
## Motivation
Now [accompanist-pager](https://github.com/google/accompanist/tree/main/pager) is deprecated, then `androidx.compose.foundation.pager` should be used instead.
But conventional implementation of pseudo-infinite scrolling, such as setting `pageCount = { Int.MAX_VALUE }`, results in ANR as of 1.6.4 (BOM 2024.03.00).## Implementation
- `LazyLayout` for infinite scrolling
- `AnchoredDraggableState` for user-interaction and animation> [!NOTE]
> Jetpack Compose 1.7.5 (BOM 2024.10.01) is used.## Features
[HorizontalLoopPager](./app/src/main/java/com/seo4d696b75/android/loop_pager_sample/ui/pager/HorizontalLoopPager.kt)
- ✅ Infinite horizontal scrolling (not pseudo implementation!)
- ✅ Works properly without ANR
- ✅ Implemented without accompanist library
- ✅ Same user interaction and animation as `HorizontalPager`
- ✅ Supports content padding like `HorizontalPager`
- ✅ Page position is savable, so can be restored