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

feat(android): hide radio buttons OptionDialog #10645

Merged
merged 10 commits into from
Apr 25, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,23 @@ public void processProperties(KrollDict d)

private void processOptions(String[] optionText, int selectedIndex)
{
getBuilder().setSingleChoiceItems(optionText, selectedIndex, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which)
{
handleEvent(which);
hide(null);
}
});
if (selectedIndex != -1) {
getBuilder().setSingleChoiceItems(optionText, selectedIndex, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which)
{
handleEvent(which);
hide(null);
}
});
} else {
getBuilder().setItems(optionText, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which)
{
handleEvent(which);
hide(null);
}
});
}
}

private void processButtons(String[] buttonText)
Expand Down
3 changes: 2 additions & 1 deletion apidoc/Titanium/UI/OptionDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ properties:
platforms: [android, iphone, ipad]

- name: selectedIndex
summary: Defines the default selected option.
summary: Defines the default selected option. Since `8.1.0`, if not defined or -1 it will show a
normal list instead of radio buttons.
platforms: [android]
type: Number
availability: creation
Expand Down