Skip to content

Repository files navigation

ExpressView

A micro-interaction library which enables animation for various actions or reactions. Inspired from Twitter's and Instagram's like button animation.

PlatformAPITwitter

ExpressView sample gif

Gradle Dependency

dependencies {
implementation "co.ankurg.expressview:expressview:0.0.3"
}

XML

<co.ankurg.expressview.ExpressView
android:id="@+id/likeButton"android:layout_width="64dp"android:layout_height="64dp" />

Observing check state

View reacts to clicks and maintains the state on its own. To listen to the check state change, implement the following callback.

importco.ankurg.expressview.OnCheckListener...
likeButton.setOnCheckListener(object:OnCheckListener {
overridefunonChecked(view:ExpressView?) {
Log.d(TAG, "Checked")
}
overridefunonUnChecked(view:ExpressView?) {
Log.d(TAG, "Unchecked")
}
})

Attributes

NameDescriptionValueDefault
uncheckedIconUncheked icon sateDrawableHeart Icon
checkedIconChecked icon stateDrawableHeart Icon
uncheckedIconTintUnchecked icon colorColor#A1A1A1A1
checkedIconTintChecked icon colorColor#FFFF0000
iconSizeSize of icon, applied to both widht & heightDimension55% of ExpressView
burstColorColor of line burst behind the iconColor#FFFF0000
setCheckedInitial check state of iconBooleanfalse

Note:- Default ExpressView size is 48dp and iconSize is 26dp (55% of 48dp)

Public Kotlin/Java properties

NameDescriptionValueDefault
isCheckedInitial check state of iconBooleanfalse
animationStartDelayDelay between the tap and animation, applied to both icon and burst animationsLong50L
iconAnimationDurationAnimation duration of icon inside ExpressViewLong700L
burstAnimationDurationAnimation duration of line burst behind the iconLong500L
interpolatorAnimation interpolator for the icon inside ExpressViewInterpolatorBounceInterpolator
onCheckListenerCheck state change listener/callbackOnCheckListenernull

About

Let your users express more with this micro-interaction library to animate like, react, or other actions. ❤️

Topics

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages