TencentCloud / TIMSDK

Tencent Cloud Chat features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication.
https://trtc.io/products/chat
2.56k stars 2.76k forks source link

Update ConversationListAdapter.java #1177

Open Yuanarcheannovice opened 2 years ago

Yuanarcheannovice commented 2 years ago

修复会话列表 删除A会话后,再长按A会话下面其他的会话,下标异常导致闪退或者弹框位置错误

    @Override
    public void onItemRemoved(int position) {
        int itemIndex = getItemIndexInAdapter(position);
        notifyItemRemoved(itemIndex);
         //保证会话下标正常
        notifyItemRangeChanged(itemIndex,mDataSource.size()-position);
    }

    @Override
    public void onItemInserted(int position) {
        int itemIndex = getItemIndexInAdapter(position);
        notifyItemInserted(itemIndex);
        //保证会话下标正常
        notifyItemRangeChanged(itemIndex,mDataSource.size()-position);
    }