Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,448 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class BundleUtils {
public static boolean containsAtLeastOneKey(Set<String> set, Bundle bundle) {
if (set != null && !set.isEmpty()) {
Iterator<String> it = set.iterator();
while (it.hasNext()) {
if (bundle.containsKey(it.next())) {
return true;
}
}
}
return false;
}
public static boolean getBoolean(String str, Bundle bundle) {
return getBoolean(str, false, bundle);
}
public static Bundle getBundle(String str, Bundle bundle) {
return getBundle(str, null, bundle);
}
public static int getInt(String str, Bundle bundle) {
return getInt(str, 0, bundle);
}
public static long getLong(String str, Bundle bundle) {
return getLong(str, 0L, bundle);
}
public static String getString(String str, Bundle bundle) {
return getString(str, null, bundle);
}
public static void put(String str, @Nullable Object obj, Bundle bundle) {
if (obj == null) {
n.h("AppLovinSdk", "Skipped insertion into Bundle because value is null.");
return;
}
if (obj instanceof String) {
putString(str, (String) obj, bundle);
return;
}
if (obj instanceof Boolean) {
putBoolean(str, (Boolean) obj, bundle);
return;
}
if (obj instanceof Integer) {
putInt(str, (Integer) obj, bundle);
return;
}
if (obj instanceof Long) {
putLong(str, (Long) obj, bundle);
return;
}
if (obj instanceof Double) {
putDouble(str, (Double) obj, bundle);
return;
}
if (obj instanceof Byte) {
putByte(str, (Byte) obj, bundle);
return;
}
if (obj instanceof Character) {
putChar(str, (Character) obj, bundle);
return;
}
if (obj instanceof Float) {
putFloat(str, (Float) obj, bundle);
return;
}
if (obj instanceof Short) {
putShort(str, (Short) obj, bundle);
return;
}
if (obj instanceof CharSequence) {
putCharSequence(str, (CharSequence) obj, bundle);
return;
}
if (obj instanceof String[]) {
putStringArray(str, (String[]) obj, bundle);
return;
}
if (obj instanceof boolean[]) {
putBooleanArray(str, (boolean[]) obj, bundle);
return;
}
if (obj instanceof int[]) {
putIntArray(str, (int[]) obj, bundle);
return;
}
if (obj instanceof long[]) {
putLongArray(str, (long[]) obj, bundle);
return;
}
if (obj instanceof double[]) {
putDoubleArray(str, (double[]) obj, bundle);
return;
}
if (obj instanceof byte[]) {
putByteArray(str, (byte[]) obj, bundle);
return;
}
if (obj instanceof char[]) {
putCharArray(str, (char[]) obj, bundle);
return;
}
if (obj instanceof float[]) {
putFloatArray(str, (float[]) obj, bundle);
return;
}
if (obj instanceof short[]) {
putShortArray(str, (short[]) obj, bundle);
return;
}
if (obj instanceof CharSequence[]) {
putCharSequenceArray(str, (CharSequence[]) obj, bundle);
return;
}
if (obj instanceof ArrayList) {
ArrayList arrayList = (ArrayList) obj;
if (arrayList.size() > 0) {
if (arrayList.get(0) instanceof String) {
putStringArrayList(str, arrayList, bundle);
return;
} else if (arrayList.get(0) instanceof Integer) {
putIntegerArrayList(str, arrayList, bundle);
return;
} else {
if (arrayList.get(0) instanceof CharSequence) {
putCharSequenceArrayList(str, arrayList, bundle);
return;
}
return;
}
}
}
n.h("AppLovinSdk", "Skipped insertion of " + obj + " into Bundle");
}
public static void putBoolean(String str, @Nullable Boolean bool, Bundle bundle) {
if (bool != null) {
bundle.putBoolean(str, bool.booleanValue());
}
}
public static void putBooleanArray(String str, @Nullable boolean[] zArr, Bundle bundle) {
if (zArr != null) {
bundle.putBooleanArray(str, zArr);
}
}
public static void putByte(String str, @Nullable Byte b, Bundle bundle) {
if (b != null) {
bundle.putByte(str, b.byteValue());
}
}
public static void putByteArray(String str, @Nullable byte[] bArr, Bundle bundle) {
if (bArr != null) {
bundle.putByteArray(str, bArr);
}
}
public static void putChar(String str, @Nullable Character ch, Bundle bundle) {
if (ch != null) {
bundle.putChar(str, ch.charValue());
}
}
public static void putCharArray(String str, @Nullable char[] cArr, Bundle bundle) {
if (cArr != null) {
bundle.putCharArray(str, cArr);
}
}
public static void putCharSequence(String str, @Nullable CharSequence charSequence, Bundle bundle) {
if (charSequence != null) {
bundle.putCharSequence(str, charSequence);
}
}
public static void putCharSequenceArray(String str, @Nullable CharSequence[] charSequenceArr, Bundle bundle) {
if (charSequenceArr != null) {
bundle.putCharSequenceArray(str, charSequenceArr);
}
}
public static void putCharSequenceArrayList(String str, @Nullable ArrayList<CharSequence> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putCharSequenceArrayList(str, arrayList);
}
}
public static void putDouble(String str, @Nullable Double d, Bundle bundle) {
if (d != null) {
bundle.putDouble(str, d.doubleValue());
}
}
public static void putDoubleArray(String str, @Nullable double[] dArr, Bundle bundle) {
if (dArr != null) {
bundle.putDoubleArray(str, dArr);
}
}
public static void putFloat(String str, @Nullable Float f, Bundle bundle) {
if (f != null) {
bundle.putFloat(str, f.floatValue());
}
}
public static void putFloatArray(String str, @Nullable float[] fArr, Bundle bundle) {
if (fArr != null) {
bundle.putFloatArray(str, fArr);
}
}
public static void putInt(String str, @Nullable Integer num, Bundle bundle) {
if (num != null) {
bundle.putInt(str, num.intValue());
}
}
public static void putIntArray(String str, @Nullable int[] iArr, Bundle bundle) {
if (iArr != null) {
bundle.putIntArray(str, iArr);
}
}
public static void putIntegerArrayList(String str, @Nullable ArrayList<Integer> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putIntegerArrayList(str, arrayList);
}
}
public static void putLong(String str, @Nullable Long l, Bundle bundle) {
if (l != null) {
bundle.putLong(str, l.longValue());
}
}
public static void putLongArray(String str, @Nullable long[] jArr, Bundle bundle) {
if (jArr != null) {
bundle.putLongArray(str, jArr);
}
}
public static void putShort(String str, @Nullable Short sh, Bundle bundle) {
if (sh != null) {
bundle.putShort(str, sh.shortValue());
}
}
public static void putShortArray(String str, @Nullable short[] sArr, Bundle bundle) {
if (sArr != null) {
bundle.putShortArray(str, sArr);
}
}
public static void putString(String str, @Nullable String str2, Bundle bundle) {
if (str2 != null) {
bundle.putString(str, str2);
}
}
public static void putStringArray(String str, @Nullable String[] strArr, Bundle bundle) {
if (strArr != null) {
bundle.putStringArray(str, strArr);
}
}
public static void putStringArrayList(String str, @Nullable ArrayList<String> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putStringArrayList(str, arrayList);
}
}
public static void putStringIfValid(String str, @Nullable String str2, Bundle bundle) {
if (AppLovinSdkUtils.isValidString(str2)) {
bundle.putString(str, str2);
}
}
public static JSONObject toJSONObject(Bundle bundle) {
if (bundle == null) {
return new JSONObject();
}
JSONObject jSONObject = new JSONObject();
try {
for (String str : bundle.keySet()) {
Object obj = bundle.get(str);
if (obj != null) {
if (obj instanceof Bundle) {
jSONObject.put(str, toJSONObject((Bundle) obj));
} else {
if (!(obj instanceof Collection) && !(obj instanceof Parcelable[])) {
jSONObject.put(str, obj);
}
Collection asList = obj instanceof Collection ? (Collection) obj : Arrays.asList((Parcelable[]) obj);
JSONArray jSONArray = new JSONArray();
for (Object obj2 : asList) {
if (obj2 instanceof Bundle) {
jSONArray.put(toJSONObject((Bundle) obj2));
} else {
jSONArray.put(obj2);
}
}
jSONObject.put(str, jSONArray);
}
}
}
} catch (JSONException e) {
n.c("AppLovinSdk", "Failed to convert Bundle to JSONObject", e);
}
return jSONObject;
}
public static Map<String, Object> toMap(Bundle bundle) {
if (bundle == null) {
return new HashMap();
}
HashMap hashMap = new HashMap(bundle.size());
for (String str : bundle.keySet()) {
Object obj = bundle.get(str);
if (obj != null) {
if (obj instanceof Bundle) {
hashMap.put(str, toMap((Bundle) obj));
} else {
boolean z = obj instanceof Collection;
if (z || (obj instanceof Parcelable[])) {
Collection asList = z ? (Collection) obj : Arrays.asList((Parcelable[]) obj);
ArrayList arrayList = new ArrayList();
for (Object obj2 : asList) {
if (obj2 instanceof Bundle) {
arrayList.add(toMap((Bundle) obj2));
} else {
arrayList.add(obj2);
}
}
hashMap.put(str, arrayList);
} else {
hashMap.put(str, obj);
}
}
}
}
return hashMap;
}
public static Map<String, String> toStringMap(Bundle bundle) {
if (bundle == null) {
return new HashMap(0);
}
HashMap hashMap = new HashMap(bundle.size());
for (String str : bundle.keySet()) {
hashMap.put(str, String.valueOf(bundle.get(str)));
}
return hashMap;
}
public static boolean getBoolean(String str, boolean z, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Boolean) {
return ((Boolean) obj).booleanValue();
}
if (obj instanceof Number) {
return ((Number) obj).intValue() != 0;
}
if (obj instanceof String) {
String str2 = (String) obj;
if (str2.equalsIgnoreCase("true") || str2.equalsIgnoreCase("1")) {
return true;
}
if (str2.equalsIgnoreCase("false") || str2.equalsIgnoreCase("0")) {
return false;
}
return z;
}
}
return z;
}
public static Bundle getBundle(String str, Bundle bundle, Bundle bundle2) {
Bundle bundle3;
return (TextUtils.isEmpty(str) || bundle2 == null || (bundle3 = bundle2.getBundle(str)) == null) ? bundle : bundle3;
}
public static int getInt(String str, int i, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Number) {
return ((Number) obj).intValue();
}
if (obj instanceof String) {
try {
return Integer.parseInt((String) obj);
} catch (NumberFormatException unused) {
}
}
}
return i;
}
public static long getLong(String str, long j, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Number) {
return ((Number) obj).longValue();
}
if (obj instanceof String) {
try {
return Long.parseLong((String) obj);
} catch (NumberFormatException unused) {
}
}
}
return j;
}
public static String getString(String str, String str2, Bundle bundle) {
if (TextUtils.isEmpty(str) || bundle == null || !bundle.containsKey(str)) {
return str2;
}
Object obj = bundle.get(str);
return obj instanceof String ? (String) obj : String.valueOf(obj);
}
}

