diff options
author | Alan Viverette <alanv@google.com> | 2015-06-02 14:54:40 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2015-06-02 14:54:40 -0700 |
commit | 2add9bcf8c33c59f300551bdb0671bbff0b55794 (patch) | |
tree | 9e022bc69bf2024f88c47a3f24dcd57e9aaee595 /core/java/android/widget/ThemedSpinnerAdapter.java | |
parent | 5431000830551959db15038da8f057c2e993d01a (diff) | |
download | frameworks_base-2add9bcf8c33c59f300551bdb0671bbff0b55794.zip frameworks_base-2add9bcf8c33c59f300551bdb0671bbff0b55794.tar.gz frameworks_base-2add9bcf8c33c59f300551bdb0671bbff0b55794.tar.bz2 |
API review feedback for ThemedSpinnerAdapter, Spinner
Moves themed interface out of Spinner and extends SpinnerAdapter, updates
Spinner constructor to take a Theme rather than a Context.
Does NOT change BaseAdapter to implement ThemedSpinnerAdapter, because
the BaseAdapter class does not have any notion of layout inflation and
that would break the contract implied by ThemedSpinnerAdapter.
Bug: 21571899
Change-Id: Id7e8d630458857ce6c93a6a8b8f920e169ee1152
Diffstat (limited to 'core/java/android/widget/ThemedSpinnerAdapter.java')
-rw-r--r-- | core/java/android/widget/ThemedSpinnerAdapter.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/core/java/android/widget/ThemedSpinnerAdapter.java b/core/java/android/widget/ThemedSpinnerAdapter.java new file mode 100644 index 0000000..6d92620 --- /dev/null +++ b/core/java/android/widget/ThemedSpinnerAdapter.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.widget; + +import android.annotation.Nullable; +import android.content.res.Resources; +import android.content.res.Resources.Theme; +import android.view.View; +import android.view.ViewGroup; + +/** + * An extension of SpinnerAdapter that is capable of inflating drop-down views + * against a different theme than normal views. + * <p> + * Classes that implement this interface should use the theme provided to + * {@link #setDropDownViewTheme(Theme)} when creating views in + * {@link SpinnerAdapter#getDropDownView(int, View, ViewGroup)}. + */ +public interface ThemedSpinnerAdapter extends SpinnerAdapter { + /** + * Sets the {@link Resources.Theme} against which drop-down views are + * inflated. + * + * @param theme the context against which to inflate drop-down views, or + * {@code null} to use the default theme + * @see SpinnerAdapter#getDropDownView(int, View, ViewGroup) + */ + void setDropDownViewTheme(@Nullable Resources.Theme theme); + + /** + * Returns the value previously set by a call to + * {@link #setDropDownViewTheme(Theme)}. + * + * @return the {@link Resources.Theme} against which drop-down views are + * inflated, or {@code null} if one has not been explicitly set + */ + @Nullable + Resources.Theme getDropDownViewTheme(); +} |