Skip to content

mejdi14/Blob-Stepper

Repository files navigation

Welcome to Card Switcher Library 👋

gitmoji-changelog gitmoji-changelog License: MIT

✨ Demo

Installation

Add this in your root build.gradle file (not your module build.gradle file):

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

🔨Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	implementation 'com.github.mejdi14:blob-stepper:0.0.1'
}

🔥How to use

val controller = remember { BlobProgressController(steps = 3) }
     BlobStepper(controller = controller,
                    blobCircle = BlobCircle(
                        blobContent = BlobContent.TextContent(text = textValue)
                    ),
                    blobActionListener = object : BlobActionListener() {
                        override fun onChangeListener(step: Int) {
                            
                        }

                        override fun onFinishListener() {
                            
                        }

                        override fun onExplodeListener() {
                            
                        }
                    })

Blob Cicrle Options

     radius: Initial circle radius
     shrinkRadius: Circle radius after transformation
     color: Color = Cicle color
     wavesHeight: Blob waves height
     wavesMovementDurationMillis: Blob waves animation duration
     sizeTransformationDurationMillis: Circle state change duration
     wavesCount: Number of waves
     blobContent: Blob content (Text or Image)

Progress Circle Options

     radius : Initial progress circle radius
     strokeWidth: Border stroke width
     strokeDefaultColor: Stroke background color
     strokeFilledColor: Stroke progress color
     startAngle: At which angle the progress animation starts
     progressAnimationDurationMillis: Progress animation duration

Controller Functions

     progress: State<Float> : Progress percent
     currentStep: State<Int> : Current Step
     isExpanded: State<Boolean> : Cicle is on initial size
     isExploded: State<Boolean> : Circle covers all the screen
     isFinished: State<Boolean> : Progress circle reached final step
     stepsCount: Int : All steps count
     completionListener: ProgressCompletionListener : Progress is over
     shrink() : Transform the circle to the smaller size and start blob waves animation
     expand() : Go back to the initial circle size and cancel animation
     explode() : Cover all screen 
     next() : Go to the next step progress
     back() : Go back to the previous step
     goTo(step: Int) : Go to a specific step
     reset() : Rest the progress counter

Actions Listener

     onStartListener() : Animation started (circle shrink and blob waves are moving)

     onChangeListener(step: Int) : Triggered when there is a change in the circle state

     onNextStepListener() : Triggered when we move to a new step

     onFinishListener() : We reached the final step

     onClickListener() : On Circle click listener

     onExplodeListener() : Circle is exploded and covered all the screen

Blob Content

 BlobContent.TextContent(text = textValue)

 BlobContent.ImageContent(painter = painterValue)

insde the Blob Circle you can put a Text Composable or an Image Composable, both accept State value so that you can change the content value while you navigate from a step to another.

🤝 Contributing

Contributions, issues and feature requests are welcome.
Feel free to check [issues page] if you want to contribute.

Author

👤 Mejdi Hafiane

Show your support

Please ⭐️ this repository if this project helped you!

📝 License

Copyright © 2019 Mejdi Hafiane.
This project is MIT licensed.