evrencoskun / TableView

TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
MIT License
3.14k stars 459 forks source link

changeRowHeaderItemRange invalid #152

Open LittleRobotRoad opened 6 years ago

LittleRobotRoad commented 6 years ago
private void rowChange(int rowPosition) {
        int rowSize = mTableContent.size();
        List<RowHeader> list = new ArrayList<>();
        for (int i = rowPosition; i < rowSize; i++) {
            RowHeader header = new RowHeader(String.valueOf(i), i + 1 + "");
            list.add(header);
        }
        mTableAdapter.changeRowHeaderItemRange(rowPosition, list);
    }

the reason:

AbstractRecyclerViewAdapter.java

public void changeItemRange(int positionStart, List<T> items) {
        if (mItemList.size() > positionStart + items.size() && items != null) {
            for (int i = 0; i < items.size(); i++) {
                if (i != RecyclerView.NO_POSITION) {
                    mItemList.set(i + positionStart, items.get(i));
                }
            }
            notifyItemRangeChanged(positionStart, items.size());
        }
    }
ItemList.size() > positionStart + items.size() 

modify

mItemList.size() >= positionStart + items.size()
evrencoskun commented 6 years ago

Thanks @LittleRobotRoad, for the bug report!