EudyContreras / Skeleton-Bones

Library for dynamically generating skeleton loader drawables for Layouts and Views
MIT License
151 stars 15 forks source link

Development #22

Closed EudyContreras closed 3 years ago

EudyContreras commented 3 years ago

General Api improvements

Adresses issue #20

New view extensions and utility functions for toggling, enabling, disabling skeleton and bone loaders

fun View.enableSkeletonLoading() = this.toggleSkeletonLoading(true)
fun View.disableSkeletonLoading() = this.toggleSkeletonLoading(false)
fun View.toggleSkeletonLoading(enabled: Boolean)

We can now create SkeletonDrawables and BoneDrawables by passing properties and builders

fun create(view: View, enabled: Boolean = true, builder: BoneBuilder): BoneDrawable 
fun create(view: View, enabled: Boolean = true, properties: BoneProperties = BoneProperties()): BoneDrawable
fun builder(defaultProps: BoneProperties): BoneBuilder

fun create(viewGroup: ViewGroup, enabled: Boolean = true, builder: SkeletonBuilder): SkeletonDrawable
fun create(viewGroup: ViewGroup, enabled: Boolean = true, properties: SkeletonProperties = SkeletonProperties()): SkeletonDrawable
fun builder(defaultProps: SkeletonProperties = SkeletonProperties()): SkeletonBuilder

Missing builder functions for SkeletonBuilders

fun withBoneBuilder(view: View, builder: BoneBuilder.() -> Unit): SkeletonBuilder
fun setAnimateRestoreBounds(animateRestoreBounds: Boolean = false): SkeletonBuilder
fun withIgnoredBones(vararg ids: Int): SkeletonBuilder
fun withIgnoredBones(vararg views: View): SkeletonBuilder 

Missing builder properties for BoneBuilders

fun setCornerRadius(cornerRadius: Float = 0f): BoneBuilder