android.text.Layout.Alignment Java Examples

The following examples show how to use android.text.Layout.Alignment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: MediaSDK   Author: JeffMony   File: WebvttCue.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
private static Alignment convertTextAlignment(@TextAlignment int textAlignment) {
  switch (textAlignment) {
    case TEXT_ALIGNMENT_START:
    case TEXT_ALIGNMENT_LEFT:
      return Alignment.ALIGN_NORMAL;
    case TEXT_ALIGNMENT_CENTER:
      return Alignment.ALIGN_CENTER;
    case TEXT_ALIGNMENT_END:
    case TEXT_ALIGNMENT_RIGHT:
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG, "Unknown textAlignment: " + textAlignment);
      return null;
  }
}
 
Example #2
Source Project: MediaSDK   Author: JeffMony   File: Cue.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 */
public Cue(
    CharSequence text,
    @Nullable Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size) {
  this(
      text,
      textAlignment,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      size,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #3
Source Project: TelePlus-Android   Author: TelePlusDev   File: WebvttCueParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_NORMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG, "Invalid alignment value: " + s);
      return null;
  }
}
 
Example #4
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size) {
  this(
      text,
      textAlignment,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      size,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #5
Source Project: TelePlus-Android   Author: TelePlusDev   File: WebvttCueParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_NORMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG, "Invalid alignment value: " + s);
      return null;
  }
}
 
Example #6
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size) {
  this(
      text,
      textAlignment,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      size,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #7
Source Project: litho   Author: facebook   File: TextSpec.java    License: Apache License 2.0 6 votes vote down vote up
private static TextAlignment getTextAlignment(
    @Nullable Alignment alignment, @Nullable TextAlignment textAlignment) {
  if (textAlignment != null) {
    return textAlignment;
  }
  if (alignment != null) {
    switch (alignment) {
      default:
      case ALIGN_NORMAL:
        return TEXT_START;
      case ALIGN_OPPOSITE:
        return TEXT_END;
      case ALIGN_CENTER:
        return CENTER;
    }
  }
  return TEXT_START;
}
 
Example #8
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: Cue.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size) {
  this(
      text,
      textAlignment,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      size,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #9
Source Project: Telegram   Author: DrKLO   File: WebvttCueParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_NORMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG, "Invalid alignment value: " + s);
      return null;
  }
}
 
Example #10
Source Project: no-player   Author: novoda   File: NoPlayerCue.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"checkstyle:ParameterNumber", "PMD.ExcessiveParameterList"})     // TODO group parameters into classes
public NoPlayerCue(CharSequence text,
                   Alignment textAlignment,
                   Bitmap bitmap,
                   float line,
                   int lineType,
                   int lineAnchor,
                   float position,
                   int positionAnchor,
                   float size,
                   float bitmapHeight,
                   boolean windowColorSet,
                   int windowColor) {
    this.text = text;
    this.textAlignment = textAlignment;
    this.bitmap = bitmap;
    this.line = line;
    this.lineType = lineType;
    this.lineAnchor = lineAnchor;
    this.position = position;
    this.positionAnchor = positionAnchor;
    this.size = size;
    this.bitmapHeight = bitmapHeight;
    this.windowColorSet = windowColorSet;
    this.windowColor = windowColor;
}
 
Example #11
Source Project: no-player   Author: novoda   File: WebvttCueParser.java    License: Apache License 2.0 6 votes vote down vote up
private static Alignment parseTextAlignment(String s) {
    switch (s) {
        case "start":
        case "left":
            return Alignment.ALIGN_NORMAL;
        case "center":
        case "middle":
            return Alignment.ALIGN_CENTER;
        case "end":
        case "right":
            return Alignment.ALIGN_OPPOSITE;
        default:
            Log.w(TAG, "Invalid alignment value: " + s);
            return null;
    }
}
 
Example #12
Source Project: memoir   Author: ronak-manglani   File: AlignmentEffect.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void applyToSelection(RTEditText editor, Selection selectedParagraphs, Layout.Alignment alignment) {
    final Spannable str = editor.getText();

    mSpans2Process.clear();

    for (Paragraph paragraph : editor.getParagraphs()) {
        // find existing AlignmentSpan and add them to mSpans2Process to be removed
        List<RTSpan<Layout.Alignment>> existingSpans = getSpans(str, paragraph, SpanCollectMode.SPAN_FLAGS);
        mSpans2Process.removeSpans(existingSpans, paragraph);

        // if the paragraph is selected then we sure have an alignment
        boolean hasExistingSpans = !existingSpans.isEmpty();
        Alignment newAlignment = paragraph.isSelected(selectedParagraphs) ? alignment :
                                 hasExistingSpans ? existingSpans.get(0).getValue() : null;

        if (newAlignment != null) {
            boolean isRTL = Helper.isRTL(str, paragraph.start(), paragraph.end());
            AlignmentSpan alignmentSpan = new AlignmentSpan(newAlignment, isRTL);
            mSpans2Process.addSpan(alignmentSpan, paragraph);
        }
    }

    // add or remove spans
    mSpans2Process.process(str);
}
 
