com.hipipal.texteditor.undo
Class TextChangeWatcher

java.lang.Object
  extended by com.hipipal.texteditor.undo.TextChangeWatcher
All Implemented Interfaces:
Constants

public class TextChangeWatcher
extends java.lang.Object
implements Constants


Field Summary
 
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
TextChangeWatcher()
           
 
Method Summary
 void afterChange(java.lang.CharSequence s, int start, int before, int count)
          A change to the text s has been made, where the count characters starting at start have replaced the substring of length before
 void beforeChange(java.lang.CharSequence s, int start, int count, int after)
          A change to the text s will be made, where the count characters starting at start will be replaced by after characters
 void printStack()
          Prints the current stack
 void processDelete(java.lang.CharSequence s, int start, int count)
           
 void processInsert(java.lang.CharSequence s, int start, int count)
           
 int undo(android.text.Editable text)
          Undo the last operation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextChangeWatcher

public TextChangeWatcher()
Method Detail

undo

public int undo(android.text.Editable text)
Undo the last operation

Parameters:
text - the text to undo on
Returns:
the caret position

beforeChange

public void beforeChange(java.lang.CharSequence s,
                         int start,
                         int count,
                         int after)
A change to the text s will be made, where the count characters starting at start will be replaced by after characters

Parameters:
s - the sequence being changed
start - the start index
count - the number of characters that will change
after - the number of characters that will replace the old ones

afterChange

public void afterChange(java.lang.CharSequence s,
                        int start,
                        int before,
                        int count)
A change to the text s has been made, where the count characters starting at start have replaced the substring of length before

Parameters:
s - the sequence being changed
start - the start index
before - the number of character that were replaced
count - the number of characters that will change

processInsert

public void processInsert(java.lang.CharSequence s,
                          int start,
                          int count)
Parameters:
s - the sequence being modified
start - the first character index
count - the number of inserted text

processDelete

public void processDelete(java.lang.CharSequence s,
                          int start,
                          int count)
Parameters:
s - the sequence being modified
start - the first character index
count - the number of inserted text

printStack

public void printStack()
Prints the current stack