package com.igaworks.ssp.common.o; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import com.google.android.gms.ads.RequestConfiguration; import java.io.IOException; import java.io.InputStream; /* loaded from: classes2.dex */ public class i { public static int a(Context context, String str, String str2) { try { return context.getResources().getIdentifier(str, str2, context.getPackageName()); } catch (Exception unused) { return 0; } } public static Bitmap a(Context context, String str) { if (str != null && !str.equals(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED)) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.RGB_565; options.inSampleSize = 1; try { int identifier = context.getResources().getIdentifier(str.contains(".") ? str.substring(0, str.lastIndexOf(".")) : str, "mipmap", context.getPackageName()); if (identifier > 0) { InputStream openRawResource = context.getResources().openRawResource(identifier); Bitmap decodeStream = BitmapFactory.decodeStream(openRawResource, null, options); if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e10) { e10.printStackTrace(); } } return decodeStream; } } catch (Exception unused) { } try { InputStream open = context.getResources().getAssets().open("igaworks/ssp/res/" + str); Bitmap decodeStream2 = BitmapFactory.decodeStream(open, null, options); if (open != null) { open.close(); } return decodeStream2; } catch (Exception unused2) { } } return null; } }