Home

Awesome

alt text

SSJetPackComposeProgressButton

SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive.

CI Status Kotlin Version Platform API Android Arsenal

Features

🎬 Preview

On SuccessOn Failure
<a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseProgressButton.kt#L30" target="_blank"><img src="/gif/success.gif" height="850px"/></a><a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseProgressButton.kt#L30" target="_blank"><img src="/gif/failure.gif" height="850px"/></a>

🎬 Swipeable Buttons

On SuccessOn Failure
<a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseSwipeAbleProgressButton.kt#L30" target="_blank"><img src="/gif/swipeToAnimateSuccess.gif" height="450px"/></a><a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseSwipeAbleProgressButton.kt#L30" target="_blank"><img src="/gif/swipeToAnimateFailure.gif" height="450px"/></a>

🎬 Customized loading animation

On SuccessOn Failure
<a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseCustomProgressButton.kt#L27" target="_blank"><img src="/gif/custom_success.gif" height="450px"/></a><a href="https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/579c837bbb3a9d3d11523368c96229dac6a9e287/app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/base/BaseCustomProgressButton.kt#L27" target="_blank"><img src="/gif/custom_fail.gif" height="450px"/></a>

Installation

  1. Add it in your root build.gradle at the end of repositories:

    allprojects {
    	repositories {
    		...
    		maven { url 'https://jitpack.io' }
    	}
    }
    

Usage

Migration guide from release v1.0.9

Customization

All Attributes


AttributeDescriptionDefault
typeChoose type of animation from:[CIRCLE, WHEEL, ZOOM_IN_OUT_CIRCLE, CLOCK, SPIRAL, CUSTOM]None
widthWidth to be applied to the button.None
heightHeight to be applied to the button.None
onClickWill be called when the user clicks the button.None
assetColorColor to be applied to icon and text inside button.None
buttonStateRepresent the state of button from IDLE, LOADING, SUCCESS, FAILIURE from SSButtonState.None
buttonBorderWidthBorder width to draw around the button.0.dp
buttonBorderColorBorder color to be applied around the button.0.dp
animatedButtonBorderColorBorder color to be applied around the button when button is in LOADING state.0.dp
isBlinkingIconIcon will be blink with size and color.false
blinkingIconColorColor which will be used with Icon tintColor when isBlinkingIcon is enabled.null
cornerRadiusCorner radius to be applied to the button.20
speedMillisSpeed of the animation while changing the state.1000
enabledControls the enabled state of the button.true
elevationIt is used to resolve the elevation for this button in different.ButtonDefaults.elevatedButtonElevation()
colorsColors that will be used to resolve the background and content color for this button in different statesButtonDefaults.buttonColors()
paddingThe spacing values to apply internally between the container and the content.PaddingValues(0.dp)
alphaValueThe alpha of the drawn area.1f
leftImagePainterPainter to draw inside this left Icon.null
leftImageTintColorColor to be applied to left image.null
rightImagePainterPainter to draw inside this right Icon.null
rightImageTintColorColor to be applied to right image.null
successIconPainterPainter to draw inside this success state Icon.null
successIconTintColorColor to be applied to success icon.null
failureIconPainterPainter to draw inside this failure state Icon.null
failureIconTintColorColor to be applied to failure icon.null
textThe text to be displayed.null
textModifierTo apply to this text layout node.Modifier
fontSizeThe size of glyphs to use when painting the text.TextUnit.Unspecified
fontStyleThe typeface variant to use when drawing the letters (e.g., italic).null
fontFamilyThe font family to be used when rendering the text.null
fontWeightThe typeface thickness to use when painting the text (e.g., [FontWeight.Bold]).null
hourHandColorColor will be apply to hour hand in clock type animation only.Color.Black
customLoadingIconPainterpainter [Painter] to draw your custom loading icon.painterResource(id = R.drawable.simform_logo)
customLoadingEffectCustom loading animation type like roation, zoom in out etc.SSCustomLoadingEffect( rotation = false, zoomInOut = false, colorChanger = false)
customLoadingPaddingSpacing between button border and loading icon.0.dp
shouldAutoMoveToIdleStateIn case of success/failure state after defined time it move back to idle state.true
swipeAbleButtonPaddingSpacing for swipeAble button icon.true
swipeAbleButtonThresholdThreshold for swipe button, once this threshold will reach it will consider button as loading state based on shouldAutomateSwipeToAnimate.0.5f
shouldAutomateSwipeToAnimateBased on this it will determine if button should move to loading state once swipeAbleButtonThreshold has been reached or should wait for user to stop swipe.false
onSwipeAbleButtonDragPercentageUpdateThis will give callback of the progress update when the swipe is in progress.None
onSwipedThis will give callback once swipe is reached at threshold and button moves to loading state.None

Our JetPackCompose Sample

SSComposeCookBook : A Collection of major Jetpack compose UI components which are commonly used.

Find this library useful? ❤️

Support it by joining stargazers for this repository.⭐

How to Contribute🤝

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 Check out our Contributing Guide for ideas on contributing.

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Medium Blog

For more info go to Progress Button using JetPack Compose : SSJetPackComposeProgressButton

Awesome Mobile Libraries

License

Distributed under the MIT License. See LICENSE for details.