Top Related Projects
Create circular ProgressBar in Android ⭕
Circle button widget for Android
Android loading animations
A small Android library allowing you to have a smooth and customizable horizontal or circular indeterminate ProgressBar
Quick Overview
Circular Progress Button is an Android library that provides a custom button with an integrated circular progress indicator. It allows developers to easily create buttons that can show loading states, success/failure animations, and more, enhancing the user experience in Android applications.
Pros
- Easy integration with existing Android projects
- Customizable appearance and behavior
- Smooth animations for state transitions
- Supports both indeterminate and determinate progress
Cons
- Limited to circular progress indicator shape
- May require additional styling to match specific app designs
- Not actively maintained (last update was in 2017)
- Lacks support for newer Android features and Material Design 3
Code Examples
- Basic button initialization:
val circularButton = findViewById<CircularProgressButton>(R.id.circularButton)
circularButton.setOnClickListener {
circularButton.startAnimation()
}
- Setting progress programmatically:
circularButton.setProgress(75) // Sets progress to 75%
- Changing button state:
circularButton.setIdleText("Submit")
circularButton.setCompleteText("Done")
circularButton.setErrorText("Error")
circularButton.setProgress(100) // Complete state
circularButton.setProgress(-1) // Error state
- Customizing button appearance:
circularButton.setIndeterminateProgressMode(true)
circularButton.setBackgroundColor(ContextCompat.getColor(this, R.color.button_bg))
circularButton.setStrokeColor(ContextCompat.getColor(this, R.color.button_stroke))
circularButton.setTextColor(ContextCompat.getColor(this, R.color.button_text))
Getting Started
- Add the dependency to your
build.gradle
file:
dependencies {
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
}
- Add the button to your layout XML:
<com.dd.CircularProgressButton
android:id="@+id/circularButton"
android:layout_width="196dp"
android:layout_height="64dp"
android:textColor="@color/white"
android:textSize="18sp"
app:cpb_textComplete="@string/Complete"
app:cpb_textError="@string/Error"
app:cpb_textIdle="@string/Upload" />
- Initialize and use the button in your Activity or Fragment:
val circularButton = findViewById<CircularProgressButton>(R.id.circularButton)
circularButton.setOnClickListener {
circularButton.startAnimation()
// Perform your task here
// Update progress or set complete/error state when done
}
Competitor Comparisons
Create circular ProgressBar in Android ⭕
Pros of CircularProgressBar
- More customization options for progress bar appearance
- Supports both determinate and indeterminate progress modes
- Actively maintained with recent updates
Cons of CircularProgressBar
- Lacks built-in button functionality
- May require more setup for complex use cases
Code Comparison
CircularProgressBar:
val circularProgressBar = CircularProgressBar(context).apply {
progress = 25
progressMax = 100
progressBarColor = Color.BLUE
backgroundProgressBarColor = Color.GRAY
}
circular-progress-button:
CircularProgressButton circularButton = findViewById(R.id.circularButton);
circularButton.setIndeterminateProgressMode(true);
circularButton.setProgress(50);
CircularProgressBar offers more granular control over the progress bar's appearance, while circular-progress-button provides an integrated button with progress functionality. CircularProgressBar is better suited for standalone progress indicators, whereas circular-progress-button is ideal for actionable progress buttons.
Circle button widget for Android
Pros of android-circlebutton
- Simpler implementation focused solely on circular button functionality
- Lighter weight with fewer dependencies
- Easier to customize and extend for specific use cases
Cons of android-circlebutton
- Lacks built-in progress indicator functionality
- Less feature-rich compared to circular-progress-button
- Not actively maintained (last update in 2015)
Code Comparison
circular-progress-button:
CircularProgressButton circularButton = (CircularProgressButton) findViewById(R.id.circularButton);
circularButton.setIndeterminateProgressMode(true);
circularButton.setProgress(50);
android-circlebutton:
CircleButton circleButton = (CircleButton) findViewById(R.id.circleButton);
circleButton.setColor(Color.BLUE);
circleButton.setImageResource(R.drawable.ic_action_tick);
The code comparison shows that circular-progress-button offers built-in progress functionality, while android-circlebutton focuses on basic circular button customization. circular-progress-button provides more options for handling progress states, whereas android-circlebutton is simpler to use for basic circular button implementations.
Both libraries offer custom attributes for styling, but circular-progress-button provides more extensive options for progress-related customization. android-circlebutton may be preferred for projects requiring a lightweight circular button without progress indicators, while circular-progress-button is better suited for applications needing integrated progress functionality in their buttons.
Android loading animations
Pros of Android-SpinKit
- Offers a wider variety of loading animations (8 different styles)
- Provides more customization options for colors and sizes
- Easier to implement for simple loading indicators
Cons of Android-SpinKit
- Lacks built-in button functionality
- Does not provide state management for progress indicators
- May require additional code for integrating with buttons or other UI elements
Code Comparison
Android-SpinKit:
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/spin_kit"
style="@style/SpinKitView.Large.Circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
circular-progress-button:
<com.dd.CircularProgressButton
android:id="@+id/circularButton"
android:layout_width="196dp"
android:layout_height="64dp"
android:textColor="@color/white"
android:textSize="18sp"
app:cpb_textComplete="@string/Complete"
app:cpb_textError="@string/Error"
app:cpb_textIdle="@string/Upload" />
Android-SpinKit focuses on providing various loading animations, while circular-progress-button combines button functionality with progress indication. The choice between the two depends on specific project requirements and desired user interface elements.
A small Android library allowing you to have a smooth and customizable horizontal or circular indeterminate ProgressBar
Pros of SmoothProgressBar
- Offers a wider variety of progress bar styles, including horizontal and circular options
- Provides smoother animations and transitions between progress states
- Supports indeterminate progress animations out of the box
Cons of SmoothProgressBar
- Less focused on button-specific functionality compared to circular-progress-button
- May require more customization for use in button contexts
- Documentation is not as extensive as circular-progress-button
Code Comparison
SmoothProgressBar:
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:spb_color="#FF0000"
app:spb_sections_count="4"
app:spb_speed="2.0"
app:spb_stroke_width="4dp"
app:spb_stroke_separator_length="4dp"/>
circular-progress-button:
<com.dd.CircularProgressButton
android:id="@+id/circularButton"
android:layout_width="196dp"
android:layout_height="64dp"
android:textColor="@color/white"
android:textSize="18sp"
app:cpb_textComplete="@string/Complete"
app:cpb_textError="@string/Error"
app:cpb_textIdle="@string/Upload"/>
Both libraries offer easy-to-use XML implementations, but circular-progress-button is more focused on button-specific attributes, while SmoothProgressBar provides more general progress bar customization options.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Note: updated version of this library will be available here.
Description
Android Button which can morph to Circular Progress
Wiki
Integration
The lib is available on Maven Central, you can find it with Gradle, please
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.dmytrodanylyk:circular-progress-button:$latest'
}
ProGuard
If you are using proguard with your project, add following code to your proguard config file
-keepclassmembers class com.dd.StrokeGradientDrawable {
public void setStrokeColor(int);
}
Contributions
If you want to contribute to this library make sure you send pull request to dev branch.
Used By
List of applications on Play Store where this library is used, if you want to be added - ping me.
Icon | Application |
---|---|
Passei Direto: Provas & Aulas | |
Finger Gesture Launcher |
Sample
License
The MIT License (MIT)
Copyright (c) 2014 Danylyk Dmytro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Top Related Projects
Create circular ProgressBar in Android ⭕
Circle button widget for Android
Android loading animations
A small Android library allowing you to have a smooth and customizable horizontal or circular indeterminate ProgressBar
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot