-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewTreeObserver.OnPreDrawListener,android.view.accessibility.AccessibilityEventSource,android.widget.Filter.FilterListener,androidx.appcompat.widget.EmojiCompatConfigurationView,androidx.core.view.TintableBackgroundView,com.amrdeveloper.codeview.Findable,com.amrdeveloper.codeview.Replaceable
public class CodeView extends AppCompatMultiAutoCompleteTextView implements Findable, Replaceable
CodeView is a CustomView to provide a lot of features that you need to highlights and creating an editor for your custom programming language or data format
-
-
Field Summary
Fields Modifier and Type Field Description private inttabWidthprivate inttabLengthprivate booleanhighlightWhileTextChangingprivate booleanenableLineNumberprivate booleanenableRelativeLineNumberprivate booleanenableHighlightCurrentLineprivate booleanenableAutoIndentationprivate final Set<Character>indentationStartsprivate final Set<Character>indentationEndsprivate intautoCompleteItemHeightInDp
-
Constructor Summary
Constructors Constructor Description CodeView(Context context)CodeView(Context context, AttributeSet attrs)CodeView(Context context, AttributeSet attrs, int defStyleAttr)
-
Method Summary
Modifier and Type Method Description voidsetTabWidth(int characters)Modify the current tab with voidsetTabLength(int length)Modify the tab length to use it in auto indenting feature voidsetHighlightWhileTextChanging(boolean updateWhileTextChanging)Enable or disable highlighting while text is changing voidsetEnableLineNumber(boolean enableLineNumber)Enable or disable the line number feature voidsetEnableRelativeLineNumber(boolean enableRelativeLineNumber)Enable or disable the relative line number feature voidsetEnableHighlightCurrentLine(boolean enableHighlightCurrentLine)Enable or disable the highlighting current line feature voidsetEnableAutoIndentation(boolean enableAutoIndentation)Enable or disable auto indenting feature voidsetIndentationStarts(Set<Character> characters)Set the indenting starts set of characters voidsetIndentationEnds(Set<Character> characters)Set the indenting ends set of characters voidsetAutoCompleteItemHeightInDp(int height)Modify the auto complete item height List<Token>findMatches(String regex)Find all the the tokens that matches the regex string and save them on a list TokenfindNextMatch()Highlight and return the next token TokenfindPrevMatch()Highlight and return the previous token voidclearMatches()Clear all the matches tokens voidreplaceFirstMatch(String regex, String replacement)Replace the first string that matched by the regex with new string voidreplaceAllMatches(String regex, String replacement)Replace all strings that matched by the regex with new string voidsetTextHighlighted(CharSequence text)Replace the current text with new highlighted text voidcancelHighlighterRender()Stop the highlighter task voidsetSyntaxPatternsMap(Map<Pattern, Integer> syntaxPatterns)Setup the syntax of your data as a map of patterns with their colors voidaddSyntaxPattern(Pattern pattern, @ColorInt() int Color)Add Single syntax as a Pattern with one Color voidremoveSyntaxPattern(Pattern pattern)Remove one pattern from the Syntax patterns intgetSyntaxPatternsSize()voidresetSyntaxPatternList()Remove all syntax patterns voidresetHighlighter()Un highlight all keywords by removing all spans voidaddErrorLine(int lineNum, int color)Add New Error to the current set of errors to highlight it voidremoveErrorLine(int lineNum)Remove one error by the line number from the error set voidremoveAllErrorLines()Remove all the errors from the errors set and change hasErrors to false intgetErrorsSize()StringgetTextWithoutTrailingSpace()voidsetAutoCompleteTokenizer(MultiAutoCompleteTextView.Tokenizer tokenizer)Replace the current Auto Complete default tokenizer by custom one voidsetRemoveErrorsWhenTextChanged(boolean removeErrors)Enable or disable remove all the current errors when text is changed voidreHighlightSyntax()Re Highlight the syntax patterns voidreHighlightErrors()Re Highlight the current errors booleanisHasError()voidsetUpdateDelayTime(int time)Modify the highlighting delay time intgetUpdateDelayTime()booleanisLineNumberEnabled()booleanisLineRelativeNumberEnabled()booleanisHighlightCurrentLineEnabled()voidsetHighlightCurrentLineColor(int color)Modify the highlight current line color voidsetLineNumberTextColor(int color)Modify the line number text color voidsetLineNumberTextSize(float size)Modify the line number text size voidsetMatchingHighlightColor(int color)Modify the matches tokens highlighting color voidsetLineNumberTypeface(Typeface typeface)Modify the typeface of line number voidsetMaxSuggestionsSize(int maxSuggestions)Modify the maximum number of suggestions to show, default is Integer. voidenablePairComplete(boolean enable)Enable or disable the auto pairs complete feature voidenablePairCompleteCenterCursor(boolean enable)Enable or disable moving the cursor to the center after insert pair complete voidsetPairCompleteMap(Map<Character, Character> map)Set the pairs for auto pairs complete feature voidaddPairCompleteItem(char key, char value)Add new pair complete item using key and value voidremovePairCompleteItem(char key)Remove single pair complete item by key voidclearPairCompleteMap()Clear all of pairs voidshowDropDown()-
Methods inherited from class androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
getSupportBackgroundTintList, getSupportBackgroundTintMode, isEmojiCompatEnabled, onCreateInputConnection, setBackgroundDrawable, setBackgroundResource, setDropDownBackgroundResource, setEmojiCompatEnabled, setKeyListener, setSupportBackgroundTintList, setSupportBackgroundTintMode, setTextAppearance -
Methods inherited from class android.widget.MultiAutoCompleteTextView
enoughToFilter, getAccessibilityClassName, performValidation, setTokenizer -
Methods inherited from class android.widget.AutoCompleteTextView
clearListSelection, dismissDropDown, getAdapter, getCompletionHint, getDropDownAnchor, getDropDownBackground, getDropDownHeight, getDropDownHorizontalOffset, getDropDownVerticalOffset, getDropDownWidth, getInputMethodMode, getItemClickListener, getItemSelectedListener, getListSelection, getOnItemClickListener, getOnItemSelectedListener, getThreshold, getValidator, isPerformingCompletion, isPopupShowing, onCommitCompletion, onFilterComplete, onKeyDown, onKeyPreIme, onKeyUp, onWindowFocusChanged, performCompletion, refreshAutoCompleteResults, setAdapter, setCompletionHint, setDropDownAnchor, setDropDownBackgroundDrawable, setDropDownHeight, setDropDownHorizontalOffset, setDropDownVerticalOffset, setDropDownWidth, setInputMethodMode, setListSelection, setOnClickListener, setOnDismissListener, setOnItemClickListener, setOnItemSelectedListener, setText, setThreshold, setValidator, showDropDown -
Methods inherited from class android.widget.EditText
extendSelection, getFreezesText, getText, selectAll, setEllipsize, setSelection -
Methods inherited from class android.widget.TextView
addExtraDataToAccessibilityNodeInfo, addTextChangedListener, append, autofill, beginBatchEdit, bringPointIntoView, cancelLongPress, clearComposingText, computeScroll, debug, didTouchFocusSelect, drawableHotspotChanged, endBatchEdit, extractText, findViewsWithText, getAutoLinkMask, getAutoSizeMaxTextSize, getAutoSizeMinTextSize, getAutoSizeStepGranularity, getAutoSizeTextAvailableSizes, getAutoSizeTextType, getAutofillHints, getAutofillType, getAutofillValue, getBaseline, getBreakStrategy, getCompoundDrawablePadding, getCompoundDrawableTintBlendMode, getCompoundDrawableTintList, getCompoundDrawableTintMode, getCompoundDrawables, getCompoundDrawablesRelative, getCompoundPaddingBottom, getCompoundPaddingEnd, getCompoundPaddingLeft, getCompoundPaddingRight, getCompoundPaddingStart, getCompoundPaddingTop, getCurrentHintTextColor, getCurrentTextColor, getCustomInsertionActionModeCallback, getCustomSelectionActionModeCallback, getEditableText, getEllipsize, getError, getExtendedPaddingBottom, getExtendedPaddingTop, getFilters, getFirstBaselineToTopHeight, getFocusedRect, getFontFeatureSettings, getFontVariationSettings, getGravity, getHighlightColor, getHint, getHintTextColors, getHyphenationFrequency, getImeActionId, getImeActionLabel, getImeHintLocales, getImeOptions, getIncludeFontPadding, getInputExtras, getInputType, getJustificationMode, getKeyListener, getLastBaselineToBottomHeight, getLayout, getLetterSpacing, getLineBounds, getLineBreakStyle, getLineBreakWordStyle, getLineCount, getLineHeight, getLineSpacingExtra, getLineSpacingMultiplier, getLinkTextColors, getLinksClickable, getMarqueeRepeatLimit, getMaxEms, getMaxHeight, getMaxLines, getMaxWidth, getMinEms, getMinHeight, getMinLines, getMinWidth, getMovementMethod, getOffsetForPosition, getPaint, getPaintFlags, getPrivateImeOptions, getSelectionEnd, getSelectionStart, getShadowColor, getShadowDx, getShadowDy, getShadowRadius, getShowSoftInputOnFocus, getText, getTextClassifier, getTextColors, getTextCursorDrawable, getTextDirectionHeuristic, getTextLocale, getTextLocales, getTextMetricsParams, getTextScaleX, getTextSelectHandle, getTextSelectHandleLeft, getTextSelectHandleRight, getTextSize, getTextSizeUnit, getTotalPaddingBottom, getTotalPaddingEnd, getTotalPaddingLeft, getTotalPaddingRight, getTotalPaddingStart, getTotalPaddingTop, getTransformationMethod, getTypeface, getUrls, hasOverlappingRendering, hasSelection, invalidateDrawable, isAllCaps, isCursorVisible, isElegantTextHeight, isFallbackLineSpacing, isHorizontallyScrollable, isInputMethodTarget, isSingleLine, isSuggestionsEnabled, isTextSelectable, jumpDrawablesToCurrentState, length, moveCursorToVisibleOffset, onBeginBatchEdit, onCheckIsTextEditor, onCommitCorrection, onCreateViewTranslationRequest, onDragEvent, onEditorAction, onEndBatchEdit, onGenericMotionEvent, onKeyMultiple, onKeyShortcut, onPreDraw, onPrivateIMECommand, onReceiveContent, onResolvePointerIcon, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onTextContextMenuItem, onTouchEvent, onTrackballEvent, onVisibilityAggregated, performLongClick, removeTextChangedListener, sendAccessibilityEventUnchecked, setAllCaps, setAutoLinkMask, setAutoSizeTextTypeUniformWithConfiguration, setAutoSizeTextTypeUniformWithPresetSizes, setAutoSizeTextTypeWithDefaults, setBreakStrategy, setCompoundDrawablePadding, setCompoundDrawableTintBlendMode, setCompoundDrawableTintList, setCompoundDrawableTintMode, setCompoundDrawables, setCompoundDrawablesRelative, setCompoundDrawablesRelativeWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCursorVisible, setCustomInsertionActionModeCallback, setCustomSelectionActionModeCallback, setEditableFactory, setElegantTextHeight, setEms, setEnabled, setError, setExtractedText, setFallbackLineSpacing, setFilters, setFirstBaselineToTopHeight, setFontFeatureSettings, setFontVariationSettings, setFreezesText, setGravity, setHeight, setHighlightColor, setHint, setHintTextColor, setHorizontallyScrolling, setHyphenationFrequency, setImeActionLabel, setImeHintLocales, setImeOptions, setIncludeFontPadding, setInputExtras, setInputType, setJustificationMode, setLastBaselineToBottomHeight, setLetterSpacing, setLineBreakStyle, setLineBreakWordStyle, setLineHeight, setLineSpacing, setLines, setLinkTextColor, setLinksClickable, setMarqueeRepeatLimit, setMaxEms, setMaxHeight, setMaxLines, setMaxWidth, setMinEms, setMinHeight, setMinLines, setMinWidth, setMovementMethod, setOnEditorActionListener, setPadding, setPaddingRelative, setPaintFlags, setPrivateImeOptions, setRawInputType, setScroller, setSelectAllOnFocus, setSelected, setShadowLayer, setShowSoftInputOnFocus, setSingleLine, setSpannableFactory, setTextClassifier, setTextColor, setTextCursorDrawable, setTextIsSelectable, setTextKeepState, setTextLocale, setTextLocales, setTextMetricsParams, setTextScaleX, setTextSelectHandle, setTextSelectHandleLeft, setTextSelectHandleRight, setTextSize, setTransformationMethod, setTypeface, setWidth, showContextMenu -
Methods inherited from class android.view.View
addChildrenForAccessibility, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearFocus, clearViewTranslationCallback, combineMeasuredStates, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findOnBackInvokedDispatcher, findViewById, findViewWithTag, focusSearch, forceHasOverlappingRendering, forceLayout, gatherTransparentRegion, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillId, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCreateVirtualViewTranslationRequests, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyLongPress, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onScrollCaptureSearch, onStartTemporaryDetach, onViewTranslationResponse, onVirtualViewTranslationResponses, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setWindowInsetsAnimationCallback, setX, setY, setZ, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CodeView
CodeView(Context context)
-
CodeView
CodeView(Context context, AttributeSet attrs)
-
CodeView
CodeView(Context context, AttributeSet attrs, int defStyleAttr)
-
-
Method Detail
-
setTabWidth
void setTabWidth(int characters)
Modify the current tab with
- Parameters:
characters- to use it to calculate the tab width
-
setTabLength
void setTabLength(int length)
Modify the tab length to use it in auto indenting feature
- Parameters:
length- The new tab length value
-
setHighlightWhileTextChanging
void setHighlightWhileTextChanging(boolean updateWhileTextChanging)
Enable or disable highlighting while text is changing
- Parameters:
updateWhileTextChanging- True to enable highlighting while text is changing
-
setEnableLineNumber
void setEnableLineNumber(boolean enableLineNumber)
Enable or disable the line number feature
- Parameters:
enableLineNumber- Flag to enable or disable line number
-
setEnableRelativeLineNumber
void setEnableRelativeLineNumber(boolean enableRelativeLineNumber)
Enable or disable the relative line number feature
- Parameters:
enableRelativeLineNumber- Flag to enable or disable line relative number
-
setEnableHighlightCurrentLine
void setEnableHighlightCurrentLine(boolean enableHighlightCurrentLine)
Enable or disable the highlighting current line feature
- Parameters:
enableHighlightCurrentLine- Flag to enable or disable highlighting current line
-
setEnableAutoIndentation
void setEnableAutoIndentation(boolean enableAutoIndentation)
Enable or disable auto indenting feature
- Parameters:
enableAutoIndentation- Flag to enable or disable auto indenting
-
setIndentationStarts
void setIndentationStarts(Set<Character> characters)
Set the indenting starts set of characters
- Parameters:
characters- Set of characters to use them as indenting starts
-
setIndentationEnds
void setIndentationEnds(Set<Character> characters)
Set the indenting ends set of characters
- Parameters:
characters- Set of characters to use them as indenting ends
-
setAutoCompleteItemHeightInDp
void setAutoCompleteItemHeightInDp(int height)
Modify the auto complete item height
- Parameters:
height- auto complete item height in dp
-
findMatches
List<Token> findMatches(String regex)
Find all the the tokens that matches the regex string and save them on a list
- Parameters:
regex- The regex used to find tokens
-
findNextMatch
Token findNextMatch()
Highlight and return the next token
-
findPrevMatch
Token findPrevMatch()
Highlight and return the previous token
-
clearMatches
void clearMatches()
Clear all the matches tokens
-
replaceFirstMatch
void replaceFirstMatch(String regex, String replacement)
Replace the first string that matched by the regex with new string
- Parameters:
regex- regex Regex used to find the first target stringreplacement- Text to replace that matched string by it
-
replaceAllMatches
void replaceAllMatches(String regex, String replacement)
Replace all strings that matched by the regex with new string
- Parameters:
regex- Regex used to find the target stringreplacement- Text to replace that matched string by it
-
setTextHighlighted
void setTextHighlighted(CharSequence text)
Replace the current text with new highlighted text
- Parameters:
text- The new Text
-
cancelHighlighterRender
void cancelHighlighterRender()
Stop the highlighter task
-
setSyntaxPatternsMap
void setSyntaxPatternsMap(Map<Pattern, Integer> syntaxPatterns)
Setup the syntax of your data as a map of patterns with their colors
- Parameters:
syntaxPatterns- Map of Patterns and Colors
-
addSyntaxPattern
void addSyntaxPattern(Pattern pattern, @ColorInt() int Color)
Add Single syntax as a Pattern with one Color
- Parameters:
pattern- Syntax feature patternColor- Colors used when highlighting the pattern
-
removeSyntaxPattern
void removeSyntaxPattern(Pattern pattern)
Remove one pattern from the Syntax patterns
- Parameters:
pattern- Pattern object to remove it
-
getSyntaxPatternsSize
int getSyntaxPatternsSize()
-
resetSyntaxPatternList
void resetSyntaxPatternList()
Remove all syntax patterns
-
resetHighlighter
void resetHighlighter()
Un highlight all keywords by removing all spans
-
addErrorLine
void addErrorLine(int lineNum, int color)
Add New Error to the current set of errors to highlight it
- Parameters:
lineNum- The error line numbercolor- The color to highlight this error
-
removeErrorLine
void removeErrorLine(int lineNum)
Remove one error by the line number from the error set
- Parameters:
lineNum- The error line number to remove it
-
removeAllErrorLines
void removeAllErrorLines()
Remove all the errors from the errors set and change hasErrors to false
-
getErrorsSize
int getErrorsSize()
-
getTextWithoutTrailingSpace
String getTextWithoutTrailingSpace()
-
setAutoCompleteTokenizer
void setAutoCompleteTokenizer(MultiAutoCompleteTextView.Tokenizer tokenizer)
Replace the current Auto Complete default tokenizer by custom one
- Parameters:
tokenizer- The new custom Tokenizer
-
setRemoveErrorsWhenTextChanged
void setRemoveErrorsWhenTextChanged(boolean removeErrors)
Enable or disable remove all the current errors when text is changed
- Parameters:
removeErrors- True to enable remove current error
-
reHighlightSyntax
void reHighlightSyntax()
Re Highlight the syntax patterns
-
reHighlightErrors
void reHighlightErrors()
Re Highlight the current errors
-
isHasError
boolean isHasError()
-
setUpdateDelayTime
void setUpdateDelayTime(int time)
Modify the highlighting delay time
- Parameters:
time- The new delay time
-
getUpdateDelayTime
int getUpdateDelayTime()
-
isLineNumberEnabled
boolean isLineNumberEnabled()
-
isLineRelativeNumberEnabled
boolean isLineRelativeNumberEnabled()
-
isHighlightCurrentLineEnabled
boolean isHighlightCurrentLineEnabled()
-
setHighlightCurrentLineColor
void setHighlightCurrentLineColor(int color)
Modify the highlight current line color
- Parameters:
color- The new color value
-
setLineNumberTextColor
void setLineNumberTextColor(int color)
Modify the line number text color
- Parameters:
color- The new color value
-
setLineNumberTextSize
void setLineNumberTextSize(float size)
Modify the line number text size
- Parameters:
size- The new text size in pixel units
-
setMatchingHighlightColor
void setMatchingHighlightColor(int color)
Modify the matches tokens highlighting color
- Parameters:
color- The new color value
-
setLineNumberTypeface
void setLineNumberTypeface(Typeface typeface)
Modify the typeface of line number
- Parameters:
typeface- The typeface to be set
-
setMaxSuggestionsSize
void setMaxSuggestionsSize(int maxSuggestions)
Modify the maximum number of suggestions to show, default is Integer.MAX_VALUE
- Parameters:
maxSuggestions- the maximum number of suggestions
-
enablePairComplete
void enablePairComplete(boolean enable)
Enable or disable the auto pairs complete feature
- Parameters:
enable- Flag to enable or disable auto pair complete
-
enablePairCompleteCenterCursor
void enablePairCompleteCenterCursor(boolean enable)
Enable or disable moving the cursor to the center after insert pair complete
- Parameters:
enable- Flag to enable or disable pair complete center cursor
-
setPairCompleteMap
void setPairCompleteMap(Map<Character, Character> map)
Set the pairs for auto pairs complete feature
- Parameters:
map- Map of pairs of characters
-
addPairCompleteItem
void addPairCompleteItem(char key, char value)
Add new pair complete item using key and value
- Parameters:
key- the pair complete item keyvalue- the pair complete item value
-
removePairCompleteItem
void removePairCompleteItem(char key)
Remove single pair complete item by key
- Parameters:
key- the pair complete item key
-
clearPairCompleteMap
void clearPairCompleteMap()
Clear all of pairs
-
showDropDown
void showDropDown()
-
-
-
-