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; }
private void notifyFocusChanged(int index, boolean hasFocus) { if (this.changeListener != null) { View child = getChildAt(index); changeListener.onFocusChanged(child, hasFocus); } }
private void notifySelectionChanged(int index, boolean selected) { View child = getChildAt(index); if (this.changeListener != null) { changeListener.onSelectionChanged(itemList, index, child, selected); } }