Skip to content

About

This is an android text undo redo library

Resources

Stars

11 stars

Watchers

1 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

TextUndoRedo

This is an android text undo redo library. The library is very small, only a Java file.

ScreenShot

demo

Usage

  1. Will TextUndoRedo.java copy to your project.

  2. To bind TextUndoRedo and EditText.

TUR = new TextUndoRedo(EditText editText, TextChangeInfo info);
  1. call exeUndo() or exeRedo().
TUR.exeUndo();  

TUR.exeRedo();

Note

Call exeUndo() before please make sure that canUndo() is true, exeRedo() too.

if(canUndo){
  exeUndo();
}

if(canRedo){
  exeRedo();
}

This is the safest.

or, You can use the interface TextChangeInfo to in time call canUndo() and canRedo().

public interface TextChangeInfo {
  void textAction();
}
public void textAction() {
  btn_undo.setEnabled(TUR.canUndo());
  btn_redo.setEnabled(TUR.canRedo());
}

but, You need to deal with the issue of the screen direction.(Every time a new TextUndoRedo will create a new Record)

android:configChanges="orientation|keyboardHidden|screenSize"

or

android:screenOrientation="portrait"

or

android:screenOrientation="landscape"

or

......

For the above these problems, you can consult sample :)

Author

Name: Arowa_Z
Email: Arowa_Z@qq.com

About

This is an android text undo redo library

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages