|
|
|
@ -5,7 +5,6 @@ import android.util.AttributeSet |
|
|
|
import android.view.ContextMenu |
|
|
|
import android.view.ContextMenu |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import timber.log.Timber |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContextMenuRecyclerView : RecyclerView { |
|
|
|
class ContextMenuRecyclerView : RecyclerView { |
|
|
|
@ -22,10 +21,8 @@ class ContextMenuRecyclerView : RecyclerView { |
|
|
|
|
|
|
|
|
|
|
|
override fun showContextMenuForChild(originalView: View): Boolean { |
|
|
|
override fun showContextMenuForChild(originalView: View): Boolean { |
|
|
|
val longPressPosition = getChildAdapterPosition(originalView) |
|
|
|
val longPressPosition = getChildAdapterPosition(originalView) |
|
|
|
Timber.d("longPressPosition = $longPressPosition") |
|
|
|
|
|
|
|
if (longPressPosition >= 0) { |
|
|
|
if (longPressPosition >= 0) { |
|
|
|
val longPressId = adapter!!.getItemId(longPressPosition) |
|
|
|
val longPressId = adapter!!.getItemId(longPressPosition) |
|
|
|
Timber.d("longPressId = $longPressId") |
|
|
|
|
|
|
|
mContextMenuInfo = RecyclerViewContextMenuInfo(longPressPosition, longPressId) |
|
|
|
mContextMenuInfo = RecyclerViewContextMenuInfo(longPressPosition, longPressId) |
|
|
|
return super.showContextMenuForChild(originalView) |
|
|
|
return super.showContextMenuForChild(originalView) |
|
|
|
} |
|
|
|
} |
|
|
|
|