Open smichel17 opened 8 years ago
I wouldn't call it abusing. And using ActionMode
again adds another layer of confusion. Considering it's working fine as is, I prefer to only do this if it's really needed.
Okay, abusing may be a little harsh.
I still think we should look into it; I believe actionMode will implement the default animations for entering selection, which is nice. I think it will also simplify our selection code, since it keeps track of when items in the RecyclerView are selected and triggers the right callbacks automatically.
Especially the second point looks interesting. I will look into it.
Go here and then scroll to Enabling batch contextual actions in a ListView or GridView
.
@smichel17 Note that a ListView and a RecyclerView are quite different. Not sure if it matters here.
@mpcjanssen once we
it'll be trivial to call the correct actionMode callback upon receiving a message that selection has changed.
It does matter that ListView and RecyclerView are different. Here's someone making them work together. It's a reasonable amount of code, but that's because he made it very modular.
https://medium.com/@BladeCoder/implementing-a-modal-selection-helper-for-recyclerview-1e888b4cd5b9
Instead of abusing onCreateOptionsMenu, there's already a class in the support library for that.
https://developer.android.com/reference/android/support/v7/view/ActionMode.html