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);
}
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);
}
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;
}
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;
}
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;
}
Aggregations