Skip to content

Commit

Permalink
Analysis: Suppress recyclerview adapter position deprecation warning
Browse files Browse the repository at this point in the history
This started appearing because, as part of the 'ExoPlayer' update to
'2.18.1', its transient 'RecyclerView' dependency got updated
as well, from '1.1.0' to '1.2.1', which caused this deprecation warning.

Warning Message: "'getter for adapterPosition: Int' is deprecated.
Deprecated in Java"

Explanation: "This method is confusing when adapters nest other
adapters. If you are calling this in the context of an Adapter, you
probably want to call getBindingAdapterPosition or if you want the
position as RecyclerView sees it, you should call
getAbsoluteAdapterPosition."

This deprecated warning is suppressed, that is, instead of being
resolved, since a resolution is out of the scope of this 'ExoPlayer'
update.

For more info see:
- RecyclerView.ViewHolder#getAdapterPosition (Doc):
https://developer.android.com/reference/androidx/recyclerview/widget/
RecyclerView.ViewHolder#getAdapterPosition()
  • Loading branch information
ParaskP7 committed Feb 9, 2023
1 parent 3e75453 commit dde3f45
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class TrailingLabelViewHolder(
parent: ViewGroup,
private val uiHelpers: UiHelpers
) : TrainOfAvatarsViewHolder<TrailingLabelItemBinding>(parent.viewBinding(TrailingLabelItemBinding::inflate)) {
@Suppress("DEPRECATION")
fun bind(textItem: TrailingLabelTextItem) = with(binding) {
val position = adapterPosition

Expand Down

0 comments on commit dde3f45

Please sign in to comment.