├── settings.gradle ├── exampleapp ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── res │ ├── drawable-hdpi │ │ ├── edinburgh.jpg │ │ ├── ic_drawer.png │ │ ├── ic_launcher.png │ │ ├── operahuset.jpg │ │ ├── holyroodpark.jpg │ │ ├── blenheim_palace.jpg │ │ ├── drawer_shadow.9.png │ │ └── millennium_stadium.jpg │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── layout │ │ ├── lv_github.xml │ │ ├── lv_colour_text.xml │ │ ├── lv_style.xml │ │ ├── lv_signer.xml │ │ ├── activity_main.xml │ │ ├── lv_header_layout.xml │ │ ├── lv_image.xml │ │ ├── lv_colour.xml │ │ ├── lv_style_box.xml │ │ ├── square_layout.xml │ │ ├── customcolourdialog.xml │ │ └── percentdialog.xml ├── project.properties ├── AndroidManifest.xml ├── build.gradle └── src │ └── ch │ └── halcyon │ └── squareprogressbar │ └── example │ ├── PreviewView.java │ ├── dialogs │ ├── CustomColourDialog.java │ └── PercentDialog.java │ ├── SquareFragment.java │ └── MainActivity.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── squareprogressbar ├── res │ ├── drawable-hdpi │ │ └── ic_spb_empty.png │ ├── values │ │ └── strings.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── progressbarview.xml ├── src │ └── ch │ │ └── halcyon │ │ └── squareprogressbar │ │ ├── utils │ │ ├── CalculationUtil.java │ │ ├── ColourUtil.java │ │ └── PercentStyle.java │ │ ├── SquareProgressView.java │ │ └── SquareProgressBar.java ├── AndroidManifest.xml ├── project.properties └── build.gradle ├── .gitignore ├── android-square-progressbar.iml ├── gradlew.bat ├── README.md └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':exampleapp' 2 | include ':squareprogressbar' 3 | -------------------------------------------------------------------------------- /exampleapp/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/ic_launcher-web.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /exampleapp/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/libs/android-support-v4.jar -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/edinburgh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/edinburgh.jpg -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/operahuset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/operahuset.jpg -------------------------------------------------------------------------------- /exampleapp/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/holyroodpark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/holyroodpark.jpg -------------------------------------------------------------------------------- /exampleapp/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/blenheim_palace.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/blenheim_palace.jpg -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /exampleapp/res/drawable-hdpi/millennium_stadium.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/exampleapp/res/drawable-hdpi/millennium_stadium.jpg -------------------------------------------------------------------------------- /squareprogressbar/res/drawable-hdpi/ic_spb_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrwonderman/android-square-progressbar/HEAD/squareprogressbar/res/drawable-hdpi/ic_spb_empty.png -------------------------------------------------------------------------------- /squareprogressbar/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android-square-progressbar 4 | That's the image to draw the progressbar around. 5 | 6 | -------------------------------------------------------------------------------- /exampleapp/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Mar 28 21:29:05 BST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip 7 | -------------------------------------------------------------------------------- /exampleapp/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | -------------------------------------------------------------------------------- /exampleapp/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #168686 5 | #333333 6 | #777777 7 | #168686 8 | #FFFFFF 9 | 10 | -------------------------------------------------------------------------------- /squareprogressbar/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /squareprogressbar/src/ch/halcyon/squareprogressbar/utils/CalculationUtil.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.utils; 2 | 3 | import android.content.Context; 4 | import android.util.TypedValue; 5 | 6 | public class CalculationUtil { 7 | 8 | public static int convertDpToPx(float dp, Context context) { 9 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, 10 | context.getResources().getDisplayMetrics()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /squareprogressbar/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /squareprogressbar/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /squareprogressbar/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | android.library=true 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | build/ 16 | 17 | # Local configuration file (sdk path, etc) 18 | local.properties 19 | 20 | # Eclipse project files 21 | .classpath 22 | .project 23 | 24 | # Windows thumbnail db 25 | .DS_Store 26 | 27 | # IDEA/Android Studio project files, because 28 | # the project can be imported from settings.gradle 29 | .idea 30 | *.iml 31 | 32 | # Old-style IDEA project files 33 | *.ipr 34 | *.iws 35 | 36 | # Local IDEA workspace 37 | .idea/workspace.xml 38 | 39 | # Gradle cache 40 | .gradle -------------------------------------------------------------------------------- /exampleapp/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | android.library.reference.1=../android-square-progressbar 16 | -------------------------------------------------------------------------------- /squareprogressbar/src/ch/halcyon/squareprogressbar/utils/ColourUtil.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | import android.R.color; 6 | 7 | public class ColourUtil { 8 | static ArrayList colourArray = new ArrayList(); 9 | 10 | public static ArrayList getColourArray() { 11 | colourArray.add(color.holo_blue_bright); 12 | colourArray.add(color.holo_blue_dark); 13 | colourArray.add(color.holo_blue_light); 14 | colourArray.add(color.holo_green_dark); 15 | colourArray.add(color.holo_green_light); 16 | colourArray.add(color.holo_orange_dark); 17 | colourArray.add(color.holo_orange_light); 18 | colourArray.add(color.holo_purple); 19 | colourArray.add(color.holo_red_dark); 20 | colourArray.add(color.holo_red_light); 21 | return colourArray; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /android-square-progressbar.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /exampleapp/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 18sp 8 | 14sp 9 | 65dp 10 | 14sp 11 | 6dp 12 | 1dp 13 | 8dp 14 | 2dp 15 | 6dp 16 | 8dp 17 | 1dp 18 | 5dp 19 | 20 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_github.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 23 | 24 | -------------------------------------------------------------------------------- /exampleapp/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_colour_text.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 24 | 25 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_style.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 25 | 26 | -------------------------------------------------------------------------------- /squareprogressbar/res/layout/progressbarview.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 25 | 26 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_signer.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 25 | 26 | -------------------------------------------------------------------------------- /exampleapp/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 12 | 13 | 27 | 28 | -------------------------------------------------------------------------------- /exampleapp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | dependencies { 4 | compile fileTree(dir: 'libs', include: '*.jar') 5 | compile project(':squareprogressbar') 6 | } 7 | 8 | android { 9 | compileSdkVersion 17 10 | buildToolsVersion '27.0.3' 11 | 12 | sourceSets { 13 | main { 14 | manifest.srcFile 'AndroidManifest.xml' 15 | java.srcDirs = ['src'] 16 | resources.srcDirs = ['src'] 17 | aidl.srcDirs = ['src'] 18 | renderscript.srcDirs = ['src'] 19 | res.srcDirs = ['res'] 20 | assets.srcDirs = ['assets'] 21 | } 22 | 23 | // Move the tests to tests/java, tests/res, etc... 24 | // instrumentTest.setRoot('tests') 25 | 26 | // Move the build types to build-types/ 27 | // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 28 | // This moves them out of them default location under src//... which would 29 | // conflict with src/ being used by the main source set. 30 | // Adding new build types or product flavors should be accompanied 31 | // by a similar customization. 32 | debug.setRoot('build-types/debug') 33 | release.setRoot('build-types/release') 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_header_layout.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 16 | 17 | 30 | 31 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_image.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 22 | 23 | 33 | 34 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_colour.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 23 | 24 | 34 | 35 | -------------------------------------------------------------------------------- /exampleapp/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | android-square-progressbar-example 5 | Progress: 6 | Width: 7 | Opacity 8 | 9 | 10 | Open navigation drawer 11 | Close navigation drawer 12 | 13 | 14 | Colour 15 | Subitem One 16 | Subitem Two 17 | Style 18 | Subitem Three 19 | Title Three 20 | Subitem Four 21 | Subitem Five 22 | 23 | 24 | 25 | Description One 26 | Description Two 27 | 28 | Description Three 29 | 30 | Description Four 31 | Description Five 32 | 33 | 34 | CENTER 35 | RIGHT 36 | LEFT 37 | 38 | 39 | by Yannick Signer (halcyon.ch) 40 | main image of the progressbar 41 | (000,000,000) 42 | Green: 43 | Cancel 44 | Save 45 | Blue: 46 | RGB COLOUR: 47 | Red: 48 | 49 | -------------------------------------------------------------------------------- /exampleapp/res/layout/lv_style_box.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 25 | 26 | 36 | 37 | 45 | 46 | -------------------------------------------------------------------------------- /squareprogressbar/src/ch/halcyon/squareprogressbar/utils/PercentStyle.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.utils; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.Paint; 5 | import android.graphics.Paint.Align; 6 | 7 | public class PercentStyle { 8 | private Paint.Align align; 9 | private float textSize; 10 | private boolean percentSign; 11 | private String customText = "%"; 12 | private int textColor = Color.BLACK; 13 | 14 | public PercentStyle() { 15 | // do nothing 16 | } 17 | 18 | public PercentStyle(Align align, float textSize, boolean percentSign) { 19 | super(); 20 | this.align = align; 21 | this.textSize = textSize; 22 | this.percentSign = percentSign; 23 | } 24 | 25 | public Paint.Align getAlign() { 26 | return align; 27 | } 28 | 29 | public void setAlign(Paint.Align align) { 30 | this.align = align; 31 | } 32 | 33 | public float getTextSize() { 34 | return textSize; 35 | } 36 | 37 | public void setTextSize(float textSize) { 38 | this.textSize = textSize; 39 | } 40 | 41 | public boolean isPercentSign() { 42 | return percentSign; 43 | } 44 | 45 | public void setPercentSign(boolean percentSign) { 46 | this.percentSign = percentSign; 47 | } 48 | 49 | public String getCustomText() { 50 | return customText; 51 | } 52 | 53 | /** 54 | * With this you can set a custom text which should get displayed right 55 | * behind the number of the progress. Per default it displays a %. 56 | * 57 | * @param customText 58 | * The custom text you want to display. 59 | * @since 1.4.0 60 | */ 61 | public void setCustomText(String customText) { 62 | this.customText = customText; 63 | } 64 | 65 | public int getTextColor() { 66 | return textColor; 67 | } 68 | 69 | /** 70 | * Set the color of the text that display the current progress. This will 71 | * also change the color of the text that normally represents a %. 72 | * 73 | * @param textColor 74 | * the color to set the text to. 75 | * @since 1.4.0 76 | */ 77 | public void setTextColor(int textColor) { 78 | this.textColor = textColor; 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /exampleapp/src/ch/halcyon/squareprogressbar/example/PreviewView.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.example; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.Paint.Align; 7 | import android.graphics.Paint.Style; 8 | import android.graphics.Path; 9 | import android.util.AttributeSet; 10 | import android.view.View; 11 | 12 | public class PreviewView extends View { 13 | 14 | private final Paint paintPaint; 15 | private Align center = Align.CENTER; 16 | private float size = 150; 17 | private boolean b = true; 18 | 19 | public PreviewView(Context context) { 20 | super(context); 21 | 22 | paintPaint = new Paint(); 23 | paintPaint.setColor(context.getResources().getColor( 24 | android.R.color.black)); 25 | paintPaint.setAntiAlias(true); 26 | paintPaint.setStyle(Style.STROKE); 27 | } 28 | 29 | public PreviewView(Context context, AttributeSet attrs, int defStyle) { 30 | super(context, attrs, defStyle); 31 | 32 | paintPaint = new Paint(); 33 | paintPaint.setColor(context.getResources().getColor( 34 | android.R.color.black)); 35 | paintPaint.setAntiAlias(true); 36 | paintPaint.setStyle(Style.STROKE); 37 | } 38 | 39 | public PreviewView(Context context, AttributeSet attrs) { 40 | super(context, attrs); 41 | 42 | paintPaint = new Paint(); 43 | paintPaint.setColor(context.getResources().getColor( 44 | android.R.color.black)); 45 | paintPaint.setAntiAlias(true); 46 | paintPaint.setStyle(Style.STROKE); 47 | } 48 | 49 | @Override 50 | protected void onDraw(Canvas canvas) { 51 | super.onDraw(canvas); 52 | Path path = new Path(); 53 | path.moveTo(0, 0); 54 | path.lineTo(0, canvas.getWidth()); 55 | path.lineTo(canvas.getHeight(), canvas.getWidth()); 56 | path.lineTo(canvas.getHeight(), 0); 57 | path.lineTo(0, 0); 58 | canvas.drawPath(path, paintPaint); 59 | paintPaint.setTextAlign(center); 60 | paintPaint.setTextSize(Float.valueOf(String.valueOf(size))); 61 | canvas.drawText(b ? "32%" : "32", canvas.getWidth() / 2, (int) ((canvas 62 | .getHeight() / 2) - ((paintPaint.descent() + paintPaint 63 | .ascent()) / 2)), paintPaint); 64 | } 65 | 66 | public void drawText(int size, Align center, boolean b) { 67 | this.size = size; 68 | this.center = center; 69 | this.b = b; 70 | this.invalidate(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /exampleapp/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | 19 | 20 | 27 | 28 | 35 | 62 | 63 | -------------------------------------------------------------------------------- /exampleapp/res/layout/square_layout.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 18 | 19 | 20 | 30 | 31 | 40 | 41 | 49 | 50 | 61 | 62 | 71 | 72 | -------------------------------------------------------------------------------- /squareprogressbar/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: "com.jfrog.bintray" 4 | 5 | version = "1.6.4" 6 | 7 | android { 8 | compileSdkVersion 17 9 | buildToolsVersion '27.0.3' 10 | 11 | sourceSets { 12 | main { 13 | manifest.srcFile 'AndroidManifest.xml' 14 | java.srcDirs = ['src'] 15 | resources.srcDirs = ['src'] 16 | aidl.srcDirs = ['src'] 17 | renderscript.srcDirs = ['src'] 18 | res.srcDirs = ['res'] 19 | assets.srcDirs = ['assets'] 20 | }} 21 | 22 | defaultConfig { 23 | minSdkVersion 14 24 | targetSdkVersion 17 25 | versionCode 11 26 | versionName version 27 | } 28 | 29 | buildTypes { 30 | } 31 | } 32 | 33 | dependencies { 34 | } 35 | 36 | def siteUrl = 'https://github.com/mrwonderman/android-square-progressbar' // Homepage URL of the library 37 | def gitUrl = 'https://github.com/mrwonderman/android-square-progressbar.git' // Git repository URL 38 | group = "ch.halcyon" // Maven Group ID for the artifact 39 | 40 | 41 | install { 42 | repositories.mavenInstaller { 43 | // This generates POM.xml with proper parameters 44 | pom { 45 | project { 46 | packaging 'aar' 47 | 48 | // Add your description here 49 | name 'android-square-progressbar' 50 | //description = 'An android library to display a progressbar that goes around an image.' 51 | url siteUrl 52 | 53 | // Set your license 54 | licenses { 55 | license { 56 | name 'The Apache Software License, Version 2.0' 57 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 58 | } 59 | } 60 | developers { 61 | developer { 62 | id 'yansigner' 63 | name 'Yannick Signer' 64 | email 'yannick@signer.pro' 65 | } 66 | } 67 | scm { 68 | connection gitUrl 69 | developerConnection gitUrl 70 | url siteUrl 71 | 72 | } 73 | } 74 | } 75 | } 76 | } 77 | 78 | task sourcesJar(type: Jar) { 79 | from android.sourceSets.main.java.srcDirs 80 | classifier = 'sources' 81 | } 82 | 83 | task javadoc(type: Javadoc) { 84 | source = android.sourceSets.main.java.srcDirs 85 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 86 | } 87 | 88 | task javadocJar(type: Jar, dependsOn: javadoc) { 89 | classifier = 'javadoc' 90 | from javadoc.destinationDir 91 | } 92 | artifacts { 93 | archives javadocJar 94 | archives sourcesJar 95 | } 96 | 97 | Properties properties = new Properties() 98 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 99 | 100 | bintray { 101 | user = properties.getProperty("bintray.user") 102 | key = properties.getProperty("bintray.apikey") 103 | 104 | configurations = ['archives'] 105 | pkg { 106 | repo = "maven" 107 | // it is the name that appears in bintray when logged 108 | name = "squareprogressbar" 109 | websiteUrl = siteUrl 110 | vcsUrl = gitUrl 111 | licenses = ["Apache-2.0"] 112 | publish = true 113 | } 114 | } -------------------------------------------------------------------------------- /exampleapp/src/ch/halcyon/squareprogressbar/example/dialogs/CustomColourDialog.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.example.dialogs; 2 | 3 | import ch.halcyon.squareprogressbar.example.R; 4 | import android.app.Dialog; 5 | import android.content.Context; 6 | import android.graphics.Color; 7 | import android.graphics.drawable.ColorDrawable; 8 | import android.view.View; 9 | import android.view.Window; 10 | import android.widget.Button; 11 | import android.widget.SeekBar; 12 | import android.widget.SeekBar.OnSeekBarChangeListener; 13 | import android.widget.TextView; 14 | 15 | /** 16 | * This gives the user the possibility to set a custom colour to the 17 | * SquareProgressBar by selecting a RGB-colour. 18 | * 19 | * @author yansigner 20 | * @since 1.4.0 21 | */ 22 | public class CustomColourDialog extends Dialog { 23 | 24 | private final Button saveButton; 25 | private SeekBar rSeekBar; 26 | private SeekBar gSeekBar; 27 | private SeekBar bSeekBar; 28 | private int choosenRGB; 29 | 30 | public CustomColourDialog(final Context context) { 31 | super(context); 32 | requestWindowFeature(Window.FEATURE_NO_TITLE); 33 | this.setContentView(R.layout.customcolourdialog); 34 | this.setCancelable(false); 35 | 36 | Button closeButton = (Button) this 37 | .findViewById(R.id.returnColourDialog); 38 | closeButton.setOnClickListener(new View.OnClickListener() { 39 | 40 | @Override 41 | public void onClick(View v) { 42 | dismiss(); 43 | } 44 | }); 45 | saveButton = (Button) this.findViewById(R.id.shareColourDialog); 46 | 47 | rSeekBar = (SeekBar) findViewById(R.id.rSeekBar); 48 | rSeekBar.setMax(255); 49 | rSeekBar.setProgress(111); 50 | rSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener()); 51 | 52 | gSeekBar = (SeekBar) findViewById(R.id.gSeekBar); 53 | gSeekBar.setMax(255); 54 | gSeekBar.setProgress(111); 55 | gSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener()); 56 | 57 | bSeekBar = (SeekBar) findViewById(R.id.bSeekBar); 58 | bSeekBar.setMax(255); 59 | bSeekBar.setProgress(111); 60 | bSeekBar.setOnSeekBarChangeListener(rgbOnSeekBarListener()); 61 | 62 | calculateRGB(); 63 | 64 | } 65 | 66 | private OnSeekBarChangeListener rgbOnSeekBarListener() { 67 | return new OnSeekBarChangeListener() { 68 | 69 | @Override 70 | public void onStopTrackingTouch(SeekBar arg0) { 71 | // nothing to do =) 72 | } 73 | 74 | @Override 75 | public void onStartTrackingTouch(SeekBar arg0) { 76 | // nothing to do =) 77 | 78 | } 79 | 80 | @Override 81 | public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) { 82 | calculateRGB(); 83 | } 84 | }; 85 | } 86 | 87 | /** 88 | * Returns the save button of the dialog. 89 | * 90 | * @return the save {@link Button}. 91 | */ 92 | public Button getSaveButton() { 93 | return saveButton; 94 | } 95 | 96 | /** 97 | * Calculates the current set RGB value according to the three 98 | * {@link SeekBar}s. This also changes the background of the Dialog. 99 | */ 100 | private void calculateRGB() { 101 | int r = rSeekBar.getProgress(); 102 | int g = gSeekBar.getProgress(); 103 | int b = bSeekBar.getProgress(); 104 | ((TextView) findViewById(R.id.rgbText)).setText("(" + r + "," + g + "," 105 | + b + ")"); 106 | choosenRGB = Color.rgb(r, g, b); 107 | getWindow().setBackgroundDrawable(new ColorDrawable(choosenRGB)); 108 | } 109 | 110 | /** 111 | * Returns the Color which was chosen in the Dialog. 112 | * 113 | * @return the chosen RGB-colour. 114 | */ 115 | public int getChoosenRGB() { 116 | return choosenRGB; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /exampleapp/src/ch/halcyon/squareprogressbar/example/SquareFragment.java: -------------------------------------------------------------------------------- 1 | package ch.halcyon.squareprogressbar.example; 2 | 3 | import ch.halcyon.squareprogressbar.SquareProgressBar; 4 | 5 | import android.app.Fragment; 6 | import android.os.Bundle; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.SeekBar; 11 | import android.widget.SeekBar.OnSeekBarChangeListener; 12 | import android.widget.TextView; 13 | 14 | import java.util.Random; 15 | 16 | public class SquareFragment extends Fragment { 17 | public SquareProgressBar squareProgressBar; 18 | private SeekBar progressSeekBar, widthSeekBar; 19 | 20 | @Override 21 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 22 | Bundle savedInstanceState) { 23 | View view = inflater.inflate(ch.halcyon.squareprogressbar.example.R.layout.square_layout, container, false); 24 | 25 | final TextView progressView = (TextView) view 26 | .findViewById(ch.halcyon.squareprogressbar.example.R.id.progressDisplay); 27 | progressView.setText("32%"); 28 | 29 | squareProgressBar = (SquareProgressBar) view.findViewById(ch.halcyon.squareprogressbar.example.R.id.subi2); 30 | squareProgressBar.setImage(ch.halcyon.squareprogressbar.example.R.drawable.blenheim_palace); 31 | squareProgressBar.setColor("#C9C9C9"); 32 | squareProgressBar.setProgress(32); 33 | squareProgressBar.setWidth(8); 34 | squareProgressBar.setOnClickListener(new View.OnClickListener() { 35 | @Override 36 | public void onClick(View view) { 37 | 38 | Random random = new Random(); 39 | 40 | // random progress 41 | setProgressBarProgress(random.nextInt(100), progressView); 42 | 43 | // random width 44 | int randWidth = random.nextInt(17) + 4; 45 | widthSeekBar.setProgress(randWidth); 46 | squareProgressBar.setWidth(randWidth); 47 | 48 | // random colour 49 | squareProgressBar.setColorRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256)); 50 | } 51 | }); 52 | 53 | progressSeekBar = (SeekBar) view 54 | .findViewById(ch.halcyon.squareprogressbar.example.R.id.progressSeekBar); 55 | progressSeekBar 56 | .setOnSeekBarChangeListener(new OnSeekBarChangeListener() { 57 | 58 | @Override 59 | public void onStopTrackingTouch(SeekBar seekBar) { 60 | // nothing to do 61 | } 62 | 63 | @Override 64 | public void onStartTrackingTouch(SeekBar seekBar) { 65 | // nothing to do 66 | } 67 | 68 | @Override 69 | public void onProgressChanged(SeekBar seekBar, 70 | int progress, boolean fromUser) { 71 | setProgressBarProgress(progress, progressView); 72 | } 73 | }); 74 | 75 | widthSeekBar = (SeekBar) view.findViewById(ch.halcyon.squareprogressbar.example.R.id.widthSeekBar); 76 | widthSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { 77 | 78 | @Override 79 | public void onStopTrackingTouch(SeekBar seekBar) { 80 | // nothing to do 81 | } 82 | 83 | @Override 84 | public void onStartTrackingTouch(SeekBar seekBar) { 85 | // nothing to do 86 | } 87 | 88 | @Override 89 | public void onProgressChanged(SeekBar seekBar, int progress, 90 | boolean fromUser) { 91 | squareProgressBar.setWidth(progress); 92 | } 93 | }); 94 | return view; 95 | } 96 | 97 | private void setProgressBarProgress(int progress, TextView progressView) { 98 | squareProgressBar.setProgress(progress); 99 | progressView.setText(progress + "%"); 100 | progressSeekBar.setProgress(progress); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /exampleapp/res/layout/customcolourdialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 23 | 24 | 30 | 31 | 40 | 41 | 47 | 48 | 54 | 55 | 64 | 65 | 75 | 76 | 86 | 87 | 95 | 96 |