Example #13
Source Project: memoir   Author: ronak-manglani   File: AlignmentEffect.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void applyToSelection(RTEditText editor, Selection selectedParagraphs, Layout.Alignment alignment) {
    final Spannable str = editor.getText();

    mSpans2Process.clear();

    for (Paragraph paragraph : editor.getParagraphs()) {
        // find existing AlignmentSpan and add them to mSpans2Process to be removed
        List<RTSpan<Layout.Alignment>> existingSpans = getSpans(str, paragraph, SpanCollectMode.SPAN_FLAGS);
        mSpans2Process.removeSpans(existingSpans, paragraph);

        // if the paragraph is selected then we sure have an alignment
        boolean hasExistingSpans = !existingSpans.isEmpty();
        Alignment newAlignment = paragraph.isSelected(selectedParagraphs) ? alignment :
                                 hasExistingSpans ? existingSpans.get(0).getValue() : null;

        if (newAlignment != null) {
            boolean isRTL = Helper.isRTL(str, paragraph.start(), paragraph.end());
            AlignmentSpan alignmentSpan = new AlignmentSpan(newAlignment, isRTL);
            mSpans2Process.addSpan(alignmentSpan, paragraph);
        }
    }

    // add or remove spans
    mSpans2Process.process(str);
}
 
Example #14
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: WebvttCueParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_NORMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG, "Invalid alignment value: " + s);
      return null;
  }
}
 
Example #15
Source Project: MediaSDK   Author: JeffMony   File: WebvttCue.java    License: Apache License 2.0 5 votes vote down vote up
private WebvttCue(
    long startTime,
    long endTime,
    CharSequence text,
    @Nullable Alignment textAlignment,
    float line,
    @Cue.LineType int lineType,
    @Cue.AnchorType int lineAnchor,
    float position,
    @Cue.AnchorType int positionAnchor,
    float width) {
  super(text, textAlignment, line, lineType, lineAnchor, position, positionAnchor, width);
  this.startTime = startTime;
  this.endTime = endTime;
}
 
Example #16
Source Project: MediaSDK   Author: JeffMony   File: Cue.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param textSizeType See {@link #textSizeType}.
 * @param textSize See {@link #textSize}.
 */
public Cue(
    CharSequence text,
    @Nullable Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    @TextSizeType int textSizeType,
    float textSize) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      textSizeType,
      textSize,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #17
Source Project: TelePlus-Android   Author: TelePlusDev   File: WebvttCue.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WebvttCue(long startTime, long endTime, CharSequence text, Alignment textAlignment,
    float line, @Cue.LineType int lineType, @Cue.AnchorType int lineAnchor, float position,
    @Cue.AnchorType int positionAnchor, float width) {
  super(text, textAlignment, line, lineType, lineAnchor, position, positionAnchor, width);
  this.startTime = startTime;
  this.endTime = endTime;
}
 
Example #18
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param textSizeType See {@link #textSizeType}.
 * @param textSize See {@link #textSize}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    @TextSizeType int textSizeType,
    float textSize) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      textSizeType,
      textSize,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #19
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param windowColorSet See {@link #windowColorSet}.
 * @param windowColor See {@link #windowColor}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    boolean windowColorSet,
    int windowColor) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      /* textSizeType= */ TYPE_UNSET,
      /* textSize= */ DIMEN_UNSET,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      windowColorSet,
      windowColor);
}
 
Example #20
Source Project: Telegram   Author: DrKLO   File: WebvttCue.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WebvttCue(long startTime, long endTime, CharSequence text, Alignment textAlignment,
    float line, @Cue.LineType int lineType, @Cue.AnchorType int lineAnchor, float position,
    @Cue.AnchorType int positionAnchor, float width) {
  super(text, textAlignment, line, lineType, lineAnchor, position, positionAnchor, width);
  this.startTime = startTime;
  this.endTime = endTime;
}
 
Example #21
Source Project: TelePlus-Android   Author: TelePlusDev   File: WebvttCue.java    License: GNU General Public License v2.0 5 votes vote down vote up
public WebvttCue(long startTime, long endTime, CharSequence text, Alignment textAlignment,
    float line, @Cue.LineType int lineType, @Cue.AnchorType int lineAnchor, float position,
    @Cue.AnchorType int positionAnchor, float width) {
  super(text, textAlignment, line, lineType, lineAnchor, position, positionAnchor, width);
  this.startTime = startTime;
  this.endTime = endTime;
}
 
Example #22
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param textSizeType See {@link #textSizeType}.
 * @param textSize See {@link #textSize}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    @TextSizeType int textSizeType,
    float textSize) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      textSizeType,
      textSize,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      /* windowColorSet= */ false,
      /* windowColor= */ Color.BLACK);
}
 
Example #23
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param windowColorSet See {@link #windowColorSet}.
 * @param windowColor See {@link #windowColor}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    boolean windowColorSet,
    int windowColor) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      /* textSizeType= */ TYPE_UNSET,
      /* textSize= */ DIMEN_UNSET,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      windowColorSet,
      windowColor);
}
 
