OnItemViewSelectedListener.java revision a00bada00bff4a58436a39472ab14ccb7a8f619d
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. The concept of 18 * current selection is different than focus. A row or item can be selected without having focus; 19 * for example, when a row header view gains focus then the corresponding row view becomes selected. 20 */ 21public interface OnItemViewSelectedListener { 22 /** 23 * Called when the a row or a new item becomes selected. 24 * <p> 25 * For a non {@link ListRow} case, parameter item may be null. Event is fired when 26 * selection changes between rows, regardless if row view has focus or not. 27 * <p> 28 * For a {@link ListRow} case, parameter item is null if the list row is empty. 29 * </p> 30 * <p> 31 * In the case of a grid, the row parameter is always null. 32 * </p> 33 * <li> 34 * Row has focus: event is fired when focus changes between children of the row. 35 * </li> 36 * <li> 37 * No row has focus: the event is fired with the currently selected row and last 38 * focused item in the row. 39 * </li> 40 * 41 * @param itemViewHolder The view holder of the item that is currently selected. 42 * @param item The item that is currently selected. 43 * @param rowViewHolder The view holder of the row that is currently selected. 44 * @param row The row that is currently selected. 45 */ 46 public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, 47 RowPresenter.ViewHolder rowViewHolder, Row row); 48} 49