am 4156c870: am e25f6587: Merge "API review feedback for ThemedSpinnerAdapter, Spinner" into mnc-dev

* commit '4156c8709bc46d48fb2a92ca580100308f68210d':
  API review feedback for ThemedSpinnerAdapter, Spinner
This commit is contained in:
Alan Viverette
2015-06-03 02:22:09 +00:00
committed by Android Git Automerger
7 changed files with 85 additions and 49 deletions

View File

@@ -39662,7 +39662,7 @@ package android.widget {
ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int, int);
}
public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public ArrayAdapter(android.content.Context, int);
ctor public ArrayAdapter(android.content.Context, int, int);
ctor public ArrayAdapter(android.content.Context, int, T[]);
@@ -39903,7 +39903,7 @@ package android.widget {
method public abstract void onCheckedChanged(android.widget.CompoundButton, boolean);
}
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public deprecated CursorAdapter(android.content.Context, android.database.Cursor);
ctor public CursorAdapter(android.content.Context, android.database.Cursor, boolean);
ctor public CursorAdapter(android.content.Context, android.database.Cursor, int);
@@ -41168,7 +41168,7 @@ package android.widget {
method public abstract boolean onShareTargetSelected(android.widget.ShareActionProvider, android.content.Intent);
}
public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public SimpleAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String, ?>>, int, java.lang.String[], int[]);
method public int getCount();
method public android.content.res.Resources.Theme getDropDownViewTheme();
@@ -41297,7 +41297,7 @@ package android.widget {
ctor public Spinner(android.content.Context, android.util.AttributeSet, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int, android.content.Context);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int, android.content.res.Resources.Theme);
method public int getDropDownHorizontalOffset();
method public int getDropDownVerticalOffset();
method public int getDropDownWidth();
@@ -41318,11 +41318,6 @@ package android.widget {
field public static final int MODE_DROPDOWN = 1; // 0x1
}
public static abstract interface Spinner.ThemedSpinnerAdapter {
method public abstract android.content.res.Resources.Theme getDropDownViewTheme();
method public abstract void setDropDownViewTheme(android.content.res.Resources.Theme);
}
public abstract interface SpinnerAdapter implements android.widget.Adapter {
method public abstract android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup);
}
@@ -41724,6 +41719,11 @@ package android.widget {
field public static final android.os.Parcelable.Creator<android.widget.TextView.SavedState> CREATOR;
}
public abstract interface ThemedSpinnerAdapter implements android.widget.SpinnerAdapter {
method public abstract android.content.res.Resources.Theme getDropDownViewTheme();
method public abstract void setDropDownViewTheme(android.content.res.Resources.Theme);
}
public class TimePicker extends android.widget.FrameLayout {
ctor public TimePicker(android.content.Context);
ctor public TimePicker(android.content.Context, android.util.AttributeSet);

View File

@@ -42240,7 +42240,7 @@ package android.widget {
ctor public AnalogClock(android.content.Context, android.util.AttributeSet, int, int);
}
public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public class ArrayAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public ArrayAdapter(android.content.Context, int);
ctor public ArrayAdapter(android.content.Context, int, int);
ctor public ArrayAdapter(android.content.Context, int, T[]);
@@ -42481,7 +42481,7 @@ package android.widget {
method public abstract void onCheckedChanged(android.widget.CompoundButton, boolean);
}
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public deprecated CursorAdapter(android.content.Context, android.database.Cursor);
ctor public CursorAdapter(android.content.Context, android.database.Cursor, boolean);
ctor public CursorAdapter(android.content.Context, android.database.Cursor, int);
@@ -43746,7 +43746,7 @@ package android.widget {
method public abstract boolean onShareTargetSelected(android.widget.ShareActionProvider, android.content.Intent);
}
public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.Spinner.ThemedSpinnerAdapter {
public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
ctor public SimpleAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String, ?>>, int, java.lang.String[], int[]);
method public int getCount();
method public android.content.res.Resources.Theme getDropDownViewTheme();
@@ -43875,7 +43875,7 @@ package android.widget {
ctor public Spinner(android.content.Context, android.util.AttributeSet, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int, android.content.Context);
ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int, android.content.res.Resources.Theme);
method public int getDropDownHorizontalOffset();
method public int getDropDownVerticalOffset();
method public int getDropDownWidth();
@@ -43896,11 +43896,6 @@ package android.widget {
field public static final int MODE_DROPDOWN = 1; // 0x1
}
public static abstract interface Spinner.ThemedSpinnerAdapter {
method public abstract android.content.res.Resources.Theme getDropDownViewTheme();
method public abstract void setDropDownViewTheme(android.content.res.Resources.Theme);
}
public abstract interface SpinnerAdapter implements android.widget.Adapter {
method public abstract android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup);
}
@@ -44302,6 +44297,11 @@ package android.widget {
field public static final android.os.Parcelable.Creator<android.widget.TextView.SavedState> CREATOR;
}
public abstract interface ThemedSpinnerAdapter implements android.widget.SpinnerAdapter {
method public abstract android.content.res.Resources.Theme getDropDownViewTheme();
method public abstract void setDropDownViewTheme(android.content.res.Resources.Theme);
}
public class TimePicker extends android.widget.FrameLayout {
ctor public TimePicker(android.content.Context);
ctor public TimePicker(android.content.Context, android.util.AttributeSet);

View File

@@ -50,8 +50,7 @@ import java.util.List;
* or to have some of data besides toString() results fill the views,
* override {@link #getView(int, View, ViewGroup)} to return the type of view you want.
*/
public class ArrayAdapter<T> extends BaseAdapter implements Filterable,
Spinner.ThemedSpinnerAdapter {
public class ArrayAdapter<T> extends BaseAdapter implements Filterable, ThemedSpinnerAdapter {
/**
* Contains the list of objects that represent the data of this ArrayAdapter.
* The content of this list is referred to as "the array" in the documentation.

View File

@@ -38,7 +38,7 @@ import android.view.ViewGroup;
* columns.
*/
public abstract class CursorAdapter extends BaseAdapter implements Filterable,
CursorFilter.CursorFilterClient, Spinner.ThemedSpinnerAdapter {
CursorFilter.CursorFilterClient, ThemedSpinnerAdapter {
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}

View File

@@ -51,7 +51,7 @@ import java.util.Map;
* </ul>
* If no appropriate binding can be found, an {@link IllegalStateException} is thrown.
*/
public class SimpleAdapter extends BaseAdapter implements Filterable, Spinner.ThemedSpinnerAdapter {
public class SimpleAdapter extends BaseAdapter implements Filterable, ThemedSpinnerAdapter {
private int[] mTo;
private String[] mFrom;
private ViewBinder mViewBinder;

View File

@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Rect;
@@ -217,24 +218,24 @@ public class Spinner extends AbsSpinner implements OnClickListener {
* Can be 0 to not look for defaults.
* @param mode Constant describing how the user will select choices from
* the spinner.
* @param popupContext The context against which the dialog or dropdown
* popup will be inflated. Can be null to use the view
* context. If set, this will override any value
* specified by
* {@link android.R.styleable#Spinner_popupTheme}.
* @param popupTheme The theme against which the dialog or dropdown popup
* should be inflated. May be {@code null} to use the
* view theme. If set, this will override any value
* specified by
* {@link android.R.styleable#Spinner_popupTheme}.
*
* @see #MODE_DIALOG
* @see #MODE_DROPDOWN
*/
public Spinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int mode,
Context popupContext) {
Theme popupTheme) {
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.Spinner, defStyleAttr, defStyleRes);
if (popupContext != null) {
mPopupContext = popupContext;
if (popupTheme != null) {
mPopupContext = new ContextThemeWrapper(context, popupTheme);
} else {
final int popupThemeResId = a.getResourceId(R.styleable.Spinner_popupTheme, 0);
if (popupThemeResId != 0) {
@@ -932,9 +933,8 @@ public class Spinner extends AbsSpinner implements OnClickListener {
mListAdapter = (ListAdapter) adapter;
}
if (dropDownTheme != null && adapter instanceof Spinner.ThemedSpinnerAdapter) {
final Spinner.ThemedSpinnerAdapter themedAdapter =
(Spinner.ThemedSpinnerAdapter) adapter;
if (dropDownTheme != null && adapter instanceof ThemedSpinnerAdapter) {
final ThemedSpinnerAdapter themedAdapter = (ThemedSpinnerAdapter) adapter;
if (themedAdapter.getDropDownViewTheme() == null) {
themedAdapter.setDropDownViewTheme(dropDownTheme);
}
@@ -1263,20 +1263,4 @@ public class Spinner extends AbsSpinner implements OnClickListener {
}
}
public interface ThemedSpinnerAdapter {
/**
* Sets the {@link Resources.Theme} against which drop-down views are
* inflated.
*
* @param theme the context against which to inflate drop-down views
* @see SpinnerAdapter#getDropDownView(int, View, ViewGroup)
*/
public void setDropDownViewTheme(Resources.Theme theme);
/**
* @return The {@link Resources.Theme} against which drop-down views are
* inflated.
*/
public Resources.Theme getDropDownViewTheme();
}
}

View File

@@ -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();
}