From 72ffe6bdd672fb567970a7ff28bed40bcc019b9c Mon Sep 17 00:00:00 2001 From: Gavriil Sitnikov Date: Thu, 22 Dec 2016 17:09:03 +0300 Subject: [PATCH] findviewbyid fixed a bit --- .../roboswag/components/navigation/ViewController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/touchin/roboswag/components/navigation/ViewController.java b/src/main/java/ru/touchin/roboswag/components/navigation/ViewController.java index 6177c77..f2c3e4e 100644 --- a/src/main/java/ru/touchin/roboswag/components/navigation/ViewController.java +++ b/src/main/java/ru/touchin/roboswag/components/navigation/ViewController.java @@ -119,6 +119,7 @@ public class ViewController, * * @param resId Resource id for the string */ + @NonNull public final String getString(@StringRes final int resId) { return getActivity().getString(resId); } @@ -130,6 +131,7 @@ public class ViewController, * @param resId Resource id for the format string * @param formatArgs The format arguments that will be used for substitution. */ + @NonNull public final String getString(@StringRes final int resId, @NonNull final Object... formatArgs) { return getActivity().getString(resId, formatArgs); } @@ -178,8 +180,9 @@ public class ViewController, * @return The view that has the given id in the hierarchy. */ @NonNull - public View findViewById(@IdRes final int id) { - final View viewById = getContainer().findViewById(id); + @SuppressWarnings("unchecked") + public T findViewById(@IdRes final int id) { + final T viewById = (T) getContainer().findViewById(id); if (viewById == null) { throw new ShouldNotHappenException("No view for id=" + getActivity().getResources().getResourceName(id)); }