Search in sources :

Example 1 with TextDirectionHeuristic

use of android.text.TextDirectionHeuristic in project android_frameworks_base by DirtyUnicorns.

the class TextView method onRtlPropertiesChanged.

@Override
public void onRtlPropertiesChanged(int layoutDirection) {
    super.onRtlPropertiesChanged(layoutDirection);
    final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
    if (mTextDir != newTextDir) {
        mTextDir = newTextDir;
        if (mLayout != null) {
            checkForRelayout();
        }
    }
}
Also used : TextDirectionHeuristic(android.text.TextDirectionHeuristic)

Example 2 with TextDirectionHeuristic

use of android.text.TextDirectionHeuristic in project android_frameworks_base by AOSPA.

the class TextView method onRtlPropertiesChanged.

@Override
public void onRtlPropertiesChanged(int layoutDirection) {
    super.onRtlPropertiesChanged(layoutDirection);
    final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
    if (mTextDir != newTextDir) {
        mTextDir = newTextDir;
        if (mLayout != null) {
            checkForRelayout();
        }
    }
}
Also used : TextDirectionHeuristic(android.text.TextDirectionHeuristic)

Example 3 with TextDirectionHeuristic

use of android.text.TextDirectionHeuristic in project edx-app-android by edx.

the class CustomTypefaceSpan method needMirroring.

// Since the 'mirrorable' flag is only set to true if the SDK
// version supports it, we don't need an explicit check for that
// before calling getLayoutDirection().
@TargetApi(JELLY_BEAN_MR1)
@CheckResult
private boolean needMirroring() {
    if (!mirrorable)
        return false;
    // Passwords fields should be LTR
    if (view.getTransformationMethod() instanceof PasswordTransformationMethod) {
        return false;
    }
    // Always need to resolve layout direction first
    final boolean defaultIsRtl = view.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
    if (SDK_INT < JELLY_BEAN_MR2) {
        return defaultIsRtl;
    }
    // Select the text direction heuristic according to the
    // package-private getTextDirectionHeuristic() method in TextView
    TextDirectionHeuristic textDirectionHeuristic;
    switch(view.getTextDirection()) {
        default:
        case TEXT_DIRECTION_FIRST_STRONG:
            textDirectionHeuristic = defaultIsRtl ? TextDirectionHeuristics.FIRSTSTRONG_RTL : TextDirectionHeuristics.FIRSTSTRONG_LTR;
            break;
        case TEXT_DIRECTION_ANY_RTL:
            textDirectionHeuristic = TextDirectionHeuristics.ANYRTL_LTR;
            break;
        case TEXT_DIRECTION_LTR:
            textDirectionHeuristic = TextDirectionHeuristics.LTR;
            break;
        case TEXT_DIRECTION_RTL:
            textDirectionHeuristic = TextDirectionHeuristics.RTL;
            break;
        case TEXT_DIRECTION_LOCALE:
            textDirectionHeuristic = TextDirectionHeuristics.LOCALE;
            break;
        case TEXT_DIRECTION_FIRST_STRONG_LTR:
            textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_LTR;
            break;
        case TEXT_DIRECTION_FIRST_STRONG_RTL:
            textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_RTL;
            break;
    }
    CharSequence text = view.getText();
    return textDirectionHeuristic.isRtl(text, 0, text.length());
}
Also used : PasswordTransformationMethod(android.text.method.PasswordTransformationMethod) TextDirectionHeuristic(android.text.TextDirectionHeuristic) CheckResult(android.support.annotation.CheckResult) TargetApi(android.annotation.TargetApi)

Example 4 with TextDirectionHeuristic

use of android.text.TextDirectionHeuristic in project platform_frameworks_base by android.

the class TextView method onRtlPropertiesChanged.

@Override
public void onRtlPropertiesChanged(int layoutDirection) {
    super.onRtlPropertiesChanged(layoutDirection);
    final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
    if (mTextDir != newTextDir) {
        mTextDir = newTextDir;
        if (mLayout != null) {
            checkForRelayout();
        }
    }
}
Also used : TextDirectionHeuristic(android.text.TextDirectionHeuristic)

Example 5 with TextDirectionHeuristic

use of android.text.TextDirectionHeuristic in project android_frameworks_base by ResurrectionRemix.

the class TextView method onRtlPropertiesChanged.

@Override
public void onRtlPropertiesChanged(int layoutDirection) {
    super.onRtlPropertiesChanged(layoutDirection);
    final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
    if (mTextDir != newTextDir) {
        mTextDir = newTextDir;
        if (mLayout != null) {
            checkForRelayout();
        }
    }
}
Also used : TextDirectionHeuristic(android.text.TextDirectionHeuristic)

Aggregations

TextDirectionHeuristic (android.text.TextDirectionHeuristic)7 TargetApi (android.annotation.TargetApi)1 CheckResult (android.support.annotation.CheckResult)1 StaticLayout (android.text.StaticLayout)1 PasswordTransformationMethod (android.text.method.PasswordTransformationMethod)1