コード例 #1
0
  private void createItemSourceList(ObservableCollection<Object> newList) {
    if (itemList != null && collectionObserver != null) itemList.unsubscribe(collectionObserver);

    itemList = newList;
    videoListViews = new WeakList<View>();
    if (newList == null) return;

    currentList = null;

    itemList.subscribe(collectionObserver);
    newList(newList);
  }
コード例 #2
0
  public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
      switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_DPAD_LEFT:
          if (movePrevious()) {
            setChildSelections();
          }
          handled = true;
          break;

        case KeyEvent.KEYCODE_DPAD_RIGHT:
          if (moveNext()) {
            setChildSelections();
          }
          handled = true;
          break;

        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
          mReceivedInvokeKeyDown = true;
          if (this.changeListener != null) {
            View child = getChildAt(mSelectedIndex);
            Object obj = itemList.getItem(mSelectedIndex);
            changeListener.onItemSelected(obj, mSelectedIndex, child);
          }
          handled = true;
          break;
      }
    }
    return handled;
  }