package androidx.appcompat.widget; import android.content.Context; import android.content.res.Resources; import android.view.LayoutInflater; import android.widget.SpinnerAdapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.view.ContextThemeWrapper; 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); } @NonNull public LayoutInflater getDropDownViewInflater() { LayoutInflater layoutInflater = this.mDropDownInflater; return layoutInflater != null ? layoutInflater : this.mInflater; } @Nullable public Resources.Theme getDropDownViewTheme() { LayoutInflater layoutInflater = this.mDropDownInflater; if (layoutInflater == null) { return null; } return layoutInflater.getContext().getTheme(); } public void setDropDownViewTheme(@Nullable Resources.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 Resources.Theme getDropDownViewTheme(); void setDropDownViewTheme(@Nullable Resources.Theme theme); }