aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-29 22:35:28 +0200
committersteckbrief <steckbrief@chefmail.de>2016-03-29 22:35:28 +0200
commita0c4b022de514ef0334b8aa28662338519eb2071 (patch)
treebeceb80779946decd8458910b6864c83a67e93d2 /src/main/java/de/thedevstack/conversationsplus
parente388dfc0b8c32ea5916ae6f803217061dac58663 (diff)
parentbcf0d929dda50a3c8c94e5d384840bedc51d4e63 (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Conflicts: src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java75
1 files changed, 75 insertions, 0 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
new file mode 100644
index 00000000..bb08014b
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/ui/TextViewUtil.java
@@ -0,0 +1,75 @@
+package de.thedevstack.conversationsplus.utils.ui;
+
+import android.support.annotation.StringRes;
+import android.widget.TextView;
+
+/**
+ * Created by steckbrief on 29.03.2016.
+ */
+public final class TextViewUtil {
+ public static void enable(TextView tv) {
+ setColorEnabledAndTextResId(tv, null, true, null);
+ }
+
+ public static void enable(TextView tv, String text) {
+ setColorEnabledAndText(tv, null, true, text);
+ }
+
+ public static void enable(TextView tv, Integer color) {
+ setColorEnabledAndTextResId(tv, color, true, null);
+ }
+
+ public static void enable(TextView tv, Integer color, @StringRes Integer resid) {
+ setColorEnabledAndTextResId(tv, color, true, resid);
+ }
+
+ public static void disable(TextView tv) {
+ setColorEnabledAndTextResId(tv, null, false, null);
+ }
+
+ public static void disable(TextView tv, String text) {
+ setColorEnabledAndText(tv, null, false, text);
+ }
+
+ public static void disable(TextView tv, Integer color) {
+ setColorEnabledAndTextResId(tv, color, false, null);
+ }
+
+ public static void disable(TextView tv, Integer color, @StringRes Integer resid) {
+ setColorEnabledAndTextResId(tv, color, false, resid);
+ }
+
+ public static void setColor(TextView tv, Integer color) {
+ setColorEnabledAndTextResId(tv, color, null, null);
+ }
+
+ public static void setColorEnabledAndTextResId(TextView tv, Integer color, Boolean enabled, @StringRes Integer resid) {
+ if (null != color) {
+ tv.setTextColor(color);
+ }
+
+ if (enabled != null) {
+ tv.setEnabled(enabled);
+ }
+ if (resid != null) {
+ tv.setText(resid);
+ }
+ }
+
+ public static void setColorEnabledAndText(TextView tv, Integer color, Boolean enabled, String text) {
+ if (null != color) {
+ tv.setTextColor(color);
+ }
+
+ if (enabled != null) {
+ tv.setEnabled(enabled);
+ }
+ if (text != null) {
+ tv.setText(text);
+ }
+ }
+
+ private TextViewUtil() {
+ // avoid instantiation - helper class
+ }
+}