package com.e16din.lightutils.utils;

import android.app.Activity;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;

import com.e16din.lightutils.compat.HtmlCompat;

/**
 * Created by e16din on 14.08.15.
 */
public class TextViewUtils extends DeviceUtils {

    public static void updateHtml(TextView tv) {
        tv.setText(HtmlCompat.fromHtml(tv.getText().toString()));
    }

    public static void updateHtml(Activity activity, int tvId) {
        TextView tv = (TextView) activity.findViewById(tvId);
        if (tv != null)
            tv.setText(HtmlCompat.fromHtml(tv.getText().toString()));
    }

    /**
     * Sets the text with colored substring to your TextView
     *
     * @param vText     the TextView
     * @param fulltext  original string
     * @param substring substring for coloring
     * @param color     color of substring
     */
    public static void setTextWithColoredSpan(TextView vText, String fulltext, String substring,
                                              int color) {

        vText.setText(fulltext, TextView.BufferType.SPANNABLE);
        Spannable spannable = (Spannable) vText.getText();

        int i = fulltext.indexOf(substring);

        spannable.setSpan(new ForegroundColorSpan(color), i, i + substring.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}

@@ -1013,54 +1013,8 @@
 ing,
-%0A                                             
  int
@@ -1023,17 +1023,16 @@
 olor) %7B%0A
-%0A
         
@@ -1337,10 +1337,106 @@
 ;%0A    %7D%0A
+%0A    public static boolean isEmpty(TextView vText) %7B%0A        return vText.length() == 0;%0A    %7D%0A%0A
 %7D%0A

Add isEmpty(TextView)