diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a1e84f2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+/.idea
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..36e12a8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,38 @@
+# GuideView
+新手引导视图,初次打开页面时显示。
+
+
+*使用图片
+
+
+ ImageView iv = new ImageView(this);
+ iv.setImageResource(R.drawable.img_new_task_guide);
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ iv.setLayoutParams(params);
+
+![image](https://github.com/laxian/GuideView/blob/develop/app/snapshot1.jpeg)
+
+*使用文字
+
+ TextView iv = new TextView(this);
+ iv.setText("欢迎使用");
+ iv.setTextColor(getResources().getColor(R.color.white));
+
+![image](https://github.com/laxian/GuideView/blob/develop/app/snapshot2.jpeg)
+
+*显示GuideView
+
+ GuideView.Builder
+ .newInstance(this) // 必须调用
+ .setTargetView(view) // 必须调用,设置需要Guide的View
+ .setCustomTipsView(iv) // 必须调用,设置GuideView,可以使任意View的实例,比如ImageView 或者TextView
+ .setDirction(GuideView.Direction.LEFT_BOTTOM) // 设置GuideView 相对于TargetView的位置,有八种,不设置则默认在屏幕左上角
+ .setBackGround(getResources().getColor(R.color.shadow)) // 设置背景颜色,默认透明
+ .setOnclickExit(null) // 设置点击消失,可以传入一个Callback,执行被点击后的操作
+ .setRadius(32) // 设置圆形透明区域半径,默认是targetView的显示矩形的半径
+ .setCenter(300, 300) // 设置圆心,默认是targetView的中心
+ .setOffset(200, 60) // 设置偏移,一般用于微调GuideView的位置
+ .showOnce() // 设置首次显示,设置后,显示一次后,不再显示
+ .build() // 必须调用,Buider模式,返回GuideView实例
+ .show(); // 必须调用,显示GuideView
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..f9b6768
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion '23.0.2'
+ defaultConfig {
+ applicationId "com.laxian.guideview"
+ minSdkVersion 16
+ targetSdkVersion 19
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ productFlavors {
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.+'
+ compile 'com.android.support:design:23.+'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..58bef5c
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/snapshot1.jpeg b/app/snapshot1.jpeg
new file mode 100644
index 0000000..a39f616
Binary files /dev/null and b/app/snapshot1.jpeg differ
diff --git a/app/snapshot2.jpeg b/app/snapshot2.jpeg
new file mode 100644
index 0000000..43de35e
Binary files /dev/null and b/app/snapshot2.jpeg differ
diff --git a/app/src/androidTest/java/com/laxian/guideview/ApplicationTest.java b/app/src/androidTest/java/com/laxian/guideview/ApplicationTest.java
new file mode 100644
index 0000000..fcfcde3
--- /dev/null
+++ b/app/src/androidTest/java/com/laxian/guideview/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.laxian.guideview;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..0fb71dc
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/laxian/guideview/GuideView.java b/app/src/main/java/com/laxian/guideview/GuideView.java
new file mode 100644
index 0000000..f50a686
--- /dev/null
+++ b/app/src/main/java/com/laxian/guideview/GuideView.java
@@ -0,0 +1,554 @@
+package com.laxian.guideview;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.RectF;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.FrameLayout;
+import android.widget.RelativeLayout;
+
+import java.util.List;
+
+/**
+ * Created by zhouweixian on 2016/1/23.
+ */
+public class GuideView extends RelativeLayout implements ViewTreeObserver.OnGlobalLayoutListener {
+ private final String TAG = getClass().getSimpleName();
+ private Context mContent;
+ private List mViews;
+ private boolean first = true;
+ /**
+ * targetView前缀。SHOW_GUIDE_PREFIX + targetView.getId()作为保存在SP文件的key。
+ */
+ private static final String SHOW_GUIDE_PREFIX = "show_guide_on_view_";
+ /**
+ * GuideView 偏移量
+ */
+ private int offsetX, offsetY;
+ /**
+ * targetView 的外切圆半径
+ */
+ private int radius;
+ /**
+ * 需要显示提示信息的View
+ */
+ private View targetView;
+ /**
+ * 自定义View
+ */
+ private View customGuideView;
+ /**
+ * 透明圆形画笔
+ */
+ private Paint mCirclePaint;
+ /**
+ * 背景色画笔
+ */
+ private Paint mBackgroundPaint;
+ /**
+ * targetView是否已测量
+ */
+ private boolean isMeasured;
+ /**
+ * targetView圆心
+ */
+ private int[] center;
+ /**
+ * 绘图层叠模式
+ */
+ private PorterDuffXfermode porterDuffXfermode;
+ /**
+ * 绘制前景bitmap
+ */
+ private Bitmap bitmap;
+ /**
+ * 背景色和透明度,格式 #aarrggbb
+ */
+ private int backgroundColor;
+ /**
+ * Canvas,绘制bitmap
+ */
+ private Canvas temp;
+ /**
+ * 相对于targetView的位置.在target的那个方向
+ */
+ private Direction direction;
+
+ /**
+ * 形状
+ */
+ private MyShape myShape;
+ /**
+ * targetView左上角坐标
+ */
+ private int[] location;
+ private boolean onClickExit;
+ private OnClickCallback onclickListener;
+ private RelativeLayout guideViewLayout;
+
+ public void restoreState() {
+ Log.v(TAG, "restoreState");
+ offsetX = offsetY = 0;
+ radius = 0;
+ mCirclePaint = null;
+ mBackgroundPaint = null;
+ isMeasured = false;
+ center = null;
+ porterDuffXfermode = null;
+ bitmap = null;
+ needDraw = true;
+ // backgroundColor = Color.parseColor("#00000000");
+ temp = null;
+ // direction = null;
+
+ }
+
+ public int[] getLocation() {
+ return location;
+ }
+
+ public void setLocation(int[] location) {
+ this.location = location;
+ }
+
+ public GuideView(Context context) {
+ super(context);
+ this.mContent = context;
+ init();
+ }
+
+ public int getRadius() {
+ return radius;
+ }
+
+ public void setRadius(int radius) {
+ this.radius = radius;
+ }
+
+ public void setOffsetX(int offsetX) {
+ this.offsetX = offsetX;
+ }
+
+ public void setOffsetY(int offsetY) {
+ this.offsetY = offsetY;
+ }
+
+ public void setDirection(Direction direction) {
+ this.direction = direction;
+ }
+
+ public void setShape(MyShape shape) {
+ this.myShape = shape;
+ }
+
+ public void setCustomGuideView(View customGuideView) {
+ this.customGuideView = customGuideView;
+ if (!first) {
+ restoreState();
+ }
+ }
+
+ public void setBgColor(int background_color) {
+ this.backgroundColor = background_color;
+ }
+
+ public View getTargetView() {
+ return targetView;
+ }
+
+ public void setTargetView(View targetView) {
+ this.targetView = targetView;
+ // restoreState();
+ if (!first) {
+ // guideViewLayout.removeAllViews();
+ }
+ }
+
+ private void init() {
+ }
+
+ public void showOnce() {
+ if (targetView != null) {
+ mContent.getSharedPreferences(TAG, Context.MODE_PRIVATE).edit().putBoolean(generateUniqId(targetView), true).commit();
+ }
+ }
+
+ private boolean hasShown() {
+ if (targetView == null)
+ return true;
+ return mContent.getSharedPreferences(TAG, Context.MODE_PRIVATE).getBoolean(generateUniqId(targetView), false);
+ }
+
+ private String generateUniqId(View v) {
+ return SHOW_GUIDE_PREFIX + v.getId();
+ }
+
+ public int[] getCenter() {
+ return center;
+ }
+
+ public void setCenter(int[] center) {
+ this.center = center;
+ }
+
+ public void hide() {
+ Log.v(TAG, "hide");
+ if (customGuideView != null) {
+ targetView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ this.removeAllViews();
+ ((FrameLayout) ((Activity) mContent).getWindow().getDecorView()).removeView(this);
+ restoreState();
+ }
+ }
+
+ public void show() {
+ Log.v(TAG, "show");
+ if (hasShown())
+ return;
+
+ if (targetView != null) {
+ targetView.getViewTreeObserver().addOnGlobalLayoutListener(this);
+ }
+
+ this.setBackgroundResource(R.color.transparent);
+
+ ((FrameLayout) ((Activity) mContent).getWindow().getDecorView()).addView(this);
+ first = false;
+ }
+
+ /**
+ * 添加提示文字,位置在targetView的下边
+ * 在屏幕窗口,添加蒙层,蒙层绘制总背景和透明圆形,圆形下边绘制说明文字
+ */
+ private void createGuideView() {
+ Log.v(TAG, "createGuideView");
+
+ // 添加到蒙层
+ // if (guideViewLayout == null) {
+ // guideViewLayout = new RelativeLayout(mContent);
+ // }
+
+ // Tips布局参数
+ LayoutParams guideViewParams;
+ guideViewParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ guideViewParams.setMargins(0, center[1] + radius + 10, 0, 0);
+
+ if (customGuideView != null) {
+
+ // LayoutParams guideViewParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ if (direction != null) {
+ int width = this.getWidth();
+ int height = this.getHeight();
+
+ int left = center[0] - radius;
+ int right = center[0] + radius;
+ int top = center[1] - radius;
+ int bottom = center[1] + radius;
+ switch (direction) {
+ case TOP:
+ this.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
+ guideViewParams.setMargins(offsetX, offsetY - height + top, -offsetX, height - top - offsetY);
+ break;
+ case LEFT:
+ this.setGravity(Gravity.RIGHT);
+ guideViewParams.setMargins(offsetX - width + left, top + offsetY, width - left - offsetX, -top - offsetY);
+ break;
+ case BOTTOM:
+ this.setGravity(Gravity.CENTER_HORIZONTAL);
+ guideViewParams.setMargins(offsetX, bottom + offsetY, -offsetX, -bottom - offsetY);
+ break;
+ case RIGHT:
+ guideViewParams.setMargins(right + offsetX, top + offsetY, -right - offsetX, -top - offsetY);
+ break;
+ case LEFT_TOP:
+ this.setGravity(Gravity.RIGHT | Gravity.BOTTOM);
+ guideViewParams.setMargins(offsetX - width + left, offsetY - height + top, width - left - offsetX, height - top - offsetY);
+ break;
+ case LEFT_BOTTOM:
+ this.setGravity(Gravity.RIGHT);
+ guideViewParams.setMargins(offsetX - width + left, bottom + offsetY, width - left - offsetX, -bottom - offsetY);
+ break;
+ case RIGHT_TOP:
+ this.setGravity(Gravity.BOTTOM);
+ guideViewParams.setMargins(right + offsetX, offsetY - height + top, -right - offsetX, height - top - offsetY);
+ break;
+ case RIGHT_BOTTOM:
+ guideViewParams.setMargins(right + offsetX, bottom + offsetY, -right - offsetX, -top - offsetY);
+ break;
+ }
+ } else {
+ guideViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ guideViewParams.setMargins(offsetX, offsetY, -offsetX, -offsetY);
+ }
+
+ // guideViewLayout.addView(customGuideView);
+
+ this.addView(customGuideView, guideViewParams);
+ }
+ }
+
+ /**
+ * 获得targetView 的宽高,如果未测量,返回{-1, -1}
+ *
+ * @return
+ */
+ private int[] getTargetViewSize() {
+ int[] location = {-1, -1};
+ if (isMeasured) {
+ location[0] = targetView.getWidth();
+ location[1] = targetView.getHeight();
+ }
+ return location;
+ }
+
+ /**
+ * 获得targetView 的半径
+ *
+ * @return
+ */
+ private int getTargetViewRadius() {
+ if (isMeasured) {
+ int[] size = getTargetViewSize();
+ int x = size[0];
+ int y = size[1];
+
+ return (int) (Math.sqrt(x * x + y * y) / 2);
+ }
+ return -1;
+ }
+
+ boolean needDraw = true;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ Log.v(TAG, "onDraw");
+
+ if (!isMeasured)
+ return;
+
+ if (targetView == null)
+ return;
+
+ // if (!needDraw) return;
+
+ drawBackground(canvas);
+
+ }
+
+ private void drawBackground(Canvas canvas) {
+ Log.v(TAG, "drawBackground");
+ needDraw = false;
+ // 先绘制bitmap,再将bitmap绘制到屏幕
+ bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
+ temp = new Canvas(bitmap);
+
+ // 背景画笔
+ Paint bgPaint = new Paint();
+ if (backgroundColor != 0)
+ bgPaint.setColor(backgroundColor);
+ else
+ bgPaint.setColor(getResources().getColor(R.color.shadow));
+
+ // 绘制屏幕背景
+ temp.drawRect(0, 0, temp.getWidth(), temp.getHeight(), bgPaint);
+
+ // targetView 的透明圆形画笔
+ if (mCirclePaint == null)
+ mCirclePaint = new Paint();
+ porterDuffXfermode = new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT);// 或者CLEAR
+ mCirclePaint.setXfermode(porterDuffXfermode);
+ mCirclePaint.setAntiAlias(true);
+
+ if (myShape != null) {
+ RectF oval = new RectF();
+ switch (myShape) {
+ case CIRCULAR://圆形
+ temp.drawCircle(center[0], center[1], radius, mCirclePaint);//绘制圆形
+ break;
+ case ELLIPSE://椭圆
+ //RectF对象
+ oval.left = center[0] - 150; //左边
+ oval.top = center[1] - 50; //上边
+ oval.right = center[0] + 150; //右边
+ oval.bottom = center[1] + 50; //下边
+ temp.drawOval(oval, mCirclePaint); //绘制椭圆
+ break;
+ case RECTANGULAR://圆角矩形
+ //RectF对象
+ oval.left = center[0] - 150; //左边
+ oval.top = center[1] - 50; //上边
+ oval.right = center[0] + 150; //右边
+ oval.bottom = center[1] + 50; //下边
+ temp.drawRoundRect(oval, radius, radius, mCirclePaint); //绘制圆角矩形
+ break;
+ }
+ } else {
+ temp.drawCircle(center[0], center[1], radius, mCirclePaint);//绘制圆形
+ }
+
+ // 绘制到屏幕
+ canvas.drawBitmap(bitmap, 0, 0, bgPaint);
+ bitmap.recycle();
+ }
+
+ public void setOnClickExit(boolean onClickExit) {
+ this.onClickExit = onClickExit;
+ }
+
+ public void setOnclickListener(OnClickCallback onclickListener) {
+ this.onclickListener = onclickListener;
+ }
+
+ private void setClickInfo() {
+ final boolean exit = onClickExit;
+ setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (onclickListener != null) {
+ onclickListener.onClickedGuideView();
+ }
+ if (exit) {
+ hide();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onGlobalLayout() {
+ if (isMeasured)
+ return;
+ if (targetView.getHeight() > 0 && targetView.getWidth() > 0) {
+ isMeasured = true;
+ }
+
+ // 获取targetView的中心坐标
+ if (center == null) {
+ // 获取右上角坐标
+ location = new int[2];
+ targetView.getLocationInWindow(location);
+ center = new int[2];
+ // 获取中心坐标
+ center[0] = location[0] + targetView.getWidth() / 2;
+ center[1] = location[1] + targetView.getHeight() / 2;
+ }
+ // 获取targetView外切圆半径
+ if (radius == 0) {
+ radius = getTargetViewRadius();
+ }
+ // 添加GuideView
+ createGuideView();
+ }
+
+ /**
+ * 定义GuideView相对于targetView的方位,共八种。不设置则默认在targetView下方
+ */
+ enum Direction {
+ LEFT, TOP, RIGHT, BOTTOM,
+ LEFT_TOP, LEFT_BOTTOM,
+ RIGHT_TOP, RIGHT_BOTTOM
+ }
+
+ /**
+ * 定义目标控件的形状,共3种。圆形,椭圆,带圆角的矩形(可以设置圆角大小),不设置则默认是圆形
+ */
+ enum MyShape {
+ CIRCULAR, ELLIPSE, RECTANGULAR
+ }
+
+ /**
+ * GuideView点击Callback
+ */
+ interface OnClickCallback {
+ void onClickedGuideView();
+ }
+
+ public static class Builder {
+ static GuideView guiderView;
+ static Builder instance = new Builder();
+ Context mContext;
+
+ private Builder() {
+ }
+
+ public Builder(Context ctx) {
+ mContext = ctx;
+ }
+
+ public static Builder newInstance(Context ctx) {
+ guiderView = new GuideView(ctx);
+ return instance;
+ }
+
+ public Builder setTargetView(View target) {
+ guiderView.setTargetView(target);
+ return instance;
+ }
+
+ public Builder setBgColor(int color) {
+ guiderView.setBgColor(color);
+ return instance;
+ }
+
+ public Builder setDirction(Direction dir) {
+ guiderView.setDirection(dir);
+ return instance;
+ }
+
+ public Builder setShape(MyShape shape) {
+ guiderView.setShape(shape);
+ return instance;
+ }
+
+ public Builder setOffset(int x, int y) {
+ guiderView.setOffsetX(x);
+ guiderView.setOffsetY(y);
+ return instance;
+ }
+
+ public Builder setRadius(int radius) {
+ guiderView.setRadius(radius);
+ return instance;
+ }
+
+ public Builder setCustomGuideView(View view) {
+ guiderView.setCustomGuideView(view);
+ return instance;
+ }
+
+ public Builder setCenter(int X, int Y) {
+ guiderView.setCenter(new int[]{X, Y});
+ return instance;
+ }
+
+ public Builder showOnce() {
+ guiderView.showOnce();
+ return instance;
+ }
+
+ public GuideView build() {
+ guiderView.setClickInfo();
+ return guiderView;
+ }
+
+ public Builder setOnclickExit(boolean onclickExit) {
+ guiderView.setOnClickExit(onclickExit);
+ return instance;
+ }
+
+ public Builder setOnclickListener(final OnClickCallback callback) {
+ guiderView.setOnclickListener(callback);
+ return instance;
+ }
+ }
+}
diff --git a/app/src/main/java/com/laxian/guideview/MainActivity.java b/app/src/main/java/com/laxian/guideview/MainActivity.java
new file mode 100644
index 0000000..0d4e3da
--- /dev/null
+++ b/app/src/main/java/com/laxian/guideview/MainActivity.java
@@ -0,0 +1,114 @@
+package com.laxian.guideview;
+
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.Gravity;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+public class MainActivity extends AppCompatActivity {
+
+ private ImageButton menu;
+ private Button btnTest;
+ private Button btnTest2;
+ private GuideView guideView;
+ private GuideView guideView3;
+ private GuideView guideView2;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ menu = (ImageButton) findViewById(R.id.ib_menu);
+ btnTest = (Button) findViewById(R.id.btn_test);
+ btnTest2 = (Button) findViewById(R.id.btn_test2);
+
+ }
+
+ private void setGuideView() {
+
+ // 使用图片
+ final ImageView iv = new ImageView(this);
+ iv.setImageResource(R.drawable.img_new_task_guide);
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ iv.setLayoutParams(params);
+
+ // 使用文字
+ TextView tv = new TextView(this);
+ tv.setText("欢迎使用");
+ tv.setTextColor(getResources().getColor(R.color.white));
+ tv.setTextSize(30);
+ tv.setGravity(Gravity.CENTER);
+
+ // 使用文字
+ final TextView tv2 = new TextView(this);
+ tv2.setText("欢迎使用2");
+ tv2.setTextColor(getResources().getColor(R.color.white));
+ tv2.setTextSize(30);
+ tv2.setGravity(Gravity.CENTER);
+
+
+ guideView = GuideView.Builder
+ .newInstance(this)
+ .setTargetView(menu)//设置目标
+ .setCustomGuideView(iv)
+ .setDirction(GuideView.Direction.LEFT_BOTTOM)
+ .setShape(GuideView.MyShape.CIRCULAR) // 设置圆形显示区域,
+ .setBgColor(getResources().getColor(R.color.shadow))
+ .setOnclickListener(new GuideView.OnClickCallback() {
+ @Override
+ public void onClickedGuideView() {
+ guideView.hide();
+ guideView2.show();
+ }
+ })
+ .build();
+
+
+ guideView2 = GuideView.Builder
+ .newInstance(this)
+ .setTargetView(btnTest)
+ .setCustomGuideView(tv)
+ .setDirction(GuideView.Direction.LEFT_BOTTOM)
+ .setShape(GuideView.MyShape.ELLIPSE) // 设置椭圆形显示区域,
+ .setBgColor(getResources().getColor(R.color.shadow))
+ .setOnclickListener(new GuideView.OnClickCallback() {
+ @Override
+ public void onClickedGuideView() {
+ guideView2.hide();
+ guideView3.show();
+ }
+ })
+ .build();
+
+
+ guideView3 = GuideView.Builder
+ .newInstance(this)
+ .setTargetView(btnTest2)
+ .setCustomGuideView(tv2)
+ .setDirction(GuideView.Direction.LEFT_BOTTOM)
+ .setShape(GuideView.MyShape.RECTANGULAR) // 设置矩形显示区域,
+ .setRadius(80) // 设置圆形或矩形透明区域半径,默认是targetView的显示矩形的半径,如果是矩形,这里是设置矩形圆角大小
+ .setBgColor(getResources().getColor(R.color.shadow))
+ .setOnclickListener(new GuideView.OnClickCallback() {
+ @Override
+ public void onClickedGuideView() {
+ guideView3.hide();
+ guideView.show();
+ }
+ })
+ .build();
+ guideView.show();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ setGuideView();
+ }
+}
diff --git a/app/src/main/res/drawable-xhdpi/img_new_task_guide.png b/app/src/main/res/drawable-xhdpi/img_new_task_guide.png
new file mode 100644
index 0000000..affbdc1
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/img_new_task_guide.png differ
diff --git a/app/src/main/res/drawable/ic_menu_moreoverflow.png b/app/src/main/res/drawable/ic_menu_moreoverflow.png
new file mode 100644
index 0000000..ee63a9e
Binary files /dev/null and b/app/src/main/res/drawable/ic_menu_moreoverflow.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..9964a48
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/app_bar.xml b/app/src/main/res/layout/app_bar.xml
new file mode 100644
index 0000000..7241b26
--- /dev/null
+++ b/app/src/main/res/layout/app_bar.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
new file mode 100644
index 0000000..501bafa
--- /dev/null
+++ b/app/src/main/res/layout/content_main.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..a6afe03
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..dbbdd40
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..9bf3d40
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,12 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
+ #00000000
+ #cc222222
+ #ffb93221
+ #fff
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..5f5dbe3
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+ 引导蒙层
+ Settings
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..545b9c6
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/com/laxian/guideview/ExampleUnitTest.java b/app/src/test/java/com/laxian/guideview/ExampleUnitTest.java
new file mode 100644
index 0000000..225dc9e
--- /dev/null
+++ b/app/src/test/java/com/laxian/guideview/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.laxian.guideview;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..e0b366a
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..22218f9
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+## Project-wide Gradle settings.
+#
+# 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.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -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
+#Wed Jan 27 15:51:20 CST 2016
+systemProp.http.proxyHost=127.0.0.1
+systemProp.http.proxyPort=9666
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..122a0dc
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'