-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swipeable autoclose #3093
base: master
Are you sure you want to change the base?
Swipeable autoclose #3093
Changes from all commits
1adb386
559f198
02db4b3
2a5984e
839f5fb
b994406
96e12d7
f656ea4
6e44878
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 :-) |
||
} |
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