use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton in project Osmand by osmandapp.
the class SelectionBottomSheet method createHeaderView.
private BaseBottomSheetItem createHeaderView() {
View view = inflater.inflate(R.layout.settings_group_title, null);
title = view.findViewById(R.id.title);
titleDescription = view.findViewById(R.id.title_description);
primaryDescription = view.findViewById(R.id.primary_description);
secondaryDescription = view.findViewById(R.id.secondary_description);
selectedSize = view.findViewById(R.id.selected_size);
toggleContainer = view.findViewById(R.id.custom_radio_buttons);
radioGroup = new TextToggleButton(app, toggleContainer, nightMode);
selectAllButton = view.findViewById(R.id.select_all_button);
checkBoxTitle = view.findViewById(R.id.check_box_title);
checkBox = view.findViewById(R.id.check_box);
if (modes != null) {
radioGroup.setItems(modes);
}
return new SimpleBottomSheetItem.Builder().setCustomView(view).create();
}
use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton in project Osmand by osmandapp.
the class HikingRoutesFragment method setupTypesCard.
private void setupTypesCard(@NonNull View view) {
View container = view.findViewById(R.id.card_container);
boolean enabled = property != null && isEnabled();
if (enabled) {
TextRadioItem selectedItem = null;
List<TextRadioItem> items = new ArrayList<>();
for (String value : property.getPossibleValues()) {
TextRadioItem item = createRadioButton(value);
if (Algorithms.stringsEqual(value, pref.get())) {
selectedItem = item;
}
items.add(item);
}
TextView title = container.findViewById(R.id.title);
TextView description = container.findViewById(R.id.description);
title.setText(R.string.routes_color_by_type);
description.setText(AndroidUtils.getRenderingStringPropertyDescription(app, pref.get()));
LinearLayout radioButtonsContainer = view.findViewById(R.id.custom_radio_buttons);
TextToggleButton radioGroup = new TextToggleButton(app, radioButtonsContainer, nightMode, true);
radioGroup.setItems(items);
radioGroup.setSelectedItem(selectedItem);
}
AndroidUiHelper.updateVisibility(container, enabled);
AndroidUiHelper.updateVisibility(container.findViewById(R.id.descr), false);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.topShadowView), enabled);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.card_bottom_divider), enabled);
}
use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton in project Osmand by osmandapp.
the class CycleRoutesFragment method setupTypesCard.
private void setupTypesCard(@NonNull View view) {
CommonPreference<Boolean> pref = settings.getCustomRenderBooleanProperty(CYCLE_NODE_NETWORK_ROUTES_ATTR);
View container = view.findViewById(R.id.card_container);
TextView title = container.findViewById(R.id.title);
TextView description = container.findViewById(R.id.description);
title.setText(R.string.routes_color_by_type);
description.setText(pref.get() ? R.string.rendering_value_walkingRoutesOSMCNodes_description : R.string.walking_route_osmc_description);
TextRadioItem relation = createRadioButton(pref, false, R.string.layer_route);
TextRadioItem nodeNetworks = createRadioButton(pref, true, R.string.rendering_value_walkingRoutesOSMCNodes_name);
TextToggleButton radioGroup = new TextToggleButton(app, view.findViewById(R.id.custom_radio_buttons), nightMode);
radioGroup.setItems(relation, nodeNetworks);
radioGroup.setSelectedItem(pref.get() ? nodeNetworks : relation);
boolean enabled = getPreference().get();
AndroidUiHelper.updateVisibility(container, enabled);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.topShadowView), enabled);
AndroidUiHelper.updateVisibility(container.findViewById(R.id.descr), false);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.card_bottom_divider), enabled);
}
use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton in project Osmand by osmandapp.
the class TravelRoutesFragment method setupTypeRadioGroup.
private void setupTypeRadioGroup(@NonNull View view) {
boolean selected = settings.SHOW_TRAVEL.get();
LinearLayout buttonsContainer = view.findViewById(R.id.custom_radio_buttons);
if (selected) {
TextRadioItem routes = createRadioButton(TravelType.ROUTE_TYPES);
TextRadioItem files = createRadioButton(TravelType.TRAVEL_FILES);
TextRadioItem points = createRadioButton(TravelType.ROUTE_POINTS);
TextToggleButton radioGroup = new TextToggleButton(app, buttonsContainer, nightMode, true);
radioGroup.setItems(routes, files, points);
switch(travelType) {
case ROUTE_TYPES:
radioGroup.setSelectedItem(routes);
break;
case TRAVEL_FILES:
radioGroup.setSelectedItem(files);
break;
case ROUTE_POINTS:
radioGroup.setSelectedItem(points);
break;
}
}
AndroidUiHelper.updateVisibility(buttonsContainer, selected);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.space), selected);
AndroidUiHelper.updateVisibility(view.findViewById(R.id.header_divider), selected);
}
use of net.osmand.plus.widgets.multistatetoggle.TextToggleButton in project Osmand by osmandapp.
the class GPXAction method setupTrackToggleButton.
private void setupTrackToggleButton(@NonNull View container, @NonNull MapActivity mapActivity) {
OsmandApplication app = mapActivity.getMyApplication();
boolean night = isNightMode(mapActivity);
LinearLayout trackToggle = container.findViewById(R.id.track_toggle);
trackToggleButton = new TextToggleButton(app, trackToggle, night);
TextRadioItem alwaysAskButton = new TextRadioItem(app.getString(R.string.confirm_every_run));
TextRadioItem selectTrackButton = new TextRadioItem(app.getString(R.string.shared_string_select));
alwaysAskButton.setOnClickListener(getOnTrackToggleButtonClicked(container, true, mapActivity));
selectTrackButton.setOnClickListener(getOnTrackToggleButtonClicked(container, false, mapActivity));
trackToggleButton.setItems(alwaysAskButton, selectTrackButton);
trackToggleButton.setSelectedItem(shouldUseSelectedGpxFile() ? selectTrackButton : alwaysAskButton);
updateTrackBottomInfo(container, !shouldUseSelectedGpxFile());
setupSelectAnotherTrackButton(container, night, mapActivity);
if (shouldUseSelectedGpxFile()) {
setupGpxTrackInfo(container, app);
}
}
Aggregations