Search in sources :

Example 1 with OnRadioItemClickListener

use of net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener in project Osmand by osmandapp.

the class MultiStateToggleButton method createBtn.

private void createBtn(@NonNull final _Radio item) {
    LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
    ViewGroup button = (ViewGroup) inflater.inflate(getRadioItemLayoutId(), container, false);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            OnRadioItemClickListener l = item.getListener();
            if (l != null && l.onRadioItemClick(item, container)) {
                setSelectedItem(item);
            }
        }
    });
    initItemView(button, item);
    buttons.add(button);
    container.addView(button);
}
Also used : ViewGroup(android.view.ViewGroup) OnRadioItemClickListener(net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener) LayoutInflater(android.view.LayoutInflater) View(android.view.View)

Example 2 with OnRadioItemClickListener

use of net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener in project Osmand by osmandapp.

the class HikingRoutesFragment method createRadioButton.

private TextRadioItem createRadioButton(@NonNull String value) {
    String name = AndroidUtils.getRenderingStringPropertyValue(app, value);
    TextRadioItem item = new TextRadioItem(name);
    item.setOnClickListener(new OnRadioItemClickListener() {

        @Override
        public boolean onRadioItemClick(RadioItem radioItem, View v) {
            pref.set(value);
            previousValue = value;
            View view = getView();
            if (view != null) {
                setupHeader(view);
                setupTypesCard(view);
            }
            refreshMap();
            return true;
        }
    });
    return item;
}
Also used : OnRadioItemClickListener(net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) RadioItem(net.osmand.plus.widgets.multistatetoggle.RadioItem) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 3 with OnRadioItemClickListener

use of net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener in project Osmand by osmandapp.

the class CycleRoutesFragment method createRadioButton.

private TextRadioItem createRadioButton(@NonNull CommonPreference<Boolean> pref, boolean enabled, int titleId) {
    TextRadioItem item = new TextRadioItem(getString(titleId));
    item.setOnClickListener(new OnRadioItemClickListener() {

        @Override
        public boolean onRadioItemClick(RadioItem radioItem, View view) {
            pref.set(enabled);
            View mainView = getView();
            if (mainView != null) {
                setupTypesCard(mainView);
            }
            MapActivity mapActivity = (MapActivity) getMyActivity();
            if (mapActivity != null) {
                mapActivity.refreshMapComplete();
                mapActivity.getMapLayers().updateLayers(mapActivity);
            }
            return true;
        }
    });
    return item;
}
Also used : OnRadioItemClickListener(net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) RadioItem(net.osmand.plus.widgets.multistatetoggle.RadioItem) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) MapActivity(net.osmand.plus.activities.MapActivity)

Example 4 with OnRadioItemClickListener

use of net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener in project Osmand by osmandapp.

the class RouteLineColorCard method createMapThemeButton.

private TextRadioItem createMapThemeButton(final boolean isNight) {
    TextRadioItem item = new TextRadioItem(app.getString(!isNight ? DAY_TITLE_ID : NIGHT_TITLE_ID));
    item.setOnClickListener(new OnRadioItemClickListener() {

        @Override
        public boolean onRadioItemClick(RadioItem radioItem, View view) {
            selectedMapTheme = isNight ? DayNightMode.NIGHT : DayNightMode.DAY;
            changeMapTheme(selectedMapTheme);
            updateDescription();
            return true;
        }
    });
    return item;
}
Also used : OnRadioItemClickListener(net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) RadioItem(net.osmand.plus.widgets.multistatetoggle.RadioItem) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView)

Example 5 with OnRadioItemClickListener

use of net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener in project Osmand by osmandapp.

the class SplitIntervalBottomSheet method createRadioButton.

private TextRadioItem createRadioButton(final GpxSplitType splitType, int titleId) {
    String title = app.getString(titleId);
    TextRadioItem item = new TextRadioItem(title);
    item.setOnClickListener(new OnRadioItemClickListener() {

        @Override
        public boolean onRadioItemClick(RadioItem radioItem, View view) {
            selectedSplitType = splitType;
            updateSlider();
            return true;
        }
    });
    return item;
}
Also used : OnRadioItemClickListener(net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) RadioItem(net.osmand.plus.widgets.multistatetoggle.RadioItem) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) View(android.view.View) TextView(android.widget.TextView)

Aggregations

View (android.view.View)6 OnRadioItemClickListener (net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener)6 RadioItem (net.osmand.plus.widgets.multistatetoggle.RadioItem)5 TextRadioItem (net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem)5 TextView (android.widget.TextView)4 ImageView (android.widget.ImageView)2 LayoutInflater (android.view.LayoutInflater)1 ViewGroup (android.view.ViewGroup)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 MapActivity (net.osmand.plus.activities.MapActivity)1