├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── jaydenxiao
│ │ └── highlightguideview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── jaydenxiao
│ │ │ └── highlightguideview
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable-xhdpi
│ │ ├── circle_button.png
│ │ ├── dmtext.png
│ │ ├── dstext.png
│ │ ├── listlead.png
│ │ └── qtext.png
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── jaydenxiao
│ └── highlightguideview
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── guider
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── jaydenxiao
│ │ └── guider
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── jaydenxiao
│ │ │ └── guider
│ │ │ ├── HighLightGuideView.java
│ │ │ ├── UiUtil.java
│ │ │ └── ViewUtils.java
│ └── res
│ │ ├── drawable-xhdpi
│ │ ├── hl_down_left.png
│ │ ├── hl_down_right.png
│ │ ├── hl_up_left.png
│ │ └── hl_up_right.png
│ │ └── values
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── jaydenxiao
│ └── guider
│ └── ExampleUnitTest.java
├── screenshots
└── device-2016-08-16-161213.gif
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | HighLightGuideView
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
25 |
26 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HighLightGuideView
2 | **项目介绍:** A library for app's new feature guiding,it supports the shape of round, oval and rectangular!
3 | (一个用于 app 新功能高亮引导的库,支持圆形、椭圆形、矩形高亮形状)
4 |
5 | 
6 |
7 | **支持配置属性:**
8 | (1)外部点击是否关闭setTouchOutsideDismiss
9 | (2)控件高亮形状类型,有圆形、椭圆形、矩形setHighLightStyle
10 | (3)高亮画笔类型,有平滑和一般,默认平滑setMaskblurstyle
11 | (4)蒙层颜色setMaskColor
12 | (5)高亮控件padding,setHighLisghtPadding
13 |
14 | **使用方法:**
15 |
16 | dependencies {
17 |
18 | compile 'com.jaydenxiao:guider:1.0.0'
19 | }
20 |
21 | **1. 全屏提示,没高亮控件情况引导**
22 |
23 | HighLightGuideView.builder(this)
24 | .addNoHighLightGuidView(R.drawable.listlead)
25 | .setMaskColor(getResources().getColor(R.color.mask_color))
26 | .show();
27 |
28 | **2. 有高亮控件情况引导(单个高亮控件)**
29 |
30 | HighLightGuideView.builder(this)
31 | .addHighLightGuidView(view, R.drawable.dmtext)
32 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_OVAL)
33 | .show();
34 |
35 | **3. 有高亮控件情况引导(多个高亮控件)**
36 |
37 | HighLightGuideView.builder(this)
38 | .addHighLightGuidView(view1, R.drawable.dstext)
39 | .addHighLightGuidView(view2, R.drawable.dmtext)
40 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_OVAL)
41 | .show();
42 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "24.0.0 rc4"
6 |
7 | defaultConfig {
8 | applicationId "com.jaydenxiao.highlightguideview"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | testCompile 'junit:junit:4.12'
25 | compile project(':guider')
26 | compile 'com.android.support:appcompat-v7:23.4.0'
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in H:\android-22\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/jaydenxiao/highlightguideview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.highlightguideview;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/jaydenxiao/highlightguideview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.highlightguideview;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.view.Window;
7 | import android.widget.Button;
8 |
9 | import com.jaydenxiao.guider.HighLightGuideView;
10 |
11 |
12 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
13 |
14 | private Button bt_top_left;
15 | private Button bt_top_right;
16 | private Button bt_middle;
17 | private Button bt_bottom_left;
18 | private Button bt_bottom_right;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | getWindow().requestFeature(Window.FEATURE_NO_TITLE);
24 | setContentView(R.layout.activity_main);
25 | bindViews();
26 | }
27 |
28 | private void bindViews() {
29 | bt_top_left = (Button) findViewById(R.id.bt_top_left);
30 | bt_top_left.setOnClickListener(this);
31 | bt_top_right = (Button) findViewById(R.id.bt_top_right);
32 | bt_top_right.setOnClickListener(this);
33 | bt_middle = (Button) findViewById(R.id.bt_middle);
34 | bt_middle.setOnClickListener(this);
35 | bt_bottom_left = (Button) findViewById(R.id.bt_bottom_left);
36 | bt_bottom_left.setOnClickListener(this);
37 | bt_bottom_right = (Button) findViewById(R.id.bt_bottom_right);
38 | bt_bottom_right.setOnClickListener(this);
39 | HighLightGuideView.builder(this)
40 | .addNoHighLightGuidView(R.drawable.listlead)
41 | .setMaskColor(getResources().getColor(R.color.mask_color))
42 | .show();
43 | }
44 |
45 | @Override
46 | public void onClick(View view) {
47 | switch (view.getId()) {
48 | case R.id.bt_top_left:
49 | HighLightGuideView.builder(this)
50 | .addHighLightGuidView(bt_top_left, R.drawable.dmtext)
51 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_OVAL)
52 | .show();
53 | break;
54 | case R.id.bt_top_right:
55 | HighLightGuideView.builder(this)
56 | .addHighLightGuidView(bt_top_right, R.drawable.dstext)
57 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_RECT)
58 | .show();
59 | break;
60 | case R.id.bt_middle:
61 | HighLightGuideView.builder(this)
62 | .addHighLightGuidView(bt_middle, R.drawable.dmtext)
63 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_CIRCLE)
64 | .show();
65 | break;
66 | case R.id.bt_bottom_left:
67 | HighLightGuideView.builder(this)
68 | .addHighLightGuidView(bt_bottom_left, R.drawable.dstext)
69 | .addHighLightGuidView(bt_top_right, R.drawable.dmtext)
70 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_RECT)
71 | .show();
72 | break;
73 | case R.id.bt_bottom_right:
74 | HighLightGuideView.builder(this)
75 | .addHighLightGuidView(bt_bottom_right, R.drawable.dstext)
76 | .addHighLightGuidView(bt_top_left, R.drawable.dmtext)
77 | .setHighLightStyle(HighLightGuideView.VIEWSTYLE_OVAL)
78 | .show();
79 | break;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/circle_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/drawable-xhdpi/circle_button.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/dmtext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/drawable-xhdpi/dmtext.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/dstext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/drawable-xhdpi/dstext.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/listlead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/drawable-xhdpi/listlead.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/qtext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/drawable-xhdpi/qtext.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
19 |
27 |
28 |
36 |
37 |
38 |
44 |
45 |
53 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #f09030
4 | #f09030
5 | #FF4081
6 | #ffffff
7 | #f09030
8 | #99e5eaee
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 30dp
4 | 30dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | HighLightGuideView-master
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/jaydenxiao/highlightguideview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.highlightguideview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0'
9 | // NOTE: Do not place your application dependencies here; they belong
10 | // in the individual module build.gradle files
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | jcenter()
17 | }
18 | }
19 |
20 | task clean(type: Delete) {
21 | delete rootProject.buildDir
22 | }
23 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/guider/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/guider/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext{
4 | PUBLISH_GROUP_ID = 'com.jaydenxiao'
5 | PUBLISH_ARTIFACT_ID = 'guider'
6 | PUBLISH_VERSION = '1.0.0'
7 | }
8 | android {
9 | compileSdkVersion 23
10 | buildToolsVersion "24.0.0 rc4"
11 |
12 | defaultConfig {
13 | minSdkVersion 15
14 | targetSdkVersion 23
15 | versionCode 1
16 | versionName "1.0.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | testCompile 'junit:junit:4.12'
29 | compile 'com.android.support:appcompat-v7:23.4.0'
30 | }
31 | apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
32 |
--------------------------------------------------------------------------------
/guider/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in H:\android-22\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/guider/src/androidTest/java/com/jaydenxiao/guider/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.guider;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/guider/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/guider/src/main/java/com/jaydenxiao/guider/HighLightGuideView.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.guider;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.graphics.BlurMaskFilter;
8 | import android.graphics.Canvas;
9 | import android.graphics.Paint;
10 | import android.graphics.PorterDuff;
11 | import android.graphics.PorterDuffXfermode;
12 | import android.graphics.Rect;
13 | import android.graphics.RectF;
14 | import android.support.v4.content.ContextCompat;
15 | import android.util.Log;
16 | import android.view.MotionEvent;
17 | import android.view.View;
18 | import android.view.ViewGroup;
19 | import android.view.Window;
20 |
21 | import java.util.ArrayList;
22 |
23 |
24 | /**
25 | * * des:“应用新功能”的用户指引view
26 | * Created by jaydenxiao
27 | * on 2016.08.11:59
28 | */
29 | public class HighLightGuideView extends View {
30 | //高亮类型:矩形、圆形、椭圆形
31 | public static final int VIEWSTYLE_RECT = 0;
32 | public static final int VIEWSTYLE_CIRCLE = 1;
33 | public static final int VIEWSTYLE_OVAL = 2;
34 | //画笔类型,圆滑、默认
35 | public static final int MASKBLURSTYLE_SOLID = 0;
36 | public static final int MASKBLURSTYLE_NORMAL = 1;
37 |
38 | private View rootView;//activity的contentview,是FrameLayout
39 | private Bitmap jtUpLeft, jtUpRight, jtDownRight, jtDownLeft;// 指示箭头
40 | private Bitmap fgBitmap;// 前景
41 | private Canvas mCanvas;// 绘制蒙版层的画布
42 | private Paint mPaint;// 绘制蒙版层画笔
43 | private int screenW, screenH;// 屏幕宽高
44 | private static final int margin = 40;
45 | private int radius;//圆半径
46 | private OnDismissListener onDismissListener;//关闭监听
47 | private Activity activity;
48 |
49 | /*******************可配置属性*****************************/
50 | private boolean touchOutsideCancel = true;//外部点击是否可关闭
51 | private int highLightStyle = VIEWSTYLE_RECT;//高亮类型默认圆形
52 | public int maskblurstyle = MASKBLURSTYLE_SOLID;//画笔类型默认
53 | private ArrayList tipBitmaps;//显示图片
54 | private ArrayList targetViews;//高亮目标view
55 | private int maskColor = 0x99000000;// 蒙版层颜色
56 | private int borderWitdh = 10;
57 | private int highLisghtPadding = 0;// 高亮控件padding
58 |
59 |
60 | private HighLightGuideView(Activity activity) {
61 | super(activity);
62 | this.activity=activity;
63 | // 计算参数
64 | cal(activity);
65 | // 初始化对象
66 | init(activity);
67 | }
68 |
69 | public static HighLightGuideView builder(Activity activity) {
70 | return new HighLightGuideView(activity);
71 | }
72 |
73 | /**
74 | * 计算参数
75 | *
76 | * @param context 上下文环境引用
77 | */
78 | private void cal(Context context) {
79 | // 获取屏幕尺寸数组
80 | int[] screenSize = UiUtil.getScreenSize((Activity) context);
81 | // 获取屏幕宽高
82 | screenW = screenSize[0];
83 | screenH = screenSize[1];
84 | }
85 |
86 | /**
87 | * 初始化对象
88 | */
89 | private void init(Context context) {
90 | tipBitmaps = new ArrayList<>();
91 | targetViews = new ArrayList<>();
92 | rootView = ((Activity) getContext()).findViewById(android.R.id.content);
93 | // 实例化画笔并开启其抗锯齿和抗抖动
94 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
95 | // 设置画笔透明度为0是关键!
96 | mPaint.setARGB(0, 255, 0, 0);
97 | // 设置混合模式为DST_IN
98 | mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
99 | BlurMaskFilter.Blur blurStyle = null;
100 | switch (maskblurstyle) {
101 | case MASKBLURSTYLE_SOLID:
102 | blurStyle = BlurMaskFilter.Blur.SOLID;
103 | break;
104 | case MASKBLURSTYLE_NORMAL:
105 | blurStyle = BlurMaskFilter.Blur.NORMAL;
106 | break;
107 | }
108 | mPaint.setMaskFilter(new BlurMaskFilter(15, blurStyle));
109 | // 生成前景图Bitmap
110 | fgBitmap = Bitmap.createBitmap(screenW, screenH, Bitmap.Config.ARGB_4444);
111 | // 将其注入画布
112 | mCanvas = new Canvas(fgBitmap);
113 | // 绘制前景画布颜色
114 | mCanvas.drawColor(maskColor);
115 | // 实例化箭头图片
116 | jtDownRight = BitmapFactory.decodeResource(getResources(), R.drawable.hl_down_right);
117 | jtDownLeft = BitmapFactory.decodeResource(getResources(), R.drawable.hl_down_left);
118 | jtUpLeft = BitmapFactory.decodeResource(getResources(), R.drawable.hl_up_left);
119 | jtUpRight = BitmapFactory.decodeResource(getResources(), R.drawable.hl_up_right);
120 | }
121 |
122 | @Override
123 | protected void onDraw(Canvas canvas) {
124 | if (targetViews == null && tipBitmaps == null)
125 | return;
126 | // 绘制前景
127 | canvas.drawBitmap(fgBitmap, 0, 0, null);
128 | //有高亮控件
129 | if (targetViews.size() > 0 && tipBitmaps.size() > 0) {
130 | for (int i = 0; i < targetViews.size(); i++) {
131 | //高亮控件宽高
132 | int vWidth = targetViews.get(i).getWidth();
133 | int vHeight = targetViews.get(i).getHeight();
134 | //获取获取高亮控件坐标
135 | int left = 0;
136 | int top = 0;
137 | int right = 0;
138 | int bottom = 0;
139 | try {
140 | Rect rtLocation =ViewUtils.getLocationInView(((ViewGroup)activity.findViewById(Window.ID_ANDROID_CONTENT)).getChildAt(0),targetViews.get(i));
141 | left = rtLocation.left;
142 | top = rtLocation.top;
143 | right = rtLocation.right;
144 | bottom = rtLocation.bottom;
145 | Log.d("statusheightssleft",left+"");
146 | Log.d("statusheightsstop",top+"");
147 | Log.d("statusheightbottom",right+"");
148 | Log.d("statusheightsbottom",bottom+"");
149 | } catch (Exception e) {
150 | e.printStackTrace();
151 | }
152 | //绘制高亮形状
153 | switch (highLightStyle) {
154 | case VIEWSTYLE_OVAL:
155 | RectF rectf = new RectF(left-highLisghtPadding, top-highLisghtPadding, right+highLisghtPadding, bottom+highLisghtPadding);
156 | mCanvas.drawOval(rectf, mPaint);
157 | break;
158 | case VIEWSTYLE_RECT:
159 | RectF rect = new RectF(left - borderWitdh-highLisghtPadding, top - borderWitdh-highLisghtPadding, right + borderWitdh+highLisghtPadding, bottom + borderWitdh+highLisghtPadding);
160 | mCanvas.drawRoundRect(rect, 20, 20, mPaint);
161 | break;
162 | case VIEWSTYLE_CIRCLE:
163 | default:
164 | radius = vWidth > vHeight ? vWidth / 2 +highLisghtPadding/2: vHeight / 2+ highLisghtPadding/2;
165 | if (radius < 50) {
166 | radius = 100;
167 | }
168 | mCanvas.drawCircle(left + vWidth / 2, top + vHeight / 2, radius, mPaint);
169 | break;
170 |
171 | }
172 | //绘制箭头和提示图
173 | if (bottom < screenH / 2 || (screenH / 2 - top > bottom - screenH / 2)) {// 偏上
174 | int jtTop = highLightStyle == VIEWSTYLE_CIRCLE ? bottom +highLisghtPadding + margin+radius/3 : bottom +highLisghtPadding+ margin;
175 | if (right < screenW / 2 || (screenW / 2 - left > right - screenW / 2)) {//偏左
176 | canvas.drawBitmap(jtUpLeft, left + vWidth / 2, jtTop, null);
177 | if (tipBitmaps.get(i) != null) {
178 | canvas.drawBitmap(tipBitmaps.get(i), left + vWidth / 2, jtTop + jtUpLeft.getHeight(), null);
179 | }
180 | } else {
181 | canvas.drawBitmap(jtUpRight, left + vWidth / 2 - 100 - margin, jtTop, null);
182 | if (tipBitmaps.get(i) != null) {
183 | canvas.drawBitmap(tipBitmaps.get(i), left + vWidth / 2 - 100 - tipBitmaps.get(i).getWidth() / 2, jtTop + jtUpRight.getHeight(), null);
184 | }
185 | }
186 | } else {
187 | int jtTop = highLightStyle == VIEWSTYLE_CIRCLE ? top - jtDownLeft.getHeight()-radius/3 -highLisghtPadding- margin : top - jtDownLeft.getHeight() - margin-highLisghtPadding;
188 | if (right < screenW / 2 || (screenW / 2 - left > right - screenW / 2)) {
189 | canvas.drawBitmap(jtDownLeft, left + vWidth / 2, jtTop, null);
190 | if (tipBitmaps.get(i) != null) {
191 | canvas.drawBitmap(tipBitmaps.get(i), left + vWidth / 2, jtTop - tipBitmaps.get(i).getHeight(), null);
192 | }
193 | } else {
194 | canvas.drawBitmap(jtDownRight, left + vWidth / 2 - 100 - margin, jtTop, null);
195 | if (tipBitmaps.get(i) != null) {
196 | canvas.drawBitmap(tipBitmaps.get(i), left + vWidth / 2 - 100 - tipBitmaps.get(i).getWidth() / 2 - margin, jtTop - tipBitmaps.get(i).getHeight(), null);
197 | }
198 | }
199 | }
200 | }
201 | }
202 | //无高亮控件,只是显示提示图片(仅能提示一张)
203 | else if (tipBitmaps.size() > 0) {
204 | canvas.drawBitmap(tipBitmaps.get(0), (screenW - tipBitmaps.get(0).getWidth()) / 2, (screenH - tipBitmaps.get(0).getHeight()) / 2, null);
205 | }
206 | }
207 |
208 | @Override
209 | public boolean onTouchEvent(MotionEvent event) {
210 | switch (event.getAction()) {
211 | case MotionEvent.ACTION_UP://
212 | if (touchOutsideCancel) {
213 | this.setVisibility(View.GONE);
214 | //移除view
215 | if (rootView != null) {
216 | ((ViewGroup) rootView).removeView(this);
217 | }
218 | //返回监听
219 | if (this.onDismissListener != null) {
220 | onDismissListener.onDismiss();
221 | }
222 | return true;
223 | }
224 | break;
225 | }
226 | return true;
227 | }
228 |
229 | public interface OnDismissListener {
230 | public void onDismiss();
231 | }
232 |
233 | /********************builder模式设置属性******************************/
234 |
235 | /**
236 | * 绘制前景画布颜色
237 | *
238 | * @param bgColor
239 | */
240 | public HighLightGuideView setMaskColor(int bgColor) {
241 | try {
242 | this.maskColor = ContextCompat.getColor(getContext(),bgColor);
243 | // 重新绘制前景画布
244 | mCanvas.drawColor(maskColor);
245 | } catch (Exception e) {
246 | e.printStackTrace();
247 | }
248 | return this;
249 | }
250 |
251 | /**
252 | * 设置高亮显示类型
253 | *
254 | * @param style
255 | */
256 | public HighLightGuideView setHighLightStyle(int style) {
257 | this.highLightStyle = style;
258 | return this;
259 | }
260 |
261 | /**
262 | * 设置高亮画笔类型
263 | *
264 | * @param maskblurstyle
265 | */
266 | public HighLightGuideView setMaskblurstyle(int maskblurstyle) {
267 | this.maskblurstyle = maskblurstyle;
268 | return this;
269 | }
270 |
271 | /**
272 | * 设置需要高亮的View和提示的图片
273 | *
274 | * @param targetView
275 | * @param res
276 | */
277 | public HighLightGuideView addHighLightGuidView(View targetView, int res) {
278 | try {
279 | targetViews.add(targetView);
280 | tipBitmaps.add(BitmapFactory.decodeResource(getResources(), res));
281 | } catch (Exception e) {
282 | e.printStackTrace();
283 | }
284 | return this;
285 | }
286 |
287 | /**
288 | * 设置不需要高亮的View,只是提示图片
289 | *
290 | * @param res
291 | */
292 | public HighLightGuideView addNoHighLightGuidView(int res) {
293 | try {
294 | tipBitmaps.add(BitmapFactory.decodeResource(getResources(), res));
295 | } catch (Exception e) {
296 | e.printStackTrace();
297 | }
298 | return this;
299 | }
300 |
301 | /**
302 | * 设置外部是否关闭,默认关闭
303 | *
304 | * @param cancel
305 | */
306 | public HighLightGuideView setTouchOutsideDismiss(boolean cancel) {
307 | this.touchOutsideCancel = cancel;
308 | return this;
309 | }
310 |
311 | /**
312 | * 设置额外的边框宽度
313 | *
314 | * @param borderWidth
315 | */
316 | public HighLightGuideView setBorderWidth(int borderWidth) {
317 | this.borderWitdh = borderWidth;
318 | return this;
319 | }
320 |
321 | /**
322 | * 设置状态栏高度 默认是减去了一个状态栏高度 如果主题设置android:windowTranslucentStatus=true
323 | * 需要设置状态栏高度为0
324 | *
325 | * @param highLisghtPadding
326 | */
327 | public HighLightGuideView setHighLisghtPadding(int highLisghtPadding) {
328 | this.highLisghtPadding = highLisghtPadding;
329 | return this;
330 | }
331 |
332 | /**
333 | * 设置关闭监听
334 | *
335 | * @param listener
336 | */
337 | public HighLightGuideView setOnDismissListener(OnDismissListener listener) {
338 | this.onDismissListener = listener;
339 | return this;
340 | }
341 |
342 | /**
343 | * 清空画布
344 | */
345 | public HighLightGuideView clearBg() {
346 | if (mCanvas != null) {
347 | Paint paint = new Paint();
348 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
349 | mCanvas.drawPaint(paint);
350 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
351 | }
352 | // 将其注入画布
353 | mCanvas = new Canvas(fgBitmap);
354 | // 绘制前景画布
355 | mCanvas.drawColor(maskColor);
356 | return this;
357 | }
358 |
359 | /**
360 | * 显示
361 | */
362 | public void show() {
363 | if (rootView != null) {
364 | ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams
365 | (ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
366 | ((ViewGroup) rootView).addView(this, ((ViewGroup) rootView).getChildCount(), lp);
367 | }
368 | }
369 |
370 | }
371 |
--------------------------------------------------------------------------------
/guider/src/main/java/com/jaydenxiao/guider/UiUtil.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.guider;
2 |
3 |
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.util.DisplayMetrics;
7 |
8 | /**
9 | * * des:测量工具类
10 | * Created by jaydenxiao
11 | * on 2016.08.11:59
12 | */
13 | public final class UiUtil {
14 |
15 | /**
16 | * 获取屏幕尺寸
17 | *
18 | * @param activity
19 | * Activity
20 | * @return 屏幕尺寸像素值,下标为0的值为宽,下标为1的值为高
21 | */
22 | public static int[] getScreenSize(Activity activity) {
23 | DisplayMetrics metrics = new DisplayMetrics();
24 | activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
25 | return new int[] { metrics.widthPixels, metrics.heightPixels };
26 | }
27 |
28 | /**
29 | * 获取状态栏高度
30 | * @param context
31 | * @return
32 | */
33 | public static int getStatusBarHeight(Context context) {
34 | int result = 0;
35 | int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
36 | if (resId > 0) {
37 | result = context.getResources().getDimensionPixelOffset(resId);
38 | }
39 | return result;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/guider/src/main/java/com/jaydenxiao/guider/ViewUtils.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.guider;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.graphics.Rect;
6 | import android.view.View;
7 |
8 | /**
9 | * * des:测量位置
10 | * Created by jaydenxiao
11 | * on 2016.08.11:59
12 | */
13 | public class ViewUtils {
14 | private static final String FRAGMENT_CON = "NoSaveStateFrameLayout";
15 |
16 | public static Rect getLocationInView(View parent, View child) {
17 | if (child == null || parent == null) {
18 | throw new IllegalArgumentException("parent and child can not be null .");
19 | }
20 | View decorView = null;
21 | Context context = child.getContext();
22 | if (context instanceof Activity) {
23 | decorView = ((Activity) context).getWindow().getDecorView();
24 | }
25 | Rect result = new Rect();
26 | Rect tmpRect = new Rect();
27 |
28 | View tmp = child;
29 |
30 | if (child == parent) {
31 | child.getHitRect(result);
32 | return result;
33 | }
34 | while (tmp != decorView && tmp != parent) {
35 | //找到控件占据的矩形区域的矩形坐标
36 | tmp.getHitRect(tmpRect);
37 | if (!tmp.getClass().equals(FRAGMENT_CON)) {
38 | result.left += tmpRect.left;
39 | result.top += tmpRect.top;
40 | }
41 | tmp = (View) tmp.getParent();
42 | }
43 | result.right = result.left + child.getMeasuredWidth();
44 | result.bottom = result.top + child.getMeasuredHeight();
45 | return result;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/guider/src/main/res/drawable-xhdpi/hl_down_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/guider/src/main/res/drawable-xhdpi/hl_down_left.png
--------------------------------------------------------------------------------
/guider/src/main/res/drawable-xhdpi/hl_down_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/guider/src/main/res/drawable-xhdpi/hl_down_right.png
--------------------------------------------------------------------------------
/guider/src/main/res/drawable-xhdpi/hl_up_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/guider/src/main/res/drawable-xhdpi/hl_up_left.png
--------------------------------------------------------------------------------
/guider/src/main/res/drawable-xhdpi/hl_up_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/guider/src/main/res/drawable-xhdpi/hl_up_right.png
--------------------------------------------------------------------------------
/guider/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #f09030
4 | #f09030
5 | #FF4081
6 | #ffffff
7 | #f09030
8 | #99e5eaee
9 |
10 |
--------------------------------------------------------------------------------
/guider/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Library
3 |
4 |
--------------------------------------------------------------------------------
/guider/src/test/java/com/jaydenxiao/guider/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.jaydenxiao.guider;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/screenshots/device-2016-08-16-161213.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaydenxiao2016/HighLightGuideView/679e53f4193f11b4b528ebd066e815cb7d473300/screenshots/device-2016-08-16-161213.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':guider'
2 |
--------------------------------------------------------------------------------