├── .gitignore ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── douban │ │ └── guide │ │ └── overlay │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── douban │ │ └── guide │ │ └── overlay │ │ ├── ButtonClickGuideOverlay.java │ │ └── MainActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ ├── ic_launcher.png │ └── ic_overlay_arrow_top.png │ ├── layout │ ├── activity_main.xml │ └── view_overlay.xml │ ├── menu │ └── menu_main.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── library.iml ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── douban │ │ └── guide │ │ └── overlay │ │ └── library │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── douban │ │ └── guide │ │ └── overlay │ │ └── library │ │ ├── AbsGuideOverlay.java │ │ ├── OverlayView.java │ │ └── Shape.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_main.xml │ └── fragment_main.xml │ ├── menu │ └── menu_main.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── dimens.xml │ └── strings.xml ├── sample └── art │ └── android-guide-overlay.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | bin 3 | target 4 | *.swp 5 | .idea 6 | .settings 7 | *.iml 8 | .classpath 9 | .project 10 | out 11 | classes 12 | gen-external-apklibs 13 | local.properties 14 | .DS_Store 15 | .gradle 16 | build_by_gradle.sh 17 | /build/ 18 | app/packer.properties 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | android-guide-overlay 2 | ====================== 3 | Used to introduce new feature to the users 4 | 5 | Demo Application 6 | ================ 7 | 8 | ![android-guide-overlay Screenshots][1] 9 | 10 | License 11 | ======= 12 | 13 | Copyright 2015 qluan 14 | 15 | Licensed under the Apache License, Version 2.0 (the "License"); 16 | you may not use this file except in compliance with the License. 17 | You may obtain a copy of the License at 18 | 19 | http://www.apache.org/licenses/LICENSE-2.0 20 | 21 | Unless required by applicable law or agreed to in writing, software 22 | distributed under the License is distributed on an "AS IS" BASIS, 23 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | See the License for the specific language governing permissions and 25 | limitations under the License. 26 | 27 | [1]: sample/art/android-guide-overlay.png 28 | 29 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.douban.guide.overlay" 9 | minSdkVersion 11 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.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(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.0.0' 25 | compile(project(':library')) 26 | } 27 | -------------------------------------------------------------------------------- /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 D:\Android\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/douban/guide/overlay/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.douban.guide.overlay; 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 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/douban/guide/overlay/ButtonClickGuideOverlay.java: -------------------------------------------------------------------------------- 1 | package com.douban.guide.overlay; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.FrameLayout; 9 | import android.widget.ImageView; 10 | import android.widget.RelativeLayout; 11 | import android.widget.TextView; 12 | 13 | import com.douban.guide.overlay.library.AbsGuideOverlay; 14 | import com.douban.guide.overlay.library.OverlayView; 15 | import com.douban.guide.overlay.library.Shape; 16 | 17 | import butterknife.ButterKnife; 18 | import butterknife.InjectView; 19 | 20 | /** 21 | * Created by qluan on 2015/3/27. 22 | */ 23 | public class ButtonClickGuideOverlay extends RelativeLayout implements AbsGuideOverlay, View.OnClickListener{ 24 | 25 | @InjectView(R.id.overlay_view) 26 | public OverlayView mOverlayView; 27 | @InjectView(R.id.overlay_content) 28 | public View mContent; 29 | 30 | @InjectView(R.id.overlay_content_image) 31 | public ImageView mImageView; 32 | @InjectView(R.id.overlay_content_text) 33 | public TextView mMessage; 34 | 35 | public ButtonClickGuideOverlay(Context context) { 36 | super(context); 37 | init(); 38 | } 39 | 40 | public ButtonClickGuideOverlay(Context context, AttributeSet attrs) { 41 | super(context, attrs); 42 | init(); 43 | } 44 | 45 | public ButtonClickGuideOverlay(Context context, AttributeSet attrs, int defStyleAttr) { 46 | super(context, attrs, defStyleAttr); 47 | init(); 48 | } 49 | 50 | private void init() { 51 | LayoutInflater.from(getContext()) 52 | .inflate(R.layout.view_overlay, this, true); 53 | ButterKnife.inject(this, this); 54 | 55 | setOnClickListener(this); 56 | } 57 | 58 | @Override 59 | public void hide() { 60 | setVisibility(View.GONE); 61 | } 62 | 63 | @Override 64 | public void show(Shape shape) { 65 | if (null == shape) { 66 | return; 67 | } 68 | resetContent(shape); 69 | setVisibility(View.VISIBLE); 70 | } 71 | 72 | private void resetContent(Shape shape) { 73 | mOverlayView.setShape(shape); 74 | FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mContent.getLayoutParams(); 75 | if (null == layoutParams) { 76 | layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 77 | ViewGroup.LayoutParams.WRAP_CONTENT); 78 | } 79 | layoutParams.topMargin = (int) shape.getBottom(); 80 | mContent.setLayoutParams(layoutParams); 81 | } 82 | 83 | @Override 84 | public void onClick(View v) { 85 | if (null == v) { 86 | return; 87 | } 88 | hide(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/douban/guide/overlay/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.douban.guide.overlay; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v7.app.ActionBarActivity; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v4.app.Fragment; 7 | import android.os.Bundle; 8 | import android.view.LayoutInflater; 9 | import android.view.Menu; 10 | import android.view.MenuItem; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.os.Build; 14 | import android.widget.Button; 15 | 16 | import com.douban.guide.overlay.library.Shape; 17 | 18 | 19 | public class MainActivity extends ActionBarActivity { 20 | 21 | ButtonClickGuideOverlay mGuideOverlay; 22 | Button mButton; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_main); 28 | mGuideOverlay = (ButtonClickGuideOverlay) findViewById(R.id.overlay); 29 | mButton = (Button) findViewById(R.id.button); 30 | mButton.postDelayed(new Runnable() { 31 | @Override 32 | public void run() { 33 | showButtonGuideOverlay(); 34 | } 35 | }, 300); 36 | } 37 | 38 | @Override 39 | public boolean onCreateOptionsMenu(Menu menu) { 40 | // Inflate the menu; this adds items to the action bar if it is present. 41 | getMenuInflater().inflate(R.menu.menu_main, menu); 42 | return true; 43 | } 44 | 45 | @Override 46 | public boolean onOptionsItemSelected(MenuItem item) { 47 | // Handle action bar item clicks here. The action bar will 48 | // automatically handle clicks on the Home/Up button, so long 49 | // as you specify a parent activity in AndroidManifest.xml. 50 | int id = item.getItemId(); 51 | 52 | //noinspection SimplifiableIfStatement 53 | if (id == R.id.action_settings) { 54 | return true; 55 | } 56 | 57 | return super.onOptionsItemSelected(item); 58 | } 59 | 60 | private void showButtonGuideOverlay() { 61 | int paddingHorizontal = mButton.getWidth() / 5; 62 | int paddingVertical = mButton.getHeight() / 4; 63 | float left = mButton.getX() + paddingHorizontal; 64 | float right = mButton.getRight() - paddingHorizontal; 65 | float top = mButton.getY() - paddingVertical; 66 | float bottom = mButton.getBottom() + paddingVertical; 67 | mGuideOverlay.show(new Shape.Oval(left, top, right, bottom)); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qluan/android-guide-overlay/88a399232619cce801aea68ce01d051bb79ff016/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qluan/android-guide-overlay/88a399232619cce801aea68ce01d051bb79ff016/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qluan/android-guide-overlay/88a399232619cce801aea68ce01d051bb79ff016/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qluan/android-guide-overlay/88a399232619cce801aea68ce01d051bb79ff016/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_overlay_arrow_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qluan/android-guide-overlay/88a399232619cce801aea68ce01d051bb79ff016/app/src/main/res/drawable-xxhdpi/ic_overlay_arrow_top.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 17 | 18 |