/** * Move a media from one position to another * * @param startPosition start position * @param endPosition end position * @throws IndexOutOfBoundsException */ public void move(int startPosition, int endPosition) { if (!(isValid(startPosition) && endPosition >= 0 && endPosition <= mInternalList.size())) throw new IndexOutOfBoundsException("Indexes out of range"); MediaWrapper toMove = mInternalList.get(startPosition); mInternalList.remove(startPosition); if (startPosition >= endPosition) mInternalList.add(endPosition, toMove); else mInternalList.add(endPosition - 1, toMove); signalEventListeners(EVENT_MOVED, startPosition, endPosition, toMove.getLocation()); }
public void insert(int position, MediaWrapper media) { mInternalList.add(position, media); signalEventListeners(EVENT_ADDED, position, -1, media.getLocation()); }