/** * removes a range of items starting with the given position within the existing icons * * @param position the global position * @param itemCount the count of items which were removed */ public ModelAdapter<?, Item> removeRange(int position, int itemCount) { if (mOriginalItems != null) { //global position to relative int length = mOriginalItems.size(); int preItemCount = mItemAdapter.getFastAdapter().getPreItemCount(position); //make sure we do not delete to many items int saveItemCount = Math.min(itemCount, length - position + preItemCount); for (int i = 0; i < saveItemCount; i++) { mOriginalItems.remove(position - preItemCount); } publishResults(mConstraint, performFiltering(mConstraint)); return mItemAdapter; } else { return mItemAdapter.removeRange(position, itemCount); } }