Skip to content

Commit

Permalink
Update selected ViewHolder after notifying
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Oct 16, 2024
1 parent cb7226c commit 7d764d7
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ internal class PivotSelector(
}

fun onLayoutCompleted() {
if (isSelectionUpdatePending) {
isSelectionUpdatePending = false
dispatchViewHolderSelected()
dispatchViewHolderSelectedAndAligned()
}
/**
* Always update the selected ViewHolder on every layout update
*/
Expand All @@ -223,11 +228,6 @@ internal class PivotSelector(
}
}
}
if (isSelectionUpdatePending) {
isSelectionUpdatePending = false
dispatchViewHolderSelected()
dispatchViewHolderSelectedAndAligned()
}
}

fun getCurrentSubPositions(): Int {
Expand Down Expand Up @@ -350,15 +350,13 @@ internal class PivotSelector(
listener.onViewHolderDeselected(recyclerView, viewHolder)
}
}

if (viewHolder is DpadViewHolder) {
selectedViewHolder = viewHolder
viewHolder.onViewHolderSelected()
} else {
selectedViewHolder = null
}
}

selectedViewHolder = viewHolder

if (viewHolder != null) {
selectionListeners.forEach { listener ->
listener.onViewHolderSelected(
Expand Down

0 comments on commit 7d764d7

Please sign in to comment.