Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26793] Android: Hide radio buttons OptionDialog

GitHub Issuen/a
TypeNew Feature
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-04-25T13:16:10.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.1.0
ComponentsAndroid
Labelsandroid, optiondialog
ReporterMichael Gangolf
AssigneeGary Mathews
Created2019-01-23T17:03:14.000+0000
Updated2019-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

FileDateSize
ti_option.png2019-01-23T17:02:07.000+000022375

Comments

  1. Michael Gangolf 2019-01-23

    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)
  2. Joshua Quick 2019-01-23

    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.
  3. Michael Gangolf 2019-01-23

    oh sorry, didn't search for it before! Sounds like a good idea with the selectedIndex! I'll change that
  4. Joshua Quick 2019-01-23

    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
  5. Hans Knöchel 2019-03-01

    [~jquick] Can you assign 8.1.0 here so it doesn't get moved out for some reason? :)
  6. Samir Mohammed 2019-03-04

    FR Passed, waiting on Jenkins to be ready for merge.
  7. Samir Mohammed 2019-04-25

    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

JSON Source