package o; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import o.C17052tZT; /* loaded from: classes2.dex */ public final class hdZ { private static final int[] a = {android.R.attr.theme, C17052tZT.IeS.theme}; private static final int[] b = {C17052tZT.IeS.materialThemeOverlay}; public static Context MQ_(Context context, AttributeSet attributeSet, int i, int i2) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, b, i, i2); boolean z = false; int resourceId = obtainStyledAttributes.getResourceId(0, 0); obtainStyledAttributes.recycle(); if ((context instanceof mhG) && ((mhG) context).e == resourceId) { z = true; } if (resourceId == 0 || z) { return context; } mhG mhg = new mhG(context, resourceId); int MP_ = MP_(context, attributeSet); if (MP_ != 0) { mhg.getTheme().applyStyle(MP_, true); } return mhg; } private static int MP_(Context context, AttributeSet attributeSet) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, a); int resourceId = obtainStyledAttributes.getResourceId(0, 0); int resourceId2 = obtainStyledAttributes.getResourceId(1, 0); obtainStyledAttributes.recycle(); return resourceId != 0 ? resourceId : resourceId2; } }