public class DefaultChipTerminatorHandler extends java.lang.Object implements ChipTerminatorHandler
BEHAVIOR_CHIPIFY_ALL, BEHAVIOR_CHIPIFY_CURRENT_TOKEN, BEHAVIOR_CHIPIFY_TO_TERMINATOR, PASTE_BEHAVIOR_USE_DEFAULT| Constructor and Description |
|---|
DefaultChipTerminatorHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChipTerminator(char character,
int behavior)
Adds a character as a chip terminator.
|
int |
findAndHandleChipTerminators(ChipTokenizer tokenizer,
android.text.Editable text,
int start,
int end,
boolean isPasteEvent)
Parses the provided text looking for characters marked as chip terminators through
ChipTerminatorHandler.addChipTerminator(char, int) and ChipTerminatorHandler.setChipTerminators(Map). |
void |
setChipTerminators(java.util.Map<java.lang.Character,java.lang.Integer> chipTerminators)
Sets all the characters that will be marked as chip terminators.
|
void |
setPasteBehavior(int pasteBehavior)
Customizes the way paste events are handled.
|
public void setChipTerminators(java.util.Map<java.lang.Character,java.lang.Integer> chipTerminators)
ChipTerminatorHandlersetChipTerminators in interface ChipTerminatorHandlerchipTerminators - a map of characters to be marked as chip terminators to behaviors that describe how to respond to the characters, or null
to remove all chip terminatorspublic void addChipTerminator(char character,
int behavior)
ChipTerminatorHandlerbehavior Must be one of:
addChipTerminator in interface ChipTerminatorHandlercharacter - the character to mark as a chip terminatorbehavior - the behavior describing how to respond to the chip terminatorpublic void setPasteBehavior(int pasteBehavior)
ChipTerminatorHandlerChipTerminatorHandler.BEHAVIOR_CHIPIFY_ALLChipTerminatorHandler.BEHAVIOR_CHIPIFY_CURRENT_TOKENChipTerminatorHandler.BEHAVIOR_CHIPIFY_TO_TERMINATORChipTerminatorHandler.PASTE_BEHAVIOR_USE_DEFAULT is passed, whatever behavior is configured for a particular chip terminator
(through ChipTerminatorHandler.setChipTerminators(Map) or ChipTerminatorHandler.addChipTerminator(char, int) will be used for that chip terminatorsetPasteBehavior in interface ChipTerminatorHandlerpasteBehavior - the behavior to use on a paste eventpublic int findAndHandleChipTerminators(ChipTokenizer tokenizer, android.text.Editable text, int start, int end, boolean isPasteEvent)
ChipTerminatorHandlerChipTerminatorHandler.addChipTerminator(char, int) and ChipTerminatorHandler.setChipTerminators(Map).
The provided Editable will be modified if chip terminators are encountered.findAndHandleChipTerminators in interface ChipTerminatorHandlertokenizer - the ChipTokenizer to use to identify and chipify tokens in the texttext - the text in which to search for chip terminators tokens to be chippedstart - the index at which to begin looking for chip terminators (inclusive)end - the index at which to end looking for chip terminators (exclusive)isPasteEvent - true if this handling is for a paste event in which case the behavior set in ChipTerminatorHandler.setPasteBehavior(int) will be used,
otherwise false