-
Notifications
You must be signed in to change notification settings - Fork 419
Swipeable autoclose #3093
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Swipeable autoclose #3093
Conversation
Update from CN1 master
Update for fix of spanlabels etc
Update from CN1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Looks great just a couple of cosmetic changes to make usage possible without overriding.
@@ -383,6 +383,8 @@ public void actionPerformed(ActionEvent evt) { | |||
} | |||
|
|||
if (initialX != -1) { | |||
if (getPreviouslyOpened() != null && getPreviouslyOpened() != SwipeableContainer.this && getPreviouslyOpened().isOpen()) | |||
getPreviouslyOpened().close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add curly brackets around the statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yes, sure
public SwipeableContainer getPreviouslyOpened() { | ||
return null; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a field and a setter, also include text in the @return
tag otherwise the Javadoc looks weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my use case (and I believe most other), a field and setter doesn't make sense: I have a long list of SwipeableContainers and keep track of which is opened in the Form (I overwrite openToLeft, openToRight and close() to store/remove an open Swipeable). For a local field (like 'openSwipeable') to make sense, every SwipeableContainer would need to get that set.
I assume there might be a better overall way to smoothly close any already opened Swpeiable, but here I went for minimal impact to the existing code.
(NB. My first attempt was to override openToLeft/openToRight to close the previously opened Swipeable, but since they only get called once Swipeable is completely opened, it didn't look right).
If you still think it makes sense, I can add these since it won't break anything, at worst it could lead a developer down a wrong path at first :-)
Added support necessary to close an already open SwipeableContainer as soon as another one starts opening.