improves ViewUtil
This commit is contained in:
parent
62bc6885db
commit
1b07917a26
2 changed files with 31 additions and 0 deletions
src/main/java/de/thedevstack/conversationsplus/utils/ui
|
@ -12,6 +12,13 @@ import de.thedevstack.conversationsplus.ConversationsPlusColors;
|
|||
*/
|
||||
public final class TextViewUtil extends ViewUtil {
|
||||
|
||||
public static void setTextWithoutAutoLink(TextView tv, CharSequence text) {
|
||||
int oldAutoLinkMask = tv.getAutoLinkMask();
|
||||
tv.setAutoLinkMask(0);
|
||||
tv.setText(text);
|
||||
tv.setAutoLinkMask(oldAutoLinkMask);
|
||||
}
|
||||
|
||||
public static void setText(View parentView, int textViewId, CharSequence text) {
|
||||
TextView tv = (TextView) parentView.findViewById(textViewId);
|
||||
if (null != tv) {
|
||||
|
|
|
@ -28,6 +28,14 @@ public class ViewUtil {
|
|||
return view;
|
||||
}
|
||||
|
||||
public static <T extends View> void gone(T... views) {
|
||||
if (null != views && 0 < views.length) {
|
||||
for (T view : views) {
|
||||
gone(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends View> T visible(T view) {
|
||||
if (null != view) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
|
@ -35,10 +43,26 @@ public class ViewUtil {
|
|||
return view;
|
||||
}
|
||||
|
||||
public static <T extends View> void visible(T... views) {
|
||||
if (null != views && 0 < views.length) {
|
||||
for (T view : views) {
|
||||
visible(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends View> T invisible(T view) {
|
||||
if (null != view) {
|
||||
view.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public static <T extends View> void invisible(T... views) {
|
||||
if (null != views && 0 < views.length) {
|
||||
for (T view : views) {
|
||||
invisible(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue