Package icyllis.modernui.text
Interface Editable
- All Superinterfaces:
Appendable
,CharSequence
,GetChars
,Spannable
,Spanned
- All Known Implementing Classes:
SpannableStringBuilder
This is the interface for text whose content and markup can be changed (as opposed
to immutable text like Strings). If you make a
DynamicLayout
of an Editable,
the layout will be re-flowed as the text is changed.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Factory used by TextView to create newEditables
. -
Field Summary
Fields inherited from interface icyllis.modernui.text.Spanned
SPAN_COMPOSING, SPAN_EXCLUSIVE_EXCLUSIVE, SPAN_EXCLUSIVE_INCLUSIVE, SPAN_INCLUSIVE_EXCLUSIVE, SPAN_INCLUSIVE_INCLUSIVE, SPAN_INTERMEDIATE, SPAN_MARK_MARK, SPAN_MARK_POINT, SPAN_PARAGRAPH, SPAN_POINT_MARK, SPAN_POINT_MARK_MASK, SPAN_POINT_POINT, SPAN_PRIORITY, SPAN_PRIORITY_SHIFT, SPAN_USER, SPAN_USER_SHIFT
-
Method Summary
Modifier and TypeMethodDescriptionappend
(char text) Convenience for append(String.valueOf(text)).append
(CharSequence text) Convenience for replace(length(), length(), text, 0, text.length())append
(CharSequence text, int start, int end) Convenience for replace(length(), length(), text, start, end)void
clear()
Convenience for replace(0, length(), "", 0, 0).void
Removes all spans from the Editable, as if by callingSpannable.removeSpan(java.lang.Object)
on each of them.delete
(int st, int en) Convenience for replace(st, en, "", 0, 0)Returns the array of input filters that are currently applied to changes to this Editable.insert
(int where, CharSequence text) Convenience for replace(where, where, text, 0, text.length());insert
(int where, CharSequence text, int start, int end) Convenience for replace(where, where, text, start, end)replace
(int st, int en, CharSequence text) Convenience for replace(st, en, text, 0, text.length())replace
(int st, int en, CharSequence source, int start, int end) Replaces the specified range (st…en
) of text in this Editable with a copy of the slicestart…end
fromsource
.void
setFilters
(InputFilter[] filters) Sets the series of filters that will be called in succession whenever the text of this Editable is changed, each of which has the opportunity to limit or transform the text that is being inserted.Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, subSequence, toString
Methods inherited from interface icyllis.modernui.text.Spannable
removeSpan, removeSpan, setSpan
Methods inherited from interface icyllis.modernui.text.Spanned
getSpanEnd, getSpanFlags, getSpans, getSpans, getSpanStart, nextSpanTransition
-
Field Details
-
DEFAULT_FACTORY
The standard Editable Factory.
-
-
Method Details
-
replace
Replaces the specified range (st…en
) of text in this Editable with a copy of the slicestart…end
fromsource
. The destination slice may be empty, in which case the operation is an insertion, or the source slice may be empty, in which case the operation is a deletion.Before the change is committed, each filter that was set with
setFilters(icyllis.modernui.text.InputFilter[])
is given the opportunity to modify thesource
text.If
source
is Spanned, the spans from it are preserved into the Editable. Existing spans within the Editable that entirely cover the replaced range are retained, but any that were strictly within the range that was replaced are removed. If thesource
contains a span withSpanned.SPAN_PARAGRAPH
flag, and it does not satisfy the paragraph boundary constraint, it is not retained. As a special case, the cursor position is preserved even when the entire range where it is located is replaced.- Returns:
- a reference to this object.
- See Also:
-
replace
Convenience for replace(st, en, text, 0, text.length())- See Also:
-
insert
Convenience for replace(where, where, text, start, end)- See Also:
-
insert
Convenience for replace(where, where, text, 0, text.length());- See Also:
-
delete
Convenience for replace(st, en, "", 0, 0)- See Also:
-
append
Convenience for replace(length(), length(), text, 0, text.length())- Specified by:
append
in interfaceAppendable
- See Also:
-
append
Convenience for replace(length(), length(), text, start, end)- Specified by:
append
in interfaceAppendable
- See Also:
-
append
Convenience for append(String.valueOf(text)).- Specified by:
append
in interfaceAppendable
- See Also:
-
clear
void clear()Convenience for replace(0, length(), "", 0, 0). Note that this clears the text, not the spans; useclearSpans()
if you need that.- See Also:
-
clearSpans
void clearSpans()Removes all spans from the Editable, as if by callingSpannable.removeSpan(java.lang.Object)
on each of them. -
setFilters
Sets the series of filters that will be called in succession whenever the text of this Editable is changed, each of which has the opportunity to limit or transform the text that is being inserted. -
getFilters
Returns the array of input filters that are currently applied to changes to this Editable.
-