TextUtilsCompat.java 2.74 KB
package android.support.v4.text;

import android.os.Build.VERSION;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.util.Locale;

public final class TextUtilsCompat
{
  public static final Locale ROOT;
  static String a;
  static String b;
  private static final a c;
  
  static
  {
    if (Build.VERSION.SDK_INT >= 17) {}
    for (c = new b();; c = new a())
    {
      ROOT = new Locale("", "");
      a = "Arab";
      b = "Hebr";
      return;
    }
  }
  
  public static int getLayoutDirectionFromLocale(@Nullable Locale paramLocale)
  {
    return c.a(paramLocale);
  }
  
  @NonNull
  public static String htmlEncode(@NonNull String paramString)
  {
    return c.a(paramString);
  }
  
  static class a
  {
    public int a(@Nullable Locale paramLocale)
    {
      int j = 1;
      if ((paramLocale != null) && (!paramLocale.equals(TextUtilsCompat.ROOT)))
      {
        String str = ICUCompat.maximizeAndGetScript(paramLocale);
        int i;
        if (str == null)
        {
          i = j;
          switch (Character.getDirectionality(paramLocale.getDisplayName(paramLocale).charAt(0)))
          {
          default: 
            i = 0;
          }
        }
        do
        {
          do
          {
            return i;
            i = j;
          } while (str.equalsIgnoreCase(TextUtilsCompat.a));
          i = j;
        } while (str.equalsIgnoreCase(TextUtilsCompat.b));
      }
      return 0;
    }
    
    @NonNull
    public String a(@NonNull String paramString)
    {
      StringBuilder localStringBuilder = new StringBuilder();
      int i = 0;
      if (i < paramString.length())
      {
        char c = paramString.charAt(i);
        switch (c)
        {
        default: 
          localStringBuilder.append(c);
        }
        for (;;)
        {
          i += 1;
          break;
          localStringBuilder.append("&lt;");
          continue;
          localStringBuilder.append("&gt;");
          continue;
          localStringBuilder.append("&amp;");
          continue;
          localStringBuilder.append("&#39;");
          continue;
          localStringBuilder.append("&quot;");
        }
      }
      return localStringBuilder.toString();
    }
  }
  
  static final class b
    extends TextUtilsCompat.a
  {
    public final int a(@Nullable Locale paramLocale)
    {
      return TextUtils.getLayoutDirectionFromLocale(paramLocale);
    }
    
    @NonNull
    public final String a(@NonNull String paramString)
    {
      return TextUtils.htmlEncode(paramString);
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/text/TextUtilsCompat.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */