Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the Target and realize the use of the square view on the basis of the circle #404

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/screenshot3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 27 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<h1 align="center">
<img src="/.github/video.gif" width="280" height="498" alt="Video 1"/>
<img src="/.github/screenshot1.png" width="280" height="498" alt="Screenshot 1"/>
<img src="/.github/screenshot2.png" width="280" height="498" alt="Screenshot 2"/><br/>
<img src="/.github/screenshot2.png" width="280" height="615" alt="Screenshot 2"/>
<img src="/.github/screenshot3.jpg" width="280" height="615" alt="Screenshot 2"/><br/>

TapTargetView
</h1>
Expand All @@ -12,23 +13,15 @@

An implementation of tap targets from [Google's Material Design guidelines on feature discovery](https://material.io/archive/guidelines/growth-communications/feature-discovery.html).

**Min SDK:** 14
**Min SDK:** 21

[JavaDoc](https://javadoc.jitpack.io/com/github/KeepSafe/TapTargetView/latest/javadoc/)

## Installation

TapTargetView is distributed using [MavenCentral](https://search.maven.org/artifact/com.getkeepsafe.taptargetview/taptargetview).

```groovy
repositories {
mavenCentral()
}

dependencies {
implementation 'com.getkeepsafe.taptargetview:taptargetview:x.x.x'
}
```
## No Publish

If you wish, you may also use TapTargetView with [jitpack](https://jitpack.io/#KeepSafe/TapTargetView).
For snapshots, please follow the instructions [here](https://jitpack.io/#KeepSafe/TapTargetView/-SNAPSHOT).
Expand All @@ -37,33 +30,28 @@ For snapshots, please follow the instructions [here](https://jitpack.io/#KeepSaf

### Simple usage

```kotlin
Activity.showGuideView(
view.createTarget("Please Input Some Thing")
.outerCircleColor(R.color.colorAccent)
.targetIconColor(android.R.color.holo_blue_dark)
.transparentTarget(true)
.textColor(android.R.color.black)
.setTargetShapeType(TapTargetShapeType.RectAngle(16))
)
```

```java
TapTargetView.showFor(this, // `this` is an Activity
TapTarget.forView(findViewById(R.id.target), "This is a target", "We have the best targets, believe me")
// All options below are optional
.outerCircleColor(R.color.red) // Specify a color for the outer circle
.outerCircleAlpha(0.96f) // Specify the alpha amount for the outer circle
.targetCircleColor(R.color.white) // Specify a color for the target circle
.titleTextSize(20) // Specify the size (in sp) of the title text
.titleTextColor(R.color.white) // Specify the color of the title text
.descriptionTextSize(10) // Specify the size (in sp) of the description text
.descriptionTextColor(R.color.red) // Specify the color of the description text
.textColor(R.color.blue) // Specify a color for both the title and description text
.textTypeface(Typeface.SANS_SERIF) // Specify a typeface for the text
.dimColor(R.color.black) // If set, will dim behind the view with 30% opacity of the given color
.drawShadow(true) // Whether to draw a drop shadow or not
.cancelable(false) // Whether tapping outside the outer circle dismisses the view
.tintTarget(true) // Whether to tint the target view's color
.transparentTarget(false) // Specify whether the target is transparent (displays the content underneath)
.icon(Drawable) // Specify a custom drawable to draw as the target
.targetRadius(60), // Specify the target radius (in dp)
new TapTargetView.Listener() { // The listener can listen for regular clicks, long clicks or cancels
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view); // This call is optional
doSomething();
}
});
TargetViewExtensionsKTX.showGuideView(
Activity,
view.createTarget("Please Input Some Thing")
.outerCircleColor(R.color.colorAccent)
.targetIconColor(android.R.color.holo_blue_dark)
.transparentTarget(true)
.textColor(android.R.color.black)
.setTargetShapeType(TapTargetShapeType.RectAngle(16)),
null
);
```

You may also choose to target your own custom `Rect` with `TapTarget.forBounds(Rect, ...)`
Expand All @@ -76,9 +64,9 @@ Additionally, each color can be specified via a `@ColorRes` or a `@ColorInt`. Fu

You can easily create a sequence of tap targets with `TapTargetSequence`:

```java
```kotlin
new TapTargetSequence(this)
.targets(
.addTarget(
TapTarget.forView(findViewById(R.id.never), "Gonna"),
TapTarget.forView(findViewById(R.id.give), "You", "Up")
.dimColor(android.R.color.never)
Expand Down
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion defCompileSdkVersion
Expand All @@ -16,11 +17,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation project(':taptargetview')
implementation "androidx.appcompat:appcompat:$defAppCompatVersion"
implementation "com.google.android.material:material:$defMaterialVersion"
implementation 'com.facebook.stetho:stetho:1.5.0'
}
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".SampleApplication">
<activity android:name=".MainActivity">
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down

This file was deleted.

Loading