├── 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
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── fingerth
│ │ │ └── suputils
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── fingerth
│ │ │ └── suputils
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── fingerth
│ │ └── suputils
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── FingerthDialogUtilsLibrary
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── styles.xml
│ │ │ ├── colors.xml
│ │ │ └── attr_progressbar.xml
│ │ ├── drawable-hdpi
│ │ │ ├── dialog_tip.png
│ │ │ ├── dialog_error.png
│ │ │ └── dialog_success.png
│ │ ├── drawable
│ │ │ ├── selector_gray.xml
│ │ │ ├── selector_green.xml
│ │ │ ├── selector_tip_color.xml
│ │ │ ├── selector_error_red.xml
│ │ │ ├── drawable_round_green.xml
│ │ │ ├── drawable_round_error_red.xml
│ │ │ ├── drawable_round_green_dark.xml
│ │ │ ├── drawable_round_error_red_dark.xml
│ │ │ ├── drawable_round_white.xml
│ │ │ ├── drawable_round_gray.xml
│ │ │ ├── drawable_round_gray_dark.xml
│ │ │ ├── drawable_round_tip.xml
│ │ │ ├── drawable_round_white_dd.xml
│ │ │ └── drawable_round_tip_dark.xml
│ │ └── layout
│ │ │ ├── dialog_progress_view.xml
│ │ │ ├── dialog_round_progressbar_view.xml
│ │ │ ├── dialog_horizontal_progressbar_view.xml
│ │ │ ├── dialog_alert_view.xml
│ │ │ └── dialog_confirm_alert_view.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── fingerth
│ │ └── supdialogutils
│ │ ├── utils
│ │ └── SupDialogStaticUtils.java
│ │ ├── progressbar
│ │ ├── round
│ │ │ └── RoundWidthNumberProgressBar.java
│ │ └── horizontal
│ │ │ └── HorizontalWithNumberProgressBar.java
│ │ └── SYSDiaLogUtils.java
├── build.gradle
└── proguard-rules.pro
├── settings.gradle
├── pic
├── pro_01.jpg
├── pro_02.jpg
├── pro_03.jpg
├── pro_04.jpg
├── pro_05.jpg
├── pro_06.jpg
├── pro_07.jpg
├── pro_08.jpg
├── pro_09.jpg
└── pro_10.jpg
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── gradlew
└── README.md
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':FingerthDialogUtilsLibrary'
2 |
--------------------------------------------------------------------------------
/pic/pro_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_01.jpg
--------------------------------------------------------------------------------
/pic/pro_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_02.jpg
--------------------------------------------------------------------------------
/pic/pro_03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_03.jpg
--------------------------------------------------------------------------------
/pic/pro_04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_04.jpg
--------------------------------------------------------------------------------
/pic/pro_05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_05.jpg
--------------------------------------------------------------------------------
/pic/pro_06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_06.jpg
--------------------------------------------------------------------------------
/pic/pro_07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_07.jpg
--------------------------------------------------------------------------------
/pic/pro_08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_08.jpg
--------------------------------------------------------------------------------
/pic/pro_09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_09.jpg
--------------------------------------------------------------------------------
/pic/pro_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/pic/pro_10.jpg
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FingerthAndroidUtils
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FingerthDialogUtilsLibrary
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/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/fingerth/FingerthAndroidUtils/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/fingerth/FingerthAndroidUtils/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/fingerth/FingerthAndroidUtils/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/fingerth/FingerthAndroidUtils/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_tip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_tip.png
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_error.png
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fingerth/FingerthAndroidUtils/HEAD/FingerthDialogUtilsLibrary/src/main/res/drawable-hdpi/dialog_success.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jul 11 14:13:41 CST 2017
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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/selector_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/selector_green.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/selector_tip_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/selector_error_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/fingerth/suputils/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.suputils;
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 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_green.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_error_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_green_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_error_red_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_gray_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_tip.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_white_dd.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/drawable/drawable_round_tip_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | apply plugin: 'com.github.dcendents.android-maven'
4 | group='com.github.fingerth'
5 |
6 | android {
7 | compileSdkVersion 25
8 | buildToolsVersion "25.0.3"
9 |
10 | defaultConfig {
11 | minSdkVersion 14
12 | targetSdkVersion 25
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 | compile 'com.android.support:appcompat-v7:25.3.1'
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/fingerth/suputils/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.suputils;
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.fingerth.suputils", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #000000
5 | #ff0000
6 |
7 | #00000000
8 |
9 |
10 | #FFFFFF
11 | #F8F8F8
12 | #F4F4F4
13 | #DDDDDD
14 | #EEEEEE
15 |
16 |
17 | #24292B
18 | #333333
19 | #A3A3A3
20 | #6c6c6c
21 | #636363
22 | #808080
23 |
24 |
25 | #808080
26 |
27 | #FF5252
28 | #FF2525
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\AndroidStudio\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 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.fingerth.suputils"
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile project(':FingerthDialogUtilsLibrary')
28 | compile 'com.android.support:appcompat-v7:25.3.1'
29 | testCompile 'junit:junit:4.12'
30 | }
31 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\AndroidStudio\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 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/values/attr_progressbar.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 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/layout/dialog_progress_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
23 |
24 |
31 |
32 |
43 |
44 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/java/com/fingerth/supdialogutils/utils/SupDialogStaticUtils.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.supdialogutils.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.util.DisplayMetrics;
6 | import android.util.TypedValue;
7 |
8 | public class SupDialogStaticUtils {
9 |
10 | public static final String TAG = "SupDialogStaticUtils";
11 |
12 | private static int sysWidth = 0;
13 | private static int sysHeight = 0;
14 |
15 | /**
16 | * 获取手机的分比率,高和宽
17 | */
18 | private static void getScreen(Activity activity) {
19 | if (SupDialogStaticUtils.sysWidth <= 0 || SupDialogStaticUtils.sysHeight <= 0) {
20 | DisplayMetrics dm = new DisplayMetrics();
21 | activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
22 | SupDialogStaticUtils.sysWidth = dm.widthPixels;
23 | SupDialogStaticUtils.sysHeight = dm.heightPixels;
24 | }
25 | }
26 |
27 | public static int getScreenWidth(Activity activity) {
28 | getScreen(activity);
29 | return SupDialogStaticUtils.sysWidth;
30 | }
31 |
32 | public static int getScreenHeight(Activity activity) {
33 | getScreen(activity);
34 | return SupDialogStaticUtils.sysHeight;
35 | }
36 |
37 | public static int getStatusBarHeight(Context c) {
38 | int result = 0;
39 | int resourceId = c.getResources().getIdentifier("status_bar_height", "dimen", "android");
40 | if (resourceId > 0) {
41 | result = c.getResources().getDimensionPixelSize(resourceId);
42 | }
43 | return result;
44 | }
45 |
46 |
47 | public static int dp2px(Context context, int dp) {
48 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
49 | }
50 |
51 | public static int dp2px(Context context, float dp) {
52 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
53 | }
54 |
55 |
56 | public static int sp2px(Context context, int sp) {
57 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, context.getResources().getDisplayMetrics());
58 |
59 | }
60 |
61 | public static int px2dip(Context context, float pxValue) {
62 | final float scale = context.getResources().getDisplayMetrics().density;
63 | return (int) (pxValue / scale + 0.5f);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/layout/dialog_round_progressbar_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
24 |
25 |
26 |
39 |
40 |
41 |
42 |
53 |
54 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/layout/dialog_horizontal_progressbar_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
24 |
25 |
34 |
35 |
44 |
45 |
49 |
50 |
60 |
61 |
62 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/layout/dialog_alert_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
27 |
28 |
29 |
40 |
41 |
50 |
51 |
52 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/.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 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 1.8
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/res/layout/dialog_confirm_alert_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
27 |
28 |
29 |
42 |
43 |
54 |
55 |
59 |
60 |
64 |
65 |
79 |
80 |
84 |
85 |
99 |
100 |
104 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
30 |
31 |
38 |
39 |
46 |
47 |
54 |
55 |
62 |
63 |
72 |
73 |
80 |
81 |
92 |
93 |
100 |
101 |
108 |
109 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/java/com/fingerth/supdialogutils/progressbar/round/RoundWidthNumberProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.supdialogutils.progressbar.round;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.graphics.RectF;
8 | import android.util.AttributeSet;
9 |
10 | import com.fingerth.supdialogutils.R;
11 | import com.fingerth.supdialogutils.progressbar.horizontal.HorizontalWithNumberProgressBar;
12 | import com.fingerth.supdialogutils.utils.SupDialogStaticUtils;
13 |
14 | /**
15 | * ======================================================
16 | * Created by Administrator able_fingerth on 2017/7/13.
17 | *
18 | * 版权所有,违者必究!
19 | * <详情描述/>
20 | * 參考路徑:
21 | * http://blog.csdn.net/lmj623565791/article/details/43371299
22 | * 我自己有改善。
23 | */
24 | public class RoundWidthNumberProgressBar extends HorizontalWithNumberProgressBar {
25 |
26 | // android:layout_width="90dp"
27 | // android:layout_height="90dp"
28 | // fingerth:progressbar_reached_color="#0EFF96"
29 | // fingerth:progressbar_reached_height="2dp"
30 | // fingerth:progressbar_text_color="#0EFF96"
31 | // fingerth:progressbar_text_size="16sp"
32 | // fingerth:progressbar_unreached_color="#dddddd"
33 | // fingerth:progressbar_unreached_height="1.5dp"
34 | // fingerth:radius="43dp"
35 |
36 | //
37 |
38 | /**
39 | * mRadius of view
40 | */
41 | private int mRadius = SupDialogStaticUtils.dp2px(getContext(), 30);
42 |
43 | public RoundWidthNumberProgressBar(Context context) {
44 | this(context, null);
45 | }
46 |
47 | public RoundWidthNumberProgressBar(Context context, AttributeSet attrs) {
48 | super(context, attrs);
49 |
50 | //mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
51 | //這裡我處理下 mReachedProgressBarHeight 要大於 mUnReachedProgressBarHeight
52 | if (mUnReachedProgressBarHeight > mReachedProgressBarHeight) {
53 | mUnReachedProgressBarHeight = mReachedProgressBarHeight;
54 | }
55 |
56 | TypedArray ta = context.obtainStyledAttributes(attrs,
57 | R.styleable.RoundWidthNumberBar);
58 | mRadius = (int) ta.getDimension(
59 | R.styleable.RoundWidthNumberBar_radius, mRadius);
60 | ta.recycle();
61 |
62 | mTextSize = SupDialogStaticUtils.sp2px(getContext(), 14);
63 |
64 | mPaint.setStyle(Paint.Style.STROKE);
65 | mPaint.setAntiAlias(true);
66 | mPaint.setDither(true);
67 | mPaint.setStrokeCap(Paint.Cap.ROUND);
68 |
69 | }
70 |
71 | @Override
72 | protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
73 | int heightMode = MeasureSpec.getMode(heightMeasureSpec);
74 | int widthMode = MeasureSpec.getMode(widthMeasureSpec);
75 |
76 | int paintWidth = Math.max(mReachedProgressBarHeight, mUnReachedProgressBarHeight);
77 |
78 | if (heightMode != MeasureSpec.EXACTLY) {
79 | int exceptHeight = (int) (getPaddingTop() + getPaddingBottom() + mRadius * 2 + paintWidth);
80 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(exceptHeight, MeasureSpec.EXACTLY);
81 | }
82 | if (widthMode != MeasureSpec.EXACTLY) {
83 | int exceptWidth = (int) (getPaddingLeft() + getPaddingRight() + mRadius * 2 + paintWidth);
84 | widthMeasureSpec = MeasureSpec.makeMeasureSpec(exceptWidth, MeasureSpec.EXACTLY);
85 | }
86 |
87 | super.onMeasure(heightMeasureSpec, heightMeasureSpec);
88 |
89 | }
90 |
91 | @Override
92 | protected synchronized void onDraw(Canvas canvas) {
93 |
94 | String text = getProgress() + "%";
95 | // mPaint.getTextBounds(text, 0, text.length(), mTextBound);
96 | float textWidth = mPaint.measureText(text);
97 | float textHeight = (mPaint.descent() + mPaint.ascent()) / 2;
98 |
99 | canvas.save();
100 | canvas.translate(getPaddingLeft(), getPaddingTop());
101 | mPaint.setStyle(Paint.Style.STROKE);
102 | // draw unreaded bar
103 | mPaint.setColor(mUnReachedBarColor);
104 | mPaint.setStrokeWidth(mUnReachedProgressBarHeight);
105 | canvas.drawCircle(mRadius + mReachedProgressBarHeight / 2, mRadius + mReachedProgressBarHeight / 2, mRadius, mPaint);
106 | // draw reached bar
107 | mPaint.setColor(mReachedBarColor);
108 | mPaint.setStrokeWidth(mReachedProgressBarHeight);
109 | float sweepAngle = getProgress() * 1.0f / getMax() * 360;
110 | canvas.drawArc(new RectF(mReachedProgressBarHeight / 2, mReachedProgressBarHeight / 2, mRadius * 2 + mReachedProgressBarHeight / 2, mRadius * 2 + mReachedProgressBarHeight / 2),
111 | 270, sweepAngle, false, mPaint);
112 | // draw text
113 | mPaint.setStyle(Paint.Style.FILL);
114 | canvas.drawText(text, mRadius - textWidth / 2, mRadius - textHeight, mPaint);
115 |
116 | canvas.restore();
117 |
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fingerth/suputils/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.suputils;
2 |
3 | import android.content.DialogInterface;
4 | import android.os.AsyncTask;
5 | import android.os.Bundle;
6 | import android.os.SystemClock;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.view.View;
9 | import android.widget.ProgressBar;
10 | import android.widget.Toast;
11 |
12 | import com.fingerth.supdialogutils.SYSDiaLogUtils;
13 |
14 | public class MainActivity extends AppCompatActivity {
15 |
16 | private ProgressBar horizontal_bar;
17 | private ProgressBar round_bar;
18 | private AsyncTaskProgress asyncTaskProgress;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_main);
24 | horizontal_bar = (ProgressBar) findViewById(R.id.horizontal_bar);
25 | round_bar = (ProgressBar) findViewById(R.id.round_bar);
26 | }
27 |
28 | public void onClick1(View view) {
29 | SYSDiaLogUtils.showSuccessDialog(this, false);
30 | }
31 |
32 | public void onClick2(View view) {
33 | SYSDiaLogUtils.showSuccessDialog(this, "操作成功", "恭喜你,操作成功了!", "OK", false);
34 | }
35 |
36 | public void onClick3(View view) {
37 | SYSDiaLogUtils.showInfoDialog(this, "操作提示", "很抱歉,你還不夠硬氣!", "取消", false);
38 | }
39 |
40 | public void onClick4(View view) {
41 | SYSDiaLogUtils.showErrorDialog(this, "錯誤警告", "很抱歉,你這次真的是錯了,請重新試試!", "取消", false);
42 | }
43 |
44 | public void onClick5(View view) {
45 | SYSDiaLogUtils.showSystemProgressDialog(this, "標題", "", false, new DialogInterface.OnCancelListener() {
46 | @Override
47 | public void onCancel(DialogInterface dialog) {
48 | Toast.makeText(MainActivity.this, "點擊消失", Toast.LENGTH_SHORT).show();
49 | }
50 | });
51 | }
52 |
53 | public void onClick6(View view) {
54 | SYSDiaLogUtils.showProgressDialog(this, SYSDiaLogUtils.SYSDiaLogType.IosType, "加載中...", false, new DialogInterface.OnCancelListener() {
55 | @Override
56 | public void onCancel(DialogInterface dialog) {
57 | Toast.makeText(MainActivity.this, "點擊消失", Toast.LENGTH_SHORT).show();
58 | }
59 | });
60 | }
61 |
62 | public void onClick7(View view) {
63 | SYSDiaLogUtils.showProgressBar(this, "", "", false, new DialogInterface.OnCancelListener() {
64 | @Override
65 | public void onCancel(DialogInterface dialog) {
66 | if (SYSDiaLogUtils.getProgressBar() < 100) {
67 | if (asyncTaskProgress != null) {
68 | asyncTaskProgress.cancel(true);
69 | }
70 | SYSDiaLogUtils.showErrorDialog(MainActivity.this, "下載失敗", "由於你取消了下載,導致下載失敗!", "確定", false);
71 | }
72 | }
73 | });
74 | asyncTaskProgress = new AsyncTaskProgress();
75 | asyncTaskProgress.execute("");
76 | }
77 |
78 | public void onClick8(View view) {
79 | SYSDiaLogUtils.showProgressBar(this, SYSDiaLogUtils.SYSDiaLogType.HorizontalWithNumberProgressBar, "正在加載...");
80 | asyncTaskProgress = new AsyncTaskProgress();
81 | asyncTaskProgress.execute("");
82 | }
83 |
84 | public void onClick9(View view) {
85 | SYSDiaLogUtils.showProgressBar(this, SYSDiaLogUtils.SYSDiaLogType.RoundWidthNumberProgressBar, "正在加載...");
86 | asyncTaskProgress = new AsyncTaskProgress();
87 | asyncTaskProgress.execute("");
88 | }
89 |
90 | public void onClick10(View view) {
91 | SYSDiaLogUtils.showConfirmDialog(this, true, SYSDiaLogUtils.SYSConfirmType.Tip, "標題", "我是提示!", new SYSDiaLogUtils.ConfirmDialogListener() {
92 | @Override
93 | public void onClickButton(boolean clickLeft, boolean clickRight) {
94 | if (clickLeft) {
95 | Toast.makeText(MainActivity.this, "left", Toast.LENGTH_SHORT).show();
96 | } else if (clickRight) {
97 | Toast.makeText(MainActivity.this, "right", Toast.LENGTH_SHORT).show();
98 | }
99 | }
100 | });
101 | }
102 |
103 |
104 | private class AsyncTaskProgress extends AsyncTask {
105 | @Override
106 | protected void onPreExecute() {
107 | super.onPreExecute();
108 | }
109 |
110 | @Override
111 | protected Object doInBackground(String... params) {
112 | for (int i = 0; i < 100; i++) {
113 | SystemClock.sleep(50);
114 | publishProgress(i + 1);
115 | }
116 | return params;
117 | }
118 |
119 | @Override
120 | protected void onProgressUpdate(Integer... values) {
121 | //horizontal_bar.setProgress(values[0] % 100);
122 | SYSDiaLogUtils.setProgressBar(values[0] % 100);
123 | if (values[0] == 100) {
124 | SYSDiaLogUtils.dismissProgress();
125 | SYSDiaLogUtils.showSuccessDialog(MainActivity.this, false);
126 | }
127 | super.onProgressUpdate(values);
128 | }
129 |
130 | @Override
131 | protected void onPostExecute(Object o) {
132 | super.onPostExecute(o);
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 使用方法
2 | - Step 1. Add the JitPack repository to your build file
3 | - Add it in your root build.gradle at the end of repositories:
4 | ```
5 | allprojects {
6 | repositories {
7 | ...
8 | maven { url 'https://jitpack.io' }
9 | }
10 | }
11 | ```
12 | - Step 2. Add the dependency
13 | ```
14 | dependencies {
15 | compile 'com.github.fingerth:FingerthAndroidUtils:1.0.3'
16 | }
17 | ```
18 |
19 |
20 | ## 使用 ##
21 | - 代码1
22 |
23 | ```
24 | SYSDiaLogUtils.showSuccessDialog(this, false);
25 | ```
26 |
27 | - 效果图1
28 |
29 |
30 | 
31 |
32 |
33 | ----------
34 |
35 |
36 | - 代码2
37 |
38 | ```
39 | SYSDiaLogUtils.showSuccessDialog(this, "操作成功", "恭喜你,操作成功了!", "OK", false);
40 | ```
41 |
42 | - 效果图2
43 |
44 | 
45 |
46 | ----------
47 | - 代码3
48 |
49 | ```
50 | SYSDiaLogUtils.showInfoDialog(this, "操作提示", "很抱歉,你還不夠硬氣!", "取消", false);
51 | ```
52 |
53 | - 效果图3
54 |
55 | 
56 |
57 | ----------
58 | - 代码4
59 |
60 | ```
61 | SYSDiaLogUtils.showErrorDialog(this, "錯誤警告", "很抱歉,你這次真的是錯了,請重新試試!", "取消", false);
62 | ```
63 |
64 | - 效果图4
65 |
66 | 
67 |
68 | ----------
69 | - 代码5
70 |
71 | ```
72 | SYSDiaLogUtils.showSystemProgressDialog(this, "標題", "", false, new DialogInterface.OnCancelListener() {
73 | @Override
74 | public void onCancel(DialogInterface dialog) {
75 | Toast.makeText(MainActivity.this, "點擊消失", Toast.LENGTH_SHORT).show();
76 | }
77 | });
78 | ```
79 |
80 | - 效果图5
81 |
82 | 
83 |
84 | ----------
85 | - 代码6
86 |
87 | ```
88 | SYSDiaLogUtils.showProgressDialog(this, SYSDiaLogUtils.SYSDiaLogType.IosType, "加載中...", false, new DialogInterface.OnCancelListener() {
89 | @Override
90 | public void onCancel(DialogInterface dialog) {
91 | Toast.makeText(MainActivity.this, "點擊消失", Toast.LENGTH_SHORT).show();
92 | }
93 | });
94 | ```
95 |
96 | - 效果图6
97 |
98 | 
99 |
100 | ----------
101 | - 代码7
102 |
103 | ```
104 | SYSDiaLogUtils.showProgressBar(this, "", "", false, new DialogInterface.OnCancelListener() {
105 | @Override
106 | public void onCancel(DialogInterface dialog) {
107 | if (SYSDiaLogUtils.getProgressBar() < 100) {
108 | if (asyncTaskProgress != null) {
109 | asyncTaskProgress.cancel(true);
110 | }
111 | SYSDiaLogUtils.showErrorDialog(MainActivity.this, "下載失敗", "由於你取消了下載,導致下載失敗!", "確定", false);
112 | }
113 | }
114 | });
115 | asyncTaskProgress = new AsyncTaskProgress();
116 | asyncTaskProgress.execute("");
117 | ```
118 |
119 | - 效果图7
120 |
121 | 
122 |
123 | ----------
124 | - 代码8
125 |
126 | ```
127 | SYSDiaLogUtils.showProgressBar(this, SYSDiaLogUtils.SYSDiaLogType.HorizontalWithNumberProgressBar, "正在加載...");
128 | asyncTaskProgress = new AsyncTaskProgress();
129 | asyncTaskProgress.execute("");
130 | ```
131 |
132 | - 效果图8
133 |
134 | 
135 |
136 | ----------
137 | - 代码9
138 |
139 | ```
140 | SYSDiaLogUtils.showProgressBar(this, SYSDiaLogUtils.SYSDiaLogType.RoundWidthNumberProgressBar, "正在加載...");
141 | asyncTaskProgress = new AsyncTaskProgress();
142 | asyncTaskProgress.execute("");
143 | ```
144 |
145 | - 效果图9
146 |
147 | 
148 |
149 | ----------
150 | - 代码10
151 |
152 | ```
153 | SYSDiaLogUtils.showConfirmDialog(this, true, SYSDiaLogUtils.SYSConfirmType.Tip, "標題", "我是提示!", new SYSDiaLogUtils.ConfirmDialogListener() {
154 | @Override
155 | public void onClickButton(boolean clickLeft, boolean clickRight) {
156 | if (clickLeft) {
157 | Toast.makeText(MainActivity.this, "left", Toast.LENGTH_SHORT).show();
158 | } else if (clickRight) {
159 | Toast.makeText(MainActivity.this, "right", Toast.LENGTH_SHORT).show();
160 | }
161 | }
162 | });
163 | ```
164 |
165 | - 效果图10
166 |
167 | 
168 |
169 |
170 | ----------
171 | - AsyncTaskProgress 的代码
172 |
173 | ```
174 | private AsyncTaskProgress asyncTaskProgress;
175 |
176 | private class AsyncTaskProgress extends AsyncTask {
177 | @Override
178 | protected void onPreExecute() {
179 | super.onPreExecute();
180 | }
181 |
182 | @Override
183 | protected Object doInBackground(String... params) {
184 | for (int i = 0; i < 100; i++) {
185 | SystemClock.sleep(50);
186 | publishProgress(i + 1);
187 | }
188 | return params;
189 | }
190 |
191 | @Override
192 | protected void onProgressUpdate(Integer... values) {
193 | //horizontal_bar.setProgress(values[0] % 100);
194 | SYSDiaLogUtils.setProgressBar(values[0] % 100);
195 | if (values[0] == 100) {
196 | SYSDiaLogUtils.dismissProgress();
197 | SYSDiaLogUtils.showSuccessDialog(MainActivity.this, false);
198 | }
199 | super.onProgressUpdate(values);
200 | }
201 |
202 | @Override
203 | protected void onPostExecute(Object o) {
204 | super.onPostExecute(o);
205 | }
206 | }
207 | }
208 | ```
209 | ## 小结一下 ##
210 | - 对话框,我一般都用系统提供的了,自定义bug太多,没有Google提供的稳定。
211 | - 其实我还写了很多方法,代码很简单,入门级。
212 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/java/com/fingerth/supdialogutils/progressbar/horizontal/HorizontalWithNumberProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.supdialogutils.progressbar.horizontal;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.util.AttributeSet;
8 | import android.widget.ProgressBar;
9 |
10 | import com.fingerth.supdialogutils.R;
11 | import com.fingerth.supdialogutils.utils.SupDialogStaticUtils;
12 |
13 | /**
14 | * ======================================================
15 | * Created by Administrator able_fingerth on 2017/7/13.
16 | *
17 | * 版权所有,违者必究!
18 | * <详情描述/>
19 | * 參考路徑:
20 | * http://blog.csdn.net/lmj623565791/article/details/43371299
21 | */
22 | public class HorizontalWithNumberProgressBar extends ProgressBar {
23 |
24 | private static final int DEFAULT_TEXT_SIZE = 10;
25 | private static final int DEFAULT_TEXT_COLOR = 0XFFFC00D1;
26 | private static final int DEFAULT_COLOR_UNREACHED_COLOR = 0xFFd3d6da;
27 | private static final int DEFAULT_HEIGHT_REACHED_PROGRESS_BAR = 2;
28 | private static final int DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR = 2;
29 | private static final int DEFAULT_SIZE_TEXT_OFFSET = 10;
30 |
31 | /**
32 | * painter of all drawing things
33 | */
34 | protected Paint mPaint = new Paint();
35 | /**
36 | * color of progress number
37 | */
38 | protected int mTextColor = DEFAULT_TEXT_COLOR;
39 | /**
40 | * size of text (sp)
41 | */
42 | protected int mTextSize = SupDialogStaticUtils.sp2px(getContext(), DEFAULT_TEXT_SIZE);
43 |
44 | /**
45 | * offset of draw progress
46 | */
47 | protected int mTextOffset = SupDialogStaticUtils.dp2px(getContext(), DEFAULT_SIZE_TEXT_OFFSET);
48 |
49 | /**
50 | * height of reached progress bar
51 | */
52 | protected int mReachedProgressBarHeight = SupDialogStaticUtils.dp2px(getContext(), DEFAULT_HEIGHT_REACHED_PROGRESS_BAR);
53 |
54 | /**
55 | * color of reached bar
56 | */
57 | protected int mReachedBarColor = DEFAULT_TEXT_COLOR;
58 | /**
59 | * color of unreached bar
60 | */
61 | protected int mUnReachedBarColor = DEFAULT_COLOR_UNREACHED_COLOR;
62 | /**
63 | * height of unreached progress bar
64 | */
65 | protected int mUnReachedProgressBarHeight = SupDialogStaticUtils.dp2px(getContext(), DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR);
66 | /**
67 | * view width except padding
68 | */
69 | protected int mRealWidth;
70 |
71 | protected boolean mIfDrawText = true;
72 |
73 | protected static final int VISIBLE = 0;
74 |
75 | public HorizontalWithNumberProgressBar(Context context, AttributeSet attrs) {
76 | this(context, attrs, 0);
77 | }
78 |
79 | public HorizontalWithNumberProgressBar(Context context, AttributeSet attrs, int defStyle) {
80 | super(context, attrs, defStyle);
81 |
82 | setHorizontalScrollBarEnabled(true);
83 |
84 | obtainStyledAttributes(attrs);
85 |
86 | mPaint.setTextSize(mTextSize);
87 | mPaint.setColor(mTextColor);
88 |
89 | }
90 |
91 | /**
92 | * get the styled attributes
93 | *
94 | * @param attrs
95 | */
96 | private void obtainStyledAttributes(AttributeSet attrs) {
97 | // init values from custom attributes
98 | final TypedArray attributes = getContext().obtainStyledAttributes(
99 | attrs, R.styleable.HorizontalWithNumberProgressBar);
100 |
101 | mTextColor = attributes
102 | .getColor(R.styleable.HorizontalWithNumberProgressBar_progressbar_text_color,
103 | DEFAULT_TEXT_COLOR);
104 | mTextSize = (int) attributes.getDimension(
105 | R.styleable.HorizontalWithNumberProgressBar_progressbar_text_size,
106 | mTextSize);
107 |
108 | mReachedBarColor = attributes
109 | .getColor(
110 | R.styleable.HorizontalWithNumberProgressBar_progressbar_reached_color,
111 | mTextColor);
112 | mUnReachedBarColor = attributes
113 | .getColor(
114 | R.styleable.HorizontalWithNumberProgressBar_progressbar_unreached_color,
115 | DEFAULT_COLOR_UNREACHED_COLOR);
116 | mReachedProgressBarHeight = (int) attributes
117 | .getDimension(
118 | R.styleable.HorizontalWithNumberProgressBar_progressbar_reached_height,
119 | mReachedProgressBarHeight);
120 | mUnReachedProgressBarHeight = (int) attributes
121 | .getDimension(
122 | R.styleable.HorizontalWithNumberProgressBar_progressbar_unreached_height,
123 | mUnReachedProgressBarHeight);
124 | mTextOffset = (int) attributes
125 | .getDimension(
126 | R.styleable.HorizontalWithNumberProgressBar_progressbar_text_offset,
127 | mTextOffset);
128 |
129 | int textVisible = attributes
130 | .getInt(R.styleable.HorizontalWithNumberProgressBar_progressbar_text_visibility,
131 | VISIBLE);
132 | if (textVisible != VISIBLE) {
133 | mIfDrawText = false;
134 | }
135 | attributes.recycle();
136 | }
137 |
138 | /**
139 | * 刚才不是出onDraw里面写写就行了么,为什么要改onMeasure呢,主要是因为我们所有的属性比如进度条宽度让用户自定义了,所以我们的测量也得稍微变下。
140 | */
141 | @Override
142 | protected synchronized void onMeasure(int widthMeasureSpec,int heightMeasureSpec) {
143 | int heightMode = MeasureSpec.getMode(heightMeasureSpec);
144 |
145 | if (heightMode != MeasureSpec.EXACTLY) {
146 |
147 | float textHeight = (mPaint.descent() + mPaint.ascent());
148 | int exceptHeight = (int) (getPaddingTop() + getPaddingBottom() + Math
149 | .max(Math.max(mReachedProgressBarHeight,
150 | mUnReachedProgressBarHeight), Math.abs(textHeight)));
151 |
152 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(exceptHeight,MeasureSpec.EXACTLY);
153 | }
154 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
155 |
156 | }
157 |
158 | /**
159 | * 宽度我们不变,所以的自定义属性不涉及宽度,高度呢,只考虑不是EXACTLY的情况(用户明确指定了,我们就不管了),根据padding和进度条宽度算出自己想要的,如果非EXACTLY下,我们进行exceptHeight封装,传入给控件进行测量高度。
160 | * 测量完,就到我们的onDraw了~~~
161 | *
162 | * 其实核心方法就是onDraw了,但是呢,onDraw也很简单,绘制线、绘制文本、绘制线,结束。
163 | */
164 | @Override
165 | protected synchronized void onDraw(Canvas canvas) {
166 | canvas.save();
167 | //画笔平移到指定paddingLeft, getHeight() / 2位置,注意以后坐标都为以此为0,0
168 | canvas.translate(getPaddingLeft(), getHeight() / 2);
169 |
170 | boolean noNeedBg = false;
171 | //当前进度和总值的比例
172 | float radio = getProgress() * 1.0f / getMax();
173 | //已到达的宽度
174 | float progressPosX = (int) (mRealWidth * radio);
175 | //绘制的文本
176 | String text = getProgress() + "%";
177 |
178 | //拿到字体的宽度和高度
179 | float textWidth = mPaint.measureText(text);
180 | float textHeight = (mPaint.descent() + mPaint.ascent()) / 2;
181 |
182 | //如果到达最后,则未到达的进度条不需要绘制
183 | if (progressPosX + textWidth > mRealWidth) {
184 | progressPosX = mRealWidth - textWidth;
185 | noNeedBg = true;
186 | }
187 |
188 | // 绘制已到达的进度
189 | float endX = progressPosX - mTextOffset / 2;
190 | if (endX > 0) {
191 | mPaint.setColor(mReachedBarColor);
192 | mPaint.setStrokeWidth(mReachedProgressBarHeight);
193 | canvas.drawLine(0, 0, endX, 0, mPaint);
194 | }
195 |
196 | // 绘制文本
197 | if (mIfDrawText) {
198 | mPaint.setColor(mTextColor);
199 | canvas.drawText(text, progressPosX, -textHeight, mPaint);
200 | }
201 |
202 | // 绘制未到达的进度条
203 | if (!noNeedBg) {
204 | float start = progressPosX + mTextOffset / 2 + textWidth;
205 | mPaint.setColor(mUnReachedBarColor);
206 | mPaint.setStrokeWidth(mUnReachedProgressBarHeight);
207 | canvas.drawLine(start, 0, mRealWidth, 0, mPaint);
208 | }
209 |
210 | canvas.restore();
211 |
212 | }
213 |
214 | @Override
215 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
216 | super.onSizeChanged(w, h, oldw, oldh);
217 | mRealWidth = w - getPaddingRight() - getPaddingLeft();
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/FingerthDialogUtilsLibrary/src/main/java/com/fingerth/supdialogutils/SYSDiaLogUtils.java:
--------------------------------------------------------------------------------
1 | package com.fingerth.supdialogutils;
2 |
3 | import android.app.Activity;
4 | import android.app.ProgressDialog;
5 | import android.content.Context;
6 | import android.content.DialogInterface;
7 | import android.support.v7.app.AlertDialog;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.view.inputmethod.InputMethodManager;
11 | import android.widget.FrameLayout;
12 | import android.widget.ImageView;
13 | import android.widget.LinearLayout;
14 | import android.widget.TextView;
15 |
16 | import com.fingerth.supdialogutils.progressbar.horizontal.HorizontalWithNumberProgressBar;
17 | import com.fingerth.supdialogutils.utils.SupDialogStaticUtils;
18 |
19 |
20 | /**
21 | * ======================================================
22 | * Created by Administrator able_fingerth on 2016/10/28.
23 | *
24 | * 版权所有,违者必究!
25 | * <详情描述/>
26 | */
27 | public class SYSDiaLogUtils {
28 |
29 |
30 | ////1.成功 2.提示 3.錯誤 確認
31 | private static String loadingStr = "正在加載...";
32 | private static String successStr = "成功";
33 | private static String tipStr = "提示";
34 | private static String errorStr = "錯誤";
35 | private static String confirmStr = "確認";
36 | private static String cancelStr = "取消";
37 | private static ProgressDialog progressDialog;
38 | private static AlertDialog progressAlertDialog;
39 | private static HorizontalWithNumberProgressBar horizontalProgressBar;
40 |
41 | //4 取消 確認 對話框
42 | private static AlertDialog confirmDialog;
43 |
44 | public enum SYSDiaLogType {
45 | DefaultTpye,//默認的樣式,系統樣式
46 | IosType,//ios風格的
47 | HorizontalWithNumberProgressBar, // 進度條
48 | RoundWidthNumberProgressBar, // 圓形進度條
49 | ;
50 | }
51 |
52 | public enum SYSConfirmType {
53 | Success,//成功 綠色
54 | Tip,//提示 黃黃的
55 | Warning //警告 紅色
56 | }
57 |
58 |
59 | /**
60 | * 語言適配
61 | */
62 | public static void setLangStr(String loadingStr, String successStr, String tipStr, String errorStr, String confirmStr, String cancelStr) {
63 | SYSDiaLogUtils.loadingStr = loadingStr;
64 | SYSDiaLogUtils.successStr = successStr;
65 | SYSDiaLogUtils.tipStr = tipStr;
66 | SYSDiaLogUtils.errorStr = errorStr;
67 | SYSDiaLogUtils.confirmStr = confirmStr;
68 | SYSDiaLogUtils.cancelStr = cancelStr;
69 | }
70 |
71 | /**
72 | * 1.加載對話框部分
73 | */
74 | private static ProgressDialog pDialog;
75 | private static AlertDialog pAlertDialog;
76 |
77 | /**
78 | * @param context
79 | * @param canceledOnTouchOutside 遮罩下面控件点击是否可以點擊
80 | */
81 | private static void showDefaultProgressDialog(Activity context, SYSDiaLogType type, String title, String msg,
82 | boolean canceledOnTouchOutside, boolean cancelable, DialogInterface.OnCancelListener listener) {
83 | if (context == null || context.isFinishing()) {
84 | return;
85 | }
86 | closeKeyboardHidden(context);
87 | initDialog();
88 |
89 | if (TextUtils.isEmpty(title)) {
90 | title = "";
91 | }
92 | switch (type) {
93 | case IosType:
94 | AlertDialog.Builder progressBuilder = new AlertDialog.Builder(context, R.style.AlertDialog_Styles);
95 | View dialogView = View.inflate(context, R.layout.dialog_progress_view, null);
96 | LinearLayout dialog_progress_layout = (LinearLayout) dialogView.findViewById(R.id.dialog_progress_layout);
97 | FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) dialog_progress_layout.getLayoutParams();
98 | params.width = SupDialogStaticUtils.getScreenWidth(context) * 4 / 9;
99 | params.height = SupDialogStaticUtils.getScreenWidth(context) * 4 / 9;
100 | dialog_progress_layout.setLayoutParams(params);
101 | TextView message_tv = (TextView) dialogView.findViewById(R.id.message_tv);
102 | if (TextUtils.isEmpty(msg)) {
103 | message_tv.setVisibility(View.GONE);
104 | } else {
105 | message_tv.setText(msg);
106 | }
107 | progressBuilder.setView(dialogView);
108 | pAlertDialog = progressBuilder.create();
109 | pAlertDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
110 | pAlertDialog.setCancelable(cancelable);
111 | if (listener != null && cancelable) {
112 | pAlertDialog.setOnCancelListener(listener);
113 | }
114 | pAlertDialog.show();
115 | break;
116 | case DefaultTpye:
117 | default:
118 | if (TextUtils.isEmpty(msg)) {
119 | msg = loadingStr;
120 | }
121 | pDialog = ProgressDialog.show(context, title, msg);
122 | pDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
123 | pDialog.setCancelable(cancelable);
124 | if (listener != null && cancelable) {
125 | pDialog.setOnCancelListener(listener);
126 | }
127 | break;
128 | }
129 |
130 |
131 | }
132 |
133 | public static void dismissProgress() {
134 | initDialog();
135 | }
136 |
137 | public static void showSystemProgressDialog(Activity context, String title, String msg, boolean canceledOnTouchOutside, DialogInterface.OnCancelListener listener) {
138 | showDefaultProgressDialog(context, SYSDiaLogType.DefaultTpye, title, msg, canceledOnTouchOutside, true, listener);
139 | }
140 |
141 | public static void showSystemProgressDialog(Activity context, String title, String msg, boolean canceledOnTouchOutside, boolean cancelable) {
142 | showDefaultProgressDialog(context, SYSDiaLogType.DefaultTpye, title, msg, canceledOnTouchOutside, cancelable, null);
143 | }
144 |
145 | public static void showSystemProgressDialog(Activity context, String title, String msg) {
146 | showDefaultProgressDialog(context, SYSDiaLogType.DefaultTpye, title, msg, false, true, null);
147 | }
148 |
149 | public static void showSystemProgressDialog(Activity context, String msg) {
150 | showDefaultProgressDialog(context, SYSDiaLogType.DefaultTpye, "", msg, false, true, null);
151 | }
152 |
153 | public static void showSystemProgressDialog(Activity context) {
154 | showDefaultProgressDialog(context, SYSDiaLogType.DefaultTpye, "", "", false, true, null);
155 | }
156 |
157 | public static void showProgressDialog(Activity context, SYSDiaLogType type, String msg, boolean canceledOnTouchOutside, DialogInterface.OnCancelListener listener) {
158 | showDefaultProgressDialog(context, type, "", msg, canceledOnTouchOutside, true, listener);
159 | }
160 |
161 | public static void showProgressDialog(Activity context, SYSDiaLogType type, String msg, boolean canceledOnTouchOutside, boolean cancelable) {
162 | showDefaultProgressDialog(context, type, "", msg, canceledOnTouchOutside, cancelable, null);
163 | }
164 |
165 | public static void showProgressDialog(Activity context, SYSDiaLogType type, String msg) {
166 | showDefaultProgressDialog(context, type, "", msg, false, true, null);
167 | }
168 |
169 | public static void showProgressDialog(Activity context, SYSDiaLogType type) {
170 | showDefaultProgressDialog(context, type, "", "", false, true, null);
171 | }
172 |
173 |
174 | /**
175 | * 隐藏软键盘
176 | **/
177 | private static void closeKeyboardHidden(Activity context) {
178 | View view = context.getWindow().peekDecorView();
179 | if (view != null) {
180 | InputMethodManager inputmanger = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
181 | inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
182 | }
183 | }
184 |
185 | /**
186 | * 新的對話框彈出之前,先把舊的清除掉
187 | */
188 | private static void initDialog() {
189 | if (pDialog != null && pDialog.isShowing()) {
190 | pDialog.dismiss();
191 | pDialog = null;
192 | }
193 | if (tDialog != null && tDialog.isShowing()) {
194 | tDialog.dismiss();
195 | tDialog = null;
196 | }
197 | if (pAlertDialog != null && pAlertDialog.isShowing()) {
198 | pAlertDialog.dismiss();
199 | pAlertDialog = null;
200 | }
201 | if (progressDialog != null && progressDialog.isShowing()) {
202 | progressDialog.dismiss();
203 | progressDialog = null;
204 | }
205 | if (progressAlertDialog != null && progressAlertDialog.isShowing()) {
206 | progressAlertDialog.dismiss();
207 | progressAlertDialog = null;
208 | }
209 | if (confirmDialog != null && confirmDialog.isShowing()) {
210 | confirmDialog.dismiss();
211 | confirmDialog = null;
212 | }
213 | }
214 |
215 | /**
216 | * 2.提示對話框部分
217 | */
218 | private static AlertDialog tDialog;
219 |
220 | private static void showAlertDialog(Activity context, String title, String msg, String confirmStr, int type, boolean canceledOnTouchOutside) {
221 | if (context == null || context.isFinishing()) {
222 | return;
223 | }
224 | closeKeyboardHidden(context);
225 | initDialog();
226 |
227 | AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialog_Styles);
228 | View dialogView = View.inflate(context, R.layout.dialog_alert_view, null);
229 | LinearLayout dialog_view_layout = (LinearLayout) dialogView.findViewById(R.id.dialog_view_layout);
230 | FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) dialog_view_layout.getLayoutParams();
231 | params.width = SupDialogStaticUtils.getScreenWidth(context) * 2 / 3;
232 | dialog_view_layout.setLayoutParams(params);
233 | ImageView dialog_icon = (ImageView) dialogView.findViewById(R.id.dialog_icon);
234 |
235 | TextView confirm = (TextView) dialogView.findViewById(R.id.confirm);
236 | if (TextUtils.isEmpty(confirmStr)) {
237 | confirmStr = SYSDiaLogUtils.confirmStr;
238 | }
239 | confirm.setText(confirmStr);
240 | confirm.setOnClickListener(new View.OnClickListener() {
241 | @Override
242 | public void onClick(View v) {
243 | if (tDialog != null && tDialog.isShowing()) {
244 | tDialog.dismiss();
245 | }
246 | }
247 | });
248 | //1.成功 2.提示 3.錯誤
249 | switch (type) {
250 | case 1:
251 | if (TextUtils.isEmpty(title)) {
252 | title = SYSDiaLogUtils.successStr;
253 | }
254 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_success));
255 | //selector_green
256 | confirm.setBackgroundResource(R.drawable.selector_green);
257 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_green));
258 | break;
259 | case 2:
260 | if (TextUtils.isEmpty(title)) {
261 | title = SYSDiaLogUtils.tipStr;
262 | }
263 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_tip));
264 | confirm.setBackgroundResource(R.drawable.selector_tip_color);
265 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_tip_color));
266 | break;
267 | case 3:
268 | if (TextUtils.isEmpty(title)) {
269 | title = SYSDiaLogUtils.errorStr;
270 | }
271 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_error));
272 | confirm.setBackgroundResource(R.drawable.selector_error_red);
273 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_error_red));
274 | break;
275 | default:
276 | break;
277 | }
278 | TextView title_tv = (TextView) dialogView.findViewById(R.id.title_tv);
279 | title_tv.setText(title);
280 | TextView message_tv = (TextView) dialogView.findViewById(R.id.message_tv);
281 | if (TextUtils.isEmpty(msg)) {
282 | message_tv.setVisibility(View.GONE);
283 | } else {
284 | message_tv.setText(msg);
285 | }
286 |
287 |
288 | builder.setView(dialogView);
289 | tDialog = builder.create();
290 | tDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
291 | tDialog.show();
292 |
293 | //所需要的文件
294 | //
295 | }
296 |
297 | public static void showSuccessDialog(Activity context, String title, String msg, String confirmStr, boolean canceledOnTouchOutside) {
298 | showAlertDialog(context, title, msg, confirmStr, 1, canceledOnTouchOutside);
299 | }
300 |
301 | public static void showSuccessDialog(Activity context, String title, String confirmStr, boolean canceledOnTouchOutside) {
302 | showAlertDialog(context, title, "", confirmStr, 1, canceledOnTouchOutside);
303 | }
304 |
305 | public static void showSuccessDialog(Activity context, String confirmStr, boolean canceledOnTouchOutside) {
306 | showAlertDialog(context, "", "", confirmStr, 1, canceledOnTouchOutside);
307 | }
308 |
309 | public static void showSuccessDialog(Activity context, boolean canceledOnTouchOutside) {
310 | showAlertDialog(context, "", "", "", 1, canceledOnTouchOutside);
311 | }
312 |
313 | public static void showInfoDialog(Activity context, String title, String msg, String confirmStr, boolean canceledOnTouchOutside) {
314 | showAlertDialog(context, title, msg, confirmStr, 2, canceledOnTouchOutside);
315 | }
316 |
317 | public static void showInfoDialog(Activity context, String title, String confirmStr, boolean canceledOnTouchOutside) {
318 | showAlertDialog(context, title, "", confirmStr, 2, canceledOnTouchOutside);
319 | }
320 |
321 | public static void showInfoDialog(Activity context, String confirmStr, boolean canceledOnTouchOutside) {
322 | showAlertDialog(context, "", "", confirmStr, 2, canceledOnTouchOutside);
323 | }
324 |
325 | public static void showInfoDialog(Activity context, boolean canceledOnTouchOutside) {
326 | showAlertDialog(context, "", "", "", 2, canceledOnTouchOutside);
327 | }
328 |
329 | public static void showErrorDialog(Activity context, String title, String msg, String confirmStr, boolean canceledOnTouchOutside) {
330 | showAlertDialog(context, title, msg, confirmStr, 3, canceledOnTouchOutside);
331 | }
332 |
333 | public static void showErrorDialog(Activity context, String title, String confirmStr, boolean canceledOnTouchOutside) {
334 | showAlertDialog(context, title, "", confirmStr, 3, canceledOnTouchOutside);
335 | }
336 |
337 | public static void showErrorDialog(Activity context, String confirmStr, boolean canceledOnTouchOutside) {
338 | showAlertDialog(context, "", "", confirmStr, 3, canceledOnTouchOutside);
339 | }
340 |
341 | public static void showErrorDialog(Activity context, boolean canceledOnTouchOutside) {
342 | showAlertDialog(context, "", "", "", 3, canceledOnTouchOutside);
343 | }
344 |
345 |
346 | /**
347 | * 3.進度條部分
348 | */
349 | private static void showDefaultProgressBar(Activity context, SYSDiaLogType type, String title, String msg,
350 | boolean canceledOnTouchOutside, boolean cancelable, DialogInterface.OnCancelListener listener) {
351 | if (context == null || context.isFinishing()) {
352 | return;
353 | }
354 | closeKeyboardHidden(context);
355 | initDialog();
356 |
357 | if (TextUtils.isEmpty(title)) {
358 | title = "";
359 | }
360 | switch (type) {
361 | case HorizontalWithNumberProgressBar:
362 | AlertDialog.Builder progressBarBuilder = new AlertDialog.Builder(context, R.style.AlertDialog_Styles);
363 | View dialogView = View.inflate(context, R.layout.dialog_horizontal_progressbar_view, null);
364 | LinearLayout dialog_progress_layout = (LinearLayout) dialogView.findViewById(R.id.dialog_progress_layout);
365 | FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) dialog_progress_layout.getLayoutParams();
366 | params.width = SupDialogStaticUtils.getScreenWidth(context) * 9 / 10;
367 | params.height = SupDialogStaticUtils.dp2px(context, 120);
368 | dialog_progress_layout.setLayoutParams(params);
369 | TextView message_tv = (TextView) dialogView.findViewById(R.id.message_tv);
370 | TextView title_tv = (TextView) dialogView.findViewById(R.id.title_tv);
371 | horizontalProgressBar = (HorizontalWithNumberProgressBar) dialogView.findViewById(R.id.horizontal_bar);
372 | if (TextUtils.isEmpty(title)) {
373 | title_tv.setVisibility(View.GONE);
374 | } else {
375 | title_tv.setText(title);
376 | }
377 | if (TextUtils.isEmpty(msg)) {
378 | message_tv.setVisibility(View.GONE);
379 | } else {
380 | message_tv.setText(msg);
381 | }
382 | progressBarBuilder.setView(dialogView);
383 | progressAlertDialog = progressBarBuilder.create();
384 | progressAlertDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
385 | progressAlertDialog.setCancelable(cancelable);
386 | if (listener != null && cancelable) {
387 | progressAlertDialog.setOnCancelListener(listener);
388 | }
389 | progressAlertDialog.show();
390 | break;
391 | case RoundWidthNumberProgressBar:
392 | AlertDialog.Builder roundProgressBarBuilder = new AlertDialog.Builder(context, R.style.AlertDialog_Styles);
393 | View rounddialogView = View.inflate(context, R.layout.dialog_round_progressbar_view, null);
394 | LinearLayout dialog_round_progress_layout = (LinearLayout) rounddialogView.findViewById(R.id.dialog_progress_layout);
395 | FrameLayout.LayoutParams params1 = (FrameLayout.LayoutParams) dialog_round_progress_layout.getLayoutParams();
396 | params1.width = SupDialogStaticUtils.dp2px(context, 140);
397 | params1.height = SupDialogStaticUtils.dp2px(context, 140);
398 | dialog_round_progress_layout.setLayoutParams(params1);
399 | TextView messageTv = (TextView) rounddialogView.findViewById(R.id.message_tv);
400 | horizontalProgressBar = (HorizontalWithNumberProgressBar) rounddialogView.findViewById(R.id.round_bar);
401 |
402 | if (TextUtils.isEmpty(msg)) {
403 | if (TextUtils.isEmpty(title)) {
404 | messageTv.setVisibility(View.GONE);
405 | } else {
406 | messageTv.setText(title);
407 | }
408 | } else {
409 | messageTv.setText(msg);
410 | }
411 | roundProgressBarBuilder.setView(rounddialogView);
412 | progressAlertDialog = roundProgressBarBuilder.create();
413 | progressAlertDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
414 | progressAlertDialog.setCancelable(cancelable);
415 | if (listener != null && cancelable) {
416 | progressAlertDialog.setOnCancelListener(listener);
417 | }
418 | progressAlertDialog.show();
419 | break;
420 | case DefaultTpye:
421 | default:
422 | if (TextUtils.isEmpty(msg)) {
423 | msg = loadingStr;
424 | }
425 | progressDialog = new ProgressDialog(context);
426 | progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); //设置样式
427 | progressDialog.setTitle(title); //设置Title
428 | progressDialog.setMessage(msg);
429 | progressDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
430 | progressDialog.setCancelable(cancelable);
431 | if (listener != null && cancelable) {
432 | progressDialog.setOnCancelListener(listener);
433 | }
434 | progressDialog.show();
435 | break;
436 | }
437 |
438 | }
439 |
440 | public static void showProgressBar(Activity context, String title, String msg, boolean canceledOnTouchOutside, DialogInterface.OnCancelListener listener) {
441 | showDefaultProgressBar(context, SYSDiaLogType.DefaultTpye, title, msg, canceledOnTouchOutside, true, listener);
442 | }
443 |
444 | public static void showProgressBar(Activity context, String title, String msg, boolean canceledOnTouchOutside, boolean cancelable) {
445 | showDefaultProgressBar(context, SYSDiaLogType.DefaultTpye, title, msg, canceledOnTouchOutside, cancelable, null);
446 | }
447 |
448 | public static void showProgressBar(Activity context, String title, String msg) {
449 | showDefaultProgressBar(context, SYSDiaLogType.DefaultTpye, title, msg, false, false, null);
450 | }
451 |
452 | public static void showProgressBar(Activity context, String msg) {
453 | showDefaultProgressBar(context, SYSDiaLogType.DefaultTpye, "", msg, false, false, null);
454 | }
455 |
456 | public static void showProgressBar(Activity context) {
457 | showDefaultProgressBar(context, SYSDiaLogType.DefaultTpye, "", "", false, false, null);
458 | }
459 |
460 | public static void setProgressBar(int progress) {
461 | if (progressDialog != null && progressDialog.isShowing()) {
462 | progressDialog.setProgress(progress);
463 | }
464 | //horizontalProgressBar
465 | if (progressAlertDialog != null && progressAlertDialog.isShowing() && horizontalProgressBar != null) {
466 | horizontalProgressBar.setProgress(progress);
467 | }
468 | }
469 |
470 | public static int getProgressBar() {
471 | if (progressDialog != null && progressDialog.isShowing()) {
472 | return progressDialog.getProgress();
473 | }
474 | //horizontalProgressBar
475 | if (progressAlertDialog != null && progressAlertDialog.isShowing() && horizontalProgressBar != null) {
476 | return horizontalProgressBar.getProgress();
477 | }
478 | return 0;
479 | }
480 |
481 | public static void showProgressBar(Activity context, SYSDiaLogType type, String title, String msg, boolean canceledOnTouchOutside, DialogInterface.OnCancelListener listener) {
482 | showDefaultProgressBar(context, type, title, msg, canceledOnTouchOutside, true, listener);
483 | }
484 |
485 | public static void showProgressBar(Activity context, SYSDiaLogType type, String title, String msg, boolean canceledOnTouchOutside, boolean cancelable) {
486 | showDefaultProgressBar(context, type, title, msg, canceledOnTouchOutside, cancelable, null);
487 | }
488 |
489 | public static void showProgressBar(Activity context, SYSDiaLogType type, String title, String msg) {
490 | showDefaultProgressBar(context, type, title, msg, false, false, null);
491 | }
492 |
493 | public static void showProgressBar(Activity context, SYSDiaLogType type, String msg) {
494 | showDefaultProgressBar(context, type, "", msg, false, false, null);
495 | }
496 |
497 | public static void showProgressBar(Activity context, SYSDiaLogType type) {
498 | showDefaultProgressBar(context, type, "", "", false, false, null);
499 | }
500 |
501 | /**
502 | * 4.確認 取消 對話框部分
503 | * public enum SYSConfirmType {
504 | * Success,//成功 綠色
505 | * Tip,//提示 黃黃的
506 | * Warning //警告 紅色
507 | * }
508 | */
509 |
510 | private static void showConfirmAlertDialog(Activity context, boolean isShowPic, SYSConfirmType picType,
511 | String title, String msg, String confirmStr, String cancelStr,
512 | boolean canceledOnTouchOutside, boolean cancelable,
513 | final ConfirmDialogListener confirmDialogListener) {
514 | if (context == null || context.isFinishing()) {
515 | return;
516 | }
517 | closeKeyboardHidden(context);
518 | initDialog();
519 |
520 | AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialog_Styles);
521 | View dialogView = View.inflate(context, R.layout.dialog_confirm_alert_view, null);
522 | LinearLayout dialog_view_layout = (LinearLayout) dialogView.findViewById(R.id.dialog_view_layout);
523 | FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) dialog_view_layout.getLayoutParams();
524 | params.width = SupDialogStaticUtils.getScreenWidth(context) * 2 / 3;
525 | dialog_view_layout.setLayoutParams(params);
526 | ImageView dialog_icon = (ImageView) dialogView.findViewById(R.id.dialog_icon);
527 |
528 | TextView confirm = (TextView) dialogView.findViewById(R.id.confirm);
529 | TextView cancel = (TextView) dialogView.findViewById(R.id.cancel);
530 | if (TextUtils.isEmpty(confirmStr)) {
531 | confirmStr = SYSDiaLogUtils.confirmStr;
532 | }
533 | if (TextUtils.isEmpty(cancelStr)) {
534 | cancelStr = SYSDiaLogUtils.cancelStr;
535 | }
536 | confirm.setText(confirmStr);
537 | cancel.setText(cancelStr);
538 | confirm.setOnClickListener(new View.OnClickListener() {
539 | @Override
540 | public void onClick(View v) {
541 | if (confirmDialogListener != null) {
542 | confirmDialogListener.onClickButton(false, true);
543 | }
544 | if (confirmDialog != null && confirmDialog.isShowing()) {
545 | confirmDialog.dismiss();
546 | }
547 | }
548 | });
549 | cancel.setOnClickListener(new View.OnClickListener() {
550 | @Override
551 | public void onClick(View v) {
552 | if (confirmDialogListener != null) {
553 | confirmDialogListener.onClickButton(true, false);
554 | }
555 | if (confirmDialog != null && confirmDialog.isShowing()) {
556 | confirmDialog.dismiss();
557 | }
558 | }
559 | });
560 | if (!isShowPic) {
561 | dialog_icon.setVisibility(View.GONE);
562 | } else {
563 | //1.成功 2.提示 3.錯誤
564 | switch (picType) {
565 | case Success:
566 | if (TextUtils.isEmpty(title) && TextUtils.isEmpty(msg)) {
567 | title = SYSDiaLogUtils.successStr;
568 | }
569 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_success));
570 | //selector_green
571 | confirm.setBackgroundResource(R.drawable.selector_green);
572 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_green));
573 | break;
574 | case Tip:
575 | if (TextUtils.isEmpty(title) && TextUtils.isEmpty(msg)) {
576 | title = SYSDiaLogUtils.tipStr;
577 | }
578 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_tip));
579 | confirm.setBackgroundResource(R.drawable.selector_tip_color);
580 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_tip_color));
581 | break;
582 | case Warning:
583 | if (TextUtils.isEmpty(title) && TextUtils.isEmpty(msg)) {
584 | title = SYSDiaLogUtils.errorStr;
585 | }
586 | dialog_icon.setImageDrawable(context.getResources().getDrawable(R.drawable.dialog_error));
587 | confirm.setBackgroundResource(R.drawable.selector_error_red);
588 | //confirm.setBackground(context.getResources().getDrawable(R.drawable.selector_error_red));
589 | break;
590 | default:
591 | dialog_icon.setVisibility(View.GONE);
592 | break;
593 | }
594 | }
595 | TextView title_tv = (TextView) dialogView.findViewById(R.id.title_tv);
596 | if (TextUtils.isEmpty(title)) {
597 | title_tv.setVisibility(View.GONE);
598 | } else {
599 | title_tv.setText(title);
600 | }
601 |
602 | TextView message_tv = (TextView) dialogView.findViewById(R.id.message_tv);
603 | if (TextUtils.isEmpty(msg)) {
604 | message_tv.setVisibility(View.GONE);
605 | } else {
606 | message_tv.setText(msg);
607 | }
608 |
609 | builder.setView(dialogView);
610 | confirmDialog = builder.create();
611 | confirmDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
612 | confirmDialog.setCancelable(cancelable);
613 | confirmDialog.show();
614 |
615 | //所需要的文件
616 | //
617 | }
618 |
619 | public static void showConfirmDialog(Activity context, boolean isShowPic, SYSConfirmType picType,
620 | String title, String msg, String confirmStr, String cancelStr,
621 | boolean canceledOnTouchOutside, boolean cancelable,
622 | final ConfirmDialogListener confirmDialogListener) {
623 | showConfirmAlertDialog(context, isShowPic, picType, title, msg, confirmStr, cancelStr, canceledOnTouchOutside, cancelable, confirmDialogListener);
624 | }
625 |
626 | public static void showConfirmDialog(Activity context, boolean isShowPic, SYSConfirmType picType,
627 | String title, String msg,
628 | final ConfirmDialogListener confirmDialogListener) {
629 | showConfirmAlertDialog(context, isShowPic, picType, title, msg, "", "", false, true, confirmDialogListener);
630 | }
631 |
632 | public static void showConfirmDialog(Activity context, String title, String msg, String confirmStr, String cancelStr,
633 | boolean canceledOnTouchOutside, boolean cancelable,
634 | final ConfirmDialogListener confirmDialogListener) {
635 | showConfirmAlertDialog(context, false, SYSConfirmType.Success, title, msg, confirmStr, cancelStr, canceledOnTouchOutside, cancelable, confirmDialogListener);
636 | }
637 |
638 | public static void showConfirmDialog(Activity context, String title, String msg, String confirmStr, String cancelStr, ConfirmDialogListener confirmDialogListener) {
639 | showConfirmAlertDialog(context, false, SYSConfirmType.Success, title, msg, confirmStr, cancelStr, false, true, confirmDialogListener);
640 | }
641 |
642 | public static void showConfirmDialog(Activity context, String title, String msg, ConfirmDialogListener confirmDialogListener) {
643 | showConfirmAlertDialog(context, false, SYSConfirmType.Success, title, msg, "", "", false, true, confirmDialogListener);
644 | }
645 |
646 | public static void showConfirmDialog(Activity context, String msg, ConfirmDialogListener confirmDialogListener) {
647 | showConfirmAlertDialog(context, false, SYSConfirmType.Success, "", msg, "", "", false, true, confirmDialogListener);
648 | }
649 |
650 |
651 | public interface ConfirmDialogListener {
652 | void onClickButton(boolean clickLeft, boolean clickRight);
653 | }
654 |
655 | // private static void showCustomizeLoadingProgressDialog(Context context, boolean canceledOnTouchOutside) {
656 | // ProgressDialog mCustomizeLoadingProgressDialog = new ProgressDialog(context, ProgressDialog.THEME_HOLO_LIGHT);
657 | // mCustomizeLoadingProgressDialog.setMessage(AppConstants.appStrMap.get(AppConstants.loading));
658 | // mCustomizeLoadingProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
659 | // mCustomizeLoadingProgressDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
660 | // mCustomizeLoadingProgressDialog.setCancelable(true);
661 | // mCustomizeLoadingProgressDialog.show();
662 | // Point size = new Point();
663 | // mCustomizeLoadingProgressDialog.getWindow().getWindowManager().getDefaultDisplay().getSize(size);
664 | // //记得用mProgressDialog来得到这个界面的大小,实际上不加就是得到当前监听器匿名类对象的界面宽度
665 | //
666 | // int width = size.x;//获取界面的宽度像素
667 | // int height = size.y;
668 | // WindowManager.LayoutParams params = mCustomizeLoadingProgressDialog.getWindow().getAttributes(); //一定要用mProgressDialog得到当前界面的参数对象,否则就不是设置ProgressDialog的界面了
669 | // params.alpha = 1.0f;//设置进度条背景透明度
670 | // params.height = height / 9;//设置进度条的高度
671 | // params.gravity = Gravity.BOTTOM;//设置ProgressDialog的重心
672 | // params.width = 2 * width / 3;//设置进度条的宽度
673 | // params.dimAmount = 0f;//设置半透明背景的灰度,范围0~1,系统默认值是0.5,1表示背景完全是黑色的,0表示背景不变暗,和原来的灰度一样
674 | // mCustomizeLoadingProgressDialog.getWindow().setAttributes(params);//把参数设置给进度条,注意,一定要先show出来才可以再设置,不然就没效果了,因为只有当界面显示出来后才可以获得它的屏幕尺寸及参数等一些信息
675 | // }
676 | }
677 |
--------------------------------------------------------------------------------