Regret is a Android library for apps that wants to implement a undo/redo feature
Switch branches/tags
Nothing to show
Clone or download
Latest commit b6d1d79 Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo Refactoring Dec 3, 2018
gradle/wrapper Initial commit Nov 8, 2018
regret Refactoring Dec 3, 2018
.gitignore Refactoring Nov 19, 2018
build.gradle Refactoring Dec 2, 2018
demo.apk Added new demo.apk Dec 3, 2018
gradle.properties Initial commit Nov 8, 2018
gradlew Initial commit Nov 8, 2018
gradlew.bat Initial commit Nov 8, 2018
license Added license Nov 27, 2018
readme.md Update readme.md Dec 4, 2018
settings.gradle Initial commit Nov 8, 2018

readme.md

Regret

APK

Regret is a Android library for apps that wants to implement an undo/redo feature. The library is simple to use and will persist your history until you clear it manually and works with all primitive types and any Serializable object.

Usage

  1. Instantiate Regret and add data to it
   Regret regret = new Regret(context, this);
   regret.add(KEY_TEXT, editText.getText().toString());
   regret.add(KEY_TEXT_COLOR, Color.BLACK);
  1. Call regret.undo() or regret.redo(). The data will be returned via the callback
  @Override
    public void onDo(String key, Object value) {
        switch (key) {
            case KEY_TEXT:
                editText.setText((CharSequence) value);
                break;
            case KEY_TEXT_COLOR:
                editText.setTextColor((Integer) value);
                break;
        }
    }

Installation

Add the dependency in your build.gradle

dependencies {
    implementation 'com.muddzdev:regret:1.0.1'  
}

License

Copyright 2018 Muddi Walid

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.