You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1094 lines
38 KiB

package p028j;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.ThemedSpinnerAdapter;
import androidx.appcompat.app.DialogInterfaceC0089a;
import p007c.C0485a;
import p007c.C0491g;
import p007c.C0494j;
import p013e.C0640a;
import p020g0.C0734d;
import p022h.C0746d;
import p023h0.C0829h1;
import p023h0.InterfaceC0808e1;
import p025i.InterfaceC1015g;
/* renamed from: j.s0 */
/* loaded from: classes.dex */
public class C1194s0 extends Spinner implements InterfaceC0808e1 {
/* renamed from: l */
public static final int[] f2893l = {16843505};
/* renamed from: d */
public final C1080d f2894d;
/* renamed from: e */
public final Context f2895e;
/* renamed from: f */
public AbstractView$OnTouchListenerC1140l2 f2896f;
/* renamed from: g */
public SpinnerAdapter f2897g;
/* renamed from: h */
public final boolean f2898h;
/* renamed from: i */
public InterfaceC1208j f2899i;
/* renamed from: j */
public int f2900j;
/* renamed from: k */
public final Rect f2901k;
/* renamed from: j.s0$a */
/* loaded from: classes.dex */
public class C1195a extends AbstractView$OnTouchListenerC1140l2 {
/* renamed from: m */
public final /* synthetic */ C1202h f2902m;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public C1195a(View view, C1202h c1202h) {
super(view);
this.f2902m = c1202h;
}
@Override // p028j.AbstractView$OnTouchListenerC1140l2
/* renamed from: b */
public InterfaceC1015g mo1889b() {
return this.f2902m;
}
@Override // p028j.AbstractView$OnTouchListenerC1140l2
/* renamed from: c */
public boolean mo1888c() {
if (C1194s0.this.getInternalPopup().mo1874b()) {
return true;
}
C1194s0.this.m1890b();
return true;
}
}
/* renamed from: j.s0$b */
/* loaded from: classes.dex */
public class ViewTreeObserver$OnGlobalLayoutListenerC1196b implements ViewTreeObserver.OnGlobalLayoutListener {
public ViewTreeObserver$OnGlobalLayoutListenerC1196b() {
}
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public void onGlobalLayout() {
if (!C1194s0.this.getInternalPopup().mo1874b()) {
C1194s0.this.m1890b();
}
ViewTreeObserver viewTreeObserver = C1194s0.this.getViewTreeObserver();
if (viewTreeObserver != null) {
C1197c.m1887a(viewTreeObserver, this);
}
}
}
/* renamed from: j.s0$c */
/* loaded from: classes.dex */
public static final class C1197c {
/* renamed from: a */
public static void m1887a(ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
}
}
/* renamed from: j.s0$d */
/* loaded from: classes.dex */
public static final class C1198d {
/* renamed from: a */
public static int m1886a(View view) {
int textAlignment;
textAlignment = view.getTextAlignment();
return textAlignment;
}
/* renamed from: b */
public static int m1885b(View view) {
int textDirection;
textDirection = view.getTextDirection();
return textDirection;
}
/* renamed from: c */
public static void m1884c(View view, int i) {
view.setTextAlignment(i);
}
/* renamed from: d */
public static void m1883d(View view, int i) {
view.setTextDirection(i);
}
}
/* renamed from: j.s0$e */
/* loaded from: classes.dex */
public static final class C1199e {
/* renamed from: a */
public static void m1882a(ThemedSpinnerAdapter themedSpinnerAdapter, Resources.Theme theme) {
Resources.Theme dropDownViewTheme;
dropDownViewTheme = themedSpinnerAdapter.getDropDownViewTheme();
if (C0734d.m3043a(dropDownViewTheme, theme)) {
return;
}
themedSpinnerAdapter.setDropDownViewTheme(theme);
}
}
/* renamed from: j.s0$f */
/* loaded from: classes.dex */
public class DialogInterface$OnClickListenerC1200f implements InterfaceC1208j, DialogInterface.OnClickListener {
/* renamed from: d */
public DialogInterfaceC0089a f2905d;
/* renamed from: e */
public ListAdapter f2906e;
/* renamed from: f */
public CharSequence f2907f;
public DialogInterface$OnClickListenerC1200f() {
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: a */
public void mo1875a(int i) {
Log.e("AppCompatSpinner", "Cannot set horizontal offset for MODE_DIALOG, ignoring");
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: b */
public boolean mo1874b() {
DialogInterfaceC0089a dialogInterfaceC0089a = this.f2905d;
if (dialogInterfaceC0089a != null) {
return dialogInterfaceC0089a.isShowing();
}
return false;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: c */
public int mo1873c() {
return 0;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: d */
public void mo1872d(int i, int i2) {
if (this.f2906e == null) {
return;
}
DialogInterfaceC0089a.C0090a c0090a = new DialogInterfaceC0089a.C0090a(C1194s0.this.getPopupContext());
CharSequence charSequence = this.f2907f;
if (charSequence != null) {
c0090a.m4942h(charSequence);
}
DialogInterfaceC0089a m4949a = c0090a.m4943g(this.f2906e, C1194s0.this.getSelectedItemPosition(), this).m4949a();
this.f2905d = m4949a;
ListView m4951n = m4949a.m4951n();
if (Build.VERSION.SDK_INT >= 17) {
C1198d.m1883d(m4951n, i);
C1198d.m1884c(m4951n, i2);
}
this.f2905d.show();
}
@Override // p028j.C1194s0.InterfaceC1208j
public void dismiss() {
DialogInterfaceC0089a dialogInterfaceC0089a = this.f2905d;
if (dialogInterfaceC0089a != null) {
dialogInterfaceC0089a.dismiss();
this.f2905d = null;
}
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: g */
public int mo1871g() {
return 0;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: i */
public Drawable mo1870i() {
return null;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: j */
public CharSequence mo1869j() {
return this.f2907f;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: l */
public void mo1868l(CharSequence charSequence) {
this.f2907f = charSequence;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: m */
public void mo1867m(Drawable drawable) {
Log.e("AppCompatSpinner", "Cannot set popup background for MODE_DIALOG, ignoring");
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: n */
public void mo1866n(int i) {
Log.e("AppCompatSpinner", "Cannot set vertical offset for MODE_DIALOG, ignoring");
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: o */
public void mo1865o(ListAdapter listAdapter) {
this.f2906e = listAdapter;
}
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
C1194s0.this.setSelection(i);
if (C1194s0.this.getOnItemClickListener() != null) {
C1194s0.this.performItemClick(null, i, this.f2906e.getItemId(i));
}
dismiss();
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: p */
public void mo1864p(int i) {
Log.e("AppCompatSpinner", "Cannot set horizontal (original) offset for MODE_DIALOG, ignoring");
}
}
/* renamed from: j.s0$g */
/* loaded from: classes.dex */
public static class C1201g implements ListAdapter, SpinnerAdapter {
/* renamed from: d */
public SpinnerAdapter f2909d;
/* renamed from: e */
public ListAdapter f2910e;
public C1201g(SpinnerAdapter spinnerAdapter, Resources.Theme theme) {
this.f2909d = spinnerAdapter;
if (spinnerAdapter instanceof ListAdapter) {
this.f2910e = (ListAdapter) spinnerAdapter;
}
if (theme != null) {
if (Build.VERSION.SDK_INT >= 23 && (spinnerAdapter instanceof ThemedSpinnerAdapter)) {
C1199e.m1882a((ThemedSpinnerAdapter) spinnerAdapter, theme);
} else if (spinnerAdapter instanceof InterfaceC1079c3) {
InterfaceC1079c3 interfaceC1079c3 = (InterfaceC1079c3) spinnerAdapter;
if (interfaceC1079c3.getDropDownViewTheme() == null) {
interfaceC1079c3.setDropDownViewTheme(theme);
}
}
}
}
@Override // android.widget.ListAdapter
public boolean areAllItemsEnabled() {
ListAdapter listAdapter = this.f2910e;
if (listAdapter != null) {
return listAdapter.areAllItemsEnabled();
}
return true;
}
@Override // android.widget.Adapter
public int getCount() {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter == null) {
return 0;
}
return spinnerAdapter.getCount();
}
@Override // android.widget.SpinnerAdapter
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter == null) {
return null;
}
return spinnerAdapter.getDropDownView(i, view, viewGroup);
}
@Override // android.widget.Adapter
public Object getItem(int i) {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter == null) {
return null;
}
return spinnerAdapter.getItem(i);
}
@Override // android.widget.Adapter
public long getItemId(int i) {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter == null) {
return -1L;
}
return spinnerAdapter.getItemId(i);
}
@Override // android.widget.Adapter
public int getItemViewType(int i) {
return 0;
}
@Override // android.widget.Adapter
public View getView(int i, View view, ViewGroup viewGroup) {
return getDropDownView(i, view, viewGroup);
}
@Override // android.widget.Adapter
public int getViewTypeCount() {
return 1;
}
@Override // android.widget.Adapter
public boolean hasStableIds() {
SpinnerAdapter spinnerAdapter = this.f2909d;
return spinnerAdapter != null && spinnerAdapter.hasStableIds();
}
@Override // android.widget.Adapter
public boolean isEmpty() {
return getCount() == 0;
}
@Override // android.widget.ListAdapter
public boolean isEnabled(int i) {
ListAdapter listAdapter = this.f2910e;
if (listAdapter != null) {
return listAdapter.isEnabled(i);
}
return true;
}
@Override // android.widget.Adapter
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter != null) {
spinnerAdapter.registerDataSetObserver(dataSetObserver);
}
}
@Override // android.widget.Adapter
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
SpinnerAdapter spinnerAdapter = this.f2909d;
if (spinnerAdapter != null) {
spinnerAdapter.unregisterDataSetObserver(dataSetObserver);
}
}
}
/* renamed from: j.s0$h */
/* loaded from: classes.dex */
public class C1202h extends C1147m2 implements InterfaceC1208j {
/* renamed from: M */
public CharSequence f2911M;
/* renamed from: N */
public ListAdapter f2912N;
/* renamed from: O */
public final Rect f2913O;
/* renamed from: P */
public int f2914P;
/* renamed from: j.s0$h$a */
/* loaded from: classes.dex */
public class C1203a implements AdapterView.OnItemClickListener {
/* renamed from: d */
public final /* synthetic */ C1194s0 f2916d;
public C1203a(C1194s0 c1194s0) {
this.f2916d = c1194s0;
}
@Override // android.widget.AdapterView.OnItemClickListener
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
C1194s0.this.setSelection(i);
if (C1194s0.this.getOnItemClickListener() != null) {
C1202h c1202h = C1202h.this;
C1194s0.this.performItemClick(view, i, c1202h.f2912N.getItemId(i));
}
C1202h.this.dismiss();
}
}
/* renamed from: j.s0$h$b */
/* loaded from: classes.dex */
public class ViewTreeObserver$OnGlobalLayoutListenerC1204b implements ViewTreeObserver.OnGlobalLayoutListener {
public ViewTreeObserver$OnGlobalLayoutListenerC1204b() {
}
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public void onGlobalLayout() {
C1202h c1202h = C1202h.this;
if (!c1202h.m1878Q(C1194s0.this)) {
C1202h.this.dismiss();
return;
}
C1202h.this.m1880O();
C1202h.super.mo2022f();
}
}
/* renamed from: j.s0$h$c */
/* loaded from: classes.dex */
public class C1205c implements PopupWindow.OnDismissListener {
/* renamed from: d */
public final /* synthetic */ ViewTreeObserver.OnGlobalLayoutListener f2919d;
public C1205c(ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
this.f2919d = onGlobalLayoutListener;
}
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
ViewTreeObserver viewTreeObserver = C1194s0.this.getViewTreeObserver();
if (viewTreeObserver != null) {
viewTreeObserver.removeGlobalOnLayoutListener(this.f2919d);
}
}
}
public C1202h(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.f2913O = new Rect();
m2008z(C1194s0.this);
m2033F(true);
m2028K(0);
m2031H(new C1203a(C1194s0.this));
}
/* JADX WARN: Removed duplicated region for block: B:22:0x008d */
/* JADX WARN: Removed duplicated region for block: B:23:0x009a */
/* renamed from: O */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public void m1880O() {
int i;
int i2;
Drawable m2020i = m2020i();
if (m2020i != null) {
m2020i.getPadding(C1194s0.this.f2901k);
i = C1187q3.m1905b(C1194s0.this) ? C1194s0.this.f2901k.right : -C1194s0.this.f2901k.left;
} else {
Rect rect = C1194s0.this.f2901k;
rect.right = 0;
rect.left = 0;
i = 0;
}
int paddingLeft = C1194s0.this.getPaddingLeft();
int paddingRight = C1194s0.this.getPaddingRight();
int width = C1194s0.this.getWidth();
C1194s0 c1194s0 = C1194s0.this;
int i3 = c1194s0.f2900j;
if (i3 == -2) {
int m1891a = c1194s0.m1891a((SpinnerAdapter) this.f2912N, m2020i());
int i4 = C1194s0.this.getContext().getResources().getDisplayMetrics().widthPixels;
Rect rect2 = C1194s0.this.f2901k;
int i5 = (i4 - rect2.left) - rect2.right;
if (m1891a > i5) {
m1891a = i5;
}
i2 = Math.max(m1891a, (width - paddingLeft) - paddingRight);
} else if (i3 != -1) {
m2037B(i3);
m2025a(!C1187q3.m1905b(C1194s0.this) ? i + (((width - paddingRight) - m2012v()) - m1879P()) : i + paddingLeft + m1879P());
} else {
i2 = (width - paddingLeft) - paddingRight;
}
m2037B(i2);
m2025a(!C1187q3.m1905b(C1194s0.this) ? i + (((width - paddingRight) - m2012v()) - m1879P()) : i + paddingLeft + m1879P());
}
/* renamed from: P */
public int m1879P() {
return this.f2914P;
}
/* renamed from: Q */
public boolean m1878Q(View view) {
return C0829h1.m2862A(view) && view.getGlobalVisibleRect(this.f2913O);
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: d */
public void mo1872d(int i, int i2) {
ViewTreeObserver viewTreeObserver;
boolean mo2024b = mo2024b();
m1880O();
m2034E(2);
super.mo2022f();
ListView mo2019k = mo2019k();
mo2019k.setChoiceMode(1);
if (Build.VERSION.SDK_INT >= 17) {
C1198d.m1883d(mo2019k, i);
C1198d.m1884c(mo2019k, i2);
}
m2027L(C1194s0.this.getSelectedItemPosition());
if (mo2024b || (viewTreeObserver = C1194s0.this.getViewTreeObserver()) == null) {
return;
}
ViewTreeObserver$OnGlobalLayoutListenerC1204b viewTreeObserver$OnGlobalLayoutListenerC1204b = new ViewTreeObserver$OnGlobalLayoutListenerC1204b();
viewTreeObserver.addOnGlobalLayoutListener(viewTreeObserver$OnGlobalLayoutListenerC1204b);
m2032G(new C1205c(viewTreeObserver$OnGlobalLayoutListenerC1204b));
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: j */
public CharSequence mo1869j() {
return this.f2911M;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: l */
public void mo1868l(CharSequence charSequence) {
this.f2911M = charSequence;
}
@Override // p028j.C1147m2, p028j.C1194s0.InterfaceC1208j
/* renamed from: o */
public void mo1865o(ListAdapter listAdapter) {
super.mo1865o(listAdapter);
this.f2912N = listAdapter;
}
@Override // p028j.C1194s0.InterfaceC1208j
/* renamed from: p */
public void mo1864p(int i) {
this.f2914P = i;
}
}
/* renamed from: j.s0$i */
/* loaded from: classes.dex */
public static class C1206i extends View.BaseSavedState {
public static final Parcelable.Creator<C1206i> CREATOR = new C1207a();
/* renamed from: d */
public boolean f2921d;
/* renamed from: j.s0$i$a */
/* loaded from: classes.dex */
public class C1207a implements Parcelable.Creator<C1206i> {
@Override // android.os.Parcelable.Creator
/* renamed from: a */
public C1206i createFromParcel(Parcel parcel) {
return new C1206i(parcel);
}
@Override // android.os.Parcelable.Creator
/* renamed from: b */
public C1206i[] newArray(int i) {
return new C1206i[i];
}
}
public C1206i(Parcel parcel) {
super(parcel);
this.f2921d = parcel.readByte() != 0;
}
public C1206i(Parcelable parcelable) {
super(parcelable);
}
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeByte(this.f2921d ? (byte) 1 : (byte) 0);
}
}
/* renamed from: j.s0$j */
/* loaded from: classes.dex */
public interface InterfaceC1208j {
/* renamed from: a */
void mo1875a(int i);
/* renamed from: b */
boolean mo1874b();
/* renamed from: c */
int mo1873c();
/* renamed from: d */
void mo1872d(int i, int i2);
void dismiss();
/* renamed from: g */
int mo1871g();
/* renamed from: i */
Drawable mo1870i();
/* renamed from: j */
CharSequence mo1869j();
/* renamed from: l */
void mo1868l(CharSequence charSequence);
/* renamed from: m */
void mo1867m(Drawable drawable);
/* renamed from: n */
void mo1866n(int i);
/* renamed from: o */
void mo1865o(ListAdapter listAdapter);
/* renamed from: p */
void mo1864p(int i);
}
public C1194s0(Context context, AttributeSet attributeSet) {
this(context, attributeSet, C0485a.spinnerStyle);
}
public C1194s0(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, -1);
}
public C1194s0(Context context, AttributeSet attributeSet, int i, int i2) {
this(context, attributeSet, i, i2, null);
}
/* JADX WARN: Code restructure failed: missing block: B:24:0x005e, code lost:
if (r11 == null) goto L8;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:33:0x006c */
/* JADX WARN: Removed duplicated region for block: B:36:0x00a6 */
/* JADX WARN: Removed duplicated region for block: B:39:0x00be */
/* JADX WARN: Removed duplicated region for block: B:42:0x00d7 */
/* JADX WARN: Removed duplicated region for block: B:49:0x003d A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r11v10 */
/* JADX WARN: Type inference failed for: r11v11 */
/* JADX WARN: Type inference failed for: r11v12 */
/* JADX WARN: Type inference failed for: r11v3 */
/* JADX WARN: Type inference failed for: r11v4 */
/* JADX WARN: Type inference failed for: r11v7, types: [android.content.res.TypedArray] */
/* JADX WARN: Type inference failed for: r6v0, types: [j.s0, android.view.View] */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public C1194s0(Context context, AttributeSet attributeSet, int i, int i2, Resources.Theme theme) {
super(context, attributeSet, i);
C0746d c0746d;
?? r11;
TypedArray typedArray;
TypedArray typedArray2;
CharSequence[] m2165p;
SpinnerAdapter spinnerAdapter;
this.f2901k = new Rect();
C1073b3.m2264a(this, getContext());
C1106g3 m2160u = C1106g3.m2160u(context, attributeSet, C0494j.f1919x2, i, 0);
this.f2894d = new C1080d(this);
try {
if (theme != null) {
c0746d = new C0746d(context, theme);
} else {
int m2168m = m2160u.m2168m(C0494j.f1704C2, 0);
if (m2168m == 0) {
this.f2895e = context;
r11 = -1;
typedArray = null;
if (i2 == -1) {
try {
typedArray2 = context.obtainStyledAttributes(attributeSet, f2893l, i, 0);
} catch (Exception e) {
e = e;
typedArray2 = null;
} catch (Throwable th) {
th = th;
if (typedArray != null) {
typedArray.recycle();
}
throw th;
}
try {
boolean hasValue = typedArray2.hasValue(0);
r11 = typedArray2;
if (hasValue) {
i2 = typedArray2.getInt(0, 0);
r11 = typedArray2;
}
} catch (Exception e2) {
e = e2;
Log.i("AppCompatSpinner", "Could not read android:spinnerMode", e);
r11 = typedArray2;
}
r11.recycle();
}
if (i2 != 0) {
DialogInterface$OnClickListenerC1200f dialogInterface$OnClickListenerC1200f = new DialogInterface$OnClickListenerC1200f();
this.f2899i = dialogInterface$OnClickListenerC1200f;
dialogInterface$OnClickListenerC1200f.mo1868l(m2160u.m2167n(C0494j.f1694A2));
} else if (i2 == 1) {
C1202h c1202h = new C1202h(this.f2895e, attributeSet, i);
C1106g3 m2160u2 = C1106g3.m2160u(this.f2895e, attributeSet, C0494j.f1919x2, i, 0);
this.f2900j = m2160u2.m2169l(C0494j.f1699B2, -2);
c1202h.m2018m(m2160u2.m2175f(C0494j.f1929z2));
c1202h.mo1868l(m2160u.m2167n(C0494j.f1694A2));
m2160u2.m2159v();
this.f2899i = c1202h;
this.f2896f = new C1195a(this, c1202h);
}
m2165p = m2160u.m2165p(C0494j.f1924y2);
if (m2165p != null) {
ArrayAdapter arrayAdapter = new ArrayAdapter(context, 17367048, m2165p);
arrayAdapter.setDropDownViewResource(C0491g.support_simple_spinner_dropdown_item);
setAdapter(arrayAdapter);
}
m2160u.m2159v();
this.f2898h = true;
spinnerAdapter = this.f2897g;
if (spinnerAdapter != null) {
setAdapter(spinnerAdapter);
this.f2897g = null;
}
this.f2894d.m2248e(attributeSet, i);
return;
}
c0746d = new C0746d(context, m2168m);
}
if (i2 == -1) {
}
if (i2 != 0) {
}
m2165p = m2160u.m2165p(C0494j.f1924y2);
if (m2165p != null) {
}
m2160u.m2159v();
this.f2898h = true;
spinnerAdapter = this.f2897g;
if (spinnerAdapter != null) {
}
this.f2894d.m2248e(attributeSet, i);
return;
} catch (Throwable th2) {
th = th2;
typedArray = r11;
}
this.f2895e = c0746d;
r11 = -1;
typedArray = null;
}
/* renamed from: a */
public int m1891a(SpinnerAdapter spinnerAdapter, Drawable drawable) {
int i = 0;
if (spinnerAdapter == null) {
return 0;
}
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 0);
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 0);
int max = Math.max(0, getSelectedItemPosition());
int min = Math.min(spinnerAdapter.getCount(), max + 15);
View view = null;
int i2 = 0;
for (int max2 = Math.max(0, max - (15 - (min - max))); max2 < min; max2++) {
int itemViewType = spinnerAdapter.getItemViewType(max2);
if (itemViewType != i) {
view = null;
i = itemViewType;
}
view = spinnerAdapter.getView(max2, view, this);
if (view.getLayoutParams() == null) {
view.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
}
view.measure(makeMeasureSpec, makeMeasureSpec2);
i2 = Math.max(i2, view.getMeasuredWidth());
}
if (drawable != null) {
drawable.getPadding(this.f2901k);
Rect rect = this.f2901k;
return i2 + rect.left + rect.right;
}
return i2;
}
/* renamed from: b */
public void m1890b() {
if (Build.VERSION.SDK_INT >= 17) {
this.f2899i.mo1872d(C1198d.m1885b(this), C1198d.m1886a(this));
} else {
this.f2899i.mo1872d(-1, -1);
}
}
@Override // android.view.ViewGroup, android.view.View
public void drawableStateChanged() {
super.drawableStateChanged();
C1080d c1080d = this.f2894d;
if (c1080d != null) {
c1080d.m2251b();
}
}
@Override // android.widget.Spinner
public int getDropDownHorizontalOffset() {
InterfaceC1208j interfaceC1208j = this.f2899i;
return interfaceC1208j != null ? interfaceC1208j.mo1873c() : super.getDropDownHorizontalOffset();
}
@Override // android.widget.Spinner
public int getDropDownVerticalOffset() {
InterfaceC1208j interfaceC1208j = this.f2899i;
return interfaceC1208j != null ? interfaceC1208j.mo1871g() : super.getDropDownVerticalOffset();
}
@Override // android.widget.Spinner
public int getDropDownWidth() {
return this.f2899i != null ? this.f2900j : super.getDropDownWidth();
}
public final InterfaceC1208j getInternalPopup() {
return this.f2899i;
}
@Override // android.widget.Spinner
public Drawable getPopupBackground() {
InterfaceC1208j interfaceC1208j = this.f2899i;
return interfaceC1208j != null ? interfaceC1208j.mo1870i() : super.getPopupBackground();
}
@Override // android.widget.Spinner
public Context getPopupContext() {
return this.f2895e;
}
@Override // android.widget.Spinner
public CharSequence getPrompt() {
InterfaceC1208j interfaceC1208j = this.f2899i;
return interfaceC1208j != null ? interfaceC1208j.mo1869j() : super.getPrompt();
}
@Override // p023h0.InterfaceC0808e1
public ColorStateList getSupportBackgroundTintList() {
C1080d c1080d = this.f2894d;
if (c1080d != null) {
return c1080d.m2250c();
}
return null;
}
@Override // p023h0.InterfaceC0808e1
public PorterDuff.Mode getSupportBackgroundTintMode() {
C1080d c1080d = this.f2894d;
if (c1080d != null) {
return c1080d.m2249d();
}
return null;
}
@Override // android.widget.Spinner, android.widget.AdapterView, android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j == null || !interfaceC1208j.mo1874b()) {
return;
}
this.f2899i.dismiss();
}
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
public void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
if (this.f2899i == null || View.MeasureSpec.getMode(i) != Integer.MIN_VALUE) {
return;
}
setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), m1891a(getAdapter(), getBackground())), View.MeasureSpec.getSize(i)), getMeasuredHeight());
}
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
ViewTreeObserver viewTreeObserver;
C1206i c1206i = (C1206i) parcelable;
super.onRestoreInstanceState(c1206i.getSuperState());
if (!c1206i.f2921d || (viewTreeObserver = getViewTreeObserver()) == null) {
return;
}
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver$OnGlobalLayoutListenerC1196b());
}
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
public Parcelable onSaveInstanceState() {
C1206i c1206i = new C1206i(super.onSaveInstanceState());
InterfaceC1208j interfaceC1208j = this.f2899i;
c1206i.f2921d = interfaceC1208j != null && interfaceC1208j.mo1874b();
return c1206i;
}
@Override // android.widget.Spinner, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
AbstractView$OnTouchListenerC1140l2 abstractView$OnTouchListenerC1140l2 = this.f2896f;
if (abstractView$OnTouchListenerC1140l2 == null || !abstractView$OnTouchListenerC1140l2.onTouch(this, motionEvent)) {
return super.onTouchEvent(motionEvent);
}
return true;
}
@Override // android.widget.Spinner, android.view.View
public boolean performClick() {
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j != null) {
if (interfaceC1208j.mo1874b()) {
return true;
}
m1890b();
return true;
}
return super.performClick();
}
@Override // android.widget.AdapterView
public void setAdapter(SpinnerAdapter spinnerAdapter) {
if (!this.f2898h) {
this.f2897g = spinnerAdapter;
return;
}
super.setAdapter(spinnerAdapter);
if (this.f2899i != null) {
Context context = this.f2895e;
if (context == null) {
context = getContext();
}
this.f2899i.mo1865o(new C1201g(spinnerAdapter, context.getTheme()));
}
}
@Override // android.view.View
public void setBackgroundDrawable(Drawable drawable) {
super.setBackgroundDrawable(drawable);
C1080d c1080d = this.f2894d;
if (c1080d != null) {
c1080d.m2247f(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(int i) {
super.setBackgroundResource(i);
C1080d c1080d = this.f2894d;
if (c1080d != null) {
c1080d.m2246g(i);
}
}
@Override // android.widget.Spinner
public void setDropDownHorizontalOffset(int i) {
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j == null) {
super.setDropDownHorizontalOffset(i);
return;
}
interfaceC1208j.mo1864p(i);
this.f2899i.mo1875a(i);
}
@Override // android.widget.Spinner
public void setDropDownVerticalOffset(int i) {
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j != null) {
interfaceC1208j.mo1866n(i);
} else {
super.setDropDownVerticalOffset(i);
}
}
@Override // android.widget.Spinner
public void setDropDownWidth(int i) {
if (this.f2899i != null) {
this.f2900j = i;
} else {
super.setDropDownWidth(i);
}
}
@Override // android.widget.Spinner
public void setPopupBackgroundDrawable(Drawable drawable) {
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j != null) {
interfaceC1208j.mo1867m(drawable);
} else {
super.setPopupBackgroundDrawable(drawable);
}
}
@Override // android.widget.Spinner
public void setPopupBackgroundResource(int i) {
setPopupBackgroundDrawable(C0640a.m3229b(getPopupContext(), i));
}
@Override // android.widget.Spinner
public void setPrompt(CharSequence charSequence) {
InterfaceC1208j interfaceC1208j = this.f2899i;
if (interfaceC1208j != null) {
interfaceC1208j.mo1868l(charSequence);
} else {
super.setPrompt(charSequence);
}
}
@Override // p023h0.InterfaceC0808e1
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
C1080d c1080d = this.f2894d;
if (c1080d != null) {
c1080d.m2244i(colorStateList);
}
}
@Override // p023h0.InterfaceC0808e1
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
C1080d c1080d = this.f2894d;
if (c1080d != null) {
c1080d.m2243j(mode);
}
}
}