OnItemSelectedListener.java revision 8b068ddbbf22a246eab49ec25a2f7c3abfbdca51
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14package android.support.v17.leanback.widget; 15 16/** 17 * Interface for receiving notification when a row or item becomes selected. 18 */ 19public interface OnItemSelectedListener { 20 /** 21 * Called when the a row or a new item becomes selected. The concept of current selection 22 * is different than focus. Row or item can be selected even they don't have focus. 23 * Having the concept of selection will allow developer to switch background to selected 24 * item or selected row when user selects rows outside row UI (e.g. a fast lane next to 25 * rows). 26 * <p> 27 * For a none {@link ListRow} case, parameter item is always null. Event is fired when 28 * selection changes between rows, regardless if row view has focus or not. 29 * <p> 30 * For a {@link ListRow} case, parameter item can be null if the list row is empty. 31 * </p> 32 * <li> 33 * Row is has focus: event is fired when focus changes between child of the row. 34 * </li> 35 * <li> 36 * None of the row has focus: the event is fired with the current selected row and last 37 * focused item in the row. 38 * </li> 39 * 40 * @param item The item that is currently selected. 41 * @param row The row that is currently selected. 42 */ 43 public void onItemSelected(Object item, Row row); 44} 45