[TIMOB-2038] Android: Use addView in TiUIDialog to add option input box to alert
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Trivial |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2011-04-15T03:08:47.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 1.6.0 M10 |
| Components | Android |
| Labels | android, dialog, feature, input, release-1.6.0 |
| Reporter | Ralf Pfeiffer |
| Assignee | Don Thorp |
| Created | 2011-04-15T03:08:46.000+0000 |
| Updated | 2017-03-03T05:47:46.000+0000 |
Description
Add the possibility of a text box inside of an alert dialog to catch user input? Code sample below...
if (d.containsKey("hasInput")) {
if (TiConvert.toBoolean(d, "hasInput")) {
Activity currentActivity = proxy.getTiContext().getTiApp().getCurrentActivity();
if (currentActivity == null) {
currentActivity = proxy.getTiContext().getActivity();
}
EditText input = new EditText(currentActivity);
builder.addView(input);
}
}
This code was written theoretically, but should show the gist of it. Possibly a new proxy such as Ti.UI.createInputDialog() should be created for this?
I.e, Ti.UI.createInputDialog({title: 'Hello', message: 'What is your name?' hasInput: true}) would show us a standard dialog, only with a text input attached. This would also need to be catered to in the fireEvent in order to extract the text.
Theoretical code:
var input = Ti.UI.createInputDialog({title: 'Hello', message: 'What is your name?' hasInput: true});
input.addEventListener('click', function(e) {
alert(e.textValue); // made up return value
});
Andrew
Assigning to Don for triage.
Worth noting that iOS CANNOT support this feature due to the HIG guidelines and dialog/error interfaces.
Android dialog already supports adding a view. It was added in 1.5.0.
Closing issue due to time passed and irrelevance of the ticket.