com.hipipal.texteditor.ui.view
Class AdvancedEditText

java.lang.Object
  extended by android.view.View
      extended by android.widget.TextView
          extended by android.widget.EditText
              extended by com.hipipal.texteditor.ui.view.AdvancedEditText
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.GestureDetector.OnGestureListener, android.view.KeyEvent.Callback, android.view.View.OnKeyListener, android.view.ViewTreeObserver.OnPreDrawListener, Constants

public class AdvancedEditText
extends android.widget.EditText
implements Constants, android.view.View.OnKeyListener, android.view.GestureDetector.OnGestureListener

TODO create a syntax highlighter


Nested Class Summary
static interface AdvancedEditText.OnTextChangedListener
           
 
Nested classes/interfaces inherited from class android.widget.TextView
android.widget.TextView.BufferType, android.widget.TextView.OnEditorActionListener, android.widget.TextView.SavedState
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, 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.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
 
Field Summary
 boolean dirty
           
 int errorLine
           
 AdvancedEditText.OnTextChangedListener onTextChangedListener
           
 int updateDelay
           
 
Fields inherited from class android.view.View
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, 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, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, 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_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_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, VISIBLE, X, Y
 
Fields inherited from interface com.hipipal.texteditor.common.Constants
ACTION_WIDGET_OPEN, BACKUP_FILE_NAME, COLOR_CLASSIC, COLOR_DRACULA, COLOR_MATRIX, COLOR_NEGATIVE, COLOR_SKY, ENC_ASCII, ENC_LATIN, ENC_UTF8, EOL_LINUX, EOL_MAC, EOL_WINDOWS, EXTRA_FORCE_READ_ONLY, EXTRA_REQUEST_CODE, FONT_FILE_NAME, FONT_FOLDER_NAME, MENU_ID_ABOUT, MENU_ID_NEW, MENU_ID_OPEN, MENU_ID_OPEN_RECENT, MENU_ID_QUIT, MENU_ID_REDO, MENU_ID_SAVE, MENU_ID_SAVE_AS, MENU_ID_SEARCH, MENU_ID_SETTINGS, MENU_ID_UNDO, PREFERENCE_ALLOW_UNDO, PREFERENCE_AUTO_SAVE, PREFERENCE_AUTO_SAVE_OVERWRITE, PREFERENCE_BACK_BUTTON_AS_UNDO, PREFERENCE_COLOR_THEME, PREFERENCE_ENCODING, PREFERENCE_END_OF_LINES, PREFERENCE_FLING_TO_SCROLL, PREFERENCE_FONT, PREFERENCE_HIGHLIGHT, PREFERENCE_HOME_PAGE_PATH, PREFERENCE_MAX_RECENTS, PREFERENCE_MAX_UNDO_STACK, PREFERENCE_RECENTS, PREFERENCE_SEARCH_MATCH_CASE, PREFERENCE_SEARCHWRAP, PREFERENCE_SELECT_FONT, PREFERENCE_SHOW_LINE_NUMBERS, PREFERENCE_TEXT_SIZE, PREFERENCE_USE_HOME_PAGE, PREFERENCE_WORDWRAP, PREFERENCES_NAME, REQUEST_FONT, REQUEST_HOME_PAGE, REQUEST_OPEN, REQUEST_RECENT, REQUEST_SAVE_AS, RESULT_ERROR, STORAGE, STORAGE_PATH, TAG, TEXT_SIZE_MAX, TEXT_SIZE_MIN
 
Constructor Summary
AdvancedEditText(android.content.Context context, android.util.AttributeSet attrs)
           
 
Method Summary
 void computeScroll()
           
 java.lang.String getCleanText()
           
 boolean onDown(android.view.MotionEvent e)
           
 void onDraw(android.graphics.Canvas canvas)
           
 boolean onFling(android.view.MotionEvent e1, android.view.MotionEvent e2, float velocityX, float velocityY)
           
 boolean onKey(android.view.View v, int keyCode, android.view.KeyEvent event)
           
 void onLongPress(android.view.MotionEvent e)
           
 boolean onScroll(android.view.MotionEvent e1, android.view.MotionEvent e2, float distanceX, float distanceY)
           
 void onShowPress(android.view.MotionEvent e)
           
 boolean onSingleTapUp(android.view.MotionEvent e)
           
 boolean onTouchEvent(android.view.MotionEvent event)
           
 void refresh()
           
 void setFileType(java.lang.String ft)
           
 void setTextHighlighted(java.lang.CharSequence text)
           
 void unHightlight()
           
 void unHightWithoutChange(android.text.Editable e)
           
 void updateFromSettings(java.lang.String fileType)
          Update view settings from the app preferences
 
Methods inherited from class android.widget.EditText
extendSelection, getText, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, selectAll, setEllipsize, setSelection, setSelection, setText
 
Methods inherited from class android.widget.TextView
addTextChangedListener, append, append, beginBatchEdit, bringPointIntoView, cancelLongPress, clearComposingText, debug, didTouchFocusSelect, endBatchEdit, extractText, findViewsWithText, getAutoLinkMask, getBaseline, getCompoundDrawablePadding, getCompoundDrawables, getCompoundDrawablesRelative, getCompoundPaddingBottom, getCompoundPaddingEnd, getCompoundPaddingLeft, getCompoundPaddingRight, getCompoundPaddingStart, getCompoundPaddingTop, getCurrentHintTextColor, getCurrentTextColor, getCustomSelectionActionModeCallback, getEditableText, getEllipsize, getError, getExtendedPaddingBottom, getExtendedPaddingTop, getFilters, getFocusedRect, getFreezesText, getGravity, getHighlightColor, getHint, getHintTextColors, getImeActionId, getImeActionLabel, getImeOptions, getIncludeFontPadding, getInputExtras, getInputType, getKeyListener, getLayout, getLineBounds, getLineCount, getLineHeight, getLineSpacingExtra, getLineSpacingMultiplier, getLinksClickable, getLinkTextColors, getMarqueeRepeatLimit, getMaxEms, getMaxHeight, getMaxLines, getMaxWidth, getMinEms, getMinHeight, getMinLines, getMinWidth, getMovementMethod, getOffsetForPosition, getPaint, getPaintFlags, getPrivateImeOptions, getSelectionEnd, getSelectionStart, getShadowColor, getShadowDx, getShadowDy, getShadowRadius, getTextColor, getTextColors, getTextColors, getTextLocale, getTextScaleX, getTextSize, getTotalPaddingBottom, getTotalPaddingEnd, getTotalPaddingLeft, getTotalPaddingRight, getTotalPaddingStart, getTotalPaddingTop, getTransformationMethod, getTypeface, getUrls, hasOverlappingRendering, hasSelection, invalidateDrawable, isCursorVisible, isInputMethodTarget, isSuggestionsEnabled, isTextSelectable, jumpDrawablesToCurrentState, length, moveCursorToVisibleOffset, onBeginBatchEdit, onCheckIsTextEditor, onCommitCompletion, onCommitCorrection, onCreateInputConnection, onDragEvent, onEditorAction, onEndBatchEdit, onFinishTemporaryDetach, onGenericMotionEvent, onKeyDown, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPopulateAccessibilityEvent, onPreDraw, onPrivateIMECommand, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onStartTemporaryDetach, onTextContextMenuItem, onTrackballEvent, onWindowFocusChanged, performAccessibilityAction, performLongClick, removeTextChangedListener, sendAccessibilityEvent, setAllCaps, setAutoLinkMask, setCompoundDrawablePadding, setCompoundDrawables, setCompoundDrawablesRelative, setCompoundDrawablesRelativeWithIntrinsicBounds, setCompoundDrawablesRelativeWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCursorVisible, setCustomSelectionActionModeCallback, setEditableFactory, setEms, setEnabled, setError, setError, setExtractedText, setFilters, setFreezesText, setGravity, setHeight, setHighlightColor, setHint, setHint, setHintTextColor, setHintTextColor, setHorizontallyScrolling, setImeActionLabel, setImeOptions, setIncludeFontPadding, setInputExtras, setInputType, setKeyListener, setLines, setLineSpacing, setLinksClickable, setLinkTextColor, setLinkTextColor, setMarqueeRepeatLimit, setMaxEms, setMaxHeight, setMaxLines, setMaxWidth, setMinEms, setMinHeight, setMinLines, setMinWidth, setMovementMethod, setOnEditorActionListener, setPadding, setPaddingRelative, setPaintFlags, setPrivateImeOptions, setRawInputType, setScroller, setSelectAllOnFocus, setSelected, setShadowLayer, setSingleLine, setSingleLine, setSpannableFactory, setText, setText, setText, setText, setTextAppearance, setTextColor, setTextColor, setTextIsSelectable, setTextKeepState, setTextKeepState, setTextLocale, setTextScaleX, setTextSize, setTextSize, setTransformationMethod, setTypeface, setTypeface, setWidth
 