View File

@@ -0,0 +1,274 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class CollectionUtils {
public static <T> boolean addObjectIfExists(@Nullable T t, List<T> list) {
if (t != null) {
return list.add(t);
}
return false;
}
public static <T> boolean addUniqueObjectIfExists(@Nullable T t, List<T> list) {
if (t == null || list.contains(t)) {
return false;
}
return list.add(t);
}
public static <T> void addUniqueObjectsIfExists(@Nullable List<T> list, List<T> list2) {
if (list == null) {
return;
}
for (T t : list) {
if (!list2.contains(t)) {
list2.add(t);
}
}
}
public static List<String> explode(String str) {
return explode(str, ",\\s*");
}
public static boolean getBoolean(Map<String, Object> map, String str) {
return getBoolean(map, str, false);
}
@Nullable
public static <T> Set<T> getDifferenceSet(@Nullable Set<T> set, @Nullable Set<T> set2) {
if (set == null) {
return null;
}
if (set2 == null) {
return new HashSet(set);
}
HashSet hashSet = new HashSet(set);
hashSet.removeAll(set2);
return hashSet;
}
public static HashMap<String, String> hashMap(String str, String str2) {
return (HashMap) map(str, str2);
}
public static String implode(Collection<String> collection, int i) {
return implode(collection, ",", i);
}
public static <K, V> boolean isEmpty(@Nullable Map<K, V> map) {
return map == null || map.isEmpty();
}
public static <K, V> Map<K, V> map(Map<K, V> map) {
return map == null ? new HashMap() : new HashMap(map);
}
public static void putBooleanIfValid(String str, Boolean bool, Map map) {
if (!StringUtils.isValidString(str) || bool == null) {
return;
}
map.put(str, bool);
}
public static void putDoubleIfValid(String str, Double d, Map map) {
if (!StringUtils.isValidString(str) || d == null) {
return;
}
map.put(str, d);
}
public static void putFloatIfValid(String str, Float f, Map map) {
if (!StringUtils.isValidString(str) || f == null) {
return;
}
map.put(str, f);
}
public static void putIntegerIfValid(String str, Integer num, Map map) {
if (!StringUtils.isValidString(str) || num == null) {
return;
}
map.put(str, num);
}
public static void putJsonArrayIfValid(String str, JSONArray jSONArray, Map map) {
if (!StringUtils.isValidString(str) || jSONArray == null || jSONArray.length() <= 0) {
return;
}
map.put(str, jSONArray);
}
public static void putLongIfValid(String str, Long l, Map map) {
if (!StringUtils.isValidString(str) || l == null) {
return;
}
map.put(str, l);
}
public static void putObjectToStringIfValid(String str, Object obj, Map map) {
if (obj == null) {
return;
}
putStringIfValid(str, obj.toString(), map);
}
public static void putStringIfValid(String str, String str2, Map map) {
if (StringUtils.isValidString(str) && StringUtils.isValidString(str2)) {
map.put(str, str2);
}
}
public static List<String> removeTrimmedEmptyStrings(List<String> list) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList();
Iterator<String> it = list.iterator();
while (it.hasNext()) {
String trim = it.next().trim();
if (!TextUtils.isEmpty(trim)) {
arrayList.add(trim);
}
}
return arrayList;
}
public static <T> List<T> synchronizedList() {
return synchronizedList(-1);
}
public static Bundle toBundle(Map<String, ?> map) {
if (map == null || map.size() == 0) {
return new Bundle();
}
Bundle bundle = new Bundle();
for (String str : map.keySet()) {
Object obj = map.get(str);
if (obj instanceof Map) {
bundle.putBundle(str, toBundle((Map) obj));
} else if (obj instanceof Boolean) {
bundle.putBoolean(str, ((Boolean) obj).booleanValue());
} else if (obj instanceof String) {
bundle.putString(str, (String) obj);
} else if (obj instanceof Integer) {
bundle.putInt(str, ((Integer) obj).intValue());
} else if (obj instanceof Long) {
bundle.putLong(str, ((Long) obj).longValue());
} else if (obj instanceof Double) {
bundle.putDouble(str, ((Double) obj).doubleValue());
} else if (obj instanceof Parcelable) {
bundle.putParcelable(str, (Parcelable) obj);
}
}
return bundle;
}
@Nullable
public static JSONArray toJSONArray(String[] strArr) {
if (strArr == null) {
return null;
}
JSONArray jSONArray = new JSONArray();
for (String str : strArr) {
jSONArray.put(str);
}
return jSONArray;
}
public static JSONObject toJson(Map<String, ?> map) throws JSONException {
if (map == null) {
return new JSONObject();
}
JSONObject jSONObject = new JSONObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
jSONObject.put(entry.getKey(), entry.getValue());
}
return jSONObject;
}
public static String toJsonString(Map<String, String> map, String str) {
try {
return toJson(map).toString();
} catch (JSONException e) {
n.c("CollectionUtils", "Failed to convert map '" + map + "' to JSON string.", e);
return str;
}
}
public static List<String> explode(String str, String str2) {
return TextUtils.isEmpty(str) ? Collections.emptyList() : Arrays.asList(str.split(str2));
}
public static boolean getBoolean(Map<String, Object> map, String str, boolean z) {
if (map != null && map.containsKey(str)) {
Object obj = map.get(str);
if (obj instanceof String) {
return Boolean.parseBoolean((String) obj);
}
if (obj instanceof Boolean) {
return ((Boolean) obj).booleanValue();
}
if (obj instanceof Number) {
return ((Number) obj).intValue() >= 1;
}
}
return z;
}
public static String implode(Collection<String> collection, String str, int i) {
if (str == null) {
throw new IllegalArgumentException("No glue specified");
}
if (collection == null || collection.size() < 1) {
return "";
}
StringBuilder sb = new StringBuilder();
int i2 = 0;
for (String str2 : collection) {
if (i2 >= i) {
break;
}
i2++;
sb.append(str2);
sb.append(str);
}
if (sb.length() > str.length()) {
sb.setLength(sb.length() - str.length());
}
return sb.toString();
}
public static <E> boolean isEmpty(@Nullable Collection<E> collection) {
return collection == null || collection.isEmpty();
}
public static <T> List<T> synchronizedList(int i) {
return i >= 0 ? Collections.synchronizedList(new ArrayList(i)) : Collections.synchronizedList(new ArrayList());
}
public static <K, V> Map<K, V> map(K k, V v) {
HashMap hashMap = new HashMap(1);
hashMap.put(k, v);
return hashMap;
}
}

