Source code
package android.support.v7.widget;
import android.content.Context;
import android.content.res.Resources.Theme;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.internal.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.widget.SpinnerAdapter;
public interface ThemedSpinnerAdapter extends SpinnerAdapter {
public static final class Helper {
private final Context mContext;
private LayoutInflater mDropDownInflater;
private final LayoutInflater mInflater;
public Helper(@NonNull Context context) {
this.mContext = context;
this.mInflater = LayoutInflater.from(context);
}
public void setDropDownViewTheme(@Nullable Theme theme) {
if (theme == null) {
this.mDropDownInflater = null;
} else if (theme == this.mContext.getTheme()) {
this.mDropDownInflater = this.mInflater;
} else {
this.mDropDownInflater = LayoutInflater.from(new ContextThemeWrapper(this.mContext, theme));
}
}
@Nullable
public Theme getDropDownViewTheme() {
return this.mDropDownInflater == null ? null : this.mDropDownInflater.getContext().getTheme();
}
@NonNull
public LayoutInflater getDropDownViewInflater() {
return this.mDropDownInflater != null ? this.mDropDownInflater : this.mInflater;
}
}
@Nullable
Theme getDropDownViewTheme();
void setDropDownViewTheme(@Nullable Theme theme);
}