To have Floating Drawable as LiveReaction on Screen, can be broadcasted to other users by using Scoket other realtime PubSub.
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'
}- Add
LiveReactionViewin.xmlfile
<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)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
*/
reactionView.performLiveReaction(
drawableRes = R.id.ic_heart_filled_red,
isSelf = true,
duration = 2000L
)To know more about implementation please checkout the Sample App
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
