| 525 | /// - `allowClose`: True to allow user to close the sheet. False to prevent it. |
| 526 | /// |
| 527 | public void setAllowClose(boolean allowClose) { |
| 528 | if (allowClose != this.allowClose) { |
| 529 | this.allowClose = allowClose; |
| 530 | if (!allowClose && isInitialized()) { |
| 531 | form.removePointerPressedListener(formPointerListener); |
| 532 | detachSwipeListeners(form); |
| 533 | dragging = false; |
| 534 | } else if (allowClose && isInitialized()) { |
| 535 | form.addPointerPressedListener(formPointerListener); |
| 536 | attachSwipeListeners(form); |
| 537 | } |
| 538 | if (parentSheet == null) { |
| 539 | backButton.setVisible(allowClose); |
| 540 | backButton.setEnabled(allowClose); |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | /// Checks whether this sheet can be dismissed by swiping it toward the |
| 546 | /// edge of the screen (e.g. swiping down for a south-positioned sheet). |