View File

@@ -0,0 +1,200 @@
package com.applovin.impl.sdk.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.StrictMode;
import android.webkit.URLUtil;
import android.widget.ImageView;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sj;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.sdk.AppLovinSdkUtils;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.InputStream;
import java.net.URL;
/* loaded from: classes2.dex */
public class ImageViewUtils {
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(final j jVar, String str, final ImageView imageView, Uri uri) {
if (!((Boolean) jVar.a(sj.D)).booleanValue()) {
InputStream inputStream = null;
try {
inputStream = FirebasePerfUrlConnection.openStream(new URL(str));
final Bitmap decodeStream = BitmapFactory.decodeStream(inputStream);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.b(j.this, decodeStream, imageView);
}
});
return;
} catch (Throwable th) {
try {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Failed to fetch image: " + uri, th);
}
return;
} finally {
yp.a(inputStream, jVar);
}
}
}
try {
InputStream openStream = FirebasePerfUrlConnection.openStream(new URL(str));
try {
final Bitmap decodeStream2 = BitmapFactory.decodeStream(openStream);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(j.this, decodeStream2, imageView);
}
});
if (openStream != null) {
openStream.close();
}
} finally {
}
} catch (Throwable th2) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Failed to fetch image: " + uri, th2);
}
jVar.J().a("ImageViewUtils", th2);
jVar.E().a("ImageViewUtils", "setImageUri", th2);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void b(ImageView imageView, Uri uri) {
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
imageView.setImageURI(uri);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public static void setAndDownscaleBitmap(final ImageView imageView, final Uri uri) {
if (uri == null || imageView == null) {
return;
}
j jVar = j.v0;
if (jVar == null) {
n.h("ImageViewUtils", "SDK has not been initialized");
} else {
jVar.j0().b().execute(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(uri, imageView);
}
});
}
}
public static void setAndDownscaleImageUri(final ImageView imageView, final Uri uri) {
if (uri == null || imageView == null) {
return;
}
if (imageView.getHeight() <= 0 || imageView.getWidth() <= 0) {
imageView.post(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.setAndDownscaleBitmap(imageView, uri);
}
});
} else {
setAndDownscaleBitmap(imageView, uri);
}
}
public static void setImageUri(final ImageView imageView, final Uri uri, final j jVar) {
if (imageView == null || uri == null) {
return;
}
final String uri2 = uri.toString();
if (URLUtil.isFileUrl(uri2) || URLUtil.isContentUrl(uri2)) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda6
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.b(imageView, uri);
}
});
return;
}
if (jVar == null) {
return;
}
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Fetching image: " + uri);
}
jVar.j0().b().execute(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda5
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(j.this, uri2, imageView, uri);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void b(j jVar, Bitmap bitmap, ImageView imageView) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Image fetched");
}
imageView.setImageDrawable(new BitmapDrawable(j.l().getResources(), bitmap));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(j jVar, Bitmap bitmap, ImageView imageView) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Image fetched");
}
imageView.setImageDrawable(new BitmapDrawable(j.l().getResources(), bitmap));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(Uri uri, final ImageView imageView) {
BitmapFactory.Options options = new BitmapFactory.Options();
int i = 1;
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(uri.getPath(), options);
int height = imageView.getHeight();
int width = imageView.getWidth();
if (height <= 0 || width <= 0) {
Point b = z3.b(imageView.getContext());
height = Math.min(b.x, b.y);
width = height;
}
int i2 = options.outHeight;
int i3 = options.outWidth;
if (i2 > height || i3 > width) {
while (true) {
int i4 = i * 2;
if (i2 / i4 < height && i3 / i4 < width) {
break;
} else {
i = i4;
}
}
}
options.inSampleSize = i;
options.inJustDecodeBounds = false;
j.v0.J();
if (n.a()) {
j.v0.J().a("ImageViewUtils", "Loading image: " + uri.getLastPathSegment() + "...");
}
final Bitmap decodeFile = BitmapFactory.decodeFile(uri.getPath(), options);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
imageView.setImageBitmap(decodeFile);
}
});
}
}

