A collection of progress indicators/loaders for Jetpack Compose
Update the project build.gradle. You can include one or more of the loaders:
dependencies {
implementation 'com.mitteloupe.loaders:loaders-gears:0.4.0'
implementation 'com.mitteloupe.loaders:loaders-jigsaw:0.2.0'
}
This project is hosted in mavenCentral().
GearsLoader()
JigsawLoader()
@Composable
fun GearsLoader(
modifier: Modifier = Modifier,
gearConfiguration: GearConfiguration = GearsLoaderDefaults.gearConfiguration,
@FloatRange(from = 0.0, to = 1.0) toothRoundness: Float = GearsLoaderDefaults.TOOTH_ROUNDNESS,
holeRadius: Dp = GearsLoaderDefaults.holeRadius,
rotationTimeMilliseconds: Int = GearsLoaderDefaults.ROTATION_TIME_MILLISECONDS,
color: Color = GearsLoaderDefaults.color,
trackColor: Color = GearsLoaderDefaults.trackColor,
gearType: GearType = GearsLoaderDefaults.gearType,
progressState: ProgressState = ProgressState.Indeterminate,
transitionTimeMilliseconds: Int = DefaultDurationMillis,
rectangleFiller: RectangleFiller = RectangleFiller(GearMesher())
)
@Composable
fun JigsawLoader(
modifier: Modifier = Modifier,
progressState: ProgressState = Indeterminate(),
horizontalPieces: Int = JigsawLoaderDefaults.horizontalPieces,
verticalPieces: Int = JigsawLoaderDefaults.verticalPieces,
puzzleBrushProvider: BrushProvider =
ColorBrushProvider(JigsawLoaderDefaults.color),
lightBrush: Brush = SolidColor(Color.White.copy(alpha = .4f)),
darkBrush: Brush = SolidColor(Color.Black.copy(alpha = .6f)),
trackColor: Color = JigsawLoaderDefaults.trackColor,
piecePresenceResolver: PiecePresenceResolver = JigsawLoaderDefaults.piecePresenceResolver(
progressState = progressState,
horizontalPieces = horizontalPieces,
verticalPieces = verticalPieces
),
transitionTimeMilliseconds: Int = AnimationConstants.DefaultDurationMillis,
@FloatRange(from = 0.0, to = 1.0) trackSaturation: Float = 1f,
knobInversionEvaluator: (placeX: Int, placeY: Int) -> Boolean =
JigsawLoaderDefaults.knobInversionEvaluator,
knobConfiguration: KnobConfiguration = JigsawLoaderDefaults.knobConfiguration,
overflow: Boolean = false
)
If this project helped you, give it a ⭐️!
Contributions to this project are welcome. Please feel free to report any issues or fork to make changes and raise a pull request.
This project is distributed under the terms of the MIT License. See LICENSE for details.