├── PayDialog
├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── 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
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── layout
│ │ │ │ │ └── activity_main.xml
│ │ │ │ ├── drawable-v24
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ └── drawable
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── hgj
│ │ │ │ └── explorer
│ │ │ │ └── MainActivity.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── hgj
│ │ │ │ └── explorer
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── hgj
│ │ │ └── explorer
│ │ │ └── ExampleInstrumentedTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── paydialog
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── attrs.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── drawable
│ │ │ │ │ ├── face_del_icon.png
│ │ │ │ │ ├── ic_close.xml
│ │ │ │ │ ├── pay_del.xml
│ │ │ │ │ ├── pay_editshap.xml
│ │ │ │ │ └── selector_gride.xml
│ │ │ │ ├── anim
│ │ │ │ │ ├── push_bottom_in.xml
│ │ │ │ │ └── push_bottom_out.xml
│ │ │ │ └── layout
│ │ │ │ │ └── pay_pass.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── hgj
│ │ │ │ └── paydialog
│ │ │ │ └── view
│ │ │ │ ├── OnPasswordInputFinish.java
│ │ │ │ ├── PayPassView.java
│ │ │ │ ├── PayDialog.java
│ │ │ │ └── MDProgressBar.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── hgj
│ │ │ │ └── paydialog
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── hgj
│ │ │ └── paydialog
│ │ │ └── ExampleInstrumentedTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── .gitignore
├── .idea
│ ├── vcs.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── gradle.xml
│ └── misc.xml
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── .gitattributes
└── README.md
/PayDialog/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/PayDialog/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':paydialog'
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PayDialog
3 |
4 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PayDialog
3 |
4 |
--------------------------------------------------------------------------------
/PayDialog/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 3dp
3 |
4 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/drawable/face_del_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/paydialog/src/main/res/drawable/face_del_icon.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hegaojian/PayDialog/HEAD/PayDialog/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/PayDialog/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/PayDialog/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #292421
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PayDialog
2 | 自定义支付密码弹窗,可拓展性高,界面友好,注释详细
3 |
4 | 示例图片:
5 | 
6 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/PayDialog/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 19 11:12:09 CST 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.1-all.zip
7 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/java/com/hgj/paydialog/view/OnPasswordInputFinish.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog.view;
2 |
3 | /**
4 | * ==========================================
5 | * 作 者:何高建
6 | * 日 期:2018/3/19
7 | * 描 述:
8 | * ===========================================
9 | */
10 |
11 | public interface OnPasswordInputFinish {
12 | void inputFinish();
13 | void inputFirst();
14 | }
15 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/drawable/ic_close.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/anim/push_bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/anim/push_bottom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/PayDialog/app/src/test/java/com/hgj/explorer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.hgj.explorer;
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 | }
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/test/java/com/hgj/paydialog/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog;
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 | }
--------------------------------------------------------------------------------
/PayDialog/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/drawable/pay_del.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/drawable/pay_editshap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/PayDialog/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/PayDialog/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/drawable/selector_gride.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/PayDialog/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/PayDialog/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 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/PayDialog/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
22 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/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
22 |
--------------------------------------------------------------------------------
/PayDialog/app/src/androidTest/java/com/hgj/explorer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.hgj.explorer;
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 | * Instrumented 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.hgj.paydialog", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/androidTest/java/com/hgj/paydialog/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog;
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 | * Instrumented 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.hgj.paydialog.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
16 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | implementation 'com.android.support:appcompat-v7:26.1.0'
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
34 | compile 'com.daimajia.easing:library:2.0@aar'
35 | compile 'com.daimajia.androidanimations:library:2.3@aar'
36 | }
37 |
--------------------------------------------------------------------------------
/PayDialog/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.hgj.paydialog"
7 | minSdkVersion 15
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(include: ['*.jar'], dir: 'libs')
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28 | implementation project(':paydialog')
29 | }
30 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/PayDialog/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/PayDialog/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 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/java/com/hgj/explorer/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.hgj.explorer;
2 |
3 | import android.os.Handler;
4 | import android.support.v4.content.ContextCompat;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.Toast;
9 |
10 | import com.hgj.paydialog.view.PayDialog;
11 |
12 | /**
13 | * ==========================================
14 | * 作 者:何高建
15 | * 日 期:2018/3/19
16 | * 描 述:
17 | * ===========================================
18 | */
19 |
20 | public class MainActivity extends AppCompatActivity implements PayDialog.PayInterface{
21 | PayDialog payDialog;
22 | boolean status = false;//替代方案,这里没有做网络请求,所以定义一个boolean字段来判断正确还是失败
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_main);
27 | findViewById(R.id.main_payerror).setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View v) {
30 | status = false;
31 | payDialog = new PayDialog(MainActivity.this,"支付金额:80元",MainActivity.this);
32 | payDialog.show();
33 | }
34 | });
35 | findViewById(R.id.main_paysucc).setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View v) {
38 | status = true;
39 | payDialog = new PayDialog(MainActivity.this,"支付金额:80元",MainActivity.this);
40 | //设置progress的颜色
41 | payDialog.setColorId(ContextCompat.getColor(MainActivity.this,R.color.black));
42 | payDialog.show();
43 | }
44 | });
45 |
46 | }
47 |
48 | @Override
49 | public void Payfinish(String password) {
50 | //这里是当用户输入密码完成时 得到输入密码的回调方法
51 | new Handler().postDelayed(new Runnable() {
52 | @Override
53 | public void run() {
54 | //这里是做请求校验的,暂时用停留2秒做假请求
55 | if(status){
56 | //请求成功
57 | payDialog.setSucc();
58 | }else{
59 | //请求失败 传入失败理由
60 | payDialog.setError("支付密码不正确");
61 | }
62 |
63 | }
64 | },2000);
65 | }
66 |
67 | @Override
68 | public void onSucc() {
69 | //回调 成功,关闭dialog 做自己的操作
70 | payDialog.cancel();
71 | }
72 |
73 | @Override
74 | public void onForget() {
75 | //当progress显示时,说明在请求网络,这时点击忘记密码不作处理
76 | if(payDialog.payPassView.progress.getVisibility()!=View.VISIBLE){
77 | Toast.makeText(MainActivity.this,"去找回密码",Toast.LENGTH_SHORT).show();
78 |
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/PayDialog/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 |
--------------------------------------------------------------------------------
/PayDialog/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/java/com/hgj/paydialog/view/PayPassView.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog.view;
2 |
3 | import android.content.Context;
4 | import android.text.Editable;
5 | import android.text.TextWatcher;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.view.View.OnClickListener;
9 | import android.widget.ImageView;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 | import com.hgj.paydialog.R;
13 |
14 | /**
15 | * ==========================================
16 | * 作 者:何高建
17 | * 日 期:2018/3/19
18 | * 描 述:
19 | * ===========================================
20 | */
21 |
22 | public class PayPassView extends LinearLayout implements OnClickListener {
23 |
24 | public TextView[] tvList;
25 | private TextView[] tv;
26 | private ImageView iv_del;
27 | public ImageView paypass_close;
28 | public TextView title;
29 | public TextView content;
30 | public TextView tips;
31 | public LinearLayout keyboard;
32 | public MDProgressBar progress;
33 | public TextView forget;
34 | public LinearLayout paydialog_linear;
35 | private View view;
36 | private String strPassword; //输入的密码
37 | private int currentIndex = -1; //用于记录当前输入密码格位置
38 | public OnPasswordInputFinish passwordInputFinish ;
39 | public PayPassView(Context context) {
40 | this(context, null);
41 | }
42 |
43 | public PayPassView(Context context, AttributeSet attrs) {
44 | this(context, attrs, 0);
45 | }
46 |
47 | public PayPassView(Context context, AttributeSet attrs, int defStyle) {
48 | super(context, attrs, defStyle);
49 | view = View.inflate(context, R.layout.pay_pass, null);
50 | tvList = new TextView[6];
51 | tips = (TextView)view.findViewById(R.id.paypass_tips);
52 | forget = (TextView)view.findViewById(R.id.paypass_forget);
53 | title = (TextView)view.findViewById(R.id.paypass_title);
54 | content = (TextView)view.findViewById(R.id.paypass_content);
55 | keyboard = (LinearLayout) view.findViewById(R.id.keyboard);
56 | paydialog_linear = (LinearLayout) view.findViewById(R.id.paydialog_linear);
57 | progress = (MDProgressBar) view.findViewById(R.id.paypass_progress);
58 | tvList[0] = (TextView)view.findViewById(R.id.pay_box1);
59 | tvList[1] = (TextView)view. findViewById(R.id.pay_box2);
60 | tvList[2] = (TextView) view.findViewById(R.id.pay_box3);
61 | tvList[3] = (TextView) view.findViewById(R.id.pay_box4);
62 | tvList[4] = (TextView) view.findViewById(R.id.pay_box5);
63 | tvList[5] = (TextView) view.findViewById(R.id.pay_box6);
64 | tv = new TextView[10];
65 | tv[0]= (TextView)view.findViewById(R.id.pay_keyboard_zero);
66 | tv[1] = (TextView)view.findViewById(R.id.pay_keyboard_one);
67 | tv[2]= (TextView)view.findViewById(R.id.pay_keyboard_two);
68 | tv[3] = (TextView)view.findViewById(R.id.pay_keyboard_three);
69 | tv[4] = (TextView)view.findViewById(R.id.pay_keyboard_four);
70 | tv[5]= (TextView)view.findViewById(R.id.pay_keyboard_five);
71 | tv[6] = (TextView)view.findViewById(R.id.pay_keyboard_sex);
72 | tv[7] = (TextView)view.findViewById(R.id.pay_keyboard_seven);
73 | tv[8]= (TextView)view.findViewById(R.id.pay_keyboard_eight);
74 | tv[9] = (TextView)view.findViewById(R.id.pay_keyboard_nine);
75 | iv_del= (ImageView)view.findViewById(R.id.pay_keyboard_del);
76 | paypass_close= (ImageView)view.findViewById(R.id.paypass_close);
77 | for(int i=0;i<10;i++){
78 | tv[i].setOnClickListener(this);
79 | }
80 | iv_del.setOnClickListener(this);
81 | addView(view);
82 | }
83 |
84 | //设置监听方法,在第6位输入完成后触发
85 | public void setOnFinishInput(final OnPasswordInputFinish pass) {
86 | this.passwordInputFinish = pass;
87 | tvList[5].addTextChangedListener(new TextWatcher() {
88 | @Override
89 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
90 |
91 | }
92 | @Override
93 | public void onTextChanged(CharSequence s, int start, int before, int count) {
94 |
95 | }
96 | @Override
97 | public void afterTextChanged(Editable s) {
98 | if (s.toString().length() == 1) {
99 | strPassword = ""; //每次触发都要先将strPassword置空,再重新获取,避免由于输入删除再输入造成混乱
100 | for (int i = 0; i < 6; i++) {
101 | strPassword += tvList[i].getText().toString().trim();
102 | }
103 | passwordInputFinish.inputFinish(); //接口中要实现的方法,完成密码输入完成后的响应逻辑
104 | }
105 | }
106 | });
107 | }
108 | @Override
109 | public void onClick(View v) {
110 | int i = v.getId();
111 | if (i == R.id.pay_keyboard_one) {
112 | getPass("1");
113 |
114 | } else if (i == R.id.pay_keyboard_two) {
115 | getPass("2");
116 |
117 | } else if (i == R.id.pay_keyboard_three) {
118 | getPass("3");
119 |
120 | } else if (i == R.id.pay_keyboard_four) {
121 | getPass("4");
122 |
123 | } else if (i == R.id.pay_keyboard_five) {
124 | getPass("5");
125 |
126 | } else if (i == R.id.pay_keyboard_sex) {
127 | getPass("6");
128 |
129 | } else if (i == R.id.pay_keyboard_seven) {
130 | getPass("7");
131 |
132 | } else if (i == R.id.pay_keyboard_eight) {
133 | getPass("8");
134 |
135 | } else if (i == R.id.pay_keyboard_nine) {
136 | getPass("9");
137 |
138 | } else if (i == R.id.pay_keyboard_zero) {
139 | getPass("0");
140 |
141 | } else if (i == R.id.pay_keyboard_del) {
142 | if (currentIndex - 1 >= -1) { //判断是否删除完毕————要小心数组越界
143 | tvList[currentIndex--].setText("");
144 | }
145 |
146 | }
147 | }
148 | public void getPass(String str){
149 | if (currentIndex >= -1 && currentIndex < 5) {
150 | tvList[++currentIndex].setText(str);
151 | }
152 | if(currentIndex==0){
153 | passwordInputFinish.inputFirst();
154 | }
155 | }
156 |
157 | public String getStrPassword() {
158 | return strPassword;
159 | }
160 | public void clearText() {
161 | for (TextView textview:tvList) {
162 | textview.setText("");
163 | }
164 | currentIndex=-1;
165 | }
166 |
167 | }
168 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/java/com/hgj/paydialog/view/PayDialog.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog.view;
2 |
3 | ////////////////////////////////////////////////////////////////////
4 | // _ooOoo_ //
5 | // o8888888o //
6 | // 88" . "88 //
7 | // (| ^_^ |) //
8 | // O\ = /O //
9 | // ____/`---'\____ //
10 | // .' \\| |// `. //
11 | // / \\||| : |||// \ //
12 | // / _||||| -:- |||||- \ //
13 | // | | \\\ - /// | | //
14 | // | \_| ''\---/'' | | //
15 | // \ .-\__ `-` ___/-. / //
16 | // ___`. .' /--.--\ `. . ___ //
17 | // ."" '< `.___\_<|>_/___.' >'"". //
18 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | //
19 | // \ \ `-. \_ __\ /__ _/ .-` / / //
20 | // ========`-.____`-.___\_____/___.-`____.-'======== //
21 | // `=---=' //
22 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
23 | // 佛祖保佑 永无BUG 永不修改 //
24 | ////////////////////////////////////////////////////////////////////
25 |
26 | import android.animation.Animator;
27 | import android.app.Dialog;
28 | import android.content.Context;
29 | import android.os.Bundle;
30 | import android.support.annotation.NonNull;
31 | import android.view.Gravity;
32 | import android.view.View;
33 | import android.view.Window;
34 | import android.view.WindowManager;
35 | import android.widget.TextView;
36 |
37 | import com.daimajia.androidanimations.library.Techniques;
38 | import com.daimajia.androidanimations.library.YoYo;
39 | import com.hgj.paydialog.R;
40 |
41 | /**
42 | * ==========================================
43 | * 作 者:何高建
44 | * 日 期:2018/3/19
45 | * 描 述:
46 | * ===========================================
47 | */
48 |
49 | public class PayDialog extends Dialog implements OnPasswordInputFinish{
50 | public PayPassView payPassView;
51 | PayInterface payInterface;
52 | boolean isclear = false;
53 | String content;
54 | private int colorId;
55 | public PayDialog(@NonNull Context context, String content, PayInterface payInterface) {
56 | // 在构造方法里, 传入主题
57 | super(context, R.style.BottomDialogStyle);
58 | this.content = content;
59 | this.payInterface = payInterface;
60 | // 拿到Dialog的Window, 修改Window的属性
61 | Window window = getWindow();
62 | window.getDecorView().setPadding(0, 0, 0, 0);
63 | // 获取Window的LayoutParams
64 | setCancelable(false);
65 | setCanceledOnTouchOutside(false);
66 | WindowManager.LayoutParams attributes = window.getAttributes();
67 | attributes.width = WindowManager.LayoutParams.MATCH_PARENT;
68 | attributes.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
69 | // 一定要重新设置, 才能生效
70 | window.setAttributes(attributes);
71 | }
72 |
73 | @Override
74 | protected void onCreate(Bundle savedInstanceState) {
75 | super.onCreate(savedInstanceState);
76 | //初始化
77 | payPassView = new PayPassView(getContext());
78 | //设置内容 如支付金额:80元
79 | payPassView.content.setText(content);
80 | if(colorId!=0){
81 | payPassView.progress.setArcColor(colorId);
82 | }
83 | setContentView(payPassView);
84 | payPassView.setOnFinishInput(this);
85 | payPassView.paypass_close.setOnClickListener(new View.OnClickListener() {
86 | @Override
87 | public void onClick(View view) {
88 | ////当progress显示时,说明在请求网络,这时点击关闭不作处理
89 | if(payPassView.progress.getVisibility()!=View.VISIBLE) {
90 | cancel();
91 | }
92 | }
93 | });
94 | payPassView.progress.setOnPasswordCorrectlyListener(new MDProgressBar.OnPasswordCorrectlyListener() {
95 | @Override
96 | public void onPasswordCorrectly() {
97 | //progress动画完成后 回调
98 | if(payInterface!=null){
99 | payInterface.onSucc();
100 | }
101 | }
102 | });
103 | payPassView.forget.setOnClickListener(new View.OnClickListener() {
104 | @Override
105 | public void onClick(View v) {
106 | if(payInterface!=null){
107 | payInterface.onForget();
108 | }
109 | }
110 | });
111 | }
112 |
113 | @Override
114 | public void inputFinish() {
115 | payPassView.progress.setVisibility(View.VISIBLE);
116 | payPassView.keyboard.setVisibility(View.INVISIBLE);
117 | if(payInterface!=null){
118 | payInterface.Payfinish(payPassView.getStrPassword());
119 | }
120 | }
121 |
122 | @Override
123 | public void inputFirst() {
124 | payPassView.tips.setVisibility(View.INVISIBLE);
125 | }
126 | public interface PayInterface{
127 | public void Payfinish(String password);
128 | public void onSucc();
129 | public void onForget();
130 | }
131 | public void setError(String errorText){
132 | payPassView.tips.setVisibility(View.VISIBLE);
133 | payPassView.tips.setText(errorText);
134 | check();
135 | }
136 |
137 | public void setSucc(){
138 | payPassView.progress.setSuccessfullyStatus();
139 | }
140 |
141 | public void check(){
142 | isclear = false;
143 | TextView[] textViews = payPassView.tvList;
144 | isclear = false;
145 | for (TextView textview:textViews) {
146 | YoYo.with(Techniques.Shake)
147 | .duration(500)
148 | .repeat(0)
149 | .onEnd(new YoYo.AnimatorCallback() {
150 | @Override
151 | public void call(Animator animator) {
152 | if(!isclear){
153 | payPassView.clearText();
154 | payPassView.progress.setVisibility(View.GONE);
155 | payPassView.keyboard.setVisibility(View.VISIBLE);
156 | isclear = true;
157 | }
158 | }
159 | })
160 | .playOn(textview);
161 | }
162 | YoYo.with(Techniques.Shake)
163 | .duration(500)
164 | .repeat(0)
165 | .playOn(payPassView.tips);
166 | }
167 |
168 | /**
169 | * 设置progress的颜色
170 | */
171 | public void setColorId(int colorId) {
172 | this.colorId = colorId;
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/java/com/hgj/paydialog/view/MDProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.hgj.paydialog.view;
2 |
3 | import android.animation.Animator;
4 | import android.animation.Animator.AnimatorListener;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ValueAnimator;
7 | import android.animation.ValueAnimator.AnimatorUpdateListener;
8 | import android.content.Context;
9 | import android.content.res.TypedArray;
10 | import android.graphics.Canvas;
11 | import android.graphics.Color;
12 | import android.graphics.Paint;
13 | import android.graphics.RectF;
14 | import android.util.AttributeSet;
15 | import android.view.View;
16 | import android.view.animation.Animation;
17 | import android.view.animation.DecelerateInterpolator;
18 | import android.view.animation.LinearInterpolator;
19 | import android.view.animation.Transformation;
20 |
21 | import com.hgj.paydialog.R;
22 |
23 | /**
24 | * ==========================================
25 | * 作 者:何高建
26 | * 日 期:2018/3/19
27 | * 描 述:
28 | * ===========================================
29 | */
30 |
31 | public class MDProgressBar extends View {
32 |
33 | private final static String TAG = MDProgressBar.class.getSimpleName();
34 |
35 | private static final float DEFAULT_MAX_ANGLE = -305f;
36 |
37 | private static final float DEFAULT_MIN_ANGLE = -19f;
38 |
39 | //默认的动画时间
40 | private static final int DEFAULT_DURATION = 660;
41 |
42 | private final static int DEFAULT_ARC_COLOR = Color.BLUE;
43 | //圆弧颜色
44 | private int arcColor = DEFAULT_ARC_COLOR;
45 |
46 | private AnimatorSet animatorSet;
47 |
48 | private float mBorderWidth;
49 |
50 | private Paint mPaint;
51 |
52 | private RectF arcRectF;
53 |
54 | private float startAngle = -45f;
55 |
56 | private float sweepAngle = -19f;
57 |
58 | private float incrementAngele = 0;
59 | //是否需要开始绘制对勾
60 | private boolean isNeedTick = false;
61 |
62 | private int mResize;
63 |
64 | private TickAnimation mTickAnimation;
65 | //判断"对勾"动画是否过半,"对勾"由两条线绘制而成。
66 | private boolean isAnimationOverHalf = false;
67 | //圆形进度条的半径
68 | private float mRadius;
69 |
70 | private float startY1;
71 |
72 | private float startX1;
73 |
74 | private float stopX1;
75 |
76 | private float stopY1;
77 |
78 | private float stopX2;
79 |
80 | private float stopY2;
81 |
82 | private OnPasswordCorrectlyListener mListener;
83 |
84 | public MDProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
85 | super(context, attrs, defStyleAttr);
86 | init(context, attrs);
87 | }
88 |
89 | public MDProgressBar(Context context, AttributeSet attrs) {
90 | super(context, attrs);
91 | init(context, attrs);
92 | }
93 |
94 | private void init(Context context, AttributeSet attrs) {
95 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.materialStatusProgressAttr);
96 | arcColor = typedArray.getColor(R.styleable.materialStatusProgressAttr_arcColor, Color.parseColor("#4a90e2"));
97 | mBorderWidth = typedArray.getDimension(R.styleable.materialStatusProgressAttr_progressBarBorderWidth,
98 | getResources().getDimension(R.dimen.material_status_progress_border));
99 | typedArray.recycle();
100 | mPaint = new Paint();
101 | mPaint.setColor(arcColor);
102 | mPaint.setStrokeWidth(mBorderWidth);
103 | mPaint.setAntiAlias(true);
104 | mPaint.setStyle(Paint.Style.STROKE);
105 | arcRectF = new RectF();
106 | mTickAnimation = new TickAnimation();
107 | mTickAnimation.setDuration(800);
108 | //对勾动画监听
109 | mTickAnimation.setAnimationListener(new Animation.AnimationListener() {
110 | @Override
111 | public void onAnimationStart(Animation animation) {
112 |
113 | }
114 |
115 | @Override
116 | public void onAnimationEnd(Animation animation) {
117 | //当对勾动画完成后,延迟一秒回掉,不然动画效果不明显
118 | if (mListener != null) {
119 | postDelayed(new Runnable() {
120 | @Override
121 | public void run() {
122 | mListener.onPasswordCorrectly();
123 |
124 | }
125 | }, 1000);
126 | }
127 | }
128 |
129 | @Override
130 | public void onAnimationRepeat(Animation animation) {
131 |
132 | }
133 | });
134 | }
135 |
136 | private void arcPaint() {
137 | mPaint.reset();
138 | mPaint.setColor(arcColor);
139 | mPaint.setStrokeWidth(mBorderWidth);
140 | mPaint.setAntiAlias(true);
141 | mPaint.setStyle(Paint.Style.STROKE);
142 | }
143 |
144 | private void linePaint() {
145 | mPaint.reset();
146 | mPaint.setColor(arcColor);
147 | mPaint.setStrokeWidth(mBorderWidth);
148 | mPaint.setAntiAlias(true);
149 | }
150 | //对勾动画完成回调
151 | public void setOnPasswordCorrectlyListener(OnPasswordCorrectlyListener listener) {
152 | this.mListener = listener;
153 | }
154 |
155 | @Override
156 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
157 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
158 | startY1 = getMeasuredHeight() / 2;
159 | mRadius = getMeasuredHeight() / 2 - 2 * mBorderWidth;
160 | startX1 = startY1 - getMeasuredHeight() / 5;
161 | }
162 |
163 | @Override
164 | protected void onDraw(Canvas canvas) {
165 | super.onDraw(canvas);
166 | arcPaint();
167 | canvas.drawArc(arcRectF, startAngle + incrementAngele, sweepAngle, false, mPaint);
168 | if (animatorSet == null || !animatorSet.isRunning() && !isNeedTick) {
169 | startAnimation();
170 | }
171 | if (isNeedTick) {
172 | //补全圆
173 | arcPaint();
174 | canvas.drawArc(arcRectF, startAngle + incrementAngele + sweepAngle, 360 - sweepAngle, false, mPaint);
175 | linePaint();
176 | //画第一根线
177 | canvas.drawLine(startX1, startY1, stopX1, stopY1, mPaint);
178 | if (isAnimationOverHalf) {
179 | //-2 +2 是为了两根线尽可能靠拢
180 | canvas.drawLine(stopX1 - 2, stopY1 + 2, stopX2, stopY2, mPaint);
181 | }
182 | }
183 | }
184 | //对勾动画
185 | private class TickAnimation extends Animation {
186 |
187 | @Override
188 | protected void applyTransformation(final float interpolatedTime, Transformation t) {
189 | super.applyTransformation(interpolatedTime, t);
190 | if (interpolatedTime <= 0.5f) {
191 | stopX1 = startX1 + mRadius / 3 * interpolatedTime * 2;
192 | stopY1 = startY1 + mRadius / 3 * interpolatedTime * 2;
193 | isAnimationOverHalf = false;
194 | } else {
195 | stopX2 = stopX1 + (mRadius - 20) * (interpolatedTime - 0.5f) * 2;
196 | stopY2 = stopY1 - (mRadius - 20) * (interpolatedTime - 0.5f) * 2;
197 | isAnimationOverHalf = true;
198 | }
199 | invalidate();
200 | }
201 | }
202 |
203 | @Override
204 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
205 | super.onSizeChanged(w, h, oldw, oldh);
206 | mResize = (w < h) ? w : h;
207 | setBound();
208 | }
209 |
210 | private void setBound() {
211 | int paddingLeft = getPaddingLeft();
212 | int paddingTop = getPaddingTop();
213 | arcRectF.set(paddingLeft + mBorderWidth, paddingTop + mBorderWidth, mResize - paddingLeft - mBorderWidth, mResize - paddingTop - mBorderWidth);
214 | }
215 |
216 | public void startAnimation() {
217 | isNeedTick = false;
218 | if (animatorSet != null && animatorSet.isRunning()) {
219 | animatorSet.cancel();
220 | }
221 | if (animatorSet == null) {
222 | animatorSet = new AnimatorSet();
223 | }
224 | AnimatorSet set = loopAnimator();
225 | animatorSet.play(set);
226 | animatorSet.addListener(new AnimatorListener() {
227 |
228 | private boolean isCancel = false;
229 |
230 | @Override
231 | public void onAnimationStart(Animator animation) {
232 |
233 | }
234 |
235 | @Override
236 | public void onAnimationRepeat(Animator animation) {
237 | }
238 |
239 | @Override
240 | public void onAnimationEnd(Animator animation) {
241 | if (!isCancel) {
242 | startAnimation();
243 | }
244 | }
245 |
246 | @Override
247 | public void onAnimationCancel(Animator animation) {
248 | isCancel = true;
249 | }
250 | });
251 | animatorSet.start();
252 | }
253 |
254 | /**
255 | * 进度条旋转的动画
256 | */
257 | private AnimatorSet loopAnimator() {
258 | //从小圈到大圈
259 | ValueAnimator holdAnimator1 = ValueAnimator.ofFloat(incrementAngele + DEFAULT_MIN_ANGLE, incrementAngele + 115f);
260 | holdAnimator1.addUpdateListener(new AnimatorUpdateListener() {
261 | @Override
262 | public void onAnimationUpdate(ValueAnimator animation) {
263 | incrementAngele = (float) animation.getAnimatedValue();
264 | }
265 | });
266 | holdAnimator1.setDuration(DEFAULT_DURATION);
267 | holdAnimator1.setInterpolator(new LinearInterpolator());
268 | ValueAnimator expandAnimator = ValueAnimator.ofFloat(DEFAULT_MIN_ANGLE, DEFAULT_MAX_ANGLE);
269 | expandAnimator.addUpdateListener(new AnimatorUpdateListener() {
270 | @Override
271 | public void onAnimationUpdate(ValueAnimator animation) {
272 | sweepAngle = (float) animation.getAnimatedValue();
273 | incrementAngele -= sweepAngle;
274 | invalidate();
275 | }
276 | });
277 | expandAnimator.setDuration(DEFAULT_DURATION);
278 | expandAnimator.setInterpolator(new DecelerateInterpolator(2));
279 | //从大圈到小圈
280 | ValueAnimator holdAnimator = ValueAnimator.ofFloat(startAngle, startAngle + 115f);
281 | holdAnimator.addUpdateListener(new AnimatorUpdateListener() {
282 | @Override
283 | public void onAnimationUpdate(ValueAnimator animation) {
284 | startAngle = (float) animation.getAnimatedValue();
285 | }
286 | });
287 |
288 | holdAnimator.setDuration(DEFAULT_DURATION);
289 | holdAnimator.setInterpolator(new LinearInterpolator());
290 | ValueAnimator narrowAnimator = ValueAnimator.ofFloat(DEFAULT_MAX_ANGLE, DEFAULT_MIN_ANGLE);
291 | narrowAnimator.addUpdateListener(new AnimatorUpdateListener() {
292 | @Override
293 | public void onAnimationUpdate(ValueAnimator animation) {
294 | sweepAngle = (float) animation.getAnimatedValue();
295 | invalidate();
296 | }
297 | });
298 |
299 | narrowAnimator.setDuration(DEFAULT_DURATION);
300 | narrowAnimator.setInterpolator(new DecelerateInterpolator(2));
301 |
302 | AnimatorSet set = new AnimatorSet();
303 | set.play(holdAnimator1).with(expandAnimator);
304 | set.play(holdAnimator).with(narrowAnimator).after(holdAnimator1);
305 | return set;
306 | }
307 | //清除动画
308 | private void cancelAnimator() {
309 | if (animatorSet != null) {
310 | animatorSet.cancel();
311 | isNeedTick = true;
312 | }
313 | }
314 |
315 | public void setSuccessfullyStatus() {
316 | if (animatorSet != null) {
317 | animatorSet.cancel();
318 | isNeedTick = true;
319 | startAnimation(mTickAnimation);
320 | }
321 | }
322 |
323 | @Override
324 | public void setVisibility(int visibility) {
325 | switch (visibility) {
326 | case View.VISIBLE:
327 | startAnimation();
328 | break;
329 | case View.INVISIBLE:
330 | cancelAnimator();
331 | break;
332 | case View.GONE:
333 | cancelAnimator();
334 | break;
335 | default:
336 | break;
337 | }
338 | super.setVisibility(visibility);
339 | }
340 |
341 | public void setBorderWidth(int width) {
342 | this.mBorderWidth = width;
343 | }
344 |
345 | public void setArcColor(int color) {
346 | this.arcColor = color;
347 | }
348 |
349 | public interface OnPasswordCorrectlyListener {
350 | void onPasswordCorrectly();
351 | }
352 |
353 | }
--------------------------------------------------------------------------------
/PayDialog/paydialog/src/main/res/layout/pay_pass.xml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
20 |
30 |
31 |
32 |
36 |
37 |
46 |
54 |
55 |
61 |
62 |
66 |
67 |
73 |
74 |
78 |
79 |
85 |
86 |
90 |
91 |
97 |
98 |
102 |
103 |
109 |
110 |
114 |
115 |
121 |
122 |
127 |
137 |
148 |
149 |
150 |
151 |
152 |
155 |
162 |
166 |
171 |
172 |
184 |
185 |
199 |
200 |
212 |
213 |
214 |
219 |
220 |
232 |
233 |
247 |
248 |
260 |
261 |
262 |
267 |
268 |
280 |
281 |
295 |
296 |
308 |
309 |
310 |
315 |
316 |
327 |
328 |
339 |
340 |
350 |
351 |
352 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
--------------------------------------------------------------------------------