aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/util/PendingActionHelper.java
blob: 06c291711209d034a134a29b1d6ebf391d812842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package de.pixart.messenger.ui.util;

/**
 * Created by mxf on 2018/4/3.
 */

public class PendingActionHelper {

    private PendingAction pendingAction;

    public void push(PendingAction pendingAction) {
        this.pendingAction = pendingAction;
    }

    public void execute() {
        if (pendingAction != null) {
            pendingAction.execute();
            pendingAction = null;
        }
    }

    public void undo() {
        pendingAction = null;
    }

    public interface PendingAction {
        void execute();
    }
}