├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── raw │ │ │ │ └── loading_default.gif │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable │ │ │ │ └── image_guide_pinch.xml │ │ │ └── layout │ │ │ │ └── activity_sample.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── brouding │ │ │ │ └── blockbuttonsample │ │ │ │ ├── Pref │ │ │ │ └── Pref.java │ │ │ │ └── SampleActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── brouding │ │ │ └── blockbuttonsample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── brouding │ │ └── blockbuttonsample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── blockbutton ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── values.xml │ │ │ └── drawable │ │ │ │ ├── brouding_block_button_bg_layer_default_normal.xml │ │ │ │ ├── brouding_block_button_bg_layer_default_disabled.xml │ │ │ │ └── brouding_block_button_bg_layer_default_pressed.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── brouding │ │ │ └── blockbutton │ │ │ └── BlockButton.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── brouding │ │ │ └── blockbutton │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── brouding │ │ └── blockbutton │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── sample ├── sample_video.gif ├── BlockButtonSample.apk ├── BlockButton_disabled.png └── BlockButton_enabled.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /blockbutton/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':blockbutton' 2 | -------------------------------------------------------------------------------- /sample/sample_video.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/sample/sample_video.gif -------------------------------------------------------------------------------- /sample/BlockButtonSample.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/sample/BlockButtonSample.apk -------------------------------------------------------------------------------- /sample/BlockButton_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/sample/BlockButton_disabled.png -------------------------------------------------------------------------------- /sample/BlockButton_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/sample/BlockButton_enabled.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BlockButtonSample 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /blockbutton/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BlockButton 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/raw/loading_default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/raw/loading_default.gif -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BROUDING/BlockButton/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /blockbutton/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /blockbutton/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #0074ef 4 | #063f78 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #333333 4 | #222222 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Aug 30 16:26:29 KST 2018 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-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/brouding/blockbuttonsample/Pref/Pref.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbuttonsample.Pref; 2 | 3 | /** 4 | * Created by John on 7/11/17. 5 | */ 6 | 7 | public class Pref { 8 | public final static String PREFERENCE_NAME = "PREF_SAMPLE_PROJECT"; 9 | 10 | public final static boolean FIRST_WELCOME_DEFAULT = false; 11 | public final static String KEY_FIRST_WELCOME = "firstWelcome"; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/brouding/blockbuttonsample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbuttonsample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /blockbutton/src/test/java/com/brouding/blockbutton/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbutton; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /blockbutton/src/main/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /blockbutton/src/main/res/drawable/brouding_block_button_bg_layer_default_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /blockbutton/src/main/res/drawable/brouding_block_button_bg_layer_default_disabled.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /blockbutton/src/main/res/drawable/brouding_block_button_bg_layer_default_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /blockbutton/src/androidTest/java/com/brouding/blockbutton/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbutton; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.brouding.blockbutton.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/brouding/blockbuttonsample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbuttonsample; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.brouding.blockbuttonsample", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | SUPPORT_V4_VERSION=26.1.0 15 | SUPPORT_V7_VERSION=26.1.0 16 | 17 | COMPILE_SDK_VERSION=26 18 | BUILD_TOOLS_VERSION=26.0.2 19 | TARGET_SDK_VERSION=26 20 | MIN_SDK_VERSION=14 21 | 22 | # When configured, Gradle will run in incubating parallel mode. 23 | # This option should only be used with decoupled projects. More details, visit 24 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 25 | # org.gradle.parallel=true 26 | -------------------------------------------------------------------------------- /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 /Users/John/Library/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /blockbutton/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 /Users/John/Library/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion COMPILE_SDK_VERSION as int 5 | buildToolsVersion BUILD_TOOLS_VERSION as String 6 | 7 | defaultConfig { 8 | applicationId "com.brouding.blockbuttonsample" 9 | minSdkVersion MIN_SDK_VERSION as int 10 | targetSdkVersion TARGET_SDK_VERSION as int 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | lintOptions { 23 | abortOnError false 24 | } 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 30 | exclude group: 'com.android.support', module: 'support-annotations' 31 | }) 32 | compile "com.android.support:appcompat-v7:${SUPPORT_V7_VERSION}" 33 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 34 | compile 'com.andkulikov:transitionseverywhere:1.7.4' 35 | compile 'com.brouding:android-simple-dialog:0.3.0' 36 | compile project(":blockbutton") 37 | testCompile 'junit:junit:4.12' 38 | } 39 | -------------------------------------------------------------------------------- /blockbutton/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | 4 | publish { 5 | userOrg = 'brouding' 6 | groupId = 'com.brouding' 7 | artifactId = 'android-block-button' 8 | publishVersion = '0.1.3.2.2' 9 | desc = 'Android Block Button' 10 | website = 'https://github.com/BROUDING/BlockButton' 11 | issueTracker = "https://github.com/BROUDING/BlockButton/issues" 12 | repository = "https://github.com/BROUDING/BlockButton.git" 13 | } 14 | 15 | android { 16 | compileSdkVersion COMPILE_SDK_VERSION as int 17 | buildToolsVersion BUILD_TOOLS_VERSION as String 18 | 19 | defaultConfig { 20 | minSdkVersion MIN_SDK_VERSION as int 21 | targetSdkVersion TARGET_SDK_VERSION as int 22 | versionCode 1 23 | versionName "1.0" 24 | multiDexEnabled true 25 | 26 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 27 | 28 | } 29 | 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | 37 | lintOptions { 38 | abortOnError false 39 | } 40 | } 41 | 42 | dependencies { 43 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 44 | exclude group: 'com.android.support', module: 'support-annotations' 45 | }) 46 | compile fileTree(dir: 'libs', include: ['*.jar']) 47 | compile "com.android.support:appcompat-v7:${SUPPORT_V7_VERSION}" 48 | testCompile 'junit:junit:4.12' 49 | } 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/image_guide_pinch.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BlockButton [![Platform](https://img.shields.io/badge/Platform-Android-green.svg) ]() [![Download](https://api.bintray.com/packages/brouding/maven/android-block-button/images/download.svg) ](https://bintray.com/brouding/maven/android-block-button/_latestVersion)[![GitHub license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/brouding/simpledialog/blob/master/LICENSE.txt) 2 | 3 | Android Block style Button by BROUDING 4 | - BlockButton is an extension of LinearLayout (thinking of extending RelativeLayout too..) hence, `orientation` should be set. 5 | - `layout_height` should be fixed. 6 | 7 | 8 | ![Sample Video](https://github.com/BROUDING/BlockButton/blob/master/sample/sample_video.gif?raw=true) 9 | 10 | # Sample .apk 11 | 12 | You can download the latest sample APK from this repo here: https://github.com/brouding/BlockButton/blob/master/sample/BlockButtonSample.apk 13 | 14 | --- 15 | # Gradle Dependency 16 | ### Repository 17 | The Gradle dependency is available via [jCenter](https://bintray.com/brouding/maven/android-block-button). 18 | jCenter is the default Maven repository used by Android Studio. 19 | 20 | The minimum API level supported by this library is API 14, Android 4.0 (ICE_CREAM_SANDWICH) 21 | 22 | 23 | ### Import to your project 24 | add below code in `build.gradle (Module: app)` 25 | ```gradle 26 | dependencies { 27 | // ... other dependencies here 28 | compile 'com.brouding:android-block-button:0.1.3.2.2' 29 | } 30 | ``` 31 | --- 32 | # How to use 33 | 34 | ![Sample Image_enabled](https://github.com/BROUDING/BlockButton/blob/master/sample/BlockButton_enabled.png?raw=true) ![Sample Image_disabled](https://github.com/BROUDING/BlockButton/blob/master/sample/BlockButton_disabled.png?raw=true) 35 | ```java 36 | 49 | 50 | 61 | 62 | 63 | ``` 64 | 65 | ### Parameters 66 | - `pushDepthDp` : Integer value in `dp`, default is 4 (I don't recommend integer over 6..) 67 | - `buttonColor`, `buttonGapColor`, `buttonDisabledColor`, `buttonDisabledGapColor` 68 | : Color values, it can be `#------` or `@color/---` 69 | 70 | ### In class 71 | ```java 72 | private BlockButton btnResetGuidePref = (BlockButton) layoutMain.findViewById(R.id.btn_reset_guide); 73 | btnResetGuidePref.setEnabled(false); 74 | ``` 75 | 76 | License 77 | ------- 78 | 79 | Copyright 2017 BlockButton authors. 80 | 81 | - Jeongwon Lee (ssyjk2@gmail.com) 82 | 83 | All rights reserved. 84 | 85 | Licensed under the Apache License, Version 2.0 (the "License"); 86 | you may not use this file except in compliance with the License. 87 | You may obtain a copy of the License at 88 | 89 | http://www.apache.org/licenses/LICENSE-2.0 90 | 91 | Unless required by applicable law or agreed to in writing, software 92 | distributed under the License is distributed on an "AS IS" BASIS, 93 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 94 | See the License for the specific language governing permissions and 95 | limitations under the License. 96 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /blockbutton/src/main/java/com/brouding/blockbutton/BlockButton.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbutton; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Color; 7 | import android.graphics.drawable.Drawable; 8 | import android.graphics.drawable.GradientDrawable; 9 | import android.graphics.drawable.LayerDrawable; 10 | import android.graphics.drawable.StateListDrawable; 11 | import android.os.Build; 12 | import android.support.annotation.Nullable; 13 | import android.support.v4.content.ContextCompat; 14 | import android.util.AttributeSet; 15 | import android.util.Log; 16 | import android.util.TypedValue; 17 | import android.widget.LinearLayout; 18 | 19 | /** 20 | * Created by John on 7/7/17. 21 | */ 22 | 23 | public class BlockButton extends LinearLayout { 24 | private Context mContext; 25 | private int paddingTop=0, paddingBottom=0, paddingLeft=0, paddingRight=0, generalPaddingTop=0, pressedPaddingTop=0, 26 | pushDepth=0, btnColor=0, btnGapColor=0, btnDisabledColor=0, btnDisabledGapColor=0, btnStokeWidth=0, btnStrokeColor=0; 27 | 28 | public BlockButton(Context context) { 29 | super(context); 30 | } 31 | 32 | public BlockButton(Context context, @Nullable AttributeSet attrs) { 33 | super(context, attrs); 34 | setButtonLayout(context, attrs); 35 | } 36 | 37 | public BlockButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 38 | super(context, attrs, defStyleAttr); 39 | setButtonLayout(context, attrs); 40 | } 41 | 42 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 43 | public BlockButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 44 | super(context, attrs, defStyleAttr, defStyleRes); 45 | setButtonLayout(context, attrs); 46 | } 47 | 48 | private void setButtonLayout(Context context, AttributeSet attrs) { 49 | this.mContext = context; 50 | this.paddingTop = this.getPaddingTop(); 51 | this.paddingBottom = this.getPaddingBottom(); 52 | this.paddingLeft = this.getPaddingLeft(); 53 | this.paddingRight = this.getPaddingRight(); 54 | 55 | // prevent render is in edit mode 56 | if( isInEditMode() ) 57 | return; 58 | 59 | if( attrs != null ) { 60 | TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.BlockButton); 61 | 62 | btnColor = getBtnColor(array); 63 | btnGapColor = getBtnGapColor(array); 64 | btnDisabledColor = getBtnDisabledColor(array); 65 | btnDisabledGapColor = getBtnDisabledGapColor(array); 66 | btnStokeWidth = getPXWithDP( getBtnStrokeWidth(array) ); 67 | btnStrokeColor = getBtnStrokeColor(array); 68 | 69 | pushDepth = getPXWithDP( getPushDepth(array) ); 70 | 71 | array.recycle(); 72 | 73 | this.generalPaddingTop = paddingTop -pushDepth/2; 74 | this.pressedPaddingTop = paddingTop +pushDepth; 75 | } 76 | 77 | this.setPadding(this.paddingLeft, this.generalPaddingTop, this.paddingRight, this.paddingBottom); 78 | 79 | if(Build.VERSION.SDK_INT <= 15) 80 | this.setBackgroundDrawable( makeSelector() ); 81 | else 82 | this.setBackground( makeSelector() ); 83 | } 84 | 85 | @Override 86 | public void setPressed(boolean pressed) { 87 | super.setPressed(pressed); 88 | this.setPadding(this.paddingLeft, pressed ? this.pressedPaddingTop : this.generalPaddingTop, this.paddingRight, this.paddingBottom); 89 | } 90 | 91 | private StateListDrawable makeSelector() { 92 | StateListDrawable res = new StateListDrawable(); 93 | res.addState(new int[] { android.R.attr.state_enabled, -android.R.attr.state_pressed }, setButtonDrawable(R.drawable.brouding_block_button_bg_layer_default_normal, false)); 94 | res.addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed }, setButtonDrawable(R.drawable.brouding_block_button_bg_layer_default_pressed, true)); 95 | res.addState(new int[] { -android.R.attr.state_enabled }, setButtonDrawable(R.drawable.brouding_block_button_bg_layer_default_disabled, false)); 96 | return res; 97 | } 98 | 99 | private Drawable setButtonDrawable(int drawableId, boolean isPressed) { 100 | LayerDrawable layerDrawable = (LayerDrawable) ContextCompat.getDrawable(mContext, drawableId).mutate(); 101 | 102 | GradientDrawable btnDrawable = (GradientDrawable) layerDrawable.findDrawableByLayerId(R.id.btn); 103 | GradientDrawable btnShadowDrawable = (GradientDrawable) layerDrawable.findDrawableByLayerId(R.id.btnShadow); 104 | 105 | if( isPressed ) { 106 | layerDrawable.setLayerInset(0, 0, pushDepth, 0, 0); 107 | layerDrawable.setLayerInset(1, 0, pushDepth, 0, 4); 108 | } else { 109 | layerDrawable.setLayerInset(1, 0, 0, 0, (pushDepth+4)); 110 | } 111 | 112 | if( drawableId == R.drawable.brouding_block_button_bg_layer_default_disabled) { 113 | btnDrawable.setColor(btnDisabledColor); 114 | btnShadowDrawable.setColor(btnDisabledGapColor); 115 | 116 | return layerDrawable; 117 | } 118 | 119 | btnDrawable.setColor(btnColor); 120 | if( btnStokeWidth!=0 ) 121 | btnDrawable.setStroke(btnStokeWidth, btnStrokeColor); 122 | btnShadowDrawable.setColor(btnGapColor); 123 | 124 | return layerDrawable; 125 | } 126 | 127 | private int getPXWithDP(int dp) { 128 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics()); 129 | } 130 | 131 | protected int getBtnColor(final TypedArray typedArray) { 132 | return typedArray.getColor(R.styleable.BlockButton_buttonColor, ContextCompat.getColor(mContext, R.color.colorPrimary)); 133 | } 134 | 135 | protected int getBtnGapColor(final TypedArray typedArray) { 136 | return typedArray.getColor(R.styleable.BlockButton_buttonGapColor, ContextCompat.getColor(mContext, R.color.colorPrimaryDark)); 137 | } 138 | 139 | protected int getBtnDisabledColor(final TypedArray typedArray) { 140 | return typedArray.getColor(R.styleable.BlockButton_buttonDisabledColor, Color.GRAY); 141 | } 142 | 143 | protected int getBtnDisabledGapColor(final TypedArray typedArray) { 144 | return typedArray.getColor(R.styleable.BlockButton_buttonDisabledGapColor, Color.DKGRAY); 145 | } 146 | 147 | protected int getBtnStrokeWidth(final TypedArray typedArray) { 148 | return typedArray.getInt(R.styleable.BlockButton_buttonStrokeWidth, 0); 149 | } 150 | 151 | protected int getBtnStrokeColor(final TypedArray typedArray) { 152 | return typedArray.getColor(R.styleable.BlockButton_buttonStrokeColor, btnColor); 153 | } 154 | 155 | protected int getPushDepth(final TypedArray typedArray) { 156 | return typedArray.getInt(R.styleable.BlockButton_pushDepthDp, 4); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /app/src/main/java/com/brouding/blockbuttonsample/SampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.brouding.blockbuttonsample; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.graphics.Color; 7 | import android.net.Uri; 8 | import android.support.annotation.NonNull; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.os.Bundle; 11 | import android.util.Log; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.LinearLayout; 15 | import android.widget.TextView; 16 | 17 | import com.brouding.blockbutton.BlockButton; 18 | import com.brouding.blockbuttonsample.Pref.Pref; 19 | import com.brouding.simpledialog.SimpleDialog; 20 | import com.transitionseverywhere.TransitionManager; 21 | 22 | public class SampleActivity extends AppCompatActivity implements View.OnClickListener { 23 | private Activity thisActivity; 24 | private SharedPreferences mPreference; 25 | 26 | private ViewGroup layoutMain; 27 | private BlockButton btnResetGuidePref; 28 | private TextView textChangeEnabled; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_sample); 34 | 35 | thisActivity = this; 36 | mPreference = getSharedPreferences(Pref.PREFERENCE_NAME, MODE_PRIVATE); 37 | 38 | layoutMain = (ViewGroup) findViewById(R.id.layout_main); 39 | 40 | BlockButton btnShowBasicDialog = (BlockButton) findViewById(R.id.btn_show_basic_dialog); 41 | btnShowBasicDialog.setOnClickListener(this); 42 | 43 | BlockButton btnShowProgressDialog = (BlockButton) findViewById(R.id.btn_show_progress_dialog); 44 | btnShowProgressDialog.setOnClickListener(this); 45 | 46 | BlockButton btnShowGuideDialog = (BlockButton) layoutMain.findViewById(R.id.btn_show_guide_dialog); 47 | btnShowGuideDialog.setOnClickListener(this); 48 | 49 | textChangeEnabled = (TextView) layoutMain.findViewById(R.id.text_btn_change_enabled); 50 | 51 | btnResetGuidePref = (BlockButton) layoutMain.findViewById(R.id.btn_reset_guide); 52 | btnResetGuidePref.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View view) { 55 | resetGuidePref(); 56 | 57 | setBtnGuideReset(false); 58 | } 59 | }); 60 | 61 | setBtnGuideReset(false); 62 | } 63 | 64 | @Override 65 | protected void onPause() { 66 | super.onPause(); 67 | 68 | resetGuidePref(); 69 | } 70 | 71 | private void setBtnGuideReset(boolean enabled) { 72 | TransitionManager.beginDelayedTransition(layoutMain); 73 | 74 | btnResetGuidePref.setEnabled(enabled); 75 | textChangeEnabled.setText("setEnabled(" +enabled +")"); 76 | } 77 | 78 | private void resetGuidePref() { 79 | SharedPreferences.Editor edit = mPreference.edit(); 80 | edit.putBoolean(Pref.KEY_FIRST_WELCOME, Pref.FIRST_WELCOME_DEFAULT); 81 | edit.apply(); 82 | } 83 | 84 | public void goToGithub(View v) { 85 | String url ="https://github.com/BROUDING/"; 86 | Intent intent; 87 | 88 | switch ( v.getId() ) { 89 | case R.id.btn_goto_block_button: 90 | url += "BlockButton"; 91 | break; 92 | 93 | case R.id.btn_goto_simple_dialog: 94 | url += "SimpleDialog"; 95 | break; 96 | } 97 | 98 | intent = new Intent( Intent.ACTION_VIEW, Uri.parse(url) ); 99 | startActivity(intent); 100 | } 101 | 102 | @Override 103 | public void onClick(View view) { 104 | switch ( view.getId() ) { 105 | case R.id.btn_show_basic_dialog: 106 | new SimpleDialog.Builder(thisActivity) 107 | .setContent("This is basic SimpleDialog :)") 108 | .setBtnConfirmText("Check!") 109 | .setBtnConfirmTextColor("#de413e") 110 | 111 | // Customizing 112 | 113 | //.setTitle("Hello !", true) 114 | //.setCancelable(true) // Default value is false 115 | //.onConfirm(new SimpleDialog.BtnCallback() { 116 | // @Override 117 | // public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { 118 | // // Do something 119 | // } 120 | //}) 121 | //.setBtnCancelText("Cancel", false) 122 | //.onCancel(new SimpleDialog.BtnCallback() { 123 | // @Override 124 | // public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { 125 | // // Do something 126 | // } 127 | //}) 128 | .show(); 129 | break; 130 | 131 | case R.id.btn_show_progress_dialog: 132 | new SimpleDialog.Builder(thisActivity) 133 | .setContent("This is progress SimpleDialog :)") 134 | .setProgressGIF(R.raw.loading_default) 135 | .setBtnCancelText("Cancel") 136 | .setBtnCancelTextColor("#2861b0") 137 | 138 | // Customizing 139 | 140 | //.setBtnCancelText("Cancel", false) 141 | //.setBtnCancelTextColor(R.color.colorPrimary) 142 | //.setBtnCancelShowTime(2000) 143 | //.onCancel(new SimpleDialog.BtnCallback() { 144 | // @Override 145 | // public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { 146 | // // thisActivity.finish(); 147 | // } 148 | //}) 149 | //.showProgress(true) 150 | .show(); 151 | break; 152 | 153 | case R.id.btn_show_guide_dialog: 154 | new SimpleDialog.Builder(thisActivity) 155 | .setTitle("Hello !", true) // Not necessary 156 | .setContent("This is guide SimpleDialog :)\n\n- You can pinch the view !") 157 | .setGuideImage(R.drawable.image_guide_pinch) // Not necessary 158 | .setGuideImageSizeDp(150, 150) 159 | .setPermanentCheck(Pref.PREFERENCE_NAME, Pref.KEY_FIRST_WELCOME) 160 | .onConfirm(new SimpleDialog.BtnCallbackWithPermanentCheck() { 161 | @Override 162 | public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which, boolean isPermanentChecked) { 163 | setBtnGuideReset(true); 164 | } 165 | }) 166 | .setBtnConfirmText("Check!") 167 | .setBtnConfirmTextColor("#e6b115") 168 | 169 | // Customizing 170 | 171 | //.setTitle("Hello !", true) 172 | //.setBtnPermanentCheckText("다시 보지 않기", true) 173 | //.setGuideImagePaddingDp(10) 174 | //.setGuideImageSizeDp(100, 100) 175 | .showIfPermanentValueIsFalse(); 176 | break; 177 | 178 | 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 22 | 23 | 34 | 35 | 36 | 41 | 42 | 54 | 55 | 66 | 67 | 68 | 73 | 74 | 80 | 81 | 85 | 94 | 95 | 106 | 107 | 108 | 113 | 114 | 115 | 121 | 132 | 133 | 144 | 145 | 146 | 152 | 153 | 154 | 155 | 156 | 157 | 167 | 168 | 174 | 175 | 185 | 186 | 197 | 198 | 199 | 200 | 212 | 213 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | --------------------------------------------------------------------------------