19 |
20 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/CircularProgress.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply from: 'https://raw.githubusercontent.com/momentummodules/Versioning/master/version.gradle'
3 |
4 | // VERSION
5 | versionMajor = 1
6 | versionMinor = 3
7 | versionPatch = 4
8 |
9 | android {
10 | compileSdkVersion 26
11 | buildToolsVersion "26.0.2"
12 |
13 | defaultConfig {
14 | applicationId "com.nomad5.circularprogress"
15 | minSdkVersion 14
16 | targetSdkVersion 26
17 | versionCode genVersionCode()
18 | versionName genVersionName()
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | sourceSets.main {
28 | assets.srcDirs += ['assets']
29 | }
30 | }
31 |
32 | dependencies {
33 | compile fileTree(dir: 'libs', include: ['*.jar'])
34 | compile project(':circularprogressview')
35 | //compile 'momentum.modules:circularprogressview:1.3.0'
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Momentum
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
18 |
19 |
28 |
29 |
39 |
40 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/nomad5/circularprogress/DemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.nomad5.circularprogress;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | import com.nomad5.circularprogressview.CircularProgressView;
8 |
9 | import junit.framework.Assert;
10 |
11 | import java.util.Random;
12 |
13 | /**
14 | * Created by mlostek on 04.05.2015.
15 | * Demo activity to demonstrate the CircularProgressView
16 | */
17 | public class DemoActivity extends Activity
18 | {
19 | Random random = new Random();
20 |
21 | /****************************************************************************************************************************
22 | */
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState)
25 | {
26 | super.onCreate(savedInstanceState);
27 | this.setContentView(R.layout.activity_demo);
28 | }
29 |
30 | /****************************************************************************************************************************
31 | * Start the progress with interpolated mode for random value
32 | */
33 | public void onStartRandomClicked(final View view)
34 | {
35 | this.startInterpolatedAnim(this.random.nextFloat());
36 | }
37 |
38 | /****************************************************************************************************************************
39 | * Start the progress with interpolated mode with target value 0
40 | */
41 | public void onStart0Clicked(final View view)
42 | {
43 | this.startInterpolatedAnim(0f);
44 | }
45 |
46 | /****************************************************************************************************************************
47 | * Start the progress with interpolated mode with target value 1
48 | */
49 | public void onStart1Clicked(final View view)
50 | {
51 | this.startInterpolatedAnim(1f);
52 | }
53 |
54 | /****************************************************************************************************************************
55 | * Start interpolated animation
56 | */
57 | private void startInterpolatedAnim(float targetValue)
58 | {
59 | final CircularProgressView progressView = this.findViewById(R.id.circularprogress);
60 | Assert.assertNotNull(progressView);
61 | progressView.setProgress(targetValue, 3000);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/circularprogressview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.jfrog.bintray'
3 | apply from: 'https://raw.githubusercontent.com/nomad5modules/GradleVersion/master/version.gradle'
4 |
5 | // VERSION
6 | versionMajor = 1
7 | versionMinor = 3
8 | versionPatch = 4
9 |
10 | android {
11 | compileSdkVersion 26
12 | buildToolsVersion "26.0.2"
13 |
14 | defaultConfig {
15 | minSdkVersion 14
16 | targetSdkVersion 26
17 | versionCode genVersionCode()
18 | versionName genVersionName()
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | }
27 |
28 | ext {
29 | // Where you will see your artifact in Bintray's web interface
30 | // The "bintrayName" should match the name of the Bintray repo.
31 | bintrayRepo = 'maven'
32 | bintrayName = 'circularprogressview'
33 | // Maven metadata
34 | publishedGroupId = 'com.nomad5'
35 | // Save yourself a head ache, and set this equal to the name of the Android Studio library
36 | // module. The artifact name needs to match the name of the library.
37 | artifact = bintrayName
38 | // Details
39 | libraryName = bintrayName
40 | libraryDescription = 'A circular progressview for Android'
41 | libraryVersion = genVersionName()
42 | librarylabels = ['Android', 'view', 'progress']
43 | // Developer stuff
44 | developerId = 'mlostek'
45 | developerName = 'Martin Mlostek [Nomad5]'
46 | developerEmail = 'martin@nomad5.com'
47 | // Web stuff
48 | siteUrl = 'https://github.com/nomad5modules/CircularProgressView'
49 | gitUrl = 'https://github.com/nomad5modules/CircularProgressView.git'
50 | issuesUrl = 'https://github.com/nomad5modules/CircularProgressView/issues'
51 | // License stuff
52 | licenseName = 'The Apache Software License, Version 2.0'
53 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
54 | licenseShort = 'Apache-2.0'
55 | }
56 |
57 | /* APPLY MAVEN AND BINTRAY PLUGIN */
58 | apply from: 'https://raw.githubusercontent.com/nomad5modules/GradleBintray/master/maven.gradle'
59 | apply from: 'https://raw.githubusercontent.com/nomad5modules/GradleBintray/master/bintray.gradle'
60 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CircularProgressView
2 |
3 | A circular progressview for android
4 |
5 | [](http://android-arsenal.com/details/1/1815)
6 |
7 | ## About
8 |
9 | This is a simple small class that renders a progress in form of an filling arc shape.
10 | A progress text can be rendered additionally. This text is rendered in the secondary color for the 'done' area of the arc.
11 |
12 | I used it for rendering the progress that is done in the background of all views. This view has no dependencies.
13 |
14 | It also supports a custom font (that is places in the 'assets' directory) and fading of the progress view (even though I recommend setting the 'fadeTime' value to -1 and use a Fragment with a FragmentTransation to fade this view in and out).
15 |
16 | All values are optional. If you want to reuse the view from the code, simply set the class members in the CircularProgressView class accordingly.
17 |
18 |
19 | 
20 |
21 | ## XML Attributes
22 |
23 | Following XML attributes are allowed
24 |
25 | ```xml
26 |
33 | ```
34 |
35 | progressColor:
36 | > The main color of the progress ARC.
37 | > The text will be rendered in this color where the arc is not yet painted.
38 |
39 | progressText:
40 | > The Text to be rendered.
41 | > Add `#VAL#` to the text in order to automatically add a interger value to the progress text.
42 |
43 | progressTextFont:
44 | > An optional ttf or otf font.
45 | > This font hast to be in the "assets" directory.
46 |
47 | progressTextSize:
48 | > The font size
49 |
50 | borderOffset:
51 | > Optional border offset, next iteration will kick this,
52 | > its just a fix to fill the corners (*will be deprecated in next version*)
53 |
54 | fadeTimeMs:
55 | > The fade in and fade out time, can be set to -1 to ignore fading
56 |
57 | ## Example Application
58 | * An example application is included in the github repository. It can also be downloaded from the playstore here https://play.google.com/store/apps/details?id=com.nomad5.circularprogress
59 |
60 | ## Gradle include from jCenter
61 | You can add it also via
62 |
63 | ```java
64 | // The dependencies
65 | dependencies {
66 | /* the circular progress view */
67 | compile 'com.nomad5:circularprogressview:1.3.3'
68 | }
69 | ```
70 |
71 | This works with jCenter and mavenCentral.
72 |
73 | ## Additional information
74 | * Set the progress to 0 (at the beginning) and 1 (at the end).
75 | * 'wrapcontent' for dimensions is not yet supported
76 | * Call `setProgress` with additional interpolation time (in ms) in order to interpolate between progress values
77 |
78 | ## License
79 | Check file LICENSE and Make sure to follow the licensing terms and conditions of the project and the software used to build the project.
80 |
81 | ## Feedback
82 | If you have any questions or feedback, feel free to get back to me!
83 |
84 | ## Next Todo's
85 | * nothing on the list. Any suggestions?
86 |
--------------------------------------------------------------------------------
/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 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |