src/main/java/de/blau/android/propertyeditor/tagform/ComboDialogRow.java
/**
     * Add a button to a RadioGroup
     * 
     * @param context Android Context
     * @param group the RadioGroup we ant to add the button to
     * @param id an id for the button
     * @param swd the value for the button
     * @param selected is true the button is selected
     * @param icon an icon to display if any
     * @param listener the Listener to call if the button is clicked
     * @param layoutParams LayoutParams for the button
     */
Add a button to a RadioGroup


Add a button to a RadioGroup
private static void addButton(@NonNull Context context, @NonNull RadioGroup group, int id, @NonNull StringWithDescription swd, boolean selected,
            @Nullable Drawable icon, @NonNull View.OnClickListener listener, @NonNull ViewGroup.LayoutParams layoutParams) {
        final AppCompatRadioButton button = new AppCompatRadioButton(context);
        String description = swd.getDescription();
        button.setText(description != null && !"".equals(description) ? description : swd.getValue());
        button.setTag(swd);
        button.setChecked(selected);
        button.setId(id);
        if (icon != null) {
            button.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
            button.setCompoundDrawablePadding(Ui.COMPOUND_DRAWABLE_PADDING);
        }
        button.setLayoutParams(layoutParams);
        group.addView(button);
        button.setOnClickListener(listener);
    }
private static void addButton ( @ NonNull Context context , @ NonNull RadioGroup group , int id , @ NonNull StringWithDescription swd , boolean selected , @ Nullable Drawable icon , @ NonNull View . OnClickListener listener , @ NonNull ViewGroup . LayoutParams layoutParams ) { final AppCompatRadioButton button = new AppCompatRadioButton ( context ) ; String description = swd . getDescription ( ) ; button . setText ( description != null && ! "" . equals ( description ) ? description : swd . getValue ( ) ) ; button . setTag ( swd ) ; button . setChecked ( selected ) ; button . setId ( id ) ; if ( icon != null ) { button . setCompoundDrawablesWithIntrinsicBounds ( icon , null , null , null ) ; button . setCompoundDrawablePadding ( Ui . COMPOUND_DRAWABLE_PADDING ) ; } button . setLayoutParams ( layoutParams ) ; group . addView ( button ) ; button . setOnClickListener ( listener ) ; }
Add a button to a RadioGroup
Add a button to a RadioGroup