Search in sources :

Example 16 with TransformationMethod

use of android.text.method.TransformationMethod 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)

Aggregations

TransformationMethod (android.text.method.TransformationMethod)16 TextPaint (android.text.TextPaint)14 Resources (android.content.res.Resources)7 TypedArray (android.content.res.TypedArray)6 Paint (android.graphics.Paint)6 SingleLineTransformationMethod (android.text.method.SingleLineTransformationMethod)6 TypedValue (android.util.TypedValue)6 Context (android.content.Context)5 DisplayMetrics (android.util.DisplayMetrics)5 LayoutParams (android.app.ActionBar.LayoutParams)2 Rect (android.graphics.Rect)2 View (android.view.View)2 OnClickListener (android.view.View.OnClickListener)2 RelativeLayout (android.widget.RelativeLayout)2 TextView (android.widget.TextView)2 DateFormatSymbols (java.text.DateFormatSymbols)2 ArrayList (java.util.ArrayList)2 Locale (java.util.Locale)2