Skip to content
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

[TIMOB-26174] Android: add setCancelable method on Ti.UI.AlertDialog #10146

Merged
merged 8 commits into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
TiC.PROPERTY_BUTTON_NAMES,
TiC.PROPERTY_CANCEL,
TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE,
TiC.PROPERTY_BUTTON_CLICK_REQUIRED,
TiC.PROPERTY_MESSAGE,
TiC.PROPERTY_MESSAGEID,
TiC.PROPERTY_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public void onCancel(DialogInterface dlg)
dialog = getBuilder().create();
dialog.setCanceledOnTouchOutside(
proxy.getProperties().optBoolean(TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE, true));
dialog.setCancelable(!proxy.getProperties().optBoolean(TiC.PROPERTY_BUTTON_CLICK_REQUIRED, false));
// Initially apply accessibility properties here, the first time
// the dialog actually becomes available. After this, propertyChanged
// can also be used.
Expand Down
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,11 @@ public class TiC
*/
public static final String PROPERTY_BUTTON_NAMES = "buttonNames";

/**
* @module.api
*/
public static final String PROPERTY_BUTTON_CLICK_REQUIRED = "buttonClickRequired";

/**
* @module.api
*/
Expand Down
12 changes: 12 additions & 0 deletions apidoc/Titanium/UI/AlertDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@ properties:
type: Number
default: undefined (Android), -1 (iOS)

- name: buttonClickRequired
summary: |
Setting this to true requires the end-user to click a dialog button to close the dialog.
description: |
Set to true to prevent the dialog from being dismissed via back navigation or tapping outside of the dialog.
This requires the end-user to click on one of the dialog buttons provided by property buttonNames. Note that
if the dialog does not have any buttons, then the dialog can only be closed programmatically via the hide() method.
type: Boolean
default: false on Android
since: "7.4.0"
platforms: [android]

- name: canceledOnTouchOutside
summary: |
When this is set to `true`, the dialog is canceled when touched outside the window's bounds.
Expand Down