-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from PierfrancescoSoffritti/dev
Version 0.0.1
- Loading branch information
Showing
54 changed files
with
2,141 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.iml | ||
.gradle | ||
/buildSrc/build/* | ||
/buildSrc/.gradle/* | ||
local.properties | ||
.idea/* | ||
!.idea/copyright | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
ktlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,101 @@ | ||
# TapTargetCompose | ||
A compose implementation of Material Design tap targets, for feature discovery. | ||
# tap-target-compose | ||
tap-target-compose is a Jetpack Compose implementation of the [Material Design tap targets](https://m1.material.io/growth-communications/feature-discovery.html#feature-discovery-design), used for feature discovery. | ||
|
||
This library was inspired by its View counterpart, [TapTargetView](https://github.com/KeepSafe/TapTargetView). | ||
|
||
<img src="/.github/tap-target-image.gif" width="280" alt="screenshot"/> | ||
|
||
# Sample app | ||
This library comes with a sample app that shows examples of how to use it. | ||
|
||
* [Click here to see the source code of the sample app](./sample-app/). | ||
|
||
:eyes: If you want to know when a new release of the library is published: [watch this repository on GitHub](https://github.com/PierfrancescoSoffritti/tap-target-compose/watchers). | ||
|
||
# Download | ||
The Gradle dependency is available via [MavenCentral](https://repo1.maven.org/maven2/com/pierfrancescosoffritti/). | ||
|
||
The minimum API level supported by this library is API 13. | ||
|
||
Add this to your module level `build.gradle` file to start using the library. | ||
|
||
```gradle | ||
dependencies { | ||
implementation "com.pierfrancescosoffritti.taptargetcompose:core:0.0.1" | ||
} | ||
``` | ||
|
||
# Quick start | ||
In order to start using the library you need to wrap your composables in a TapTargetScaffold | ||
|
||
```kotlin | ||
TapTargetScaffold(showTapTargets = true, onComplete = {}) { | ||
Surface { | ||
Button( | ||
onClick = { }, | ||
modifier = Modifier.tapTarget( | ||
precedence = 0, | ||
title = TextDefinition( | ||
text = "Tap target title", | ||
textStyle = MaterialTheme.typography.titleLarge, | ||
fontWeight = FontWeight.Bold, | ||
color = MaterialTheme.colorScheme.onSecondaryContainer | ||
), | ||
description = TextDefinition( | ||
text = "Tap target description", | ||
textStyle = MaterialTheme.typography.bodyMedium, | ||
color = MaterialTheme.colorScheme.onSecondaryContainer | ||
), | ||
tapTargetStyle = TapTargetStyle( | ||
backgroundColor = MaterialTheme.colorScheme.secondaryContainer, | ||
tapTargetHighlightColor = MaterialTheme.colorScheme.onSecondaryContainer, | ||
backgroundAlpha = 1f, | ||
), | ||
), | ||
) { | ||
Text(text = "Click here") | ||
} | ||
} | ||
} | ||
``` | ||
|
||
You can also create a `TapTargetDefinition` and pass it to the modifier: | ||
|
||
```kotlin | ||
val tapTargetDefinition = TapTargetDefinition( | ||
precedence = 1, | ||
title = TextDefinition( | ||
text = "Tap target title", | ||
textStyle = MaterialTheme.typography.titleLarge, | ||
fontWeight = FontWeight.Bold, | ||
color = MaterialTheme.colorScheme.onSecondaryContainer | ||
), | ||
description = TextDefinition( | ||
text = "Tap target description", | ||
textStyle = MaterialTheme.typography.bodyMedium, | ||
color = MaterialTheme.colorScheme.onSecondaryContainer | ||
), | ||
tapTargetStyle = TapTargetStyle( | ||
backgroundColor = MaterialTheme.colorScheme.secondaryContainer, | ||
tapTargetHighlightColor = MaterialTheme.colorScheme.onSecondaryContainer, | ||
backgroundAlpha = 1f, | ||
), | ||
) | ||
|
||
TapTargetScaffold(showTapTargets = true, onComplete = {}) { | ||
Surface { | ||
Button( | ||
onClick = { }, | ||
modifier = Modifier.tapTarget(tapTargetDefinition), | ||
) { | ||
Text(text = "Click here") | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The library supports chaining of multiple tap targets, but you can also show only one if that's what you need. | ||
|
||
--- | ||
|
||
For any question feel free to [open an issue on the GitHub repository](https://github.com/PierfrancescoSoffritti/tap-target-compose/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.jetbrains.kotlin.android) apply false | ||
alias(libs.plugins.android.library) apply false | ||
alias(libs.plugins.gradleNexus.publish) | ||
alias(libs.plugins.jetbrains.dokka) | ||
} | ||
|
||
apply(from = "./scripts/publish-root.gradle") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
14 changes: 14 additions & 0 deletions
14
buildSrc/src/main/java/com/psoffritti/taptargetcompose/Configuration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.psoffritti.taptargetcompose | ||
|
||
object Configuration { | ||
const val compileSdk = 34 | ||
const val targetSdk = 34 | ||
const val minSdk = 13 | ||
const val minSdkSampleApp = 21 | ||
private const val majorVersion = 0 | ||
private const val minorVersion = 0 | ||
private const val patchVersion = 1 | ||
const val versionCode = 1 | ||
const val versionName = "$majorVersion.$minorVersion.$patchVersion" | ||
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Project-wide Gradle settings. | ||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 | ||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
# AndroidX package structure to make it clearer which packages are bundled with the | ||
# Android operating system, and which are packaged with your app's APK | ||
# https://developer.android.com/topic/libraries/support-library/androidx-rn | ||
android.useAndroidX=true | ||
# Kotlin code style for this project: "official" or "obsolete": | ||
kotlin.code.style=official | ||
# Enables namespacing of each library's R class so that its R class includes only the | ||
# resources declared in the library itself and none from the library's dependencies, | ||
# thereby reducing the size of the R class for that library | ||
android.nonTransitiveRClass=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[versions] | ||
compose-compiler = "1.5.4" | ||
compose-bom = "2023.10.01" | ||
activity-compose = "1.8.1" | ||
core-ktx = "1.12.0" | ||
appcompat = "1.6.1" | ||
material = "1.10.0" | ||
|
||
androidGradlePlugin = "8.2.0" | ||
androidLibrary = "8.2.0" | ||
kotlinAndroid = "1.9.20" | ||
|
||
gradleNexus = "1.3.0" | ||
dokka = "1.8.10" | ||
|
||
[libraries] | ||
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" } | ||
androidx-compose-material3 = { module = "androidx.compose.material3:material3" } | ||
androidx-compose-material-icons = { module = "androidx.compose.material:material-icons-extended" } | ||
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } | ||
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } | ||
androidx-compose-animation = { module = "androidx.compose.animation:animation" } | ||
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" } | ||
|
||
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" } | ||
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" } | ||
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } | ||
material = { module = "com.google.android.material:material", version.ref = "material" } | ||
|
||
[plugins] | ||
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } | ||
android-library = { id = "com.android.library", version.ref = "androidLibrary" } | ||
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinAndroid" } | ||
gradleNexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradleNexus" } | ||
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Fri Dec 08 17:09:33 GMT 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.