public class NachoTextView
extends android.widget.MultiAutoCompleteTextView
implements android.text.TextWatcher, android.widget.AdapterView.OnItemClickListener
MultiAutoCompleteTextView that supports "chipifying" pieces of text and displaying suggestions for segments of the text.
ChipTokenizer by calling setChipTokenizer(ChipTokenizer).
By default the SpanChipTokenizer is used.
addChipTerminator(char, int) or setChipTerminators(Map).
For example if tapping enter should cause all unchipped text to become chipped, call
chipSuggestionTextView.addChipTerminator('\n', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_ALL);
To completely customize how chips are created when text is entered in this text view you can provide a custom ChipTerminatorHandler
through setChipTerminatorHandler(ChipTerminatorHandler)
setIllegalCharacterIdentifier(IllegalCharacterIdentifier)} to identify characters
that should be considered illegal.
Adapter by calling AutoCompleteTextView.setAdapter(ListAdapter)
ChipTokenizer.applyConfiguration(Editable, ChipConfiguration)
AutoCompleteTextView. To perform validation, set a NachoValidator:
nachoTextView.setNachoValidator(new ChipifyingNachoValidator());
Note: The NachoValidator will be ignored if a ChipTokenizer is not set. To perform validation without a ChipTokenizer you can use
AutoCompleteTextView's built-in Validator through AutoCompleteTextView.setValidator(Validator)
enableEditChipOnTouch(boolean, boolean). To disable this
behavior you can call disableEditChipOnTouch()
String[] suggestions = new String[]{"suggestion 1", "suggestion 2"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, suggestions);
nachoTextView.setAdapter(adapter);
nachoTextView.addChipTerminator('\n', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_ALL);
nachoTextView.addChipTerminator(' ', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_TO_TERMINATOR);
nachoTextView.setIllegalCharacters('@');
nachoTextView.setNachoValidator(new ChipifyingNachoValidator());
nachoTextView.enableEditChipOnTouch(true, true);
nachoTextView.setOnChipClickListener(new NachoTextView.OnChipClickListener() {
@Override
public void onChipClick(Chip chip, MotionEvent motionEvent) {
// Handle click event
}
});
nachoTextView.setOnChipRemoveListener(new NachoTextView.OnChipRemoveListener() {
@Override
public void onChipRemove(Chip chip) {
// Handle remove event
}
});
| Modifier and Type | Class and Description |
|---|---|
static interface |
NachoTextView.OnChipClickListener |
static interface |
NachoTextView.OnChipRemoveListener |
android.widget.MultiAutoCompleteTextView.CommaTokenizer, android.widget.MultiAutoCompleteTextView.Tokenizerandroid.widget.AutoCompleteTextView.OnDismissListener, android.widget.AutoCompleteTextView.Validatorandroid.widget.TextView.BufferType, android.widget.TextView.OnEditorActionListener, android.widget.TextView.SavedStateandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnCapturedPointerListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListenerAUTO_SIZE_TEXT_TYPE_NONE, AUTO_SIZE_TEXT_TYPE_UNIFORMACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
NachoTextView(android.content.Context context) |
NachoTextView(android.content.Context context,
android.util.AttributeSet attrs) |
NachoTextView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChipTerminator(char character,
int behavior) |
void |
afterTextChanged(android.text.Editable message) |
void |
beforeTextChanged(java.lang.CharSequence s,
int start,
int count,
int after) |
void |
chipify(int start,
int end)
Replaces the text from start (inclusive) to end (exclusive) with a chip
containing the same text
|
void |
chipifyAllUnterminatedTokens()
Chipifies all existing plain text in the field
|
void |
disableEditChipOnTouch()
Disables editing chips on touch events.
|
void |
enableEditChipOnTouch(boolean moveChipToEnd,
boolean chipifyUnterminatedTokens)
Enables editing chips on touch events.
|
java.util.List<Chip> |
getAllChips() |
java.util.List<java.lang.String> |
getChipAndTokenValues()
Returns a combination of the chip values and token values in the text.
|
android.content.res.ColorStateList |
getChipBackground() |
int |
getChipCornerRadius() |
int |
getChipHeight() |
int |
getChipHorizontalSpacing() |
int |
getChipTextColor() |
int |
getChipTextSize() |
ChipTokenizer |
getChipTokenizer() |
java.util.List<java.lang.String> |
getChipValues()
Returns a List of the string values of all the chips in the text (obtained through
Chip.getText()). |
int |
getChipVerticalSpacing() |
protected java.lang.Object |
getDataForSuggestion(android.widget.Adapter adapter,
int position)
Returns a object that will be associated with a chip that is about to be created for the item at
position in adapter because that
item was just tapped. |
java.util.List<java.lang.String> |
getTokenValues()
Returns a List of the string values of all the tokens (unchipped text) in the text
(obtained through
ChipTokenizer.findAllTokens(CharSequence)). |
void |
invalidateChips()
Applies any updated configuration parameters to any existing chips and all future chips in the text view.
|
boolean |
onChipClicked(Chip chip)
Implement this method to handle chip clicked events.
|
void |
onItemClick(android.widget.AdapterView<?> adapterView,
android.view.View view,
int position,
long id) |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
void |
onTextChanged(java.lang.CharSequence textChanged,
int start,
int before,
int count) |
boolean |
onTextContextMenuItem(int id) |
boolean |
onTouchEvent(android.view.MotionEvent event) |
void |
performValidation()
If a
Validator was set, this method will validate the entire text. |
protected void |
replaceText(java.lang.CharSequence text)
If there is a ChipTokenizer set, this method will do nothing.
|
void |
setChipBackground(android.content.res.ColorStateList chipBackground) |
void |
setChipBackgroundResource(int chipBackgroundResId) |
void |
setChipCornerRadius(int chipCornerRadius)
Sets the chip background corner radius.
|
void |
setChipCornerRadiusResource(int chipCornerRadiusResId)
Sets the chip background corner radius.
|
void |
setChipHeight(int chipHeightResId) |
void |
setChipHorizontalSpacing(int chipHorizontalSpacingResId) |
void |
setChipTerminatorHandler(ChipTerminatorHandler chipTerminatorHandler) |
void |
setChipTerminators(java.util.Map<java.lang.Character,java.lang.Integer> chipTerminators) |
void |
setChipTextColor(int chipTextColor) |
void |
setChipTextColorResource(int chipTextColorResId) |
void |
setChipTextSize(int chipTextSizeResId) |
void |
setChipTokenizer(ChipTokenizer chipTokenizer)
Sets the
ChipTokenizer to be used by this ChipSuggestionTextView. |
void |
setChipVerticalSpacing(int chipVerticalSpacingResId) |
void |
setEditingChip(Chip chip,
boolean moveChipToEnd)
Puts the provided Chip in editing mode (i.e.
|
void |
setIllegalCharacterIdentifier(IllegalCharacterIdentifier illegalCharacterIdentifier)
Sets the
IllegalCharacterIdentifier that will identify characters that should
not show up in the field when typed (i.e. |
void |
setNachoValidator(NachoValidator nachoValidator) |
void |
setOnChipClickListener(NachoTextView.OnChipClickListener onChipClickListener) |
void |
setOnChipRemoveListener(NachoTextView.OnChipRemoveListener onChipRemoveListener) |
void |
setPadding(int left,
int top,
int right,
int bottom)
Sets the padding on this View.
|
void |
setPasteBehavior(int pasteBehavior) |
void |
setText(java.util.List<java.lang.String> chipValues)
Sets the contents of this text view to contain the provided list of strings.
|
void |
setTextWithChips(java.util.List<ChipInfo> chips) |
java.lang.String |
toString() |
enoughToFilter, getAccessibilityClassName, performFiltering, performFiltering, setTokenizerclearListSelection, convertSelectionToString, dismissDropDown, getAdapter, getCompletionHint, getDropDownAnchor, getDropDownBackground, getDropDownHeight, getDropDownHorizontalOffset, getDropDownVerticalOffset, getDropDownWidth, getFilter, getItemClickListener, getItemSelectedListener, getListSelection, getOnItemClickListener, getOnItemSelectedListener, getThreshold, getValidator, isPerformingCompletion, isPopupShowing, onAttachedToWindow, onCommitCompletion, onDetachedFromWindow, onDisplayHint, onFilterComplete, onFocusChanged, onKeyDown, onKeyPreIme, onKeyUp, onWindowFocusChanged, performCompletion, setAdapter, setCompletionHint, setDropDownAnchor, setDropDownBackgroundDrawable, setDropDownBackgroundResource, setDropDownHeight, setDropDownHorizontalOffset, setDropDownVerticalOffset, setDropDownWidth, setFrame, setListSelection, setOnClickListener, setOnDismissListener, setOnItemClickListener, setOnItemSelectedListener, setText, setThreshold, setValidator, showDropDownextendSelection, getDefaultEditable, getDefaultMovementMethod, getFreezesText, getText, selectAll, setEllipsize, setSelection, setSelection, setTextaddExtraDataToAccessibilityNodeInfo, addTextChangedListener, append, append, autofill, beginBatchEdit, bringPointIntoView, cancelLongPress, clearComposingText, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollRange, debug, didTouchFocusSelect, drawableHotspotChanged, drawableStateChanged, endBatchEdit, extractText, findViewsWithText, getAutofillType, getAutofillValue, getAutoLinkMask, getAutoSizeMaxTextSize, getAutoSizeMinTextSize, getAutoSizeStepGranularity, getAutoSizeTextAvailableSizes, getAutoSizeTextType, getBaseline, getBottomPaddingOffset, getBreakStrategy, getCompoundDrawablePadding, getCompoundDrawables, getCompoundDrawablesRelative, getCompoundDrawableTintList, getCompoundDrawableTintMode, getCompoundPaddingBottom, getCompoundPaddingEnd, getCompoundPaddingLeft, getCompoundPaddingRight, getCompoundPaddingStart, getCompoundPaddingTop, getCurrentHintTextColor, getCurrentTextColor, getCustomInsertionActionModeCallback, getCustomSelectionActionModeCallback, getEditableText, getEllipsize, getError, getExtendedPaddingBottom, getExtendedPaddingTop, getFilters, getFocusedRect, getFontFeatureSettings, getFontVariationSettings, getGravity, getHighlightColor, getHint, getHintTextColors, getHyphenationFrequency, getImeActionId, getImeActionLabel, getImeHintLocales, getImeOptions, getIncludeFontPadding, getInputExtras, getInputType, getJustificationMode, getKeyListener, getLayout, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLetterSpacing, getLineBounds, getLineCount, getLineHeight, getLineSpacingExtra, getLineSpacingMultiplier, getLinksClickable, getLinkTextColors, getMarqueeRepeatLimit, getMaxEms, getMaxHeight, getMaxLines, getMaxWidth, getMinEms, getMinHeight, getMinLines, getMinWidth, getMovementMethod, getOffsetForPosition, getPaint, getPaintFlags, getPrivateImeOptions, getRightFadingEdgeStrength, getRightPaddingOffset, getSelectionEnd, getSelectionStart, getShadowColor, getShadowDx, getShadowDy, getShadowRadius, getShowSoftInputOnFocus, getTextClassifier, getTextColors, getTextLocale, getTextLocales, getTextScaleX, getTextSize, getTopPaddingOffset, getTotalPaddingBottom, getTotalPaddingEnd, getTotalPaddingLeft, getTotalPaddingRight, getTotalPaddingStart, getTotalPaddingTop, getTransformationMethod, getTypeface, getUrls, hasOverlappingRendering, hasSelection, invalidateDrawable, isCursorVisible, isInputMethodTarget, isPaddingOffsetRequired, isSuggestionsEnabled, isTextSelectable, jumpDrawablesToCurrentState, length, moveCursorToVisibleOffset, onBeginBatchEdit, onCheckIsTextEditor, onCommitCorrection, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDragEvent, onDraw, onEditorAction, onEndBatchEdit, onGenericMotionEvent, onKeyMultiple, onKeyShortcut, onPreDraw, onPrivateIMECommand, onProvideAutofillStructure, onProvideStructure, onResolvePointerIcon, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSelectionChanged, onTrackballEvent, onVisibilityChanged, performLongClick, removeTextChangedListener, setAllCaps, setAutoLinkMask, setAutoSizeTextTypeUniformWithConfiguration, setAutoSizeTextTypeUniformWithPresetSizes, setAutoSizeTextTypeWithDefaults, setBreakStrategy, setCompoundDrawablePadding, setCompoundDrawables, setCompoundDrawablesRelative, setCompoundDrawablesRelativeWithIntrinsicBounds, setCompoundDrawablesRelativeWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCompoundDrawableTintList, setCompoundDrawableTintMode, setCursorVisible, setCustomInsertionActionModeCallback, setCustomSelectionActionModeCallback, setEditableFactory, setElegantTextHeight, setEms, setEnabled, setError, setError, setExtractedText, setFilters, setFontFeatureSettings, setFontVariationSettings, setFreezesText, setGravity, setHeight, setHighlightColor, setHint, setHint, setHintTextColor, setHintTextColor, setHorizontallyScrolling, setHyphenationFrequency, setImeActionLabel, setImeHintLocales, setImeOptions, setIncludeFontPadding, setInputExtras, setInputType, setJustificationMode, setKeyListener, setLetterSpacing, setLines, setLineSpacing, setLinksClickable, setLinkTextColor, setLinkTextColor, setMarqueeRepeatLimit, setMaxEms, setMaxHeight, setMaxLines, setMaxWidth, setMinEms, setMinHeight, setMinLines, setMinWidth, setMovementMethod, setOnEditorActionListener, setPaddingRelative, setPaintFlags, setPrivateImeOptions, setRawInputType, setScroller, setSelectAllOnFocus, setSelected, setShadowLayer, setShowSoftInputOnFocus, setSingleLine, setSingleLine, setSpannableFactory, setText, setText, setText, setText, setTextAppearance, setTextAppearance, setTextClassifier, setTextColor, setTextColor, setTextIsSelectable, setTextKeepState, setTextKeepState, setTextLocale, setTextLocales, setTextScaleX, setTextSize, setTextSize, setTransformationMethod, setTypeface, setTypeface, setWidth, showContextMenu, showContextMenu, verifyDrawableaddChildrenForAccessibility, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeSystemWindowInsets, computeVerticalScrollOffset, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getAutofillHints, getAutofillId, getBackground, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, keyboardNavigationClusterSearch, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyLongPress, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillVirtualStructure, onProvideVirtualStructure, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onVisibilityAggregated, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAutofillHints, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDrawpublic NachoTextView(android.content.Context context)
public NachoTextView(android.content.Context context,
android.util.AttributeSet attrs)
public NachoTextView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.widget.TextViewprotected void onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
onLayout in class android.widget.TextViewpublic void setPadding(int left,
int top,
int right,
int bottom)
setPadding in class android.widget.TextViewleft - the left padding in pixelstop - the top padding in pixelsright - the right padding in pixelsbottom - the bottom padding in pixelspublic int getChipHorizontalSpacing()
public void setChipHorizontalSpacing(int chipHorizontalSpacingResId)
public android.content.res.ColorStateList getChipBackground()
public void setChipBackgroundResource(int chipBackgroundResId)
public void setChipBackground(android.content.res.ColorStateList chipBackground)
public int getChipCornerRadius()
public void setChipCornerRadiusResource(int chipCornerRadiusResId)
chipCornerRadiusResId - The dimension resource with the corner radius value.public void setChipCornerRadius(int chipCornerRadius)
chipCornerRadius - The corner radius value, in pixels.public int getChipTextColor()
public void setChipTextColorResource(int chipTextColorResId)
public void setChipTextColor(int chipTextColor)
public int getChipTextSize()
public void setChipTextSize(int chipTextSizeResId)
public int getChipHeight()
public void setChipHeight(int chipHeightResId)
public int getChipVerticalSpacing()
public void setChipVerticalSpacing(int chipVerticalSpacingResId)
public ChipTokenizer getChipTokenizer()
public void setChipTokenizer(ChipTokenizer chipTokenizer)
ChipTokenizer to be used by this ChipSuggestionTextView.
Note that a Tokenizer set here will override any Tokenizer set by MultiAutoCompleteTextView.setTokenizer(Tokenizer)chipTokenizer - the ChipTokenizer to setpublic void setOnChipClickListener(NachoTextView.OnChipClickListener onChipClickListener)
public void setOnChipRemoveListener(NachoTextView.OnChipRemoveListener onChipRemoveListener)
public void setChipTerminatorHandler(ChipTerminatorHandler chipTerminatorHandler)
public void setNachoValidator(NachoValidator nachoValidator)
public void setChipTerminators(java.util.Map<java.lang.Character,java.lang.Integer> chipTerminators)
public void addChipTerminator(char character,
int behavior)
public void setPasteBehavior(int pasteBehavior)
public void setIllegalCharacterIdentifier(IllegalCharacterIdentifier illegalCharacterIdentifier)
IllegalCharacterIdentifier that will identify characters that should
not show up in the field when typed (i.e. they will be deleted as soon as they are entered).
If a character is listed as both a chip terminator character and an illegal character,
it will be treated as an illegal character.illegalCharacterIdentifier - the identifier to usepublic void invalidateChips()
public void enableEditChipOnTouch(boolean moveChipToEnd,
boolean chipifyUnterminatedTokens)
disableEditChipOnTouch().
Note: If an NachoTextView.OnChipClickListener is set it's behavior will override the behavior described here if it's
NachoTextView.OnChipClickListener.onChipClick(Chip, MotionEvent) method returns true. If that method returns false, the touched chip will be put
in editing mode as expected.
moveChipToEnd - if true, the chip will also be moved to the end of the text when it is put in editing modechipifyUnterminatedTokens - if true, all unterminated tokens will be chipified before the touched chip is put in editing modedisableEditChipOnTouch()public void disableEditChipOnTouch()
enableEditChipOnTouch(boolean, boolean).enableEditChipOnTouch(boolean, boolean)public void setEditingChip(Chip chip, boolean moveChipToEnd)
chip - the chip to editmoveChipToEnd - if true, the chip will also be moved to the end of the textpublic boolean onTouchEvent(android.view.MotionEvent event)
onTouchEvent in class android.widget.TextViewpublic boolean onChipClicked(Chip chip)
chip - the chip that was clickedpublic boolean onTextContextMenuItem(int id)
onTextContextMenuItem in class android.widget.TextViewpublic void performValidation()
Validator was set, this method will validate the entire text.
(Overrides the superclass method which only validates the current token)performValidation in class android.widget.MultiAutoCompleteTextViewpublic void setText(java.util.List<java.lang.String> chipValues)
chipValues - the list of strings to chipify and set as the contents of the text view or null to clear the text viewpublic void setTextWithChips(java.util.List<ChipInfo> chips)
public void onItemClick(android.widget.AdapterView<?> adapterView,
android.view.View view,
int position,
long id)
onItemClick in interface android.widget.AdapterView.OnItemClickListenerprotected java.lang.Object getDataForSuggestion(android.widget.Adapter adapter,
int position)
position in adapter because that
item was just tapped.adapter - the adapter supplying the suggestionsposition - the position of the suggestion that was tappedprotected void replaceText(java.lang.CharSequence text)
If there is no ChipTokenizer set, we call through to the super method.
replaceText in class android.widget.MultiAutoCompleteTextViewtext - the text to be chipifiedpublic void beforeTextChanged(java.lang.CharSequence s,
int start,
int count,
int after)
beforeTextChanged in interface android.text.TextWatcherpublic void onTextChanged(java.lang.CharSequence textChanged,
int start,
int before,
int count)
onTextChanged in interface android.text.TextWatcheronTextChanged in class android.widget.TextViewpublic void afterTextChanged(android.text.Editable message)
afterTextChanged in interface android.text.TextWatcherpublic void chipifyAllUnterminatedTokens()
public void chipify(int start,
int end)
start - the index of the first character to replaceend - one more than the index of the last character to replacepublic java.util.List<Chip> getAllChips()
public java.util.List<java.lang.String> getChipValues()
Chip.getText()).
This does not include the text of any unterminated tokens.public java.util.List<java.lang.String> getTokenValues()
ChipTokenizer.findAllTokens(CharSequence)). This does not include any chipped text.public java.util.List<java.lang.String> getChipAndTokenValues()
getChipValues(),
getTokenValues()public java.lang.String toString()
toString in class android.view.View