From 0e49add1dc37b3e145a70dc43cb20ffaf67c6a9c Mon Sep 17 00:00:00 2001 From: Oleksandr Balan Date: Sun, 21 Aug 2022 10:44:09 +0200 Subject: [PATCH 1/2] Create README.md --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..25255e4 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# Page Curl + +Page Curl library for Jetpack Compose. + +## Motivation + +This library allows to create an effect of turning pages, which can be used in book reader applications, custom on-boarding screens or elsewhere. + +## Usage + +### Get a dependency + +**Step 1.** Add the JitPack repository to your build file. +Add it in your root build.gradle at the end of repositories: +``` +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } +} +``` + +**Step 2.** Add the dependency. +Check latest version on the [releases page](https://github.com/oleksandrbalan/pagecurl/releases). +``` +dependencies { + implementation 'com.github.oleksandrbalan:pagecurl:$version' +} +``` + +### Use in Composable + +The `PageCurl` has 2 mandatory arguments: +* **state** - The state of the PageCurl. Use it to programmatically change the current page or observe changes, and to configure shadow, back-page and interactions. +* **content** - The content lambda to provide the page composable. Receives the page number. + +``` +val pages = listOf("One", "Two", "Three") +val state = rememberPageCurlState(max = pages.size) +PageCurl(state = state) { index -> + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .background(MaterialTheme.colors.background) + .fillMaxSize() + ) { + Text( + text = pages[index], + style = MaterialTheme.typography.h1, + ) + } +} +``` + +See Demo application and [examples](demo/src/main/kotlin/eu/wewox/pagecurl/screens) for more usage examples. + +https://user-images.githubusercontent.com/20944869/185782671-2861c2ed-c033-4318-bf12-1d8db74fc8b5.mp4 + +https://user-images.githubusercontent.com/20944869/185782668-b52da2b9-be8d-49db-8729-88b6f9a8ee48.mp4 + +https://user-images.githubusercontent.com/20944869/185782663-4bd97a57-1a46-408d-a07b-34c193f01aba.mp4 From ae279778cbfd7ec6506af3e908a57dc4693f0077 Mon Sep 17 00:00:00 2001 From: Oleksandr Balan Date: Sun, 21 Aug 2022 10:46:48 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 25255e4..3ca1813 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![](https://jitpack.io/v/oleksandrbalan/pagecurl.svg)](https://jitpack.io/#oleksandrbalan/pagecurl) + # Page Curl Page Curl library for Jetpack Compose.