1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tv.settings.widget; 18 19 import android.view.View; 20 21 /** 22 * The adapter can optionally implement ScrollAdapterCustomSize in addition to ScrollAdapter. 23 * This class is used as same purpose of attribute "selectedSize" of ScrollAdapterView but 24 * can handle complicated size (e.g. the size of focused item is not same) 25 */ 26 public interface ScrollAdapterCustomSize extends ScrollAdapter { 27 28 /** 29 * return in pixels space when an item is in selected state. 30 * For example, the app may set a focused item to take 120 pixels comparing to 31 * 100pixels of unfocused one. ScrollAdapterView will assign more or less 32 * space to the focused item and animate the growing/shrinking.<p> 33 * NOTE: {@link ScrollAdapterView} does not actually scale the View or change 34 * it's width or height, the view itself is responsible doing the scale in 35 * {@link ScrollAdapterTransform} or {@link ScrollAdapterView.OnScrollListener} 36 */ getSelectItemSize(int adapterIndex, View view)37 int getSelectItemSize(int adapterIndex, View view); 38 39 } 40