what-the-bank/sources/com/huawei/hms/utils/ResourceLoaderUtil.java

143 lines
4.0 KiB
Java

package com.huawei.hms.utils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Base64;
import com.huawei.hms.support.log.HMSLog;
import java.nio.charset.StandardCharsets;
import org.simpleframework.xml.strategy.Name;
/* loaded from: classes2.dex */
public abstract class ResourceLoaderUtil {
private static Context a = null;
private static String b = null;
private static int c = 0;
private static byte d = 6;
private static int e = 1;
public static void setmContext(Context context) {
a = context;
if (context != null) {
b = context.getPackageName();
} else {
b = null;
HMSLog.e("ResourceLoaderUtil", "context is null");
}
}
public static int getAnimId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "anim", b);
}
public static int getColorId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "color", b);
}
public static int getDimenId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "dimen", b);
}
public static Drawable getDrawable(String str) {
Context context = a;
if (context == null) {
return null;
}
return context.getResources().getDrawable(getDrawableId(str));
}
public static int getDrawableId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "drawable", b);
}
public static int getIdId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, Name.MARK, b);
}
public static int getLayoutId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "layout", b);
}
public static String getString(String str) {
int i = 2 % 2;
int i2 = c + 105;
e = i2 % 128;
int i3 = i2 % 2;
Context context = a;
if (context == null) {
return "";
}
String string = context.getResources().getString(getStringId(str));
if (!string.startsWith(",*,)")) {
return string;
}
int i4 = c + 39;
e = i4 % 128;
int i5 = i4 % 2;
Object[] objArr = new Object[1];
f(string.substring(4), objArr);
String intern = ((String) objArr[0]).intern();
int i6 = e + 107;
c = i6 % 128;
int i7 = i6 % 2;
return intern;
}
public static int getStringId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "string", b);
}
public static int getStyleId(String str) {
Context context = a;
if (context == null) {
return 0;
}
return context.getResources().getIdentifier(str, "style", b);
}
public static String getString(String str, Object... objArr) {
Context context = a;
return context == null ? "" : context.getResources().getString(getStringId(str), objArr);
}
private static void f(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ d);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
public static Context getmContext() {
return a;
}
}