Example usage for android.text Layout getLineMax

List of usage examples for android.text Layout getLineMax

Introduction

In this page you can find the example usage for android.text Layout getLineMax.

Prototype

public float getLineMax(int line) 

Source Link

Document

Gets the unsigned horizontal extent of the specified line, including leading margin indent, but excluding trailing whitespace.

Usage

From source file:io.plaidapp.core.ui.transitions.ReflowText.java

/**
 * Calculate the right boundary for this run (harder than it sounds). As we're a letter ahead,
 * need to grab either current letter start or the end of the previous line. Also need to
 * consider maxLines case, which inserts ellipses at the overflow point  don't include these.
 *//*w  w w. ja v  a2s. c  o m*/
private int getRunRight(Layout unrestrictedLayout, Layout maxLinesLayout, int currentLine, int index, int line,
        boolean withinMax, boolean isMaxEllipsis, boolean isLastChar) {
    int runRight;
    if (line != currentLine || isLastChar) {
        if (isMaxEllipsis) {
            runRight = (int) maxLinesLayout.getPrimaryHorizontal(index);
        } else {
            runRight = (int) unrestrictedLayout.getLineMax(currentLine);
        }
    } else {
        if (withinMax) {
            runRight = (int) maxLinesLayout.getPrimaryHorizontal(index);
        } else {
            runRight = (int) unrestrictedLayout.getPrimaryHorizontal(index);
        }
    }
    return runRight;
}