Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifyItemRemoved(listData,pos) 这个API不友好不合理 #415

Open
flyWithWater opened this issue Nov 17, 2023 · 0 comments
Open

notifyItemRemoved(listData,pos) 这个API不友好不合理 #415

flyWithWater opened this issue Nov 17, 2023 · 0 comments
Labels

Comments

@flyWithWater
Copy link

notifyItemRemoved(listData,pos) 这个API:
不合理不友好的原因:
实际内部只使用了listData.size() 作为 notifyItemRangeChanged的范围,但是,没有考虑到有些使用RecyclerView的场景,他的数据源并不是标准的List 这种:例如,界面上面是一片文章,下面是对文章的一条一条评论,这种场景下,评论是在文章这个对象下面的某一个列表里面,列表的长度是由文章和评论 加起来共同决定的。

建议的修改方式:
建议不让外面传入这个listData对象,而是内部直接通过原来的Adapter的getItemCount()来获取这个值;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants