Example usage for java.lang Character DIRECTIONALITY_RIGHT_TO_LEFT

List of usage examples for java.lang Character DIRECTIONALITY_RIGHT_TO_LEFT

Introduction

In this page you can find the example usage for java.lang Character DIRECTIONALITY_RIGHT_TO_LEFT.

Prototype

byte DIRECTIONALITY_RIGHT_TO_LEFT

To view the source code for java.lang Character DIRECTIONALITY_RIGHT_TO_LEFT.

Click Source Link

Document

Strong bidirectional character type "R" in the Unicode specification.

Usage

From source file:Main.java

public static void main(String[] args) {
    for (char ch = Character.MIN_VALUE; ch < Character.MAX_VALUE; ch++) {
        if (Character.DIRECTIONALITY_RIGHT_TO_LEFT == Character.getDirectionality(ch)) {
            String s = String.format("\\u%04x", (int) ch);
            System.out.println(s);
        }// w w  w. j  a v a2  s  .  com
    }
}

From source file:Main.java

public static boolean isRTL() {
    final int directionality = Character.getDirectionality(Locale.getDefault().getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:Main.java

public static boolean isRTL(Locale locale) {
    final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:Main.java

private static boolean isRTL(Locale locale) {
    int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:com.hustunique.jianguo.materialsearchview.SearchViewUtil.java

private static boolean isRTL(Locale locale) {
    final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
    return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}

From source file:Main.java

public static boolean isStrongRightToLeft(char c) {
    byte dir = Character.getDirectionality(c);
    return (dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT)
            || (dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC)
            || (dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING)
            || (dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE);
}

From source file:android.text.TextDirectionHeuristics.java

private static int isRtlText(int directionality) {
    switch (directionality) {
    case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
        return STATE_FALSE;
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
        return STATE_TRUE;
    default://from   w  w  w. j a  va 2  s.co  m
        return STATE_UNKNOWN;
    }
}

From source file:android.text.TextDirectionHeuristics.java

private static int isRtlTextOrFormat(int directionality) {
    switch (directionality) {
    case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
    case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
    case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
        return STATE_FALSE;
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
        return STATE_TRUE;
    default://w w w .  j a va  2 s  .  c  o  m
        return STATE_UNKNOWN;
    }
}

From source file:com.pdftron.pdf.utils.Utils.java

public static boolean isSystemLanguagePerAra() {
    if (!isJellyBeanMR1()) {
        return false;
    }/*from  ww  w.  j  a  v  a  2 s .  co m*/
    final int directionality = Character.getDirectionality(Locale.getDefault().getDisplayName().charAt(0));
    if (directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
            || directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC) {
        return true;
    }
    return false;
}

From source file:com.jecelyin.editor.v2.core.text.TextUtils.java

/**
 * Fallback algorithm to detect the locale direction. Rely on the fist char of the
 * localized locale name. This will not work if the localized locale name is in English
 * (this is the case for ICU 4.4 and "Urdu" script)
 *
 * @param locale//  w  w w .ja  va  2  s .c o  m
 * @return the layout direction. This may be one of:
 * {@link android.view.View#LAYOUT_DIRECTION_LTR} or
 * {@link android.view.View#LAYOUT_DIRECTION_RTL}.
 *
 * Be careful: this code will need to be updated when vertical scripts will be supported
 *
 * @hide
 */
private static int getLayoutDirectionFromFirstChar(Locale locale) {
    switch (Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) {
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
    case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
        return View.LAYOUT_DIRECTION_RTL;

    case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
    default:
        return View.LAYOUT_DIRECTION_LTR;
    }
}