X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FCakeLight.java;h=2f77a1477c6ac50f381e9a9a337e4588111a2ff1;hb=fe55a0449c2f5d434357c481890d909fffd30b3a;hp=822e2ab5d9c2975b2335f8808a3fa640e39a07a7;hpb=d0afa6fb625ce2fe77d1ed6f0df8ed34391ddc35;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/CakeLight.java b/src/kaka/cakelight/CakeLight.java index 822e2ab..2f77a14 100644 --- a/src/kaka/cakelight/CakeLight.java +++ b/src/kaka/cakelight/CakeLight.java @@ -28,7 +28,7 @@ public class CakeLight { } public void cleanup() { - while (popMode()); + while (popMode() != null); } public void pushMode(Mode mode) { @@ -41,16 +41,14 @@ public class CakeLight { // TODO: create a composite fading mode of top of stack and new mode } - public boolean popMode() { - if (!modes.isEmpty()) { + public Mode popMode() { + if (modes.size() > 1) { Mode mode = modes.pop(); stopMode(mode); - if (!modes.isEmpty()) { - resumeMode(modes.peek()); - } - return true; + resumeMode(modes.peek()); + return mode; } - return false; + return null; // TODO: create a composite fading mode of popped mode and top of stack, unless doing cleanup }