package org.ccci.gto.android.common.util;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

public final class ViewUtils {
    @Nullable
    public static <T> T findView(@Nullable final View root, @NonNull final Class<T> clazz, final int id) {
        if (root != null) {
            final View view = root.findViewById(id);
            if (clazz.isInstance(view)) {
                return clazz.cast(view);
            }
        }
        return null;
    }
}

@@ -36,16 +36,86 @@
 .util;%0A%0A
+import android.app.Activity;%0Aimport android.support.annotation.IdRes;%0A
 import a
@@ -149,16 +149,16 @@
 onNull;%0A
-
 import a
@@ -355,16 +355,23 @@
 %3E clazz,
+ @IdRes
  final i
@@ -543,16 +543,16 @@
 (view);%0A
-
         
@@ -593,11 +593,312 @@
 l;%0A    %7D
+%0A%0A    @Nullable%0A    public static %3CT%3E T findView(@NonNull final Activity activity, @NonNull final Class%3CT%3E clazz, @IdRes final int id) %7B%0A        final View view = activity.findViewById(id);%0A        if (clazz.isInstance(view)) %7B%0A            return clazz.cast(view);%0A        %7D%0A        return null;%0A    %7D
 %0A%7D%0A

add an Activity findView util