add current-pass functionality

This commit is contained in:
ligi 2014-06-03 20:41:36 +02:00
parent 259891359d
commit 1276999d3d

View file

@ -1,5 +1,7 @@
package org.ligi.passandroid.injections;
import com.google.common.base.Optional;
import org.ligi.passandroid.model.PassStore;
import org.ligi.passandroid.model.Passbook;
import org.ligi.passandroid.model.ReducedPassInformation;
@ -10,6 +12,7 @@ import java.util.List;
public class FixedPassListPassStore implements PassStore {
private final List<Passbook> passes;
private Passbook actPass;
public FixedPassListPassStore(List<Passbook> passes) {
this.passes = passes;
@ -63,4 +66,24 @@ public class FixedPassListPassStore implements PassStore {
public List<CountedType> getCountedTypes() {
return new ArrayList<>();
}
@Override
public Optional<Passbook> getCurrentPass() {
return Optional.of(actPass);
}
@Override
public void setCurrentPass(Passbook pass) {
actPass = pass;
}
@Override
public void setCurrentPass(Optional<Passbook> pass) {
actPass = pass.get();
}
@Override
public boolean deletePassWithId(String id) {
return false;
}
}