View File

@@ -0,0 +1,686 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class JsonUtils {
public static final String EMPTY_JSON = "{}";
private static List a(JSONArray jSONArray, List list) {
if (jSONArray == null) {
return list;
}
ArrayList arrayList = new ArrayList(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(a(jSONArray.get(i)));
}
return arrayList;
}
public static boolean containsCaseInsensitiveString(String str, JSONArray jSONArray) {
for (int i = 0; i < jSONArray.length(); i++) {
try {
Object obj = jSONArray.get(i);
if ((obj instanceof String) && ((String) obj).equalsIgnoreCase(str)) {
return true;
}
} catch (JSONException unused) {
}
}
return false;
}
public static boolean containsJSONObjectContainingInt(JSONArray jSONArray, int i, String str) {
if (jSONArray != null && jSONArray.length() != 0) {
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i2);
if (optJSONObject != null && optJSONObject.optInt(str) == i) {
return true;
}
}
}
return false;
}
public static JSONObject deepCopy(JSONObject jSONObject) {
JSONObject jSONObject2 = new JSONObject();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
Object obj = jSONObject.get(next);
if (obj instanceof JSONObject) {
jSONObject2.put(next, deepCopy((JSONObject) obj));
} else if (obj instanceof JSONArray) {
jSONObject2.put(next, deepCopy((JSONArray) obj));
} else {
jSONObject2.put(next, obj);
}
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item for key '" + next + "' to JSONObject deep copy");
}
}
return jSONObject2;
}
@Nullable
public static JSONObject deserialize(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
try {
return new JSONObject(str);
} catch (Throwable th) {
n.b("JsonUtils", "Failed to deserialize into JSON: " + str, th);
return null;
}
}
public static Boolean getBoolean(JSONObject jSONObject, String str, Boolean bool) {
if (jSONObject == null || !jSONObject.has(str)) {
return bool;
}
try {
return Boolean.valueOf(jSONObject.getBoolean(str));
} catch (JSONException unused) {
return Boolean.valueOf(getInt(jSONObject, str, (bool == null || !bool.booleanValue()) ? 0 : 1) > 0);
}
}
public static double getDouble(JSONObject jSONObject, String str, double d) {
if (jSONObject == null || !jSONObject.has(str)) {
return d;
}
try {
return jSONObject.getDouble(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve double property for key = " + str, e);
return d;
}
}
public static float getFloat(JSONObject jSONObject, String str, float f) {
if (jSONObject == null || !jSONObject.has(str)) {
return f;
}
try {
double d = jSONObject.getDouble(str);
return (-3.4028234663852886E38d >= d || d >= 3.4028234663852886E38d) ? f : (float) d;
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve float property for key = " + str, e);
return f;
}
}
public static int getInt(JSONObject jSONObject, String str, int i) {
if (jSONObject == null || !jSONObject.has(str)) {
return i;
}
try {
return jSONObject.getInt(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve int property for key = " + str, e);
return i;
}
}
@Nullable
public static Integer getInteger(@Nullable JSONObject jSONObject, String str, @Nullable Integer num) {
if (jSONObject == null || !jSONObject.has(str)) {
return num;
}
try {
return Integer.valueOf(jSONObject.getInt(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve int property for key = " + str, e);
return num;
}
}
public static List<Integer> getIntegerList(JSONObject jSONObject, String str, List<Integer> list) {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toIntegerList(jSONArray) : list;
}
public static JSONArray getJSONArray(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONObject == null || !jSONObject.has(str)) {
return jSONArray;
}
try {
return jSONObject.getJSONArray(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON array for key = " + str, e);
return jSONArray;
}
}
@Nullable
public static JSONObject getJSONObject(JSONObject jSONObject, String str) {
return getJSONObject(jSONObject, str, (JSONObject) null);
}
public static List getList(JSONObject jSONObject, String str, List list) {
try {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toList(jSONArray) : list;
} catch (JSONException unused) {
return list;
}
}
public static long getLong(JSONObject jSONObject, String str, long j) {
if (jSONObject == null || !jSONObject.has(str)) {
return j;
}
try {
return jSONObject.getLong(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve long property for key = " + str, e);
return j;
}
}
public static Object getObject(JSONObject jSONObject, String str, Object obj) {
if (jSONObject == null || !jSONObject.has(str)) {
return obj;
}
try {
Object obj2 = jSONObject.get(str);
return obj2 != null ? obj2 : obj;
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve Object for key = " + str, e);
return obj;
}
}
public static Object getObjectAtIndex(JSONArray jSONArray, int i, Object obj) {
if (jSONArray == null || jSONArray.length() <= i) {
return obj;
}
try {
return jSONArray.get(i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve object at index " + i + " for JSON array", e);
return obj;
}
}
public static String getString(JSONObject jSONObject, String str, String str2) {
if (jSONObject == null) {
return str2;
}
try {
return jSONObject.has(str) ? jSONObject.getString(str) : str2;
} catch (Exception e) {
n.b("JsonUtils", "Failed to retrieve string property for key = " + str, e);
return str2;
}
}
public static List<String> getStringList(JSONObject jSONObject, String str, List<String> list) {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toStringList(jSONArray) : list;
}
public static JSONObject jsonObjectFromJsonString(String str, JSONObject jSONObject) {
try {
return new JSONObject(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to convert JSON string '" + str + "' to JSONObject", e);
return jSONObject;
}
}
public static String maybeConvertToIndentedString(JSONObject jSONObject) {
if (jSONObject == null) {
return null;
}
try {
return jSONObject.toString(4);
} catch (JSONException unused) {
return jSONObject.toString();
}
}
public static <T> List<T> optList(JSONArray jSONArray, List<T> list) {
try {
return a(jSONArray, list);
} catch (JSONException unused) {
return list;
}
}
public static void putAll(JSONObject jSONObject, JSONObject jSONObject2) {
if (jSONObject == null || jSONObject2 == null) {
return;
}
Iterator<String> keys = jSONObject2.keys();
while (keys.hasNext()) {
String next = keys.next();
Object object = getObject(jSONObject2, next, null);
if (object != null) {
putObject(jSONObject, next, object);
}
}
}
public static void putBoolean(JSONObject jSONObject, String str, boolean z) {
if (jSONObject != null) {
try {
jSONObject.put(str, z);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put boolean property for key = " + str, e);
}
}
}
public static void putBooleanIfValid(JSONObject jSONObject, String str, Boolean bool) {
if (!StringUtils.isValidString(str) || bool == null) {
return;
}
putBoolean(jSONObject, str, bool.booleanValue());
}
public static void putDouble(JSONObject jSONObject, String str, double d) {
if (jSONObject != null) {
try {
jSONObject.put(str, d);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put double property for key = " + str, e);
}
}
}
public static void putInt(JSONObject jSONObject, String str, int i) {
if (jSONObject != null) {
try {
jSONObject.put(str, i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put int property for key = " + str, e);
}
}
}
public static void putJSONObject(JSONObject jSONObject, String str, JSONObject jSONObject2) {
if (jSONObject != null) {
try {
jSONObject.put(str, jSONObject2);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put JSON property for key = " + str, e);
}
}
}
public static void putJSONObjectIfValid(JSONObject jSONObject, String str, JSONObject jSONObject2) {
if (jSONObject2 == null || jSONObject2.length() == 0) {
return;
}
putJSONObject(jSONObject, str, jSONObject2);
}
public static void putJsonArray(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONObject != null) {
try {
jSONObject.put(str, jSONArray);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put JSONArray property for key = " + str, e);
}
}
}
public static void putJsonArrayIfValid(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONArray == null || jSONArray.length() == 0) {
return;
}
putJsonArray(jSONObject, str, jSONArray);
}
public static void putLong(JSONObject jSONObject, String str, long j) {
if (jSONObject != null) {
try {
jSONObject.put(str, j);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put long property for key = " + str, e);
}
}
}
public static void putObject(JSONObject jSONObject, String str, Object obj) {
if (jSONObject != null) {
try {
jSONObject.put(str, obj);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put Object property for key = " + str, e);
}
}
}
public static void putString(JSONObject jSONObject, String str, String str2) {
if (jSONObject != null) {
try {
jSONObject.put(str, str2);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put String property for key = " + str, e);
}
}
}
public static void putStringIfValid(JSONArray jSONArray, String str) {
if (StringUtils.isValidString(str)) {
jSONArray.put(str);
}
}
public static void removeObjectsForKeys(JSONObject jSONObject, String[] strArr) {
for (String str : strArr) {
jSONObject.remove(str);
}
}
public static JSONObject shallowCopy(JSONObject jSONObject) {
JSONObject jSONObject2 = new JSONObject();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
jSONObject2.put(next, jSONObject.get(next));
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item for key '" + next + "' to JSONObject copy");
}
}
return jSONObject2;
}
public static Bundle toBundle(Object obj) {
JSONObject jSONObject;
if (obj instanceof JSONObject) {
jSONObject = (JSONObject) obj;
} else {
if (obj instanceof String) {
try {
jSONObject = new JSONObject((String) obj);
} catch (JSONException unused) {
}
}
jSONObject = null;
}
return toBundle(jSONObject);
}
public static List<Integer> toIntegerList(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
try {
arrayList.add((Integer) jSONArray.get(i));
} catch (Throwable unused) {
}
}
return arrayList;
}
public static <T> List<T> toList(JSONArray jSONArray) throws JSONException {
return a(jSONArray, new ArrayList());
}
public static List<String> toStringList(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
try {
arrayList.add((String) jSONArray.get(i));
} catch (Throwable unused) {
}
}
return arrayList;
}
public static Map<String, String> toStringMap(JSONObject jSONObject) throws JSONException {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, a(jSONObject.get(next)).toString());
}
return hashMap;
}
public static Map<String, Object> toStringObjectMap(JSONObject jSONObject) throws JSONException {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, a(jSONObject.get(next)));
}
return hashMap;
}
public static Map<String, String> tryToStringMap(JSONObject jSONObject) {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
Object a = a(jSONObject.get(next));
hashMap.put(next, a != null ? a.toString() : null);
} catch (Throwable unused) {
}
}
return hashMap;
}
public static boolean valueExists(JSONObject jSONObject, String str) {
return jSONObject != null && jSONObject.has(str);
}
@Nullable
public static JSONObject getJSONObject(JSONObject jSONObject, String str, @Nullable JSONObject jSONObject2) {
if (jSONObject == null || !jSONObject.has(str)) {
return jSONObject2;
}
try {
return jSONObject.getJSONObject(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON property for key = " + str, e);
return jSONObject2;
}
}
public static boolean valueExists(JSONArray jSONArray, Object obj) {
if (jSONArray != null && obj != null) {
for (int i = 0; i < jSONArray.length(); i++) {
if (obj.equals(getObjectAtIndex(jSONArray, i, null))) {
return true;
}
}
}
return false;
}
public static void putStringIfValid(JSONObject jSONObject, String str, String str2) {
if (StringUtils.isValidString(str) && StringUtils.isValidString(str2)) {
putString(jSONObject, str, str2);
}
}
private static Object a(Object obj) {
if (obj == JSONObject.NULL) {
return null;
}
if (obj instanceof JSONObject) {
return toStringObjectMap((JSONObject) obj);
}
return obj instanceof JSONArray ? toList((JSONArray) obj) : obj;
}
public static String maybeConvertToIndentedString(String str, int i) {
if (TextUtils.isEmpty(str)) {
return str;
}
try {
return new JSONObject(str).toString(i);
} catch (JSONException unused) {
return str;
}
}
public static Map<String, Object> toStringObjectMap(String str) {
try {
return toStringObjectMap(new JSONObject(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to convert json string '" + str + "' to map", e);
return new HashMap();
}
}
@Nullable
public static Double getDouble(JSONObject jSONObject, String str, @Nullable Double d) {
if (jSONObject == null || !jSONObject.has(str)) {
return d;
}
try {
return Double.valueOf(jSONObject.getDouble(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve Double property for key = " + str, e);
return d;
}
}
public static JSONArray getJSONArray(Object obj) {
if (obj == null) {
return new JSONArray();
}
JSONArray jSONArray = new JSONArray();
jSONArray.put(obj);
return jSONArray;
}
public static JSONObject getJSONObject(JSONArray jSONArray, int i, JSONObject jSONObject) {
if (jSONArray == null || i >= jSONArray.length()) {
return jSONObject;
}
try {
return jSONArray.getJSONObject(i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON object from array for index = " + i, e);
return jSONObject;
}
}
public static void putAll(JSONObject jSONObject, Map<String, ?> map) {
if (jSONObject == null || map == null) {
return;
}
for (Map.Entry<String, ?> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value != null) {
putObject(jSONObject, key, value);
}
}
}
@Nullable
public static Float getFloat(JSONObject jSONObject, String str, @Nullable Float f) {
if (jSONObject == null || !jSONObject.has(str)) {
return f;
}
try {
double d = jSONObject.getDouble(str);
return (-3.4028234663852886E38d >= d || d >= 3.4028234663852886E38d) ? f : Float.valueOf((float) d);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve float property for key = " + str, e);
return f;
}
}
public static JSONArray shallowCopy(JSONArray jSONArray) {
JSONArray jSONArray2 = new JSONArray();
for (int i = 0; i < jSONArray.length(); i++) {
jSONArray2.put(jSONArray.opt(i));
}
return jSONArray2;
}
public static Bundle toBundle(JSONObject jSONObject) {
if (jSONObject != null && jSONObject.length() != 0) {
Bundle bundle = new Bundle();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
if (jSONObject.isNull(next)) {
bundle.putString(next, null);
} else {
Object opt = jSONObject.opt(next);
if (opt instanceof JSONObject) {
bundle.putBundle(next, toBundle((JSONObject) opt));
} else if (opt instanceof JSONArray) {
JSONArray jSONArray = (JSONArray) opt;
if (jSONArray.length() == 0) {
bundle.putStringArrayList(next, new ArrayList<>(0));
} else if (getObjectAtIndex(jSONArray, 0, null) instanceof String) {
ArrayList<String> arrayList = new ArrayList<>(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add((String) getObjectAtIndex(jSONArray, i, null));
}
bundle.putStringArrayList(next, arrayList);
} else {
bundle.putParcelableArrayList(next, toBundle(jSONArray));
}
} else if (opt instanceof Boolean) {
bundle.putBoolean(next, ((Boolean) opt).booleanValue());
} else if (opt instanceof String) {
bundle.putString(next, (String) opt);
} else if (opt instanceof Integer) {
bundle.putInt(next, ((Integer) opt).intValue());
} else if (opt instanceof Long) {
bundle.putLong(next, ((Long) opt).longValue());
} else if (opt instanceof Double) {
bundle.putDouble(next, ((Double) opt).doubleValue());
}
}
}
return bundle;
}
return new Bundle();
}
public static JSONArray deepCopy(JSONArray jSONArray) {
JSONArray jSONArray2 = new JSONArray();
for (int i = 0; i < jSONArray.length(); i++) {
try {
Object obj = jSONArray.get(i);
if (obj instanceof JSONObject) {
jSONArray2.put(i, deepCopy((JSONObject) obj));
} else if (obj instanceof JSONArray) {
jSONArray2.put(i, deepCopy((JSONArray) obj));
} else {
jSONArray2.put(i, obj);
}
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item at index " + i + " to JSONArray deep copy");
}
}
return jSONArray2;
}
public static ArrayList<Bundle> toBundle(JSONArray jSONArray) {
if (jSONArray != null && jSONArray.length() != 0) {
ArrayList<Bundle> arrayList = new ArrayList<>(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(toBundle(jSONArray.optJSONObject(i)));
}
return arrayList;
}
return new ArrayList<>();
}
}

View File

@@ -0,0 +1,341 @@
package com.applovin.impl.sdk.utils;
import android.net.Uri;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannedString;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import com.applovin.exoplayer2.common.base.Ascii;
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
import csdk.gluads.Consts;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes2.dex */
public class StringUtils {
private static final char[] a = "0123456789abcdef".toCharArray();
public class a implements Comparator {
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(String str, String str2) {
return str.compareToIgnoreCase(str2);
}
}
private static String a(String str, Integer num) {
if (TextUtils.isEmpty(str)) {
return "";
}
try {
MessageDigest messageDigest = MessageDigest.getInstance(AndroidStaticDeviceInfoDataSource.ALGORITHM_SHA1);
messageDigest.update(str.getBytes("UTF-8"));
String hexString = toHexString(messageDigest.digest());
return num.intValue() > 0 ? hexString.substring(0, Math.min(num.intValue(), hexString.length())) : hexString;
} catch (Throwable th) {
throw new RuntimeException("SHA-1 for \"" + str + "\" failed.", th);
}
}
public static void addLinks(Spannable spannable, Pattern pattern, ClickableSpan clickableSpan, boolean z) {
Matcher matcher = pattern.matcher(spannable);
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
spannable.setSpan(clickableSpan, start, end, 33);
if (z) {
spannable.setSpan(new StyleSpan(1), start, end, 256);
}
}
}
public static String appendQueryParameter(String str, String str2, String str3) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return str;
}
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
buildUpon.appendQueryParameter(str2, str3);
return buildUpon.build().toString();
}
public static String appendQueryParameters(String str, Map<String, String> map, boolean z) {
if (TextUtils.isEmpty(str) || map == null || map.isEmpty()) {
return str;
}
if (z) {
TreeMap treeMap = new TreeMap(new a());
treeMap.putAll(map);
map = treeMap;
}
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
for (Map.Entry<String, String> entry : map.entrySet()) {
buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
}
return buildUpon.build().toString();
}
public static boolean containsAtLeastOneSubstring(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.contains(it.next())) {
return true;
}
}
return false;
}
public static boolean containsIgnoreCase(String str, String str2) {
return isValidString(str) && isValidString(str2) && str.toLowerCase().contains(str2.toLowerCase());
}
public static SpannedString createListItemDetailSpannedString(String str, int i) {
return createSpannedString(str, i, 16);
}
public static SpannedString createListItemDetailSubSpannedString(String str, int i) {
return createSpannedString(str, i, 12, 1);
}
public static SpannedString createSpannedString(String str, int i, int i2) {
return createSpannedString(str, i, i2, 0);
}
public static String emptyIfNull(String str) {
return str == null ? "" : str;
}
public static String encodeUriString(String str) {
return isValidString(str) ? Uri.encode(str) : "";
}
public static Boolean endsWith(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.endsWith(it.next())) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
public static String getHost(String str) {
return Uri.parse(str).getHost();
}
public static String getHostAndPath(String str) {
Uri parse = Uri.parse(str);
return parse.getHost() + parse.getPath();
}
public static List<String> getRegexMatches(Matcher matcher, int i) {
matcher.reset();
ArrayList arrayList = new ArrayList();
while (matcher.find()) {
String group = matcher.group(i);
if (isValidString(group)) {
arrayList.add(group);
}
}
return arrayList;
}
public static boolean isAlphaNumeric(String str) {
if (isValidString(str)) {
return str.matches("^[a-zA-Z0-9]*$");
}
return false;
}
public static boolean isNumeric(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
char charAt = str.charAt(0);
int i = (charAt == '-' || charAt == '+') ? 1 : 0;
int length = str.length();
if (i == 1 && length == 1) {
return false;
}
while (i < length) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
i++;
}
return true;
}
public static boolean isValidString(String str) {
return !TextUtils.isEmpty(str);
}
public static String join(CharSequence charSequence, List<?> list) {
if (list == null || list.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
Iterator<?> it = list.iterator();
while (it.hasNext()) {
sb.append(it.next());
sb.append(charSequence);
}
sb.delete((sb.length() - 1) - charSequence.length(), sb.length());
return sb.toString();
}
public static Matcher match(String str, String str2) {
return Pattern.compile(str2).matcher(str);
}
public static int parseInt(String str) {
return parseInt(str, 0);
}
public static long parseLong(String str, long j) {
return isNumeric(str) ? Long.parseLong(str) : j;
}
public static String prefixToIndex(int i, String str) {
if (TextUtils.isEmpty(str)) {
return str;
}
if (i > str.length()) {
i = str.length();
}
return str.substring(0, i);
}
public static String replace(String str, String str2, String str3) {
if (str3 == null) {
throw new IllegalArgumentException("No replacement target specified");
}
if (str == null || str.length() < 1 || str2 == null || str2.length() < 1) {
return str;
}
StringBuilder sb = new StringBuilder(str);
int indexOf = sb.indexOf(str2);
while (indexOf != -1) {
sb.replace(indexOf, str2.length() + indexOf, str3);
indexOf = sb.indexOf(str2, indexOf + str3.length());
}
return sb.toString();
}
public static void replaceAll(StringBuffer stringBuffer, String str, String str2) {
if (TextUtils.isEmpty(stringBuffer) || TextUtils.isEmpty(str)) {
return;
}
if (TextUtils.isEmpty(str2)) {
throw new IllegalArgumentException("No replacement target specified");
}
int indexOf = stringBuffer.indexOf(str);
while (indexOf != -1) {
stringBuffer.replace(indexOf, str.length() + indexOf, str2);
indexOf = stringBuffer.indexOf(str, indexOf + str2.length());
}
}
public static boolean startsWithAtLeastOnePrefix(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.startsWith(it.next())) {
return true;
}
}
return false;
}
public static String toDigitsOnlyVersionString(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
String[] split = str.split("\\.");
ArrayList arrayList = new ArrayList(split.length);
for (String str2 : split) {
if (isValidString(str2)) {
String[] split2 = str2.split("[^0-9]+");
if (split2.length > 0) {
arrayList.add(split2[0]);
}
}
}
return TextUtils.join(Consts.STRING_PERIOD, arrayList);
}
public static String toFullSHA1Hash(String str) {
return a(str, -1);
}
public static String toHexString(byte[] bArr) {
if (bArr == null) {
throw new IllegalArgumentException("No data specified");
}
char[] cArr = new char[bArr.length * 2];
for (int i = 0; i < bArr.length; i++) {
int i2 = i * 2;
char[] cArr2 = a;
byte b = bArr[i];
cArr[i2] = cArr2[(b & 240) >>> 4];
cArr[i2 + 1] = cArr2[b & Ascii.SI];
}
return new String(cArr);
}
public static String toHumanReadableString(String str) {
if (!isValidString(str)) {
return "";
}
StringBuilder sb = new StringBuilder(str.length());
for (String str2 : str.split("_")) {
if (isValidString(str2)) {
if (str2.equals("id")) {
sb.append(str2.toUpperCase(Locale.ENGLISH));
} else {
String substring = str2.substring(0, 1);
Locale locale = Locale.ENGLISH;
sb.append(substring.toUpperCase(locale));
sb.append(str2.substring(1).toLowerCase(locale));
}
sb.append(" ");
}
}
return sb.deleteCharAt(sb.length() - 1).toString();
}
public static String toShortSHA1Hash(String str) {
return a(str, 16);
}
public static SpannedString createSpannedString(String str, int i, int i2, int i3) {
SpannableString spannableString = new SpannableString(str);
spannableString.setSpan(new ForegroundColorSpan(i), 0, spannableString.length(), 33);
spannableString.setSpan(new AbsoluteSizeSpan(i2, true), 0, spannableString.length(), 33);
spannableString.setSpan(new StyleSpan(i3), 0, spannableString.length(), 33);
return new SpannedString(spannableString);
}
public static int parseInt(String str, int i) {
return isNumeric(str) ? Integer.parseInt(str) : i;
}
public static String replace(String str, Map<String, String> map) {
if (str != null && map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
str = str.replace(entry.getKey(), entry.getValue());
}
}
return str;
}
}