com.arellomobile.mvp.viewstate.strategy.OneExecutionStateStrategy Maven / Gradle / Ivy
package com.arellomobile.mvp.viewstate.strategy;
import java.util.List;
import com.arellomobile.mvp.MvpView;
import com.arellomobile.mvp.viewstate.ViewCommand;
/**
* Command will be saved in commands queue. And this command will be removed after first execution.
*
* Date: 24.11.2016
* Time: 11:48
*
* @author Yuri Shmakov
*/
public class OneExecutionStateStrategy implements StateStrategy {
@Override
public void beforeApply(List> currentState, ViewCommand incomingCommand) {
currentState.add(incomingCommand);
}
@Override
public void afterApply(List> currentState, ViewCommand incomingCommand) {
currentState.remove(incomingCommand);
}
}