public interface ChipTerminatorHandler
ChipTokenizer| Modifier and Type | Field and Description |
|---|---|
static int |
BEHAVIOR_CHIPIFY_ALL
When a chip terminator character is encountered in newly inserted text, all tokens in the whole text view will be chipified
|
static int |
BEHAVIOR_CHIPIFY_CURRENT_TOKEN
When a chip terminator character is encountered in newly inserted text, only the current token (that in which the chip terminator character
was found) will be chipified.
|
static int |
BEHAVIOR_CHIPIFY_TO_TERMINATOR
When a chip terminator character is encountered in newly inserted text, only the text from the previous chip up until the chip terminator
character will be chipified.
|
static int |
PASTE_BEHAVIOR_USE_DEFAULT
Constant for use with
setPasteBehavior(int). |
| 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
addChipTerminator(char, int) and 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.
|
static final int BEHAVIOR_CHIPIFY_ALL
static final int BEHAVIOR_CHIPIFY_CURRENT_TOKEN
static final int BEHAVIOR_CHIPIFY_TO_TERMINATOR
static final int PASTE_BEHAVIOR_USE_DEFAULT
setPasteBehavior(int). Use this if a paste should behave the same as a standard text input (the chip temrinators
will all behave according to their pre-determined behavior set through addChipTerminator(char, int) or setChipTerminators(Map)).void setChipTerminators(java.util.Map<java.lang.Character,java.lang.Integer> chipTerminators)
chipTerminators - 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 terminatorsvoid addChipTerminator(char character,
int behavior)
behavior Must be one of:
character - the character to mark as a chip terminatorbehavior - the behavior describing how to respond to the chip terminatorvoid setPasteBehavior(int pasteBehavior)
PASTE_BEHAVIOR_USE_DEFAULT is passed, whatever behavior is configured for a particular chip terminator
(through setChipTerminators(Map) or addChipTerminator(char, int) will be used for that chip terminatorpasteBehavior - the behavior to use on a paste eventint findAndHandleChipTerminators(ChipTokenizer tokenizer, android.text.Editable text, int start, int end, boolean isPasteEvent)
addChipTerminator(char, int) and setChipTerminators(Map).
The provided Editable will be modified if chip terminators are encountered.tokenizer - 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 setPasteBehavior(int) will be used,
otherwise false