Skip to content

Latest commit

 

History

History
103 lines (66 loc) · 7.85 KB

SKELETON_BONE.md

File metadata and controls

103 lines (66 loc) · 7.85 KB

Banner Demo

Skeleton Bone and Bone Drawable


A bone drawable loader representation of a View. Bones are typically contained within a skeleton, but bones can also be on their own. When a bone is contained within a parent that is a SkeletonDrawable, the parent drawable is in charge of the rendering of said bone. Every detail of the bone can be customized in order to provide the best look. When a bone is not contained within a Skeleton, the bone is then an independent bone and has similar but limited functionality. The bone can have its own state and can display an overlay shimmer. Below you ll find a list of properties that can be customized. Independent bones can share properties through a BonePropertyHolder

The properties covered in this section apply to both Skeleton Bones which are the virtual representation of view bones and Bone Drawables which are actual independent drawables.

Glossary

  • Dimension A dimension which should be given in dps
  • Fraction A fraction where the offset can be either 0f or 1f.

Bone Attributes


Property Availability Applies Type Default
skeletonBoneProps View Both BoneProperties null
skeletonBonePropId View Both Integer null
skeletonBoneEnabled View Both Boolean true
skeletonBoneStateOwner View, ViewGroup Bone Boolean false
skeletonBoneShapeType View Both ShapeType null
skeletonBoneToggleView View, ViewGroup Bone Boolean true
skeletonBoneColor View, ViewGroup Both Integer, ColorRes null
skeletonBoneMatchBounds View Bone Float, Dimension false
skeletonBoneSize View Bone Float, Dimension null
skeletonBoneWidth View Bone Float, Dimension null
skeletonBoneHeight View Bone Float, Dimension null
skeletonBoneMinWidth View Bone Float, Dimension null
skeletonBoneMinHeight View Bone Float, Dimension null
skeletonBoneTranslationX View Bone Float, Dimension 0f
skeletonBoneTranslationY View Bone Float, Dimension 0f
skeletonBoneCornerRadius View, ViewGroup Both Float, Dimension null
skeletonBoneMinThickness View, ViewGroup Bone Float, Dimension null
skeletonBoneMaxThickness View, ViewGroup           Bone  Float, Dimension null
skeletonBoneShadeMultiplier View Both Float, Fraction 1.0f
skeletonBoneAllowSavedState View Both Boolean false
skeletonBoneAllowWeakSavedState                     View Both Boolean false
skeletonBoneDissectLargeBones View Both           Boolean false
skeletonBoneTransitionDuration ViewGroup Both Long 2000
skeletonBoneIgnored View Bone Boolean false

Bone Attribute Descriptions


skeletonBoneProps: Sets the properties to be used by the bone corresponding to the View bound to this attribute.

skeletonBonePropId: The id of the bone property holder which contains the properties that are to be assigned to the bone generated by a view.

skeletonBoneEnabled: Determines whether or not this View should be represented as a skeleton bone or a bone drawable if independent. When the bounded view is child to a ViewGroup that is has a SkeletonDrawable the bounded view will become its own independent state owner.

skeletonBoneStateOwner: Marks the target view as an independent state owner. If this target view is an ImageView it can be notified when loaded using the notifySkeletonImageLoaded() extension function, otherwise this should be used in combination with skeletonBoneEnabled.

skeletonBoneDissectLargeBones: When true, bones which exceed the max set thickness will be dissected into a set of smaller bones. The smaller bones are evenly distributed through the space.

skeletonBoneShapeType: Sets the type of shape the bone should have (Circular | Rectangular).

skeletonBoneColor: Sets the color of the bones generated by this Skeleton View or ViewGroup.

skeletonBoneToggleView: Sets the toggle view flag. When true, the owner views of the bones are hidden while the loading state is true (Loading).

skeletonBoneShadeMultiplier: Sets the color shade multiplier for the bone used by this view. Values less than 1.0f will result in darker shades of the assigned color, while values higher than 1.0f will result in brighter shades.

skeletonBoneCornerRadius: Sets the corner radius of the bone used by this View or ViewGroup. This will only take effect if the ShapeType of the view is Circular. This affects clipping.

skeletonBoneMinThickness: Sets the absolute minimum thickness a skeleton bone can have. Bones which are thinner than the defined minimum thickness will default to the set value.

skeletonBoneMaxThickness: Sets the absolute maximum thickness a skeleton bone can have. Bones which are thinner than the defined maximum thickness will default to the set value. If skeletonDissectLargeBonesis set to true, Bones which exceed this limit will be partitioned/dissected

skeletonBoneMatchBounds: Flags the bone's dimension to be computed with the owner view's exact bounds. This will effectively ignore other bound limits that have been set.

skeletonBoneSize: Sets the width and height of the bone this property was bound to. Overrides the computed width and height.

skeletonBoneMinWidth: Sets the min width/length of the bone this property was bound to. Needed in order to assure that the layout is properly attributed prior to bone generation. This does not need to be set if the view bounded to this attribute already has a set minimum width.

skeletonBoneMinHeight: Sets the min height/thickness of the bone this property was bound to. Needed in order to assure that the layout is properly attributed prior to bone generation. This does not need to be set if the view bounded to this attribute already has a set minimum height.

skeletonBoneWidth: Sets the width/length of the bone this property was bound to. Overrides the computed width.

skeletonBoneHeight: Sets the height/thickness of the bone this property was bound to. Overrides the computed height.

skeletonBoneTranslationX: Sets the translationX of the bone this property was bound to. This will shift the bone from the center of its owner view. Use with caution.

skeletonBoneTranslationY: Sets the translationY of the bone this property was bound to. This will shift the bone from the center of its owner view. Use with caution.

skeletonBoneIgnored: If true prevents bone generation for the view this property is bound to. This will have no effect if an ancestor of this view is already ignored

skeletonBoneAllowSavedState: Determines whether or not the internal state of the bone representation of the View should be saved in memory. Useful when the state could change from true to false (Content to Loading). If the state of the drawable is never expected to change from false to true it is best to keep this set to false.

skeletonBoneAllowWeakSavedState: Determines whether or not the internal state of the bone representation of the View should be saved in memory as a weak reference. Useful when the state could change from true to false (Content to Loading). If the state of the drawable is never expected to change from false to true it is best to keep this set to false

skeletonBoneTransitionDuration: Sets the duration of the drawable's transition between enabled and disabled.