Example #24
Source Project: TelePlus-Android   Author: TelePlusDev   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Cue(
    CharSequence text,
    Alignment textAlignment,
    Bitmap bitmap,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    @TextSizeType int textSizeType,
    float textSize,
    float size,
    float bitmapHeight,
    boolean windowColorSet,
    int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.bitmapHeight = bitmapHeight;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
  this.textSizeType = textSizeType;
  this.textSize = textSize;
}
 
Example #25
Source Project: mvvm-template   Author: duyp   File: TableHandler.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override public void draw(@NonNull Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(textColor);
    paint.setStyle(Style.STROKE);

    int numberOfColumns = tableRow.size();

    if (numberOfColumns == 0) {
        return;
    }

    int columnWidth = tableWidth / numberOfColumns;

    int offset;

    for (int i = 0; i < numberOfColumns; i++) {

        offset = i * columnWidth;

        if (paintBorder) {
            // The rect is open at the bottom, so there's a single line
            // between rows.
            canvas.drawRect(offset, 0, offset + columnWidth, rowHeight, paint);
        }

        StaticLayout layout = new StaticLayout(tableRow.get(i),
                getTextPaint(), (columnWidth - 2 * PADDING),
                Alignment.ALIGN_NORMAL, 1.5f, 0.5f, true);

        canvas.translate(offset + PADDING, 0);
        layout.draw(canvas);
        canvas.translate(-1 * (offset + PADDING), 0);

    }
}
 
Example #26
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Cue(
    CharSequence text,
    Alignment textAlignment,
    Bitmap bitmap,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    @TextSizeType int textSizeType,
    float textSize,
    float size,
    float bitmapHeight,
    boolean windowColorSet,
    int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.bitmapHeight = bitmapHeight;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
  this.textSizeType = textSizeType;
  this.textSize = textSize;
}
 
Example #27
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: Cue.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a text cue.
 *
 * @param text See {@link #text}.
 * @param textAlignment See {@link #textAlignment}.
 * @param line See {@link #line}.
 * @param lineType See {@link #lineType}.
 * @param lineAnchor See {@link #lineAnchor}.
 * @param position See {@link #position}.
 * @param positionAnchor See {@link #positionAnchor}.
 * @param size See {@link #size}.
 * @param windowColorSet See {@link #windowColorSet}.
 * @param windowColor See {@link #windowColor}.
 */
public Cue(
    CharSequence text,
    Alignment textAlignment,
    float line,
    @LineType int lineType,
    @AnchorType int lineAnchor,
    float position,
    @AnchorType int positionAnchor,
    float size,
    boolean windowColorSet,
    int windowColor) {
  this(
      text,
      textAlignment,
      /* bitmap= */ null,
      line,
      lineType,
      lineAnchor,
      position,
      positionAnchor,
      /* textSizeType= */ TYPE_UNSET,
      /* textSize= */ DIMEN_UNSET,
      size,
      /* bitmapHeight= */ DIMEN_UNSET,
      windowColorSet,
      windowColor);
}
 
Example #28
Source Project: K-Sonic   Author: jcodeing   File: WebvttCue.java    License: MIT License 5 votes vote down vote up
public WebvttCue(long startTime, long endTime, CharSequence text, Alignment textAlignment,
    float line, @Cue.LineType int lineType, @Cue.AnchorType int lineAnchor, float position,
    @Cue.AnchorType int positionAnchor, float width) {
  super(text, textAlignment, line, lineType, lineAnchor, position, positionAnchor, width);
  this.startTime = startTime;
  this.endTime = endTime;
}
 
Example #29
Source Project: juicessh-performancemonitor   Author: Sonelli   File: AutoResizeTextView.java    License: Apache License 2.0 5 votes vote down vote up
private int getTextHeight(CharSequence source, TextPaint paint, int width, float textSize) {
    // Update the text paint object
    paint.setTextSize(textSize);
    // Measure using a static layout
    StaticLayout layout = new StaticLayout(source, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, true);
    return layout.getHeight();
}
 
Example #30
Source Project: K-Sonic   Author: jcodeing   File: Cue.java    License: MIT License 5 votes vote down vote up
private Cue(CharSequence text, Alignment textAlignment, Bitmap bitmap, float line,
    @LineType int lineType, @AnchorType int lineAnchor, float position,
    @AnchorType int positionAnchor, float size, boolean windowColorSet, int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
}