| 1 | /* |
| 2 | * Copyright (C) 2015 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 android.widget; |
| 18 | |
| 19 | import android.annotation.Nullable; |
| 20 | import android.content.res.Resources; |
| 21 | import android.content.res.Resources.Theme; |
| 22 | import android.view.View; |
| 23 | import android.view.ViewGroup; |
| 24 | |
| 25 | /** |
| 26 | * An extension of SpinnerAdapter that is capable of inflating drop-down views |
| 27 | * against a different theme than normal views. |
| 28 | * <p> |
| 29 | * Classes that implement this interface should use the theme provided to |
| 30 | * {@link #setDropDownViewTheme(Theme)} when creating views in |
| 31 | * {@link SpinnerAdapter#getDropDownView(int, View, ViewGroup)}. |
| 32 | */ |
| 33 | public interface ThemedSpinnerAdapter extends SpinnerAdapter { |
| 34 | /** |
| 35 | * Sets the {@link Resources.Theme} against which drop-down views are |
| 36 | * inflated. |
| 37 | * |
| 38 | * @param theme the context against which to inflate drop-down views, or |
| 39 | * {@code null} to use the default theme |
| 40 | * @see SpinnerAdapter#getDropDownView(int, View, ViewGroup) |
| 41 | */ |
| 42 | void setDropDownViewTheme(@Nullable Resources.Theme theme); |
| 43 | |
| 44 | /** |
| 45 | * Returns the value previously set by a call to |
| 46 | * {@link #setDropDownViewTheme(Theme)}. |
| 47 | * |
| 48 | * @return the {@link Resources.Theme} against which drop-down views are |
| 49 | * inflated, or {@code null} if one has not been explicitly set |
| 50 | */ |
| 51 | @Nullable |
| 52 | Resources.Theme getDropDownViewTheme(); |
| 53 | } |