How to make swipe left to reply animation in chat app?

Viewed 178

I am working on a messenger project and it is about completed. But I wanted to make a feature for replying to a specific message by swiping. I searched about it and found an amazing article. So I have just implemented it and it worked as it should be.

Now the question is how to make it work for the right side messages, swipe left to reply. Or we can say just the opposite of the usual. I just want to make it looks professional like WhatsApp.

I have tried this way But it just swipes to left, No reply animation no vibration. Source Code

override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
    mView = viewHolder.itemView
    imageDrawable = context.getDrawable(R.drawable.ic_reply_black_24dp)!!
    shareRound = context.getDrawable(R.drawable.ic_round_shape)!!
    val direction = if (viewHolder.itemViewType != MessageType.SEND) {
        RIGHT
    } else {
        LEFT
    }
    return ItemTouchHelper.Callback.makeMovementFlags(ACTION_STATE_IDLE, direction)
}
0 Answers
Related