diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1532174
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,179 @@
+
+# Created by https://www.gitignore.io/api/java,android,osx,intellij,gradle
+
+### Android ###
+# Built application files
+*.apk
+*.ap_
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# Intellij
+*.iml
+.idea/
+
+# Keystore files
+#*.jks
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# Google Services (e.g. APIs or Firebase)
+#google-services.json
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+### Android Patch ###
+gen-external-apklibs
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff:
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+
+# Sensitive or high-churn files:
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.xml
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+
+# Gradle:
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Mongo Explorer plugin:
+.idea/**/mongoSettings.xml
+
+## File-based project format:
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+/out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+### Intellij Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+### Java ###
+# Compiled class file
+
+# Log file
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+### OSX ###
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Gradle ###
+.gradle
+/build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties
+
+# End of https://www.gitignore.io/api/java,android,osx,intellij,gradle
+/app/build/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..eb1c6bf
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+language: android
+android:
+ components:
+ - platform-tools
+ - build-tools-26.0.1
+ - android-26
+ - extra-android-support
+script:
+ - ./gradlew build
+before_install:
+ - chmod +x gradlew
+branches:
+ only:
+ - master
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e7d3afe
--- /dev/null
+++ b/README.md
@@ -0,0 +1,144 @@
+# CircularProgressView:
+[](https://travis-ci.org/GuilhE/android-circular-progress-view)
+
+![sample1]
+
+A fancy CircularProgressView.
+
+#### Version 1.x
+
+ - **September, 2017** - CircularProgressView
+
+
+## Getting started
+
+Include it into your project, for example, as a Gradle compile dependency:
+
+```groovy
+compile 'com.github.guilhe:circular-progress-view:1.0.0'
+```
+[](https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22circular-progress-view%22) [  ](https://bintray.com/gdelgado/android/circular-progress-view/_latestVersion)
+
+## Sample usage
+
+Check out the __sample__ module where you can find a few examples of how to create it by `xml` or `java`.
+
+Attributes accepted in xml:
+```xml
+
+
+
+
+
+
+
+
+
+```
+Example:
+```xml
+
+ ```
+
+To customize this `View` by code, these are the available methods to do so:
+```java
+ public void setSize(int size) {}
+
+ public void setStartingAngle(int angle) {}
+
+ public int getStartingAngle() {}
+
+ public void setMax(int max) {}
+
+ public int getMax() {}
+
+ public void setColor(int color) {}
+
+ public void setColorResource(@ColorRes int resId) {}
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setColor(Color color) {}
+
+ public void setProgressColor(int color) {}
+
+ public void setProgressColorResource(@ColorRes int resId) {}
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setProgressColor(Color color) {}
+
+ public int getProgressColor() {}
+
+ public void setBackgroundColor(int color) {}
+
+ public void setShadowColorResource(@ColorRes int resId) {}
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setBackgroundColor(Color color) {}
+
+ public int getBackgroundColor() {}
+
+ public void setShadowEnabled(boolean enable) {}
+
+ public boolean isShadowEnabled() {}
+
+ public void setProgressStrokeThickness(float thickness) {}
+
+ public float getProgressStrokeThickness() {}
+
+ public void setProgress(float progress) {}
+
+ public void setProgress(float progress, boolean animate) {}
+
+ public void setProgress(float progress, boolean animate, long duration) {}
+
+ public float getProgress() {}
+
+ public void resetProgress() {}
+
+ public void resetProgress(boolean animate) {}
+
+ public void resetProgress(boolean animate, long duration) {}
+
+ public void setAnimationInterpolator(TimeInterpolator interpolator) {}
+```
+
+For more details checkout the __sample app__, _javadocs_ or the code itself.
+
+
+
+
+## Binaries
+
+Binaries and dependency information for Gradle, Maven, Ivy and others can be found at [https://search.maven.org](https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22circular-progress-view%22).
+
+
+
+## Dependencies
+- [com.android.support:support-annotations](https://developer.android.com/topic/libraries/support-library/packages.html#annotations)
+- [com.android.support:appcompat-v7](https://developer.android.com/topic/libraries/support-library/features.html#v7-appcompat)
+
+## Bugs and Feedback
+
+For bugs, questions and discussions please use the [Github Issues](https://github.com/GuilhE/android-circular-progress-view/issues).
+
+
+## LICENSE
+
+Copyright (c) 2017-present, AndroidUtils Contributors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..3da4f24
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,37 @@
+// 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:2.3.3'
+ }
+}
+
+plugins {
+ id "com.jfrog.bintray" version "1.7.3"
+ id "com.github.dcendents.android-maven" version "1.5"
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ maven {
+ url "https://maven.google.com"
+ }
+ }
+
+ tasks.withType(Javadoc) {
+ options.addStringOption('Xdoclint:none', '-quiet')
+ options.addStringOption('encoding', 'UTF-8')
+ }
+}
+
+ext {
+ minSdkVersion = 19
+ targetSdkVersion = 26
+ compileSdkVersion = 26
+ buildToolsVersion = '26.0.1'
+
+ supportLibraryVersion = '26.0.1'
+}
\ No newline at end of file
diff --git a/circular-progress-view/build.gradle b/circular-progress-view/build.gradle
new file mode 100644
index 0000000..a667a86
--- /dev/null
+++ b/circular-progress-view/build.gradle
@@ -0,0 +1,43 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+
+ defaultConfig {
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode 1
+ versionName "1.0.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ android {
+ lintOptions {
+ abortOnError false
+ }
+ }
+}
+
+dependencies {
+ compile "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
+ compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
+
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ testCompile 'junit:junit:4.12'
+ androidTestCompile 'junit:junit:4.12'
+}
+
+if (project.rootProject.file('local.properties').exists()) {
+ apply from: 'deploy.gradle'
+}
\ No newline at end of file
diff --git a/circular-progress-view/deploy.gradle b/circular-progress-view/deploy.gradle
new file mode 100644
index 0000000..419c07e
--- /dev/null
+++ b/circular-progress-view/deploy.gradle
@@ -0,0 +1,86 @@
+apply plugin: 'com.jfrog.bintray'
+apply plugin: 'com.github.dcendents.android-maven'
+
+group = publishedGroupId // Maven Group ID for the artifact
+version = libraryVersion
+
+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 = bintrayRepo
+ name = bintrayName
+ desc = libraryDescription
+ websiteUrl = siteUrl
+ vcsUrl = gitUrl
+ licenses = ["Apache-2.0"]
+ publish = true
+ publicDownloadNumbers = true
+ version {
+ desc = libraryDescription
+ }
+ }
+}
+
+install {
+ repositories.mavenInstaller {
+ // This generates POM.xml with proper parameters
+ pom {
+ project {
+ packaging 'aar'
+ groupId publishedGroupId
+ artifactId artifact
+
+ // Add your description here
+ name libraryName
+ description libraryDescription
+ 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 developerId
+ name developerName
+ email developerEmail
+ }
+ }
+ 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
+}
\ No newline at end of file
diff --git a/circular-progress-view/proguard-rules.pro b/circular-progress-view/proguard-rules.pro
new file mode 100644
index 0000000..60e0457
--- /dev/null
+++ b/circular-progress-view/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Applications/Android/android-sdk-macosx/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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/circular-progress-view/src/main/AndroidManifest.xml b/circular-progress-view/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ff33ef1
--- /dev/null
+++ b/circular-progress-view/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/circular-progress-view/src/main/java/com/github/guilhe/circularprogressview/CircularProgressView.java b/circular-progress-view/src/main/java/com/github/guilhe/circularprogressview/CircularProgressView.java
new file mode 100644
index 0000000..97c825a
--- /dev/null
+++ b/circular-progress-view/src/main/java/com/github/guilhe/circularprogressview/CircularProgressView.java
@@ -0,0 +1,370 @@
+package com.github.guilhe.circularprogressview;
+
+import android.animation.Animator;
+import android.animation.FloatEvaluator;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.*;
+import android.os.Build;
+import android.support.annotation.ColorRes;
+import android.support.annotation.RequiresApi;
+import android.support.v4.content.ContextCompat;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.view.animation.DecelerateInterpolator;
+
+/**
+ * Created by gdelgado on 30/08/2017.
+ */
+@SuppressWarnings("unused")
+public class CircularProgressView extends View {
+
+ private static final String TAG = CircularProgressView.class.getSimpleName();
+
+ private static final float DEFAULT_VIEW_PADDING_DP = 10;
+ private static final float DEFAULT_SHADOW_PADDING_DP = 5;
+ private static final float DEFAULT_STROKE_THICKNESS_DP = 10;
+ private static final int DEFAULT_MAX_WIDTH_DP = 100;
+ private static final int DEFAULT_MAX = 100;
+ private static final int DEFAULT_STARTING_ANGLE = 275;
+ private static final int DEFAULT_ANIMATION_MILLIS = 1000;
+ private static final int DEFAULT_PROGRESS_COLOR = Color.BLACK;
+ private static final float DEFAULT_BACKGROUND_ALPHA = 0.3f;
+ private static final TimeInterpolator DEFAULT_INTERPOLATOR = new DecelerateInterpolator();
+
+ private int mMax;
+ private boolean mShadowEnabled;
+ private int mStartingAngle;
+ private float mProgress;
+ private float mProgressStrokeThickness;
+ private int mProgressColor;
+ private int mBackgroundColor;
+
+ private RectF mProgressRectF;
+ private RectF mShadowRectF;
+ private Outline mOutline;
+ private Paint mBackgroundPaint;
+ private Paint mProgressPaint;
+ private Paint mShadowPaint;
+ private int mLastValidRawMeasuredDim;
+ private float mLastValidStrokeThickness;
+
+ private TimeInterpolator mInterpolator;
+ private Animator mProgressAnimator;
+
+ public CircularProgressView(Context context) {
+ super(context);
+ init(context, null);
+ }
+
+ public CircularProgressView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(context, attrs);
+ }
+
+ public CircularProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init(context, attrs);
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ public CircularProgressView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ init(context, attrs);
+ }
+
+ private void init(Context context, AttributeSet attrs) {
+ mLastValidStrokeThickness = DEFAULT_STROKE_THICKNESS_DP;
+ mInterpolator = DEFAULT_INTERPOLATOR;
+ mProgressRectF = new RectF();
+ mShadowRectF = new RectF();
+
+ mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBackgroundPaint.setStyle(Paint.Style.STROKE);
+ mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mProgressPaint.setStyle(Paint.Style.STROKE);
+ mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mShadowPaint.setStyle(Paint.Style.STROKE);
+
+ if (attrs != null) {
+ TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularProgressView, 0, 0);
+ try {
+ mMax = typedArray.getInt(R.styleable.CircularProgressView_max, DEFAULT_MAX);
+ mShadowEnabled = typedArray.getBoolean(R.styleable.CircularProgressView_shadow, true);
+ mStartingAngle = typedArray.getInteger(R.styleable.CircularProgressView_startingAngle, DEFAULT_STARTING_ANGLE);
+ mProgress = typedArray.getFloat(R.styleable.CircularProgressView_progress, 0);
+ mProgressStrokeThickness = typedArray.getDimension(R.styleable.CircularProgressView_progressBarThickness, convertDpToPx(context, DEFAULT_STROKE_THICKNESS_DP));
+ mProgressColor = typedArray.getInt(R.styleable.CircularProgressView_progressBarColor, DEFAULT_PROGRESS_COLOR);
+ mBackgroundColor = typedArray.getInt(R.styleable.CircularProgressView_backgroundColor, mProgressColor);
+ } finally {
+ typedArray.recycle();
+ }
+ } else {
+ mProgressStrokeThickness = convertDpToPx(context, DEFAULT_STROKE_THICKNESS_DP);
+ mShadowEnabled = true;
+ mMax = DEFAULT_MAX;
+ mStartingAngle = DEFAULT_STARTING_ANGLE;
+ mProgressColor = DEFAULT_PROGRESS_COLOR;
+ mBackgroundColor = mProgressColor;
+ }
+
+ mBackgroundPaint.setColor(adjustAlpha(mBackgroundColor, DEFAULT_BACKGROUND_ALPHA));
+ mProgressPaint.setColor(mProgressColor);
+ mShadowPaint.setColor(adjustAlpha(Color.BLACK, 0.2f));
+ setThickness(mProgressStrokeThickness, false);
+ }
+
+ /**
+ * Either width or height, this view will use Math.min(width, height) value.
+ * If an invalid size is set it won't take effect and a last valid size will be used.
+ * Check {@link #onMeasure(int, int)}
+ *
+ * @param size in pixels
+ */
+ public void setSize(int size) {
+ getLayoutParams().height = size;
+ requestLayout();
+ }
+
+ /**
+ * This method changes the progress bar starting angle.
+ * The default value is 275 and it's equivalent to 12 o'clock.
+ *
+ * @param angle where the progress bar starts.
+ */
+ public void setStartingAngle(int angle) {
+ mStartingAngle = angle;
+ invalidate();
+ }
+
+ public int getStartingAngle() {
+ return mStartingAngle;
+ }
+
+ /**
+ * Sets progress bar max value (100%)
+ *
+ * @param max value
+ */
+ public void setMax(int max) {
+ mMax = max;
+ invalidate();
+ }
+
+ public int getMax() {
+ return mMax;
+ }
+
+ public void setColor(int color) {
+ setProgressColor(color);
+ setBackgroundColor(color);
+ }
+
+ public void setColorResource(@ColorRes int resId) {
+ setColor(ContextCompat.getColor(getContext(), resId));
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setColor(Color color) {
+ setColor(color.toArgb());
+ }
+
+ public void setProgressColor(int color) {
+ mProgressColor = color;
+ if (mBackgroundColor == -1) {
+ setBackgroundColor(color);
+ }
+ mProgressPaint.setColor(color);
+ invalidate();
+ }
+
+ public void setProgressColorResource(@ColorRes int resId) {
+ setProgressColor(ContextCompat.getColor(getContext(), resId));
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setProgressColor(Color color) {
+ setProgressColor(color.toArgb());
+ }
+
+ public int getProgressColor() {
+ return mProgressColor;
+ }
+
+ public void setBackgroundColor(int color) {
+ mBackgroundColor = color;
+ mBackgroundPaint.setColor(adjustAlpha(color, DEFAULT_BACKGROUND_ALPHA));
+ invalidate();
+ }
+
+ public void setShadowColorResource(@ColorRes int resId) {
+ setBackgroundColor(ContextCompat.getColor(getContext(), resId));
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ public void setBackgroundColor(Color color) {
+ setBackgroundColor(color.toArgb());
+ }
+
+ public int getBackgroundColor() {
+ return mBackgroundColor;
+ }
+
+ public void setShadowEnabled(boolean enable) {
+ mShadowEnabled = enable;
+ invalidate();
+ }
+
+ public boolean isShadowEnabled() {
+ return mShadowEnabled;
+ }
+
+ /**
+ * Changes progressBar, background and shadow line width.
+ *
+ * @param thickness in pixels
+ */
+ public void setProgressStrokeThickness(float thickness) {
+ setThickness(thickness, true);
+ }
+
+ private void setThickness(float thickness, boolean requestLayout) {
+ mProgressStrokeThickness = thickness;
+ mBackgroundPaint.setStrokeWidth(mProgressStrokeThickness);
+ mProgressPaint.setStrokeWidth(mProgressStrokeThickness);
+ mShadowPaint.setStrokeWidth(mProgressStrokeThickness);
+ if (requestLayout) {
+ requestLayout();
+ }
+ }
+
+ public float getProgressStrokeThickness() {
+ return mProgressStrokeThickness;
+ }
+
+ public void setProgress(float progress) {
+ setProgress(progress, false);
+ }
+
+ public void setProgress(float progress, boolean animate) {
+ setProgress(progress, animate, DEFAULT_ANIMATION_MILLIS);
+ }
+
+ public void setProgress(float progress, boolean animate, long duration) {
+ setProgress(progress, animate, duration, true);
+ }
+
+ public float getProgress() {
+ return mProgress;
+ }
+
+ public void resetProgress() {
+ setProgress(0);
+ }
+
+ public void resetProgress(boolean animate) {
+ resetProgress(animate, DEFAULT_ANIMATION_MILLIS);
+ }
+
+ public void resetProgress(boolean animate, long duration) {
+ setProgress(0, animate, duration, false);
+ }
+
+ public void setAnimationInterpolator(TimeInterpolator interpolator) {
+ mInterpolator = interpolator == null ? DEFAULT_INTERPOLATOR : interpolator;
+ }
+
+ private void setProgress(float progress, boolean animate, long duration, boolean clockwise) {
+ if (animate) {
+ if (mProgressAnimator != null) {
+ mProgressAnimator.cancel();
+ }
+ mProgressAnimator = getAnimator(getProgress(), clockwise ? progress : 0, duration, new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator valueAnimator) {
+ setProgressValue(((Float) valueAnimator.getAnimatedValue()));
+ }
+ });
+ mProgressAnimator.start();
+ } else {
+ setProgressValue(progress);
+ }
+ }
+
+ private void setProgressValue(float value) {
+ mProgress = value;
+ invalidate();
+ }
+
+ private ValueAnimator getAnimator(double current, double next, long duration, ValueAnimator.AnimatorUpdateListener updateListener) {
+ ValueAnimator animator = new ValueAnimator();
+ animator.setInterpolator(mInterpolator);
+ animator.setDuration(duration);
+ animator.setObjectValues(current, next);
+ animator.setEvaluator(new FloatEvaluator() {
+ public Integer evaluate(float fraction, float startValue, float endValue) {
+ return Math.round(startValue + (endValue - startValue) * fraction);
+ }
+ });
+ animator.addUpdateListener(updateListener);
+ return animator;
+ }
+
+ /**
+ * Changes color's alpha by the factor
+ *
+ * @param color The color to change alpha
+ * @param factor 1.0f (solid) to 0.0f (transparent)
+ * @return int - A color with modified alpha
+ */
+ private int adjustAlpha(int color, float factor) {
+ int alpha = Math.round(Color.alpha(color) * factor);
+ int red = Color.red(color);
+ int green = Color.green(color);
+ int blue = Color.blue(color);
+ return Color.argb(alpha, red, green, blue);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ int height = MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.UNSPECIFIED ?
+ MeasureSpec.getSize(heightMeasureSpec) : convertDpToPx(getContext(), DEFAULT_MAX_WIDTH_DP);
+
+ int rawMeasuredDim = Math.max(Math.min(width, height), 0);
+ float arcDim = mProgressStrokeThickness + convertDpToPx(getContext(), DEFAULT_VIEW_PADDING_DP);
+ mProgressRectF.set(arcDim, arcDim, rawMeasuredDim - arcDim, rawMeasuredDim - arcDim);
+
+ //To avoid creating a messy composition
+ if (mProgressRectF.width() <= mProgressStrokeThickness) {
+ rawMeasuredDim = mLastValidRawMeasuredDim;
+ mProgressRectF.set(arcDim, arcDim, rawMeasuredDim - arcDim, rawMeasuredDim - arcDim);
+ setThickness(mLastValidStrokeThickness, false);
+ }
+ mLastValidRawMeasuredDim = rawMeasuredDim;
+ mLastValidStrokeThickness = mProgressStrokeThickness;
+
+ int shadowPadding = convertDpToPx(getContext(), DEFAULT_SHADOW_PADDING_DP);
+ mShadowRectF.set(mProgressRectF.left, shadowPadding + mProgressRectF.top, mProgressRectF.right, shadowPadding + mProgressRectF.bottom);
+ setMeasuredDimension(rawMeasuredDim, rawMeasuredDim);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ float angle = 360 * mProgress / mMax;
+ if (mShadowEnabled) {
+ canvas.drawArc(mShadowRectF, mStartingAngle, angle, false, mShadowPaint);
+ }
+ canvas.drawOval(mProgressRectF, mBackgroundPaint);
+ canvas.drawArc(mProgressRectF, mStartingAngle, angle, false, mProgressPaint);
+ }
+
+ private static int convertDpToPx(Context context, float dp) {
+ return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f);
+ }
+}
\ No newline at end of file
diff --git a/circular-progress-view/src/main/res/values/attrs.xml b/circular-progress-view/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..8efa5c3
--- /dev/null
+++ b/circular-progress-view/src/main/res/values/attrs.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..fd467b5
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,33 @@
+# 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.
+org.gradle.jvmargs=-Xmx1536m
+
+# 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
+publishedGroupId = com.github.guilhe
+artifact = circular-progress-view
+
+bintrayRepo = android
+bintrayName = circular-progress-view
+
+libraryName = CircularProgressView
+libraryDescription = A fancy CircularProgressView
+libraryVersion = 1.0.0
+
+siteUrl = https://github.com/GuilhE/android-circular-progress-view
+gitUrl = https://github.com/GuilhE/android-circular-progress-view.git
+
+developerId = GuilhE
+developerName = Guilherme Delgado
+developerEmail = gdelgado@bliss.pt
\ 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..13372ae
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..a723080
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Aug 30 22:06:13 WEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/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
+
+# 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\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+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"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # 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/sample.gif b/sample.gif
new file mode 100644
index 0000000..3007092
Binary files /dev/null and b/sample.gif differ
diff --git a/sample/build.gradle b/sample/build.gradle
new file mode 100644
index 0000000..06ba3f8
--- /dev/null
+++ b/sample/build.gradle
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+
+ dataBinding {
+ enabled = true
+ }
+
+ defaultConfig {
+ applicationId "com.github.guilhe.cicularprogressview.sample"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ android {
+ lintOptions {
+ abortOnError false
+ }
+ }
+}
+
+dependencies {
+ compile project(':circular-progress-view')
+ compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+}
\ No newline at end of file
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
new file mode 100644
index 0000000..60e0457
--- /dev/null
+++ b/sample/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Applications/Android/android-sdk-macosx/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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..288012f
--- /dev/null
+++ b/sample/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/java/com/github/guilhe/circularprogressview_sample/SampleActivity.java b/sample/src/main/java/com/github/guilhe/circularprogressview_sample/SampleActivity.java
new file mode 100644
index 0000000..718edbd
--- /dev/null
+++ b/sample/src/main/java/com/github/guilhe/circularprogressview_sample/SampleActivity.java
@@ -0,0 +1,105 @@
+package com.github.guilhe.circularprogressview_sample;
+
+import android.databinding.DataBindingUtil;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+import android.widget.CompoundButton;
+import android.widget.SeekBar;
+import com.github.guilhe.circularprogressview_sample.databinding.ActivitySampleEditorBinding;
+
+/**
+ * Created by gdelgado on 30/08/2017.
+ */
+
+public class SampleActivity extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
+
+ private ActivitySampleEditorBinding mBinding;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mBinding = DataBindingUtil.setContentView(this, R.layout.activity_sample_editor);
+
+ mBinding.sizeSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.thicknessSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.progressSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.angleSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.colorRSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.colorGSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.colorBSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.bgRSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.bgGSeekBar.setOnSeekBarChangeListener(this);
+ mBinding.bgBSeekBar.setOnSeekBarChangeListener(this);
+
+ mBinding.colorsSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+ mBinding.sampleCircularProgressView.setBackgroundColor(mBinding.sampleCircularProgressView.getProgressColor());
+ }
+ });
+ mBinding.shadowSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ mBinding.sampleCircularProgressView.setShadowEnabled(checked);
+ }
+ });
+ }
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+ switch (seekBar.getId()) {
+ case R.id.size_SeekBar:
+ mBinding.sampleCircularProgressView.setSize((int) (i * getResources().getDisplayMetrics().density + 0.5f));
+ break;
+ case R.id.thickness_SeekBar:
+ mBinding.sampleCircularProgressView.setProgressStrokeThickness((int) (i * getResources().getDisplayMetrics().density + 0.5f));
+ break;
+ case R.id.progress_SeekBar:
+ mBinding.sampleCircularProgressView.setProgress(i, mBinding.animatedSwitch.isChecked());
+ break;
+ case R.id.angle_SeekBar:
+ mBinding.sampleCircularProgressView.setStartingAngle(i);
+ break;
+ case R.id.color_r_SeekBar:
+ if (mBinding.colorsSwitch.isChecked()) {
+ mBinding.sampleCircularProgressView.setColor(Color.rgb(i, mBinding.colorGSeekBar.getProgress(), mBinding.colorBSeekBar.getProgress()));
+ } else {
+ mBinding.sampleCircularProgressView.setProgressColor(Color.rgb(i, mBinding.colorGSeekBar.getProgress(), mBinding.colorBSeekBar.getProgress()));
+ }
+ break;
+ case R.id.color_g_SeekBar:
+ if (mBinding.colorsSwitch.isChecked()) {
+ mBinding.sampleCircularProgressView.setColor(Color.rgb(mBinding.colorRSeekBar.getProgress(), i, mBinding.colorBSeekBar.getProgress()));
+ } else {
+ mBinding.sampleCircularProgressView.setProgressColor(Color.rgb(mBinding.colorRSeekBar.getProgress(), i, mBinding.colorBSeekBar.getProgress()));
+ }
+ break;
+ case R.id.color_b_SeekBar:
+ if (mBinding.colorsSwitch.isChecked()) {
+ mBinding.sampleCircularProgressView.setColor(Color.rgb(mBinding.colorRSeekBar.getProgress(), mBinding.colorGSeekBar.getProgress(), i));
+ } else {
+ mBinding.sampleCircularProgressView.setProgressColor(Color.rgb(mBinding.colorRSeekBar.getProgress(), mBinding.colorGSeekBar.getProgress(), i));
+ }
+ break;
+ case R.id.bg_r_SeekBar:
+ mBinding.sampleCircularProgressView.setBackgroundColor(Color.rgb(i, mBinding.bgGSeekBar.getProgress(), mBinding.bgBSeekBar.getProgress()));
+ break;
+ case R.id.bg_g_SeekBar:
+ mBinding.sampleCircularProgressView.setBackgroundColor(Color.rgb(mBinding.bgRSeekBar.getProgress(), i, mBinding.bgBSeekBar.getProgress()));
+ break;
+ case R.id.bg_b_SeekBar:
+ mBinding.sampleCircularProgressView.setBackgroundColor(Color.rgb(mBinding.bgRSeekBar.getProgress(), mBinding.bgGSeekBar.getProgress(), i));
+ break;
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+}
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_sample_editor.xml b/sample/src/main/res/layout/activity_sample_editor.xml
new file mode 100644
index 0000000..ae06a13
--- /dev/null
+++ b/sample/src/main/res/layout/activity_sample_editor.xml
@@ -0,0 +1,237 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_sample_grid.xml b/sample/src/main/res/layout/activity_sample_grid.xml
new file mode 100644
index 0000000..ff396c2
--- /dev/null
+++ b/sample/src/main/res/layout/activity_sample_grid.xml
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..89e19e0
Binary files /dev/null and b/sample/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..6ce7370
Binary files /dev/null and b/sample/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..be0bea6
Binary files /dev/null and b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..7086481
Binary files /dev/null and b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..9d95354
Binary files /dev/null and b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/sample/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d430229
--- /dev/null
+++ b/sample/src/main/res/values/strings.xml
@@ -0,0 +1,12 @@
+
+ circular-progress-view
+ Size
+ Thickness
+ Progress (animated:
+ Starting angle
+ Color RGB (Progress & Background:
+ Shadow:
+ Shadow padding
+ Background color RGB
+ )
+
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
new file mode 100644
index 0000000..516ec04
--- /dev/null
+++ b/sample/src/main/res/values/styles.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/sample1.png b/sample1.png
new file mode 100644
index 0000000..24d7068
Binary files /dev/null and b/sample1.png differ
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..7ff86b3
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':sample', ':circular-progress-view'
\ No newline at end of file