85 lines
2.8 KiB
Java
85 lines
2.8 KiB
Java
package o;
|
|
|
|
import android.util.TypedValue;
|
|
import android.view.View;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class pyT {
|
|
static {
|
|
new TypedValue();
|
|
}
|
|
|
|
@SafeVarargs
|
|
private static <T> T[] a(T... tArr) {
|
|
int length = tArr.length;
|
|
int i = 0;
|
|
for (T t : tArr) {
|
|
if (t != null) {
|
|
tArr[i] = t;
|
|
i++;
|
|
}
|
|
}
|
|
return i != length ? (T[]) Arrays.copyOf(tArr, i) : tArr;
|
|
}
|
|
|
|
@SafeVarargs
|
|
public static <T> List<T> e(T... tArr) {
|
|
return new zru(a(tArr));
|
|
}
|
|
|
|
public static <T> T a(View view, int i, String str, Class<T> cls) {
|
|
return (T) c(view.findViewById(i), i, str, cls);
|
|
}
|
|
|
|
public static View a(View view, int i, String str) {
|
|
View findViewById = view.findViewById(i);
|
|
if (findViewById != null) {
|
|
return findViewById;
|
|
}
|
|
String resourceEntryName = view.isInEditMode() ? "<unavailable while editing>" : view.getContext().getResources().getResourceEntryName(i);
|
|
StringBuilder sb = new StringBuilder("Required view '");
|
|
sb.append(resourceEntryName);
|
|
sb.append("' with ID ");
|
|
sb.append(i);
|
|
sb.append(" for ");
|
|
sb.append(str);
|
|
sb.append(" was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.");
|
|
throw new IllegalStateException(sb.toString());
|
|
}
|
|
|
|
public static <T> T e(View view, int i, String str, Class<T> cls) {
|
|
return (T) c(a(view, i, str), i, str, cls);
|
|
}
|
|
|
|
public static <T> T c(View view, int i, String str, Class<T> cls) {
|
|
try {
|
|
return cls.cast(view);
|
|
} catch (ClassCastException e) {
|
|
String resourceEntryName = view.isInEditMode() ? "<unavailable while editing>" : view.getContext().getResources().getResourceEntryName(i);
|
|
StringBuilder sb = new StringBuilder("View '");
|
|
sb.append(resourceEntryName);
|
|
sb.append("' with ID ");
|
|
sb.append(i);
|
|
sb.append(" for ");
|
|
sb.append(str);
|
|
sb.append(" was of the wrong type. See cause for more info.");
|
|
throw new IllegalStateException(sb.toString(), e);
|
|
}
|
|
}
|
|
|
|
public static <T> T c(Object obj, String str, String str2, Class<T> cls) {
|
|
try {
|
|
return cls.cast(obj);
|
|
} catch (ClassCastException e) {
|
|
StringBuilder sb = new StringBuilder("Parameter #1 of method '");
|
|
sb.append(str);
|
|
sb.append("' was of the wrong type for parameter #1 of method '");
|
|
sb.append(str2);
|
|
sb.append("'. See cause for more info.");
|
|
throw new IllegalStateException(sb.toString(), e);
|
|
}
|
|
}
|
|
}
|