diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5fa6bf0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,33 @@
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+gen/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Eclipse project files
+.classpath
+.project
+
+# Android Studio
+.idea/
+.gradle
+/*/local.properties
+/*/out
+build
+/*/*/production
+*.iml
+*.iws
+*.ipr
+*~
+*.swp
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..f91812e
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,26 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "20.0.0"
+
+ defaultConfig {
+ applicationId "com.bigkoo.svprogresshuddemo"
+ minSdkVersion 14
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+ compile project(':svprogresshud')
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..71a43e0
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/Sai/Documents/software/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/com/bigkoo/svprogresshuddemo/ApplicationTest.java b/app/src/androidTest/java/com/bigkoo/svprogresshuddemo/ApplicationTest.java
new file mode 100644
index 0000000..1a1aa17
--- /dev/null
+++ b/app/src/androidTest/java/com/bigkoo/svprogresshuddemo/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.bigkoo.svprogresshuddemo;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..81ee9e2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/bigkoo/svprogresshuddemo/MainActivity.java b/app/src/main/java/com/bigkoo/svprogresshuddemo/MainActivity.java
new file mode 100644
index 0000000..3545967
--- /dev/null
+++ b/app/src/main/java/com/bigkoo/svprogresshuddemo/MainActivity.java
@@ -0,0 +1,84 @@
+package com.bigkoo.svprogresshuddemo;
+
+import android.app.Activity;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+
+import com.bigkoo.svprogresshud.SVProgressHUD;
+
+public class MainActivity extends Activity {
+
+ int progress = 0;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+
+ public void show(View view){
+ SVProgressHUD.show(this);
+ }
+ public void showWithMaskType(View view){
+ SVProgressHUD.showWithMaskType(this, SVProgressHUD.SVProgressHUDMaskType.None);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.Black);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.BlackCancel);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.Clear);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.ClearCancel);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.Gradient);
+// mSVProgressHUD.showWithMaskType(SVProgressHUD.SVProgressHUDMaskType.GradientCancel);
+ }
+ public void showWithStatus(View view){
+ SVProgressHUD.showWithStatus(this, "加载中...");
+ }
+ public void showInfoWithStatus(View view){
+ SVProgressHUD.showInfoWithStatus(this, "这是提示", SVProgressHUD.SVProgressHUDMaskType.None);
+ }
+ public void showSuccessWithStatus(View view){
+ SVProgressHUD.showSuccessWithStatus(this, "恭喜,提交成功!");
+ }
+ public void showErrorWithStatus(View view){
+ SVProgressHUD.showErrorWithStatus(this, "不约,叔叔我们不约~", SVProgressHUD.SVProgressHUDMaskType.GradientCancel);
+ }
+ Handler mHandler = new Handler(){
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ progress = progress + 5;
+ if (SVProgressHUD.getProgressBar(MainActivity.this).getMax() != SVProgressHUD.getProgressBar(MainActivity.this).getProgress()) {
+ SVProgressHUD.getProgressBar(MainActivity.this).setProgress(progress);
+ SVProgressHUD.setText(MainActivity.this, "进度 "+progress+"%");
+
+ mHandler.sendEmptyMessageDelayed(0,500);
+ }
+ else{
+ SVProgressHUD.dismiss(MainActivity.this);
+ SVProgressHUD.getProgressBar(MainActivity.this).setProgress(0);
+ }
+
+ }
+ };
+ public void showWithProgress(View view){
+ SVProgressHUD.showWithProgress(this, "进度 "+progress+"%", SVProgressHUD.SVProgressHUDMaskType.Black);
+ progress = 0;
+ mHandler.sendEmptyMessageDelayed(0,500);
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event)
+ {
+ if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)
+ {
+ if(SVProgressHUD.isShowing(this)){
+ SVProgressHUD.dismiss(this);
+ return false;
+ }
+ }
+
+ return super.onKeyDown(keyCode, event);
+
+ }
+
+}
diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..589da5b
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..b1cb908
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,6 @@
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..78431b6
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ SVProgressHUDDemo
+ Hello world!
+ Settings
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..cc7daad
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,20 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.0.0'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
+ classpath 'com.github.dcendents:android-maven-plugin:1.2'
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..0c71e76
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..4e5ec77
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app', ':svprogresshud'
diff --git a/svprogresshud/.gitignore b/svprogresshud/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/svprogresshud/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/svprogresshud/build.gradle b/svprogresshud/build.gradle
new file mode 100644
index 0000000..656a8bc
--- /dev/null
+++ b/svprogresshud/build.gradle
@@ -0,0 +1,100 @@
+apply plugin: 'com.android.library'
+apply plugin: 'com.github.dcendents.android-maven'
+apply plugin: 'com.jfrog.bintray'
+
+version = "1.0.0"
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "20.0.0"
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
+
+def siteUrl = 'https://github.com/saiwu-bigkoo/Android-SVProgressHUD' // #CONFIG# // project homepage
+def gitUrl = 'https://github.com/saiwu-bigkoo/Android-SVProgressHUD.git' // #CONFIG# // project git
+group = "com.bigkoo"
+
+install {
+ repositories.mavenInstaller {
+ // This generates POM.xml with proper parameters
+ pom {
+ project {
+ packaging 'aar'
+ name 'SVProgressHUD For Android' // #CONFIG# // project title
+ url siteUrl
+ // Set your license
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+ developers {
+ developer {
+ id 'sai' // #CONFIG# // your user id (you can write your nickname)
+ name 'sai.wu' // #CONFIG# // your user name
+ email 'sai.wu@bigkoo.com' // #CONFIG# // your email
+ }
+ }
+ scm {
+ connection gitUrl
+ developerConnection gitUrl
+ url siteUrl
+ }
+ }
+ }
+ }
+}
+
+task sourcesJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier = 'sources'
+}
+
+task javadoc(type: Javadoc) {
+ source = android.sourceSets.main.java.srcDirs
+ classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+}
+
+artifacts {
+ archives javadocJar
+ archives sourcesJar
+}
+
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+bintray {
+ user = properties.getProperty("bintray.user")
+ key = properties.getProperty("bintray.apikey")
+ configurations = ['archives']
+ pkg {
+ repo = "maven"
+ name = "SVProgressHUD" // #CONFIG# project name in jcenter
+ websiteUrl = siteUrl
+ vcsUrl = gitUrl
+ licenses = ["Apache-2.0"]
+ publish = true
+ }
+}
\ No newline at end of file
diff --git a/svprogresshud/proguard-rules.pro b/svprogresshud/proguard-rules.pro
new file mode 100644
index 0000000..71a43e0
--- /dev/null
+++ b/svprogresshud/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/Sai/Documents/software/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/svprogresshud/src/main/AndroidManifest.xml b/svprogresshud/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..493d93c
--- /dev/null
+++ b/svprogresshud/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVCircleProgressBar.java b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVCircleProgressBar.java
new file mode 100644
index 0000000..d60e041
--- /dev/null
+++ b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVCircleProgressBar.java
@@ -0,0 +1,197 @@
+package com.bigkoo.svprogresshud;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * Created by Sai on 15/9/1.
+ */
+public class SVCircleProgressBar extends View {
+ private Context mContext;
+ /**
+ * 画笔对象的引用
+ */
+ private Paint paint;
+
+ /**
+ * 圆环的颜色
+ */
+ private int roundColor;
+
+ /**
+ * 圆环进度的颜色
+ */
+ private int roundProgressColor;
+
+ /**
+ * 圆环的宽度
+ */
+ private float roundWidth;
+
+ /**
+ * 最大进度
+ */
+ private int max;
+
+ /**
+ * 当前进度
+ */
+ private int progress;
+
+ /**
+ * 进度的风格,实心或者空心
+ */
+ private int style;
+
+ public static final int STROKE = 0;
+ public static final int FILL = 1;
+
+ public SVCircleProgressBar(Context context) {
+ this(context, null);
+ this.mContext = context;
+
+ }
+
+ public SVCircleProgressBar(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ this.mContext = context;
+ }
+
+ public SVCircleProgressBar(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ this.mContext = context;
+
+ paint = new Paint();
+
+ TypedArray mTypedArray = context.obtainStyledAttributes(attrs,
+ R.styleable.SVCircleProgressBar);
+
+ // 获取自定义属性和默认值
+ roundColor = mTypedArray.getColor(R.styleable.SVCircleProgressBar_roundColor, Color.BLUE);
+ roundProgressColor = mTypedArray.getColor(R.styleable.SVCircleProgressBar_roundProgressColor,
+ Color.GRAY);
+ roundWidth = mTypedArray.getDimension(R.styleable.SVCircleProgressBar_roundWidth, 5);
+ max = mTypedArray.getInteger(R.styleable.SVCircleProgressBar_max, 100);
+ style = mTypedArray.getInt(R.styleable.SVCircleProgressBar_style, 0);
+
+ mTypedArray.recycle();
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ /**
+ * 画最外层的大圆环
+ */
+ int centre = getWidth() / 2; // 获取圆心的x坐标
+ int radius = (int) (centre - roundWidth / 2); // 圆环的半径
+ paint.setAntiAlias(true); // 消除锯齿
+ paint.setColor(roundColor); // 设置圆环的颜色
+ paint.setStyle(Paint.Style.STROKE); // 设置空心
+ paint.setStrokeWidth(roundWidth); // 设置圆环的宽度
+ canvas.drawCircle(centre, centre, radius, paint); // 画出圆环
+
+
+ /**
+ * 画圆弧 ,画圆环的进度
+ */
+
+ // 设置进度是实心还是空心
+ paint.setStrokeWidth(roundWidth); // 设置圆环的宽度
+ paint.setColor(roundProgressColor); // 设置进度的颜色
+ RectF oval = new RectF(centre - radius, centre - radius, centre
+ + radius, centre + radius); // 用于定义的圆弧的形状和大小的界限
+
+ switch (style) {
+ case STROKE: {
+ paint.setStyle(Paint.Style.STROKE);
+ canvas.drawArc(oval, 270, 360 * progress / max, false, paint); // 根据进度画圆弧
+ break;
+ }
+ case FILL: {
+ paint.setStyle(Paint.Style.FILL_AND_STROKE);
+ if (progress != 0)
+ canvas.drawArc(oval, 270, 360 * progress / max, true, paint); // 根据进度画圆弧
+ break;
+ }
+ }
+
+ }
+
+ public synchronized int getMax() {
+ return max;
+ }
+
+ /**
+ * 设置进度的最大值
+ *
+ * @param max
+ */
+ public synchronized void setMax(int max) {
+ if (max < 0) {
+ throw new IllegalArgumentException("max not less than 0");
+ }
+ this.max = max;
+ }
+
+ /**
+ * 获取进度.需要同步
+ *
+ * @return
+ */
+ public synchronized int getProgress() {
+ return progress;
+ }
+
+ /**
+ * 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步
+ * 刷新界面调用postInvalidate()能在非UI线程刷新
+ *
+ * @param progress
+ */
+ public synchronized void setProgress(int progress) {
+ if (progress < 0) {
+ throw new IllegalArgumentException("progress not less than 0");
+ }
+ if (progress > max) {
+ progress = max;
+ }
+ if (progress <= max) {
+ this.progress = progress;
+ postInvalidate();
+ }
+
+ }
+
+ public int getCricleColor() {
+ return roundColor;
+ }
+
+ public void setCricleColor(int cricleColor) {
+ this.roundColor = cricleColor;
+ }
+
+ public int getCricleProgressColor() {
+ return roundProgressColor;
+ }
+
+ public void setCricleProgressColor(int cricleProgressColor) {
+ this.roundProgressColor = cricleProgressColor;
+ }
+
+ public float getRoundWidth() {
+ return roundWidth;
+ }
+
+ public void setRoundWidth(float roundWidth) {
+ this.roundWidth = roundWidth;
+ }
+
+}
\ No newline at end of file
diff --git a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressDefaultView.java b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressDefaultView.java
new file mode 100644
index 0000000..187b749
--- /dev/null
+++ b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressDefaultView.java
@@ -0,0 +1,123 @@
+package com.bigkoo.svprogresshud;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.RotateAnimation;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+/**
+ * Created by Sai on 15/8/15.
+ * 默认的SVProgress效果
+ */
+public class SVProgressDefaultView extends LinearLayout {
+ private int resBigLoading = R.drawable.ic_svstatus_loading;
+ private int resInfo = R.drawable.ic_svstatus_info;
+ private int resSuccess = R.drawable.ic_svstatus_success;
+ private int resError = R.drawable.ic_svstatus_error;
+ private ImageView ivBigLoading, ivSmallLoading;
+ private SVCircleProgressBar circleProgressBar;
+ private TextView tvMsg;
+
+ private RotateAnimation mRotateAnimation;
+
+ public SVProgressDefaultView(Context context) {
+ super(context);
+ initViews();
+ init();
+ }
+
+ private void initViews() {
+ LayoutInflater.from(getContext()).inflate(R.layout.view_svprogressdefault, this, true);
+ ivBigLoading = (ImageView) findViewById(R.id.ivBigLoading);
+ ivSmallLoading = (ImageView) findViewById(R.id.ivSmallLoading);
+ circleProgressBar = (SVCircleProgressBar) findViewById(R.id.circleProgressBar);
+ tvMsg = (TextView) findViewById(R.id.tvMsg);
+ }
+
+ private void init() {
+ mRotateAnimation = new RotateAnimation(0f, 359f,
+ Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+ mRotateAnimation.setDuration(1000L);
+ mRotateAnimation.setInterpolator(new LinearInterpolator());
+ mRotateAnimation.setRepeatCount(-1);
+ mRotateAnimation.setRepeatMode(Animation.RESTART);
+ }
+
+ public void show() {
+ clearAnimations();
+ ivBigLoading.setImageResource(resBigLoading);
+ ivBigLoading.setVisibility(View.VISIBLE);
+ ivSmallLoading.setVisibility(View.GONE);
+ circleProgressBar.setVisibility(View.GONE);
+ tvMsg.setVisibility(View.GONE);
+ //开启旋转动画
+ ivBigLoading.startAnimation(mRotateAnimation);
+ }
+
+ public void showWithStatus(String string) {
+ if (string == null) {
+ show();
+ return;
+ }
+ showBaseStatus(resBigLoading, string);
+ //开启旋转动画
+ ivSmallLoading.startAnimation(mRotateAnimation);
+ }
+
+ public void showInfoWithStatus(String string) {
+ showBaseStatus(resInfo, string);
+ }
+
+ public void showSuccessWithStatus(String string) {
+ showBaseStatus(resSuccess, string);
+ }
+
+ public void showErrorWithStatus(String string) {
+ showBaseStatus(resError, string);
+ }
+ public void showWithProgress(String string) {
+ showProgress(string);
+ }
+
+ public SVCircleProgressBar getCircleProgressBar() {
+ return circleProgressBar;
+ }
+
+ public void setText(String string){
+ tvMsg.setText(string);
+ }
+
+ public void showProgress(String string) {
+ clearAnimations();
+ tvMsg.setText(string);
+ ivBigLoading.setVisibility(View.GONE);
+ ivSmallLoading.setVisibility(View.GONE);
+ circleProgressBar.setVisibility(View.VISIBLE);
+ tvMsg.setVisibility(View.VISIBLE);
+ }
+
+ public void showBaseStatus(int res, String string) {
+ clearAnimations();
+ ivSmallLoading.setImageResource(res);
+ tvMsg.setText(string);
+ ivBigLoading.setVisibility(View.GONE);
+ circleProgressBar.setVisibility(View.GONE);
+ ivSmallLoading.setVisibility(View.VISIBLE);
+ tvMsg.setVisibility(View.VISIBLE);
+ }
+
+ public void dismiss() {
+ clearAnimations();
+ }
+
+ private void clearAnimations() {
+ ivBigLoading.clearAnimation();
+ ivSmallLoading.clearAnimation();
+ }
+
+}
diff --git a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java
new file mode 100644
index 0000000..3a454ed
--- /dev/null
+++ b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java
@@ -0,0 +1,318 @@
+package com.bigkoo.svprogresshud;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.FrameLayout;
+
+/**
+ * Created by Sai on 15/8/15.
+ */
+public class SVProgressHUD {
+ private Context context;
+ private static SVProgressHUD mSVProgressHUD;
+ private static final long DISMISSDELAYED = 1000;
+ private SVProgressHUDMaskType mSVProgressHUDMaskType;
+
+ public enum SVProgressHUDMaskType {
+ None, // 允许遮罩下面控件点击
+ Clear, // 不允许遮罩下面控件点击
+ Black, // 不允许遮罩下面控件点击,背景黑色半透明
+ Gradient, // 不允许遮罩下面控件点击,背景渐变半透明
+ ClearCancel, // 不允许遮罩下面控件点击,点击遮罩消失
+ BlackCancel, // 不允许遮罩下面控件点击,背景黑色半透明,点击遮罩消失
+ GradientCancel // 不允许遮罩下面控件点击,背景渐变半透明,点击遮罩消失
+ ;
+ }
+
+ private final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM
+ );
+ private ViewGroup decorView;//activity的根View
+ private ViewGroup rootView;// mSharedView 的 根View
+ private SVProgressDefaultView mSharedView;
+
+ private Animation outAnim;
+ private Animation inAnim;
+ private int gravity = Gravity.CENTER;
+
+ private static final SVProgressHUD getInstance(Context context) {
+ if (mSVProgressHUD == null) {
+ mSVProgressHUD = new SVProgressHUD();
+ mSVProgressHUD.context = context;
+ mSVProgressHUD.gravity = Gravity.CENTER;
+ mSVProgressHUD.initViews();
+ mSVProgressHUD.initDefaultView();
+ mSVProgressHUD.initAnimation();
+ }
+ if (context != null && context != mSVProgressHUD.context ){
+ mSVProgressHUD.context = context;
+ mSVProgressHUD.initViews();
+ }
+
+ return mSVProgressHUD;
+ }
+
+ protected void initViews() {
+ LayoutInflater layoutInflater = LayoutInflater.from(context);
+ decorView = (ViewGroup) ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
+ rootView = (ViewGroup) layoutInflater.inflate(R.layout.layout_svprogresshud, null, false);
+ rootView.setLayoutParams(new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
+ ));
+ }
+ protected void initDefaultView(){
+ mSharedView = new SVProgressDefaultView(context);
+ params.gravity = gravity;
+ mSharedView.setLayoutParams(params);
+ }
+
+ protected void initAnimation() {
+ if(inAnim == null)
+ inAnim = getInAnimation();
+ if(outAnim == null)
+ outAnim = getOutAnimation();
+ }
+
+ /**
+ * show的时候调用
+ */
+ private void onAttached() {
+ decorView.addView(rootView);
+ if(mSharedView.getParent()!=null)((ViewGroup)mSharedView.getParent()).removeView(mSharedView);
+ rootView.addView(mSharedView);
+ }
+
+ /**
+ * 添加这个View到Activity的根视图
+ */
+ private void svShow() {
+
+ mHandler.removeCallbacksAndMessages(null);
+ if (!isShowing()) {
+ onAttached();
+ }
+
+ mSharedView.startAnimation(inAnim);
+
+ }
+
+ public static void show(Context context) {
+ getInstance(context).setMaskType(SVProgressHUDMaskType.Black);
+ getInstance(context).mSharedView.show();
+ getInstance(context).svShow();
+ }
+
+ public static void showWithMaskType(Context context,SVProgressHUDMaskType maskType) {
+ //判断maskType
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.show();
+ getInstance(context).svShow();
+ }
+
+ public static void showWithStatus(Context context,String string) {
+ getInstance(context).setMaskType(SVProgressHUDMaskType.Black);
+ getInstance(context).mSharedView.showWithStatus(string);
+ getInstance(context).svShow();
+ }
+
+ public static void showWithStatus(Context context,String string, SVProgressHUDMaskType maskType) {
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.showWithStatus(string);
+ getInstance(context).svShow();
+ }
+
+ public static void showInfoWithStatus(Context context,String string) {
+ getInstance(context).setMaskType(SVProgressHUDMaskType.Black);
+ getInstance(context).mSharedView.showInfoWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showInfoWithStatus(Context context,String string, SVProgressHUDMaskType maskType) {
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.showInfoWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showSuccessWithStatus(Context context,String string) {
+ getInstance(context).setMaskType(SVProgressHUDMaskType.Black);
+ getInstance(context).mSharedView.showSuccessWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showSuccessWithStatus(Context context,String string, SVProgressHUDMaskType maskType) {
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.showSuccessWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showErrorWithStatus(Context context,String string) {
+ getInstance(context).setMaskType(SVProgressHUDMaskType.Black);
+ getInstance(context).mSharedView.showErrorWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showErrorWithStatus(Context context,String string, SVProgressHUDMaskType maskType) {
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.showErrorWithStatus(string);
+ getInstance(context).svShow();
+ getInstance(context).scheduleDismiss();
+ }
+
+ public static void showWithProgress(Context context,String string, SVProgressHUDMaskType maskType) {
+ getInstance(context).setMaskType(maskType);
+ getInstance(context).mSharedView.showWithProgress(string);
+ getInstance(context).svShow();
+ }
+
+ public static SVCircleProgressBar getProgressBar(Context context){
+ return getInstance(context).mSharedView.getCircleProgressBar();
+ }
+ public static void setText(Context context,String string){
+ getInstance(context).mSharedView.setText(string);
+ }
+
+ private void setMaskType(SVProgressHUDMaskType maskType) {
+ mSVProgressHUDMaskType = maskType;
+ switch (mSVProgressHUDMaskType) {
+ case None:
+ configMaskType(android.R.color.transparent, false, false);
+ break;
+ case Clear:
+ configMaskType(android.R.color.transparent, true, false);
+ break;
+ case ClearCancel:
+ configMaskType(android.R.color.transparent, true, true);
+ break;
+ case Black:
+ configMaskType(R.color.bgColor_overlay, true, false);
+ break;
+ case BlackCancel:
+ configMaskType(R.color.bgColor_overlay, true, true);
+ break;
+ case Gradient:
+ //TODO 设置半透明渐变背景
+ configMaskType(R.drawable.bg_overlay_gradient, true, false);
+ break;
+ case GradientCancel:
+ //TODO 设置半透明渐变背景
+ configMaskType(R.drawable.bg_overlay_gradient, true, true);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void configMaskType(int bg, boolean clickable, boolean cancelable) {
+ rootView.setBackgroundResource(bg);
+ rootView.setClickable(clickable);
+ setCancelable(cancelable);
+ }
+
+ /**
+ * 检测该View是不是已经添加到根视图
+ *
+ * @return 如果视图已经存在该View返回true
+ */
+ public boolean isShowing() {
+ return rootView.getParent() != null;
+ }
+
+ public static boolean isShowing(Context context) {
+ return getInstance(context).rootView.getParent() != null;
+ }
+
+ public static void dismiss(Context context) {
+ getInstance(context).dismiss();
+ }
+
+ public void dismiss() {
+ //消失动画
+ outAnim.setAnimationListener(outAnimListener);
+ mSharedView.startAnimation(outAnim);
+ }
+
+ public void dismissImmediately() {
+ mSharedView.dismiss();
+ rootView.removeView(mSharedView);
+ decorView.removeView(rootView);
+ context = null;
+ }
+
+ public Animation getInAnimation() {
+ int res = SVProgressHUDAnimateUtil.getAnimationResource(this.gravity, true);
+ return AnimationUtils.loadAnimation(context, res);
+ }
+
+ public Animation getOutAnimation() {
+ int res = SVProgressHUDAnimateUtil.getAnimationResource(this.gravity, false);
+ return AnimationUtils.loadAnimation(context, res);
+ }
+
+ private void setCancelable(boolean isCancelable) {
+ View view = rootView.findViewById(R.id.sv_outmost_container);
+
+ if (isCancelable) {
+ view.setOnTouchListener(onCancelableTouchListener);
+ } else {
+ view.setOnTouchListener(null);
+ }
+ }
+
+ private Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ dismiss();
+ }
+ };
+
+ private void scheduleDismiss() {
+ mHandler.removeCallbacksAndMessages(null);
+ mHandler.sendEmptyMessageDelayed(0, DISMISSDELAYED);
+ }
+
+ /**
+ * Called when the user touch on black overlay in order to dismiss the dialog
+ */
+ private final View.OnTouchListener onCancelableTouchListener = new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ dismiss();
+ setCancelable(false);
+ }
+ return false;
+ }
+ };
+
+ Animation.AnimationListener outAnimListener = new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ dismissImmediately();
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ };
+}
diff --git a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUDAnimateUtil.java b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUDAnimateUtil.java
new file mode 100644
index 0000000..7bd223a
--- /dev/null
+++ b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUDAnimateUtil.java
@@ -0,0 +1,23 @@
+package com.bigkoo.svprogresshud;
+
+import android.view.Gravity;
+
+/**
+ * Created by Sai on 15/8/16.
+ */
+public class SVProgressHUDAnimateUtil {
+ private static final int INVALID = -1;
+ static int getAnimationResource(int gravity, boolean isInAnimation) {
+ switch (gravity) {
+ case Gravity.TOP:
+ return isInAnimation ? R.anim.svslide_in_top : R.anim.svslide_out_top;
+ case Gravity.BOTTOM:
+ return isInAnimation ? R.anim.svslide_in_bottom : R.anim.svslide_out_bottom;
+ case Gravity.CENTER:
+ return isInAnimation ? R.anim.svfade_in_center : R.anim.svfade_out_center;
+ default:
+ // This case is not implemented because we don't expect any other gravity at the moment
+ }
+ return INVALID;
+ }
+}
diff --git a/svprogresshud/src/main/res/anim/svfade_in_center.xml b/svprogresshud/src/main/res/anim/svfade_in_center.xml
new file mode 100755
index 0000000..8b162db
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svfade_in_center.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/anim/svfade_out_center.xml b/svprogresshud/src/main/res/anim/svfade_out_center.xml
new file mode 100755
index 0000000..bda8de2
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svfade_out_center.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/anim/svslide_in_bottom.xml b/svprogresshud/src/main/res/anim/svslide_in_bottom.xml
new file mode 100755
index 0000000..2d923d8
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svslide_in_bottom.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/anim/svslide_in_top.xml b/svprogresshud/src/main/res/anim/svslide_in_top.xml
new file mode 100755
index 0000000..844ff33
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svslide_in_top.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/anim/svslide_out_bottom.xml b/svprogresshud/src/main/res/anim/svslide_out_bottom.xml
new file mode 100755
index 0000000..c496975
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svslide_out_bottom.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/anim/svslide_out_top.xml b/svprogresshud/src/main/res/anim/svslide_out_top.xml
new file mode 100755
index 0000000..8928b92
--- /dev/null
+++ b/svprogresshud/src/main/res/anim/svslide_out_top.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_error.png b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_error.png
new file mode 100755
index 0000000..4cf4c4f
Binary files /dev/null and b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_error.png differ
diff --git a/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_info.png b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_info.png
new file mode 100755
index 0000000..1aadb13
Binary files /dev/null and b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_info.png differ
diff --git a/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_loading.png b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_loading.png
new file mode 100644
index 0000000..860dc70
Binary files /dev/null and b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_loading.png differ
diff --git a/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_success.png b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_success.png
new file mode 100755
index 0000000..c6063d0
Binary files /dev/null and b/svprogresshud/src/main/res/drawable-xxhdpi/ic_svstatus_success.png differ
diff --git a/svprogresshud/src/main/res/drawable/bg_overlay_gradient.xml b/svprogresshud/src/main/res/drawable/bg_overlay_gradient.xml
new file mode 100644
index 0000000..8c4060f
--- /dev/null
+++ b/svprogresshud/src/main/res/drawable/bg_overlay_gradient.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/drawable/bg_svprogresshuddefault.xml b/svprogresshud/src/main/res/drawable/bg_svprogresshuddefault.xml
new file mode 100644
index 0000000..2bcad62
--- /dev/null
+++ b/svprogresshud/src/main/res/drawable/bg_svprogresshuddefault.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/layout/layout_svprogresshud.xml b/svprogresshud/src/main/res/layout/layout_svprogresshud.xml
new file mode 100644
index 0000000..290dab5
--- /dev/null
+++ b/svprogresshud/src/main/res/layout/layout_svprogresshud.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/layout/view_svprogressdefault.xml b/svprogresshud/src/main/res/layout/view_svprogressdefault.xml
new file mode 100644
index 0000000..1eac5d2
--- /dev/null
+++ b/svprogresshud/src/main/res/layout/view_svprogressdefault.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/values/attrs.xml b/svprogresshud/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..114920e
--- /dev/null
+++ b/svprogresshud/src/main/res/values/attrs.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/values/colors.xml b/svprogresshud/src/main/res/values/colors.xml
new file mode 100644
index 0000000..99711f5
--- /dev/null
+++ b/svprogresshud/src/main/res/values/colors.xml
@@ -0,0 +1,13 @@
+
+
+
+ #60000000
+ #95000000
+
+ @android:color/white
+
+ #000000
+ #e5e5e5
+ @android:color/black
+
+
diff --git a/svprogresshud/src/main/res/values/dimens.xml b/svprogresshud/src/main/res/values/dimens.xml
new file mode 100755
index 0000000..fc19ade
--- /dev/null
+++ b/svprogresshud/src/main/res/values/dimens.xml
@@ -0,0 +1,17 @@
+
+
+
+ 15dp
+
+ 120dp
+
+ 80dp
+
+ 60dp
+
+ 25px
+
+ 15sp
+ 10dp
+
+
diff --git a/svprogresshud/src/main/res/values/integers.xml b/svprogresshud/src/main/res/values/integers.xml
new file mode 100755
index 0000000..1759674
--- /dev/null
+++ b/svprogresshud/src/main/res/values/integers.xml
@@ -0,0 +1,4 @@
+
+
+ 300
+
\ No newline at end of file
diff --git a/svprogresshud/src/main/res/values/styles.xml b/svprogresshud/src/main/res/values/styles.xml
new file mode 100644
index 0000000..f19de1b
--- /dev/null
+++ b/svprogresshud/src/main/res/values/styles.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file