Skip to content

Commit

Permalink
Added support to SwipeBack for return null destination form as a mean…
Browse files Browse the repository at this point in the history
…s to de-activate swipeBack if conditions to exit Form are not met (#3622)

* Fixed issue of "oversensitive swipe" #3160. PR as suggested by Shai in Reddit

* Added support to let swipeback destination form be null to prevent swipeBack for example if conditions to exit Form are not met.
  • Loading branch information
ThomasH99 authored Aug 29, 2022
1 parent 3201e01 commit db58526
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CodenameOne/src/com/codename1/ui/util/SwipeBackSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ public void actionPerformed(ActionEvent evt) {
if (x - initialDragX > Display.getInstance().convertToPixels(currentForm.getUIManager().getThemeConstant("backGestureThresholdInt", 5), true)) {
dragActivated = true;
destinationForm = destination.get();
startBackTransition(currentForm, destinationForm);
if(destinationForm!=null) { //allow destination form to be null to disable swipeback, e.g. if conditions to exit Form are not fulfilled
startBackTransition(currentForm, destinationForm);
}
}
}
}
Expand Down

0 comments on commit db58526

Please sign in to comment.