diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
commit | 754de6bb0449a577d2bb9c28cca6adf0ef9554f6 (patch) | |
tree | 279b405d94e0d86d10ed94bd34d919457944ead6 /src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java | |
parent | cd633f13b8d7327e47994bb5a000f0c0b7089e7f (diff) |
relates FS#241: Implementation of http download based on okhttp
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java | 37 |
1 files changed, 21 insertions, 16 deletions
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 extends View> 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 extends View> 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 extends View> 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 extends View> T gone(T view) { + if (null != view) { + view.setVisibility(View.GONE); } + return view; + } - return tv; + public static <T extends View> T visible(T view) { + if (null != view) { + view.setVisibility(View.VISIBLE); + } + return view; } + public static <T extends View> T invisible(T view) { + if (null != view) { + view.setVisibility(View.INVISIBLE); + } + return view; + } } |