Exemplo n.º 1
0
  /**
   * 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());
  }
Exemplo n.º 2
0
 public void insert(int position, MediaWrapper media) {
   mInternalList.add(position, media);
   signalEventListeners(EVENT_ADDED, position, -1, media.getLocation());
 }