Closed minhvietattt closed 1 year ago
How are you deleting the items and requesting focus? If you're using the default RecyclerView item animator, it might make sense to enable this: https://github.com/rubensousa/DpadRecyclerView/blob/master/dpadrecyclerview/src/main/java/com/rubensousa/dpadrecyclerview/DpadRecyclerView.kt#L658
recyclerView.setFocusSearchEnabledDuringAnimations(true)
I intentionally disabled this because by default because it's a weird behavior to switch focus during animations
Thank you. Let me try it first
Hmm, can i ask another question. How can we setFocus and select to an item in one child-dpadrecycler view fastest. At this time i try to using recyclerView.setSelectedPosition(). At this time when delete item in list (delete data and submitList() ), i save the "next_focus_position" after the deletion done. I tried to use recyclerView.setSelectedPosition() ... Unlucky it take more time than i expected.
You should reconsider using submitList
for mutable adapters and instead just remove the item from the adapter and then call notifyItemRemoved
.
submitList
will trigger diffing which you don't need if you're removing a single item. You could try requesting focus before the deletion is completed, instead of doing it afterwards
Let me try it first. It seem take more time to request focus in parent dpad recycle view. "You could try requesting focus before the deletion is completed" i will try this suggestion
@minhvietattt Any update here? If you still have problems with this, please share a sample project where I can see this issue
Thank you... I will try to make the sample soon. You help us a lot
@minhvietattt any update on this issue?
@minhvietattt closing due to inactivity. Please let me know if there's anything missing
Hi, I'm trying to implement delete list item. I try to delete item then after that need focus to next item in list. But it seem slow. I have parent Dpad recyler view and 4 child dpad recycler view. I want to delete item in one of childs dpadrecycler view then restore focus. Can you help me give suggestion for my case when using dpad recyclerview ?