From 754de6bb0449a577d2bb9c28cca6adf0ef9554f6 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 6 Feb 2017 10:01:13 +0100 Subject: relates FS#241: Implementation of http download based on okhttp --- .../conversationsplus/utils/ui/ViewUtil.java | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java index 77422587..170a6401 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java @@ -10,30 +10,35 @@ import android.view.View; public class ViewUtil { public static T visible(View parentView, @IdRes int textViewId) { - T tv = (T) parentView.findViewById(textViewId); - if (null != tv) { - tv.setVisibility(View.VISIBLE); - } - - return tv; + return ViewUtil.visible((T) parentView.findViewById(textViewId)); } public static T invisible(View parentView, @IdRes int textViewId) { - T tv = (T) parentView.findViewById(textViewId); - if (null != tv) { - tv.setVisibility(View.INVISIBLE); - } - - return tv; + return ViewUtil.invisible((T) parentView.findViewById(textViewId)); } public static T gone(View parentView, @IdRes int textViewId) { - T tv = (T) parentView.findViewById(textViewId); - if (null != tv) { - tv.setVisibility(View.GONE); + return ViewUtil.gone((T) parentView.findViewById(textViewId)); + } + + public static T gone(T view) { + if (null != view) { + view.setVisibility(View.GONE); } + return view; + } - return tv; + public static T visible(T view) { + if (null != view) { + view.setVisibility(View.VISIBLE); + } + return view; } + public static T invisible(T view) { + if (null != view) { + view.setVisibility(View.INVISIBLE); + } + return view; + } } -- cgit v1.2.3