aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java4
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java39
2 files changed, 41 insertions, 2 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java
index a775dad6..27a269f2 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java
@@ -5,9 +5,9 @@ import android.view.View;
import android.widget.TextView;
/**
- * Created by steckbrief on 29.03.2016.
+ *
*/
-public final class TextViewUtil {
+public final class TextViewUtil extends ViewUtil {
public static void setText(View parentView, int textViewId, CharSequence text) {
TextView tv = (TextView) parentView.findViewById(textViewId);
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java
new file mode 100644
index 00000000..77422587
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/ui/ViewUtil.java
@@ -0,0 +1,39 @@
+package de.thedevstack.conversationsplus.utils.ui;
+
+import android.support.annotation.IdRes;
+import android.view.View;
+
+/**
+ * Created by steckbrief on 11.01.2017.
+ */
+
+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;
+ }
+
+ 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;
+ }
+
+ 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 tv;
+ }
+
+}