diff --git a/CodenameOne/src/com/codename1/ui/SwipeableContainer.java b/CodenameOne/src/com/codename1/ui/SwipeableContainer.java index 6573be86ea..c4c8b18853 100644 --- a/CodenameOne/src/com/codename1/ui/SwipeableContainer.java +++ b/CodenameOne/src/com/codename1/ui/SwipeableContainer.java @@ -383,6 +383,8 @@ public void actionPerformed(ActionEvent evt) { } if (initialX != -1) { + if (getPreviouslyOpened() != null && getPreviouslyOpened() != SwipeableContainer.this && getPreviouslyOpened().isOpen()) + getPreviouslyOpened().close(); int diff = x - initialX; int val = 0; if(!isOpen()){ @@ -444,4 +446,12 @@ public void actionPerformed(ActionEvent evt) { } } + /** + * override to return a previously opened SwipeableContainer that should be automatically closed when starting to open this one + * @return + */ + public SwipeableContainer getPreviouslyOpened() { + return null; + } + }