示例#1
0
 /**
  * This function checks the currently playing media for subitems at the given position, and if any
  * exist, it will expand them at the same position and replace the current media.
  *
  * @param position The position to expand
  * @return -1 if no subitems were found, 0 if subitems were expanded
  */
 public int expandMedia(int position) {
   ArrayList<String> children = new ArrayList<String>();
   int ret = expandMedia(mLibVLC, position, children);
   if (ret == 0) {
     mEventHandler.callback(EventHandler.CustomMediaListExpanding, new Bundle());
     this.remove(position);
     for (String mrl : children) {
       this.insert(position, mrl);
     }
     mEventHandler.callback(EventHandler.CustomMediaListExpandingEnd, new Bundle());
   }
   return ret;
 }
示例#2
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");

    MediaHolder toMove = mInternalList.get(startPosition);
    mInternalList.remove(startPosition);
    if (startPosition >= endPosition) mInternalList.add(endPosition, toMove);
    else mInternalList.add(endPosition - 1, toMove);
    Bundle b = new Bundle();
    b.putInt("index_before", startPosition);
    b.putInt("index_after", endPosition);
    mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
  }
示例#3
0
 private void signal_list_event(int event, int position, String uri) {
   Bundle b = new Bundle();
   b.putString("item_uri", uri);
   b.putInt("item_index", position);
   mEventHandler.callback(event, b);
 }