Skip to content
Snippets Groups Projects
Commit d94fbb0f authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix TV first item not correctly focused

Fixes #2109
parent 21320fdd
No related branches found
No related tags found
1 merge request!1045Fix TV first item not correctly focused
......@@ -141,10 +141,12 @@ class FileTvItemAdapter(private val eventsHandler: IEventsHandler<MediaLibraryIt
}
binding.container.layoutParams.width = itemSize
binding.container.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
TvAdapterUtils.itemFocusChange(hasFocus, itemSize, binding.container, false) {
if (layoutPosition in dataset.indices) {
eventsHandler.onItemFocused(binding.root, getItem(layoutPosition))
focusListener?.onFocusChanged(layoutPosition)
binding.container.post {
TvAdapterUtils.itemFocusChange(hasFocus, itemSize, binding.container, false) {
if (layoutPosition in dataset.indices) {
eventsHandler.onItemFocused(binding.root, getItem(layoutPosition))
focusListener?.onFocusChanged(layoutPosition)
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment