package com.abbidot.tracker.base

import androidx.recyclerview.widget.RecyclerView
import com.qmuiteam.qmui.recyclerView.QMUIRVItemSwipeAction

/**
 *Created  by .yzq on 2021/11/22/022.
 * @link
 * @description: QMUIRVItemSwipeAction.Callback
 */
abstract class BaseQMUIRVItemSwipeAction(swipeDirection: Int) : QMUIRVItemSwipeAction.Callback() {

    private val mSwipeDirection = swipeDirection

    abstract fun removeItem(position: Int)

    override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
        removeItem(viewHolder.adapterPosition)
    }

    override fun getSwipeDirection(recyclerView: RecyclerView,
                                   viewHolder: RecyclerView.ViewHolder): Int {
        return mSwipeDirection
    }
}