Search in sources :

Example 1 with SingleLineTransformationMethod

use of android.text.method.SingleLineTransformationMethod in project LuaViewSDK by alibaba.

the class TextUtil method getMaxLines.

private static int getMaxLines(TextView view) {
    // No limit (Integer.MAX_VALUE also means no limit)
    int maxLines = -1;
    TransformationMethod method = view.getTransformationMethod();
    if (method != null && method instanceof SingleLineTransformationMethod) {
        maxLines = 1;
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // setMaxLines() and getMaxLines() are only available on android-16+
        maxLines = view.getMaxLines();
    }
    return maxLines;
}
Also used : TransformationMethod(android.text.method.TransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) TextPaint(android.text.TextPaint)

Example 2 with SingleLineTransformationMethod

use of android.text.method.SingleLineTransformationMethod in project android-autofittextview by grantland.

the class AutofitHelper method getMaxLines.

private static int getMaxLines(TextView view) {
    // No limit (Integer.MAX_VALUE also means no limit)
    int maxLines = -1;
    TransformationMethod method = view.getTransformationMethod();
    if (method != null && method instanceof SingleLineTransformationMethod) {
        maxLines = 1;
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // setMaxLines() and getMaxLines() are only available on android-16+
        maxLines = view.getMaxLines();
    }
    return maxLines;
}
Also used : TransformationMethod(android.text.method.TransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) TextPaint(android.text.TextPaint)

Example 3 with SingleLineTransformationMethod

use of android.text.method.SingleLineTransformationMethod in project LuaViewSDK by alibaba.

the class AutofitHelper method getMaxLines.

private static int getMaxLines(TextView view) {
    // No limit (Integer.MAX_VALUE also means no limit)
    int maxLines = -1;
    TransformationMethod method = view.getTransformationMethod();
    if (method != null && method instanceof SingleLineTransformationMethod) {
        maxLines = 1;
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // setMaxLines() and getMaxLines() are only available on android-16+
        maxLines = view.getMaxLines();
    }
    return maxLines;
}
Also used : TransformationMethod(android.text.method.TransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) SingleLineTransformationMethod(android.text.method.SingleLineTransformationMethod) TextPaint(android.text.TextPaint)

Aggregations

TextPaint (android.text.TextPaint)3 SingleLineTransformationMethod (android.text.method.SingleLineTransformationMethod)3 TransformationMethod (android.text.method.TransformationMethod)3