├── .gitignore ├── .idea └── copyright │ └── profiles_settings.xml ├── 365.gif ├── README.md ├── build.gradle ├── demo.apk ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── kurt │ │ └── demo │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── example │ │ └── kurt │ │ └── demo │ │ ├── Determinate.java │ │ ├── Indeterminate.java │ │ ├── MainActivity.java │ │ └── ProgressHelper.java │ └── res │ ├── drawable-hdpi │ └── ic_fab_play.png │ ├── layout │ ├── activity_main.xml │ ├── card.xml │ ├── determinate.xml │ └── indeterminate.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── example.gif ├── fabbutton ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── mbanje │ │ └── kurt │ │ └── fabbutton │ │ ├── AnimationUtils.java │ │ ├── CircleImageView.java │ │ ├── FabButton.java │ │ ├── FabUtil.java │ │ ├── ProgressRingView.java │ │ ├── ViewGroupUtils.java │ │ └── ViewGroupUtilsHoneycomb.java │ └── res │ ├── drawable-hdpi │ └── ic_fab_complete.png │ ├── drawable-mdpi │ └── ic_fab_complete.png │ ├── drawable-xhdpi │ └── ic_fab_complete.png │ ├── drawable-xxhdpi │ └── ic_fab_complete.png │ ├── layout │ └── widget_fab_button.xml │ └── values │ ├── attrs.xml │ └── dimens.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /.idea 8 | *.iml -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /365.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckurtm/FabButton/cd12dee2890c7b0efdc5d21ae4ddffa4bc1aa8ea/365.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## FabProgress 2 | Android Circular floating action button with intergrated progress indicator ring 3 | [As per material design docs](http://www.google.com/design/spec/components/progress-activity.html#progress-activity-types-of-indicators) 4 | 5 | ## Demo: 6 | 7 | [Demo apk](demo.apk) 8 | 9 | ![FabButton](example.gif) 10 | ![365 Body Workout](365.gif) 11 | 12 | ## HOW TO ADD TO YOUR PROJECT 13 | [ ![Download](https://api.bintray.com/packages/ckurtm/maven/FabButton/images/download.svg) ](https://bintray.com/ckurtm/maven/FabButton/_latestVersion) 14 | 15 | Gradle: 16 | ```groovy 17 | dependencies { 18 | compile 'mbanje.kurt:fabbutton:1.2.4@aar' 19 | } 20 | ``` 21 | 22 | ## Usage 23 | 24 | - Use FabButton: (check the demo app included) 25 | ```xml 26 | 44 | ``` 45 | ## Apps using library 46 | 47 | [![alt text][2]][1] 48 | 49 | [1]: https://play.google.com/store/apps/details?id=com.peirr.workout.play 50 | [2]: https://developer.android.com/images/brand/en_app_rgb_wo_45.png (365 Body workout) 51 | 52 | ## License 53 | 54 | The MIT License (MIT) 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a copy 57 | of this software and associated documentation files (the "Software"), to deal 58 | in the Software without restriction, including without limitation the rights 59 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 60 | copies of the Software, and to permit persons to whom the Software is 61 | furnished to do so, subject to the following conditions: 62 | 63 | The above copyright notice and this permission notice shall be included in 64 | all copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 67 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 68 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 69 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 70 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 71 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 72 | THE SOFTWARE. 73 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.compileVersion = 26 5 | ext.targetVersion = 26 6 | ext.toolsVersion = '26.0.1' 7 | 8 | ext.googleLibraryVersion = '26.1.0' 9 | 10 | repositories { 11 | jcenter() 12 | mavenCentral() 13 | google() 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.0.0-beta6' 17 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' 18 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | jcenter() 25 | google() 26 | } 27 | } -------------------------------------------------------------------------------- /demo.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckurtm/FabButton/cd12dee2890c7b0efdc5d21ae4ddffa4bc1aa8ea/demo.apk -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion compileVersion 5 | buildToolsVersion toolsVersion 6 | 7 | defaultConfig { 8 | applicationId "com.mbanje.fabprogress" 9 | minSdkVersion 16 10 | targetSdkVersion targetVersion 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | 16 | debug { 17 | minifyEnabled false 18 | } 19 | 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | implementation "com.android.support:appcompat-v7:${googleLibraryVersion}" 29 | implementation "com.android.support:design:${googleLibraryVersion}" 30 | implementation "com.android.support:cardview-v7:${googleLibraryVersion}" 31 | implementation project(':fabbutton') 32 | // compile 'mbanje.kurt:fabbutton:1.2.4@aar' 33 | } 34 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo/src/androidTest/java/com/example/kurt/demo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.kurt.demo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 28 | 29 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 48 | 49 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /demo/src/main/java/com/example/kurt/demo/Determinate.java: -------------------------------------------------------------------------------- 1 | package com.example.kurt.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.CollapsingToolbarLayout; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import mbanje.kurt.fabbutton.FabButton; 10 | 11 | /** 12 | * Created by kurt on 08 06 2015 . 13 | */ 14 | public class Determinate extends AppCompatActivity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.determinate); 20 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 21 | final FabButton button = (FabButton) findViewById(R.id.determinate); 22 | 23 | setSupportActionBar(toolbar); 24 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 25 | 26 | CollapsingToolbarLayout collapsingToolbar = 27 | (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 28 | collapsingToolbar.setTitle("Determinate"); 29 | 30 | final ProgressHelper helper = new ProgressHelper(button,this); 31 | 32 | button.setOnClickListener(new View.OnClickListener() { 33 | @Override 34 | public void onClick(View v) { 35 | helper.startDeterminate(); 36 | } 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demo/src/main/java/com/example/kurt/demo/Indeterminate.java: -------------------------------------------------------------------------------- 1 | package com.example.kurt.demo; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.CollapsingToolbarLayout; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import mbanje.kurt.fabbutton.FabButton; 10 | 11 | /** 12 | * Created by kurt on 08 06 2015 . 13 | */ 14 | public class Indeterminate extends AppCompatActivity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.indeterminate); 20 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 21 | final FabButton button = (FabButton) findViewById(R.id.determinate); 22 | setSupportActionBar(toolbar); 23 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 24 | 25 | CollapsingToolbarLayout collapsingToolbar = 26 | (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 27 | collapsingToolbar.setTitle("Indeterminate"); 28 | 29 | final ProgressHelper helper = new ProgressHelper(button,this); 30 | 31 | button.setOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | helper.startIndeterminate(); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /demo/src/main/java/com/example/kurt/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.kurt.demo; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | 9 | public class MainActivity extends AppCompatActivity { 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_main); 15 | 16 | findViewById(R.id.determinate).setOnClickListener(new View.OnClickListener() { 17 | @Override 18 | public void onClick(View v) { 19 | startActivity(new Intent(MainActivity.this,Determinate.class)); 20 | } 21 | }); 22 | 23 | findViewById(R.id.indeterminate).setOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | startActivity(new Intent(MainActivity.this, Indeterminate.class)); 27 | } 28 | }); 29 | 30 | 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /demo/src/main/java/com/example/kurt/demo/ProgressHelper.java: -------------------------------------------------------------------------------- 1 | package com.example.kurt.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Handler; 5 | 6 | import mbanje.kurt.fabbutton.FabButton; 7 | 8 | /** 9 | * Created by kurt on 08 06 2015 . 10 | */ 11 | public class ProgressHelper { 12 | 13 | private int currentProgress = 0; 14 | private Handler handle=new Handler(); 15 | private final FabButton button; 16 | private final Activity activity; 17 | 18 | public ProgressHelper(FabButton button, Activity activity) { 19 | this.button = button; 20 | this.activity = activity; 21 | } 22 | 23 | private Runnable getRunnable(final Activity activity){ 24 | return new Runnable() { 25 | @Override 26 | public void run() { 27 | currentProgress += 1; 28 | activity.runOnUiThread(new Runnable() { 29 | @Override 30 | public void run() { 31 | button.setProgress(currentProgress); 32 | if(currentProgress <= 100){ 33 | handle.postDelayed(getRunnable(activity),50); 34 | } 35 | } 36 | }); 37 | } 38 | }; 39 | } 40 | 41 | public void startIndeterminate() { 42 | button.showProgress(true); 43 | } 44 | 45 | public void startDeterminate() { 46 | button.resetIcon(); 47 | button.showShadow(false); 48 | currentProgress = 0; 49 | button.showProgress(true); 50 | button.setProgress(currentProgress); 51 | getRunnable(activity).run(); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_fab_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckurtm/FabButton/cd12dee2890c7b0efdc5d21ae4ddffa4bc1aa8ea/demo/src/main/res/drawable-hdpi/ic_fab_play.png -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 30 | 31 |