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
Conversation
I'm thinking that having both a The existing My point here is if you set So, instead of calling it @hansemannn, @garymathews, @ypbnv, your thoughts? |
+1 for |
I can see that being misleading, yes. I did not think about it. Updating it to |
@@ -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_PRESS_REQUIRED, true)); |
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.
The default value should be false
to retain the old behavior.
You should also !
the property's returned value since buttonPressRequired
set to true
means it is not cancelable via back key or outside taps.
apidoc/Titanium/UI/AlertDialog.yml
Outdated
type: Boolean | ||
default: true on Android | ||
since: "7.4.0" | ||
platforms: [android] |
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.
Default value should be false
to retain the old behavior.
And how about we change the summary to...
Setting this to true requires the end-user to click a dialog button to close the dialog.
And perhaps the following 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.
Thanks @ypbnv . Just a bit more feedback and I think we're done. :) |
/** | ||
* @module.api | ||
*/ | ||
public static final String PROPERTY_BUTTON_PRESS_REQUIRED = "buttonPressRequired"; |
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.
Should we name this buttonClickRequired
to coincide with the click
event, to prevent confusion with the pressed
event?
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.
Good point. I'm open to different names. Anyone else have an opinion?
Invert default value to keep behavior. Change the summary and add a description.
Updated with the recent suggestions. BTW should accessing this property before giving it any value return a valid result. Now it is returning |
Thanks for the recent changes @ypbnv! :)
Ideally, it should return the default value we document, but I see what you mean. None of the other properties return a default value either. I'm okay with the way it is for now. We can look into improving things later. |
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.
CR: Pass
FR Passed. The Studio Ver: 5.1.0.201807090554 |
Generated by 🚫 dangerJS |
JIRA: https://jira.appcelerator.org/browse/TIMOB-26174
Description:
Adds the
buttonClickRequired
property to Ti.UI.AlertDialog, which controls whether the dialog can be cancelled by clicking the Android system back button. Defaults totrue
.Note: No unit tests, because this property requires a user interaction.
Test case:
app.js