LiveReaction or FloatingReaction is an android custom view that helps to achieve floating reaction of drawable on screen
LiveReaction
To have Floating Drawable as LiveReaction on Screen, can be broadcasted to other users by using Scoket other realtime PubSub.
Installation
Add the following maven repository in root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the following dependency in app build.gradle:
dependencies {
implementation 'com.github.MohdShamweel:LiveReaction:1.0'
}
Usage
- Add
LiveReactionView
in.xml
file
<com.shamweel.livereaction.LiveReactionView
android:id="@+id/liveReactionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
- To perform the reaction call the below code on button click or on realtime-callback:
liveReactionView.performLiveReaction(R.drawable.ic_heart_filled_red)
Others
To limit the On-Screen floating reaction count use: Default is 30
liveReactionView.setOnScreenMaxReactionCount(25)
To clear all the floating reactions use:
liveReactionView.clearReactionView()
Other performReaction params
/**
* Call to perform Floating Reaction
* @param drawableRes : Drawable Res file to be used to perform Reaction
* @param isSelf : when true the the onScreenMaxCount is neglected
* @param duration : The duration to on-screen animation
*/
reactionViewFourth.performLiveReaction(
drawableRes = R.id.ic_heart_filled_red,
isSelf = true,
duration = 2000L
)
Example:
To know more about implementation please checkout the Sample App
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.