[TIMOB-26793] Android: Hide radio buttons OptionDialog
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-04-25T13:16:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.1.0 |
Components | Android |
Labels | android, optiondialog |
Reporter | Michael Gangolf |
Assignee | Gary Mathews |
Created | 2019-01-23T17:03:14.000+0000 |
Updated | 2019-04-25T13:16:11.000+0000 |
Description
The current OptionDialog displays the items on Android as RadioButtons. You don't have the possibility to hide those circles.
To create a dialog that looks more like the iOS version:
!ti_option.png|thumbnail!
I've added a parameter called
textOnly
var win = Ti.UI.createWindow({
title: 'Click window to test OptionDialog',
backgroundColor: 'white'
});
var opts = {
title: 'Select an option',
options: ['Option 1', 'Option 2', 'Option 3', 'Option 4'],
textOnly: true,
buttonNames: ['Cancel']
}
var dialog;
win.addEventListener('click', function() {
dialog = Ti.UI.createOptionDialog(opts);
dialog.addEventListener('click', onSelectDialog);
dialog.addEventListener('cancel', function(e) {
alert('Dialog canceled! e.cancel = ' + e.cancel + ', e.index = ' + e.index);
})
dialog.show();
});
function onSelectDialog(e) {
console.log(e);
}
win.open();
Attachments
File | Date | Size |
---|---|---|
ti_option.png | 2019-01-23T17:02:07.000+0000 | 22375 |
PR: https://github.com/appcelerator/titanium_mobile/pull/10645 I've left the default to
false
(personally I would do it the other way round, so it will look more like iOS)This is a duplicate of [TIMOB-26224]. And yes, I agree that we should not display radio buttons in the option dialog by default. They look ridiculous when nothing is selected. It should be a vertical list of buttons instead... unless the "selectedIndex" property is set because that would check one of the radio buttons.
oh sorry, didn't search for it before! Sounds like a good idea with the selectedIndex! I'll change that
I'm willing to hear other solutions to this problem too. I do think they should be buttons by default, but I'm also wondering if existing Titanium developers who are setting the "selectedIndex" might actually want the radio button behavior too. That's partly what I'm concerned about. Or perhaps this should be done via a "style" property? Because we can display a list of options in different ways, that's for sure. I'm open to suggestions. Here's a link to Google's material design regarding dialogs. https://material.io/design/components/dialogs.html#usage
[~jquick] Can you assign 8.1.0 here so it doesn't get moved out for some reason? :)
FR Passed, waiting on Jenkins to be ready for merge.
Closing ticket, fix verified in SDK version
8.1.0.v20190425050927
Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10645