├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── themes.xml │ │ ├── mipmap-xhdpi │ │ │ ├── user_po.png │ │ │ └── test_face.png │ │ ├── mipmap-xxhdpi │ │ │ ├── test_face.png │ │ │ ├── test_icon.png │ │ │ ├── test_img.png │ │ │ ├── ic_launcher.png │ │ │ ├── test_face_igg.png │ │ │ └── test_face_music.png │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── aiven │ │ └── guide │ │ └── view │ │ └── demo │ │ └── MainActivity.java ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── aiven │ │ └── guide │ │ └── view │ │ ├── base │ │ └── LayerBaseHold.java │ │ ├── layer │ │ ├── FaceHold.java │ │ ├── ClipHold.java │ │ ├── Layer.java │ │ ├── LayerCreator.java │ │ └── GuidView.java │ │ ├── clip │ │ ├── BaseClipPosition.java │ │ ├── CustomClip.java │ │ └── ViewRectClip.java │ │ ├── util │ │ ├── MLog.java │ │ └── SmartUtils.java │ │ ├── face │ │ └── IntroPanel.java │ │ └── SmartGuide.java ├── proguard-rules.pro └── build.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── misc.xml ├── gradle.xml └── jarRepositories.xml ├── screens ├── img_1.jpg ├── img_2.jpg ├── img_3.jpg ├── img_4.jpg └── img_5.jpg ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── dependency.gradle ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /j-publish.gradle -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /screens/img_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/screens/img_1.jpg -------------------------------------------------------------------------------- /screens/img_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/screens/img_2.jpg -------------------------------------------------------------------------------- /screens/img_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/screens/img_3.jpg -------------------------------------------------------------------------------- /screens/img_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/screens/img_4.jpg -------------------------------------------------------------------------------- /screens/img_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/screens/img_5.jpg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library' 2 | include ':app' 3 | rootProject.name = "SmartGuideView" -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SmartGuideView 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/user_po.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xhdpi/user_po.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/test_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xhdpi/test_face.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/test_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/test_face.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/test_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/test_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/test_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/test_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/test_face_igg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/test_face_igg.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/test_face_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiven163/SmartGuideView/HEAD/app/src/main/res/mipmap-xxhdpi/test_face_music.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF607D8B 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 25 15:17:31 CST 2020 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-6.5-bin.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /library/j-publish.gradle 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | local.properties 17 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /dependency.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | android = [ 3 | toolVersion :"29.0.2", 4 | compileSdk : 29, 5 | applicationId : "aiven.guide.view.demo", 6 | 7 | minSdk : 21, 8 | targetSdk : 28, 9 | versionCode : 1, 10 | versionName : "20.02.14.21.40", 11 | ] 12 | dependencies = [ 13 | support : "28.0.0", 14 | design : "28.0.0", 15 | ] 16 | 17 | } 18 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/base/LayerBaseHold.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.base; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.RectF; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.app.Fragment; 9 | 10 | public abstract class LayerBaseHold { 11 | 12 | abstract public void build(@Nullable Activity activity); 13 | abstract public void build(@Nullable Fragment fragment); 14 | 15 | abstract public void draw(Canvas canvas, Paint paint,@Nullable RectF clipRectF, float parentWidth, float parentHeight); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | } 4 | 5 | def deps = rootProject.ext.dependencies 6 | def config = rootProject.ext.android 7 | 8 | android { 9 | compileSdkVersion config.compileSdk 10 | buildToolsVersion config.toolVersion 11 | defaultConfig { 12 | minSdkVersion config.minSdk 13 | targetSdkVersion config.targetSdk 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | } 27 | 28 | dependencies { 29 | api "com.android.support:support-v4:${deps.support}" 30 | } 31 | 32 | 33 | 34 | apply from:'j-publish.gradle' 35 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=false 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=false -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | def deps = rootProject.ext.dependencies 6 | def config = rootProject.ext.android 7 | 8 | android { 9 | compileSdkVersion config.compileSdk 10 | buildToolsVersion config.toolVersion 11 | 12 | defaultConfig { 13 | applicationId config.applicationId 14 | minSdkVersion config.minSdk 15 | targetSdkVersion config.targetSdk 16 | versionCode 1 17 | versionName "1.0" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(include: ['*.jar'], dir: 'libs') 34 | api "com.android.support:appcompat-v7:${deps.support}" 35 | api "com.android.support:support-v4:${deps.support}" 36 | 37 | api project(':library') 38 | // implementation 'aiven.guide.view:library:1.0.0' 39 | } -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/layer/FaceHold.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.layer; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.RectF; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.app.Fragment; 9 | 10 | import aiven.guide.view.base.LayerBaseHold; 11 | import aiven.guide.view.face.IntroPanel; 12 | 13 | class FaceHold extends LayerBaseHold { 14 | protected IntroPanel facePanel; 15 | 16 | public void setFacePanel(IntroPanel facePanel) { 17 | this.facePanel = facePanel; 18 | } 19 | 20 | @Override 21 | public void build(@Nullable Activity activity) { 22 | } 23 | 24 | @Override 25 | public void build(@Nullable Fragment activity) { 26 | } 27 | 28 | @Override 29 | public void draw(Canvas canvas, Paint paint,@Nullable RectF clipRectF, float parentWidth, float parentHeight) { 30 | if(this.facePanel != null) { 31 | this.facePanel.draw(canvas, paint, clipRectF, parentWidth, parentHeight); 32 | } 33 | } 34 | 35 | 36 | @Nullable 37 | public RectF getRectF() { 38 | if(facePanel != null){ 39 | return facePanel.getRectF(); 40 | } 41 | return null; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/clip/BaseClipPosition.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.clip; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.graphics.RectF; 8 | import android.support.annotation.Nullable; 9 | import android.support.v4.app.Fragment; 10 | 11 | public abstract class BaseClipPosition { 12 | protected float offsetX; 13 | protected float offsetY; 14 | protected float radius; 15 | @Nullable 16 | protected Bitmap irregularClip; 17 | 18 | @Nullable 19 | protected RectF rectF; 20 | 21 | protected boolean eventPassThrough; 22 | 23 | public float getOffsetX() { 24 | return offsetX; 25 | } 26 | 27 | public float getOffsetY() { 28 | return offsetY; 29 | } 30 | 31 | 32 | public float getRadius() { 33 | return radius; 34 | } 35 | 36 | @Nullable 37 | public RectF getRectF() { 38 | return rectF; 39 | } 40 | 41 | @Nullable 42 | public Bitmap getIrregularClip() { 43 | return irregularClip; 44 | } 45 | 46 | public void build(@Nullable Activity activity) { 47 | } 48 | 49 | public void build(@Nullable Fragment activity) { 50 | } 51 | 52 | abstract public void draw(Canvas canvas, Paint paint,float parentWidth, float parentHeight); 53 | 54 | public boolean isEventPassThrough() { 55 | return eventPassThrough; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/layer/ClipHold.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.layer; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.RectF; 7 | import android.support.annotation.NonNull; 8 | import android.support.annotation.Nullable; 9 | import android.support.v4.app.Fragment; 10 | 11 | import aiven.guide.view.base.LayerBaseHold; 12 | import aiven.guide.view.clip.BaseClipPosition; 13 | 14 | class ClipHold extends LayerBaseHold { 15 | 16 | @Nullable 17 | protected BaseClipPosition target; 18 | 19 | @Override 20 | public void build(@Nullable Activity activity) { 21 | if(target != null){ 22 | target.build(activity); 23 | } 24 | } 25 | 26 | @Override 27 | public void build(@Nullable Fragment fragment) { 28 | if(target != null){ 29 | target.build(fragment); 30 | } 31 | } 32 | 33 | @Override 34 | public void draw(Canvas canvas, Paint paint,@Nullable RectF clipRectF, float parentWidth, float parentHeight) { 35 | if(target != null){ 36 | target.draw(canvas,paint,parentWidth,parentHeight); 37 | } 38 | } 39 | 40 | @Nullable 41 | public RectF getRectF(){ 42 | if(target != null){ 43 | return target.getRectF(); 44 | } 45 | return null; 46 | } 47 | 48 | public boolean isEventPassThrough() { 49 | if(target != null){ 50 | return target.isEventPassThrough(); 51 | } 52 | return false; 53 | } 54 | 55 | 56 | public void setTarget(@NonNull BaseClipPosition target) { 57 | this.target = target; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/util/MLog.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.util; 2 | 3 | import android.util.Log; 4 | 5 | import java.io.PrintWriter; 6 | import java.io.StringWriter; 7 | 8 | 9 | /** 10 | * @author Aiven (aiven163@aliyun.com) 11 | * @desc

