-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{kt,kts}] | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 | ||
# ktlint configuration | ||
ktlint_code_style = android | ||
#ktlint_disabled_rules = | ||
ij_kotlin_allow_trailing_comma = true | ||
ij_kotlin_allow_trailing_comma_on_call_site = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Gradle Cache | ||
description: 'Setup Gradle cache' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/libs.versions.toml') }} | ||
restore-keys: ${{ runner.os }}-gradle |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Deploy Release | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
deploy: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/gradle-cache | ||
- name: Deploy release | ||
env: | ||
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
run: ./gradlew publishToSonatype closeSonatypeStagingRepository |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Verify Pull Request | ||
|
||
on: [ pull_request, workflow_dispatch ] | ||
|
||
jobs: | ||
check: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/gradle-cache | ||
- name: Check app | ||
run: ./gradlew check | ||
|
||
test: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/gradle-cache | ||
- name: Run tests | ||
run: ./gradlew test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
The MIT license (MIT) | ||
|
||
Copyright (c) 2022 Sven Jacobs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Reveal is a lightweight, simple reveal effect (also known as coach mark, onboarding, tutorial, etc.) | ||
with a beautiful API for [Jetpack Compose](https://developer.android.com/jetpack/compose). | ||
|
||
![Demonstration](./assets/demo.gif) | ||
|
||
## Terminology | ||
|
||
| Term | Description | | ||
|-------------|--------------------------------------------------------------------------------------------| | ||
| Revealable | An element which is revealed on the screen. | | ||
| Reveal area | The area which is revealed around the revealable. Usually with a slight padding. | | ||
| Overlay | The overlay which greys out all contents except revealable. Can contain explanatory items. | | ||
|
||
## Getting started | ||
|
||
### Installation | ||
|
||
Add Reveal as a dependency to your project. It's available on Maven Central. | ||
|
||
```kotlin | ||
dependencies { | ||
implementation("com.svenjacobs.reveal:reveal-core:$REVEAL_VERSION") | ||
} | ||
``` | ||
|
||
### Compose | ||
|
||
Since you probably want the reveal effect to cover the whole screen, the `Reveal` composable should | ||
be one of the top most composables in the hierarchy of your screen-level composable. | ||
|
||
```kotlin | ||
@Composable | ||
fun MainScreen( | ||
modifier: Modifier = Modifier, | ||
) { | ||
val revealState = rememberRevealState() | ||
|
||
Reveal( | ||
modifier = modifier.fillMaxSize(), | ||
revealState = revealState, | ||
onRevealableClick = {}, | ||
onOverlayClick = {}, | ||
) { | ||
// Contents | ||
} | ||
} | ||
``` | ||
|
||
Inside `Reveal` specify revealable items via the `revealable` modifier. | ||
|
||
```kotlin | ||
enum class Keys { HelloWorld } | ||
|
||
Column { | ||
Text( | ||
modifier = Modifier.revealable(key = Keys.HelloWorld), | ||
text = "Hello world", | ||
) | ||
} | ||
``` | ||
|
||
Now launch the reveal effect via `revealState.reveal(Keys.HelloWorld)`. | ||
|
||
Nice, you just launched your first reveal effect. But what is missing is some explanatory item like | ||
text or image next to the reveal area. So let's add one. | ||
|
||
Explanatory items are specified via `overlayContent` of the `Reveal` composable. | ||
|
||
```kotlin | ||
Reveal( | ||
overlayContent = { key -> | ||
when (key) { | ||
Keys.HelloWorld -> { | ||
Surface( | ||
modifier = Modifier | ||
.align(RevealOverlayAlignment.Start) | ||
.padding(8.dp), | ||
shape = RoundedCornerShape(4.dp), | ||
color = Color.White, | ||
) { | ||
Text("This is an explanation") | ||
} | ||
} | ||
} | ||
} | ||
) { | ||
// Contents | ||
} | ||
``` | ||
|
||
The scope of the overlay content composable provides the `align()` modifier to align the item either | ||
to the start, top, end or bottom of the reveal area. | ||
|
||
`Reveal` provides two click listeners: `onRevealableClick` is called when the reveal area is clicked | ||
with the key of the current revealable as the first argument. `onOverlayClick` is called when the | ||
overlay is clicked somewhere, also with the key argument. Use any of these click listeners to reveal | ||
the next item, for example for some kind of tutorial, or to hide the effect via | ||
`revealState.hide()`. | ||
|
||
That's it for now. For more details have a look at the [demo application](./demo-android) and the | ||
JavaDoc. The library is well documented 😉 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask | ||
|
||
plugins { | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.android.library) apply false | ||
alias(libs.plugins.jetbrains.kotlin.android) apply false | ||
alias(libs.plugins.nexus.publish) | ||
alias(libs.plugins.ben.manes.versions) | ||
alias(libs.plugins.kotlinter) | ||
} | ||
|
||
group = Publication.group | ||
version = Publication.version | ||
|
||
subprojects { | ||
apply(plugin = "org.jmailen.kotlinter") | ||
|
||
kotlinter { | ||
experimentalRules = true | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype() | ||
} | ||
} | ||
|
||
tasks.withType<DependencyUpdatesTask> { | ||
|
||
fun isNonStable(version: String) = | ||
listOf("alpha", "beta", "rc", "eap", "-m", ".m", "-a", "dev").any { | ||
version.toLowerCase().contains(it) | ||
} | ||
|
||
rejectVersionIf { | ||
isNonStable(candidate.version) && !isNonStable(currentVersion) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |