Search in sources :

Example 6 with TextRadioItem

use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem in project Osmand by osmandapp.

the class GPXAction method setupWaypointAppearanceToggle.

private void setupWaypointAppearanceToggle(@NonNull View container, @NonNull MapActivity mapActivity) {
    OsmandApplication app = mapActivity.getMyApplication();
    boolean night = isNightMode(mapActivity);
    boolean usePredefinedAppearance = predefinedWaypoint != null || Boolean.parseBoolean(getParams().get(KEY_USE_PREDEFINED_WPT_APPEARANCE));
    LinearLayout appearanceToggle = container.findViewById(R.id.appearance_toggle);
    appearanceToggleButton = new TextToggleButton(app, appearanceToggle, night);
    TextRadioItem alwaysAskButton = new TextRadioItem(app.getString(R.string.confirm_every_run));
    TextRadioItem predefinedAppearanceButton = new TextRadioItem(app.getString(R.string.shared_string_predefined));
    alwaysAskButton.setOnClickListener(getOnAppearanceToggleButtonClicked(container, true, mapActivity));
    predefinedAppearanceButton.setOnClickListener(getOnAppearanceToggleButtonClicked(container, false, mapActivity));
    appearanceToggleButton.setItems(alwaysAskButton, predefinedAppearanceButton);
    TextRadioItem selectedItem = usePredefinedAppearance ? predefinedAppearanceButton : alwaysAskButton;
    appearanceToggleButton.setSelectedItem(selectedItem);
    updateAppearanceBottomInfo(container, !usePredefinedAppearance, mapActivity);
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) TextToggleButton(net.osmand.plus.widgets.multistatetoggle.TextToggleButton) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) LinearLayout(android.widget.LinearLayout)

Example 7 with TextRadioItem

use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem in project Osmand by osmandapp.

the class SelectNavProfileBottomSheet method createHeader.

private void createHeader() {
    items.add(new TitleItem(getString(R.string.select_nav_profile_dialog_title)));
    items.add(new LongDescriptionItem(getString(R.string.select_nav_profile_dialog_message)));
    TextRadioItem offline = createRadioButton(DialogMode.OFFLINE);
    TextRadioItem online = createRadioButton(DialogMode.ONLINE);
    TextRadioItem selectedItem = dialogMode == DialogMode.ONLINE ? online : offline;
    addToggleButton(selectedItem, offline, online);
}
Also used : LongDescriptionItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem) TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem)

Example 8 with TextRadioItem

use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem in project Osmand by osmandapp.

the class SelectNavProfileBottomSheet method createRadioButton.

private TextRadioItem createRadioButton(final DialogMode mode) {
    String title = getString(mode.titleId);
    TextRadioItem item = new TextRadioItem(title);
    item.setOnClickListener((radioItem, view) -> {
        if (dialogMode != mode) {
            dialogMode = mode;
            predefinedGroups = null;
            triedToDownload = false;
            updateMenuItems();
            return true;
        }
        return false;
    });
    return item;
}
Also used : TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem)

Example 9 with TextRadioItem

use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem in project Osmand by osmandapp.

the class VoiceLanguageBottomSheetFragment method createRadioButton.

private TextRadioItem createRadioButton(final InfoType voiceType) {
    String title = getString(voiceType.titleRes);
    TextRadioItem item = new TextRadioItem(title);
    item.setOnClickListener((radioItem, view) -> {
        selectedVoiceType = voiceType;
        updateMenuItems();
        return true;
    });
    return item;
}
Also used : TextRadioItem(net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem)

Example 10 with TextRadioItem

use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem 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)

Aggregations

TextRadioItem (net.osmand.plus.widgets.multistatetoggle.TextToggleButton.TextRadioItem)19 View (android.view.View)10 TextToggleButton (net.osmand.plus.widgets.multistatetoggle.TextToggleButton)10 TextView (android.widget.TextView)9 ImageView (android.widget.ImageView)6 LinearLayout (android.widget.LinearLayout)6 RadioItem (net.osmand.plus.widgets.multistatetoggle.RadioItem)5 OnRadioItemClickListener (net.osmand.plus.widgets.multistatetoggle.RadioItem.OnRadioItemClickListener)5 OsmandApplication (net.osmand.plus.OsmandApplication)3 Drawable (android.graphics.drawable.Drawable)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 MapActivity (net.osmand.plus.activities.MapActivity)2 Typeface (android.graphics.Typeface)1 SpannableString (android.text.SpannableString)1 LayoutInflater (android.view.LayoutInflater)1 OnClickListener (android.view.View.OnClickListener)1 CompoundButton (android.widget.CompoundButton)1 ImageButton (android.widget.ImageButton)1 Nullable (androidx.annotation.Nullable)1 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)1