日志输出工具

12 | */ 13 | public class MLog { 14 | 15 | public static boolean IS_DEBUG = true; 16 | public static String DEFAULT_TAG = "SmartGuide>>>"; 17 | 18 | public static void I(String msg){ 19 | I(DEFAULT_TAG,msg); 20 | } 21 | 22 | public static void I(String tag,String msg){ 23 | if(IS_DEBUG && !SmartUtils.strIsEmpty(msg)){ 24 | if(SmartUtils.strIsEmpty(tag)){ 25 | tag = DEFAULT_TAG; 26 | } 27 | Log.i(tag,msg); 28 | } 29 | } 30 | 31 | public static void V(String msg){ 32 | V(DEFAULT_TAG,msg); 33 | } 34 | 35 | public static void V(String tag,String msg){ 36 | if(IS_DEBUG && !SmartUtils.strIsEmpty(msg)){ 37 | if(SmartUtils.strIsEmpty(tag)){ 38 | tag = DEFAULT_TAG; 39 | } 40 | Log.v(tag,msg); 41 | } 42 | } 43 | 44 | public static void E(String tag,String msg){ 45 | if(IS_DEBUG && !SmartUtils.strIsEmpty(msg)){ 46 | if(SmartUtils.strIsEmpty(tag)){ 47 | tag = DEFAULT_TAG; 48 | } 49 | Log.e(tag,msg); 50 | } 51 | } 52 | 53 | public static void E(Throwable throwable){ 54 | if(throwable != null && IS_DEBUG){ 55 | E(DEFAULT_TAG,saveException2String(throwable)); 56 | } 57 | } 58 | 59 | 60 | private static String saveException2String(Throwable var0) { 61 | StringBuilder var1 = new StringBuilder("\n"); 62 | try { 63 | var1.append("异常原因:").append(var0.toString()).append("\n"); 64 | var1.append("具体如下:\n=======================================================\n"); 65 | StringWriter var2 = new StringWriter(); 66 | PrintWriter var3 = new PrintWriter(var2); 67 | var0.printStackTrace(var3); 68 | 69 | for (var0 = var0.getCause(); var0 != null; var0 = var0.getCause()) { 70 | var0.printStackTrace(var3); 71 | } 72 | var3.close(); 73 | String var5 = var2.toString(); 74 | var1.append(var5); 75 | } catch (Exception var4) { 76 | var4.printStackTrace(); 77 | } 78 | return var1.toString(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/layer/Layer.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.layer; 2 | 3 | 4 | import android.app.Activity; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.support.annotation.NonNull; 8 | import android.support.annotation.Nullable; 9 | import android.support.v4.app.Fragment; 10 | 11 | import aiven.guide.view.clip.BaseClipPosition; 12 | import aiven.guide.view.face.IntroPanel; 13 | 14 | class Layer { 15 | @NonNull 16 | private ClipHold clipHold; 17 | @NonNull 18 | private FaceHold face; 19 | @NonNull 20 | protected String tag; 21 | 22 | public Layer(String tag) { 23 | this.clipHold = new ClipHold(); 24 | this.face = new FaceHold(); 25 | this.tag = tag; 26 | } 27 | 28 | 29 | public void setClipTarget(BaseClipPosition target){ 30 | clipHold.setTarget(target); 31 | } 32 | 33 | public void setFacePanel(IntroPanel facePanel){ 34 | this.face.setFacePanel(facePanel); 35 | } 36 | 37 | 38 | public void draw(Canvas canvas, Paint paint, boolean clip, float parentWidth, float parentHeight){ 39 | if(clip){ 40 | clipHold.draw(canvas,paint,null,parentWidth,parentHeight); 41 | }else{ 42 | face.draw(canvas,paint,clipHold.getRectF(),parentWidth,parentHeight); 43 | } 44 | } 45 | 46 | protected void build(@Nullable Activity activity) { 47 | if(clipHold != null){ 48 | clipHold.build(activity); 49 | } 50 | if(face != null){ 51 | face.build(activity); 52 | } 53 | } 54 | 55 | 56 | protected void build(@Nullable Fragment fragment) { 57 | if(clipHold != null){ 58 | clipHold.build(fragment); 59 | } 60 | if(face != null){ 61 | face.build(fragment); 62 | } 63 | } 64 | 65 | @NonNull 66 | public String getTag() { 67 | return tag; 68 | } 69 | 70 | public boolean isClipEventPassThrough(){ 71 | if(clipHold != null){ 72 | return clipHold.isEventPassThrough(); 73 | } 74 | return false; 75 | } 76 | 77 | 78 | public boolean isTouchInClip(float x,float y){ 79 | if(clipHold != null && clipHold.getRectF() != null){ 80 | if(clipHold.getRectF().contains(x,y)){ 81 | return true; 82 | } 83 | } 84 | return false; 85 | } 86 | 87 | public boolean isTouchInIntro(float x,float y){ 88 | if(face != null && face.getRectF() != null){ 89 | if(face.getRectF().contains(x,y)){ 90 | return true; 91 | } 92 | } 93 | return false; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /library/src/main/java/aiven/guide/view/util/SmartUtils.java: -------------------------------------------------------------------------------- 1 | package aiven.guide.view.util; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.graphics.Point; 6 | import android.os.Build; 7 | import android.support.annotation.NonNull; 8 | import android.util.DisplayMetrics; 9 | 10 | 11 | /** 12 | * @author Aiven (aiven163@aliyun.com) 13 | *

工具方法集合

14 | */ 15 | public class SmartUtils { 16 | /** 17 | * 获取屏幕信息,包含状态栏 18 | * @param activity 19 | * @return 20 | */ 21 | public static Point getScreenSize(@NonNull Activity activity) { 22 | if (activity != null) { 23 | DisplayMetrics dm = new DisplayMetrics(); 24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 25 | activity.getWindowManager().getDefaultDisplay().getRealMetrics(dm); 26 | } else { 27 | dm = activity.getResources().getDisplayMetrics(); 28 | } 29 | int screenWidth = dm.widthPixels; 30 | int screenHeight = dm.heightPixels; 31 | return new Point(screenWidth, screenHeight); 32 | } 33 | return new Point(0, 0); 34 | } 35 | 36 | /** 37 | * 获取屏幕信息,包含状态栏 38 | * @param context 39 | * @return 40 | */ 41 | public static int getScreenWidth(@NonNull Context context) { 42 | if (context != null) { 43 | DisplayMetrics dm = new DisplayMetrics(); 44 | dm = context.getResources().getDisplayMetrics(); 45 | int screenWidth = dm.widthPixels; 46 | return screenWidth; 47 | } 48 | return 0; 49 | } 50 | 51 | public static int getScreenHeight(@NonNull Context context) { 52 | DisplayMetrics dm = context.getResources().getDisplayMetrics(); 53 | return dm.heightPixels; 54 | } 55 | 56 | /** 57 | * 获取状态栏高度 58 | * 59 | * @param context context 60 | * @return 状态栏高度 61 | */ 62 | public static int getStatusBarHeight(@NonNull Context context) { 63 | try { 64 | // 获得状态栏高度 65 | int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); 66 | return context.getResources().getDimensionPixelSize(resourceId); 67 | } catch (Exception e) { 68 | MLog.E(e); 69 | return dip2px(context, 24); 70 | } 71 | } 72 | 73 | 74 | 75 | 76 | public static int dip2px(Context context, float dipValue) { 77 | final float scale = context.getResources().getDisplayMetrics().density; 78 | return (int) (dipValue * scale + 0.5f); 79 | } 80 | 81 | public static int px2dip(Context context, float pxValue) { 82 | final float scale = context.getResources().getDisplayMetrics().density; 83 | return (int) (pxValue / scale + 0.5f); 84 | } 85 | 86 | 87 | /** 88 | * 检查字符串是否为空 89 | * @param value 90 | * @return 91 | */ 92 | public static boolean strIsEmpty(String value){ 93 | if(value != null && value.trim().length() > 0){ 94 | return false; 95 | } 96 | return true; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | 25 | 26 | 27 | 28 |