Methods inherited from class android.view.View
addChildrenForAccessibility, addFocusables, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewWithTag, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getCameraDistance, getClipBounds, getContentDescription, getContext, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasFocus, hasFocusable, hasOnClickListeners, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isOpaque, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onCancelPendingInputEvents, onFilterTouchEventForSecurity, onHoverChanged, onHoverEvent, onKeyLongPress, onWindowSystemUiVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setClipBounds, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

onTextChangedListener

public AdvancedEditText.OnTextChangedListener onTextChangedListener

updateDelay

public int updateDelay

errorLine

public int errorLine

dirty

public boolean dirty
Constructor Detail

AdvancedEditText

public AdvancedEditText(android.content.Context context,
                        android.util.AttributeSet attrs)
Parameters:
context - the current context
attrs - some attributes
Method Detail

setFileType

public void setFileType(java.lang.String ft)

computeScroll

public void computeScroll()
Overrides:
computeScroll in class android.widget.TextView
See Also:
TextView.computeScroll()

onDraw

public void onDraw(android.graphics.Canvas canvas)
Overrides:
onDraw in class android.widget.TextView
See Also:
TextView.onDraw(Canvas)

onKey

public boolean onKey(android.view.View v,
                     int keyCode,
                     android.view.KeyEvent event)
Specified by:
onKey in interface android.view.View.OnKeyListener
See Also:
View.OnKeyListener.onKey(android.view.View, int, android.view.KeyEvent)

onTouchEvent

public boolean onTouchEvent(android.view.MotionEvent event)
Overrides:
onTouchEvent in class android.widget.TextView
See Also:
TextView.onTouchEvent(android.view.MotionEvent)

onDown

public boolean onDown(android.view.MotionEvent e)
Specified by:
onDown in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onDown(android.view.MotionEvent)

onSingleTapUp

public boolean onSingleTapUp(android.view.MotionEvent e)
Specified by:
onSingleTapUp in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onSingleTapUp(android.view.MotionEvent)

onShowPress

public void onShowPress(android.view.MotionEvent e)
Specified by:
onShowPress in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onShowPress(android.view.MotionEvent)

onLongPress

public void onLongPress(android.view.MotionEvent e)
Specified by:
onLongPress in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onLongPress(android.view.MotionEvent)

onScroll

public boolean onScroll(android.view.MotionEvent e1,
                        android.view.MotionEvent e2,
                        float distanceX,
                        float distanceY)
Specified by:
onScroll in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float)

onFling

public boolean onFling(android.view.MotionEvent e1,
                       android.view.MotionEvent e2,
                       float velocityX,
                       float velocityY)
Specified by:
onFling in interface android.view.GestureDetector.OnGestureListener
See Also:
GestureDetector.OnGestureListener.onFling(android.view.MotionEvent, android.view.MotionEvent, float, float)

updateFromSettings

public void updateFromSettings(java.lang.String fileType)
Update view settings from the app preferences


setTextHighlighted

public void setTextHighlighted(java.lang.CharSequence text)

getCleanText

public java.lang.String getCleanText()

refresh

public void refresh()

unHightlight

public void unHightlight()

unHightWithoutChange

public void unHightWithoutChange(android.text.Editable e)