package com.afollestad.materialdialogs.a; import android.content.Context; import android.content.DialogInterface; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.IBinder; import android.util.TypedValue; import android.view.View; import android.view.inputmethod.InputMethodManager; import com.afollestad.materialdialogs.e; import com.afollestad.materialdialogs.f; /* compiled from: DialogUtils */ public class a { /* renamed from: ʻ reason: contains not printable characters */ public static int m6253(Context context) { return m6252(m6262(m6254(context, 16842806)) ? -16777216 : -1, 0.3f); } /* renamed from: ʻ reason: contains not printable characters */ public static int m6252(int i, float f) { return Color.argb(Math.round(((float) Color.alpha(i)) * f), Color.red(i), Color.green(i), Color.blue(i)); } /* renamed from: ʻ reason: contains not printable characters */ public static int m6254(Context context, int i) { return m6255(context, i, 0); } /* renamed from: ʻ reason: contains not printable characters */ public static int m6255(Context context, int i, int i2) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { return obtainStyledAttributes.getColor(0, i2); } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ʻ reason: contains not printable characters */ public static ColorStateList m6257(Context context, int i, ColorStateList colorStateList) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { TypedValue peekValue = obtainStyledAttributes.peekValue(0); if (peekValue == null) { return colorStateList; } if (peekValue.type < 28 || peekValue.type > 31) { ColorStateList colorStateList2 = obtainStyledAttributes.getColorStateList(0); if (colorStateList2 != null) { obtainStyledAttributes.recycle(); return colorStateList2; } obtainStyledAttributes.recycle(); return colorStateList; } ColorStateList r4 = m6272(context, peekValue.data); obtainStyledAttributes.recycle(); return r4; } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ʼ reason: contains not printable characters */ public static int m6265(Context context, int i) { return android.support.v4.content.a.m2064(context, i); } /* renamed from: ʽ reason: contains not printable characters */ public static String m6268(Context context, int i) { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(i, typedValue, true); return (String) typedValue.string; } /* access modifiers changed from: package-private */ /* renamed from: com.afollestad.materialdialogs.a.a$2 reason: invalid class name */ /* compiled from: DialogUtils */ public static /* synthetic */ class AnonymousClass2 { /* renamed from: ʻ reason: contains not printable characters */ static final /* synthetic */ int[] f4298; /* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|6) */ /* JADX WARNING: Code restructure failed: missing block: B:7:?, code lost: return; */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0012 */ static { int[] iArr = new int[e.values().length]; f4298 = iArr; iArr[e.CENTER.ordinal()] = 1; f4298[e.END.ordinal()] = 2; } } /* renamed from: ʻ reason: contains not printable characters */ private static int m6256(e eVar) { int i = AnonymousClass2.f4298[eVar.ordinal()]; int i2 = 1; if (i != 1) { i2 = 2; if (i != 2) { return 0; } } return i2; } /* renamed from: ʻ reason: contains not printable characters */ public static e m6259(Context context, int i, e eVar) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { int i2 = obtainStyledAttributes.getInt(0, m6256(eVar)); if (i2 == 1) { e eVar2 = e.CENTER; obtainStyledAttributes.recycle(); return eVar2; } else if (i2 != 2) { return e.START; } else { e eVar3 = e.END; obtainStyledAttributes.recycle(); return eVar3; } } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ʾ reason: contains not printable characters */ public static Drawable m6269(Context context, int i) { return m6258(context, i, (Drawable) null); } /* renamed from: ʻ reason: contains not printable characters */ private static Drawable m6258(Context context, int i, Drawable drawable) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { Drawable drawable2 = obtainStyledAttributes.getDrawable(0); if (drawable2 != null || drawable == null) { drawable = drawable2; } return drawable; } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ʿ reason: contains not printable characters */ public static int m6270(Context context, int i) { return m6266(context, i, -1); } /* renamed from: ʼ reason: contains not printable characters */ private static int m6266(Context context, int i, int i2) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { return obtainStyledAttributes.getDimensionPixelSize(0, i2); } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ʻ reason: contains not printable characters */ public static boolean m6263(Context context, int i, boolean z) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(new int[]{i}); try { return obtainStyledAttributes.getBoolean(0, z); } finally { obtainStyledAttributes.recycle(); } } /* renamed from: ˆ reason: contains not printable characters */ public static boolean m6271(Context context, int i) { return m6263(context, i, false); } /* renamed from: ʻ reason: contains not printable characters */ public static boolean m6262(int i) { double red = (double) Color.red(i); Double.isNaN(red); double green = (double) Color.green(i); Double.isNaN(green); double d = (red * 0.299d) + (green * 0.587d); double blue = (double) Color.blue(i); Double.isNaN(blue); return 1.0d - ((d + (blue * 0.114d)) / 255.0d) >= 0.5d; } /* renamed from: ʻ reason: contains not printable characters */ public static void m6261(View view, Drawable drawable) { if (Build.VERSION.SDK_INT < 16) { view.setBackgroundDrawable(drawable); } else { view.setBackground(drawable); } } /* renamed from: ʻ reason: contains not printable characters */ public static void m6260(DialogInterface dialogInterface, final f.a aVar) { final f fVar = (f) dialogInterface; if (fVar.m6300() != null) { fVar.m6300().post(new Runnable() { /* class com.afollestad.materialdialogs.a.a.AnonymousClass1 */ public void run() { fVar.m6300().requestFocus(); InputMethodManager inputMethodManager = (InputMethodManager) aVar.m6306().getSystemService("input_method"); if (inputMethodManager != null) { inputMethodManager.showSoftInput(fVar.m6300(), 1); } } }); } } /* renamed from: ʼ reason: contains not printable characters */ public static void m6267(DialogInterface dialogInterface, f.a aVar) { InputMethodManager inputMethodManager; f fVar = (f) dialogInterface; if (fVar.m6300() != null && (inputMethodManager = (InputMethodManager) aVar.m6306().getSystemService("input_method")) != null) { View currentFocus = fVar.getCurrentFocus(); IBinder iBinder = null; if (currentFocus != null) { iBinder = currentFocus.getWindowToken(); } else if (fVar.m6299() != null) { iBinder = fVar.m6299().getWindowToken(); } if (iBinder != null) { inputMethodManager.hideSoftInputFromWindow(iBinder, 0); } } } /* renamed from: ˈ reason: contains not printable characters */ public static ColorStateList m6272(Context context, int i) { int r5 = m6254(context, 16842806); if (i == 0) { i = r5; } return new ColorStateList(new int[][]{new int[]{-16842910}, new int[0]}, new int[]{m6252(i, 0.4f), i}); } /* renamed from: ʻ reason: contains not printable characters */ public static <T> boolean m6264(T t, T[] tArr) { if (!(tArr == null || tArr.length == 0)) { for (T t2 : tArr) { if (t2.equals(t)) { return true; } } } return false; } }