Search in sources :

Example 1 with LayoutParams

use of net.osmand.plus.widgets.FlowLayout.LayoutParams in project Osmand by osmandapp.

the class IconsCard method fillIconsSelector.

private void fillIconsSelector() {
    iconsSelector = view.findViewById(R.id.icons_selector);
    iconsSelector.removeAllViews();
    iconsSelector.setHorizontalAutoSpacing(true);
    LayoutInflater inflater = UiUtilities.getInflater(mapActivity, nightMode);
    for (String iconName : getIconNameListToShow()) {
        int width = getDimen(R.dimen.favorites_select_icon_button_right_padding);
        LayoutParams layoutParams = new LayoutParams(width, 0);
        iconsSelector.addView(createIconItemView(inflater, iconName), layoutParams);
    }
}
Also used : LayoutParams(net.osmand.plus.widgets.FlowLayout.LayoutParams) LayoutInflater(android.view.LayoutInflater) SuppressLint(android.annotation.SuppressLint)

Example 2 with LayoutParams

use of net.osmand.plus.widgets.FlowLayout.LayoutParams in project Osmand by osmandapp.

the class ColorsCard method createColorSelector.

private void createColorSelector() {
    FlowLayout selectCustomColor = view.findViewById(R.id.select_custom_color);
    selectCustomColor.removeAllViews();
    selectCustomColor.setHorizontalAutoSpacing(true);
    int minimalPaddingBetweenIcon = getDimen(R.dimen.favorites_select_icon_button_right_padding);
    for (int color : customColors) {
        selectCustomColor.addView(createColorItemView(color, selectCustomColor, true), new LayoutParams(minimalPaddingBetweenIcon, 0));
    }
    if (customColors.size() < 6) {
        selectCustomColor.addView(createAddCustomColorItemView(selectCustomColor), new LayoutParams(minimalPaddingBetweenIcon, 0));
    }
    FlowLayout selectDefaultColor = view.findViewById(R.id.select_default_color);
    selectDefaultColor.removeAllViews();
    selectDefaultColor.setHorizontalAutoSpacing(true);
    for (int color : colors) {
        selectDefaultColor.addView(createColorItemView(color, selectDefaultColor, false), new LayoutParams(minimalPaddingBetweenIcon, 0));
    }
    updateColorSelector(selectedColor);
}
Also used : FlowLayout(net.osmand.plus.widgets.FlowLayout) LayoutParams(net.osmand.plus.widgets.FlowLayout.LayoutParams)

Aggregations

LayoutParams (net.osmand.plus.widgets.FlowLayout.LayoutParams)2 SuppressLint (android.annotation.SuppressLint)1 LayoutInflater (android.view.LayoutInflater)1 FlowLayout (net.osmand.plus.widgets.FlowLayout)1