Package icyllis.modernui.text.style
Class LineBackgroundSpan.Standard
java.lang.Object
icyllis.modernui.text.style.LineBackgroundSpan.Standard
- All Implemented Interfaces:
ParcelableSpan
,LineBackgroundSpan
,ParagraphStyle
,Parcelable
- Enclosing interface:
LineBackgroundSpan
public static class LineBackgroundSpan.Standard
extends Object
implements LineBackgroundSpan, ParcelableSpan
Default implementation of the
LineBackgroundSpan
, which changes the background
color of the lines to which the span is attached.-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.text.style.LineBackgroundSpan
LineBackgroundSpan.Standard
Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags
-
Constructor Summary
ConstructorDescriptionStandard
(int color) Constructor taking a color integer.Creates aLineBackgroundSpan.Standard
from a parcel -
Method Summary
Modifier and TypeMethodDescriptionvoid
drawBackground
(Canvas canvas, Paint paint, int left, int right, int top, int baseline, int bottom, CharSequence text, int start, int end, int lineNumber) Draw the background on the canvas.final int
getColor()
int
Return a special type identifier for this span class.void
writeToParcel
(Parcel dest, int flags) The subclass implements the method to flatten its contents by calling the methods ofParcel
for its primitive values.
-
Constructor Details
-
Standard
Constructor taking a color integer.- Parameters:
color
- Color integer that defines the background color.
-
Standard
Creates aLineBackgroundSpan.Standard
from a parcel
-
-
Method Details
-
getSpanTypeId
public int getSpanTypeId()Description copied from interface:ParcelableSpan
Return a special type identifier for this span class.- Specified by:
getSpanTypeId
in interfaceParcelableSpan
-
writeToParcel
Description copied from interface:Parcelable
The subclass implements the method to flatten its contents by calling the methods ofParcel
for its primitive values.- Specified by:
writeToParcel
in interfaceParcelable
- Parameters:
dest
- the parcel to write the object's data toflags
- the flags about how the object should be written
-
getColor
- Returns:
- the color of this span.
- See Also:
-
drawBackground
public void drawBackground(@NonNull Canvas canvas, @NonNull Paint paint, int left, int right, int top, int baseline, int bottom, @NonNull CharSequence text, int start, int end, int lineNumber) Description copied from interface:LineBackgroundSpan
Draw the background on the canvas.- Specified by:
drawBackground
in interfaceLineBackgroundSpan
- Parameters:
canvas
- canvas on which the span should be renderedpaint
- paint used to draw text, which should be left unchanged on exitleft
- left position of the line relative to input canvas, in pixelsright
- right position of the line relative to input canvas, in pixelstop
- top position of the line relative to input canvas, in pixelsbaseline
- baseline of the text relative to input canvas, in pixelsbottom
- bottom position of the line relative to input canvas, in pixelstext
- current textstart
- start character index of the lineend
- end character index of the linelineNumber
- line number in the current text layout
-