MAFFilterDialog extends the MAFDialog control with filter functionalities, and extends the skinning attributes of MAFDialog with the FilterDialog flavor.
private static List<String> c_names_list; MAFFilterDialog fDialog = new MAFFilterDialog(ctx, ”Header”); fDialog.setList(c_names_list); fDialog.setSelected(selected); fDialog.setResultListener(new ResultListener() { @Override public void selectedResult(int position) { String name = c_names_list.get(position); selected = position; } });
The MAF skinning engine customizes the dialog.
<Style TargetType="Dialog" Key="DefDialog" platform="android"> <Setter Property="Background" Value="#ffffffff" /> <!-- dialog background color --> <Setter Property="Foreground" Value="#ff000000" /> <!-- dialog text color --> <Setter Property="Separator" Value="#ff00a3d7" /> <!-- dialog separator line color --> </Style> <Style TargetType="Dialog" Key="FilterDialog" BasedOn="DefDialog" platform="android"> <Setter Property="Separator" Value="0" /> <!-- dialog separator line color --> </ Style >
To set the list that appears, use setList(List<String> strings), from which you must pass a list of strings to be shown on the dialog.
To check the result of the selection, register a MAFFilterDialog.ResultListener, which has a selectedResult(int position) method that is called after the dialog is dismissed, and returns the position of the selected item in the list.
To preselect items, use the setSelected(int index) API.
Background | Dialog background color. Colors are defined as RGBA (red, green, blue, alpha). |
Foreground | Dialog text color. |
Separator | Dialog separator line color. |