refactor: Cleanup

This commit is contained in:
LisoUseInAIKyrios 2024-03-19 10:52:15 +04:00
parent ae2b4afd0c
commit af6afac925

View File

@ -195,6 +195,10 @@ public class Utils {
return getContext().getResources().getDimension(getResourceIdentifier(resourceIdentifierName, "dimen"));
}
public interface MatchFilter<T> {
boolean matches(T object);
}
/**
* @param searchRecursively If children ViewGroups should also be
* recursively searched using depth first search.
@ -202,10 +206,9 @@ public class Utils {
*/
@Nullable
public static <T extends View> T getChildView(@NonNull ViewGroup viewGroup, boolean searchRecursively,
@NonNull MatchFilter filter) {
@NonNull MatchFilter<View> filter) {
for (int i = 0, childCount = viewGroup.getChildCount(); i < childCount; i++) {
View childAt = viewGroup.getChildAt(i);
//noinspection unchecked
if (filter.matches(childAt)) {
//noinspection unchecked
return (T) childAt;
@ -230,10 +233,6 @@ public class Utils {
System.exit(0);
}
public interface MatchFilter<T> {
boolean matches(T object);
}
public static Context getContext() {
if (context == null) {
Logger.initializationError(Utils.class, "Context is null, returning null!", null);