use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.
the class OptionsBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
boolean snapToRoadEnabled = args.getBoolean(SNAP_TO_ROAD_ENABLED_KEY);
boolean addLineMode = args.getBoolean(ADD_LINE_MODE_KEY);
items.add(new TitleItem(getString(R.string.shared_string_options)));
BaseBottomSheetItem snapToRoadItem = new BottomSheetItemWithCompoundButton.Builder().setChecked(snapToRoadEnabled).setDescription(getString(snapToRoadEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled)).setIcon(snapToRoadEnabled ? getActiveIcon(R.drawable.ic_action_snap_to_road) : getContentIcon(R.drawable.ic_action_snap_to_road)).setTitle(getString(R.string.snap_to_road)).setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.snapToRoadOnCLick();
}
dismiss();
}
}).create();
items.add(snapToRoadItem);
items.add(new DividerHalfItem(getContext()));
if (addLineMode) {
BaseBottomSheetItem saveAsNewSegmentItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_polygom_dark)).setTitle(getString(R.string.shared_string_save)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addToGpxOnClick();
}
dismiss();
}
}).create();
items.add(saveAsNewSegmentItem);
} else {
BaseBottomSheetItem saveAsNewTrackItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_polygom_dark)).setTitle(getString(R.string.shared_string_save_as_gpx)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.saveAsNewTrackOnClick();
}
dismiss();
}
}).create();
items.add(saveAsNewTrackItem);
BaseBottomSheetItem addToTrackItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_split_interval)).setTitle(getString(R.string.add_segment_to_the_track)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addToTheTrackOnClick();
}
dismiss();
}
}).create();
items.add(addToTrackItem);
}
items.add(new DividerHalfItem(getContext()));
BaseBottomSheetItem clearAllItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_reset_to_default_dark)).setTitle(getString(R.string.shared_string_clear_all)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.clearAllOnClick();
}
dismiss();
}
}).create();
items.add(clearAllItem);
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.
the class ExportOptionsBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
poiCount = args.getInt(POI_COUNT_KEY);
osmNotesCount = args.getInt(NOTES_COUNT_KEY);
}
items.add(new TitleItem(getString(R.string.shared_string_export)));
items.add(new DescriptionItem(getString(R.string.osm_edits_export_desc)));
BaseBottomSheetItem poiItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(poiCount)).setIcon(getContentIcon(R.drawable.ic_action_info_dark)).setTitle(getString(R.string.poi)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(poiCount > 0)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);
}
dismiss();
}
}).create();
items.add(poiItem);
BaseBottomSheetItem osmNotesItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(osmNotesCount)).setIcon(getContentIcon(R.drawable.ic_action_bug_dark)).setTitle(getString(R.string.osm_notes)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(osmNotesCount > 0)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);
}
dismiss();
}
}).create();
items.add(osmNotesItem);
BaseBottomSheetItem allDataItem = new BottomSheetItemWithDescription.Builder().setDescription(String.valueOf(poiCount + osmNotesCount)).setIcon(getContentIcon(R.drawable.ic_action_folder)).setTitle(getString(R.string.all_data)).setLayoutId(R.layout.bottom_sheet_item_with_right_descr).setDisabled(!(poiCount + osmNotesCount > 0)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);
}
dismiss();
}
}).create();
items.add(allDataItem);
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.
the class ParkingTypeBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.parking_options)));
BaseBottomSheetItem byTypeItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_time_start)).setTitle(getString(R.string.osmand_parking_no_lim_text)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addParkingPosition(false);
}
}).create();
items.add(byTypeItem);
BaseBottomSheetItem byDateItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_time_span)).setTitle(getString(R.string.osmand_parking_time_limit)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addParkingPosition(true);
}
}).create();
items.add(byDateItem);
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.
the class SelectWptCategoriesBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
gpxFile = getGpxFile();
if (gpxFile == null) {
return;
}
items.add(new TitleItem(getGpxName(gpxFile)));
items.add(new DescriptionItem(getString(R.string.select_waypoints_category_description)));
final BottomSheetItemWithCompoundButton[] selectAllItem = new BottomSheetItemWithCompoundButton[1];
selectAllItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(true).setDescription(getString(R.string.shared_string_total) + ": " + gpxFile.getPoints().size()).setIcon(getContentIcon(R.drawable.ic_action_group_select_all)).setTitle(getString(R.string.shared_string_select_all)).setLayoutId(R.layout.bottom_sheet_item_with_descr_and_checkbox_56dp).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !selectAllItem[0].isChecked();
selectAllItem[0].setChecked(checked);
for (BottomSheetItemWithCompoundButton item : categoryItems) {
item.setChecked(checked);
}
}
}).create();
items.add(selectAllItem[0]);
items.add(new DividerItem(getContext()));
Map<String, List<WptPt>> pointsByCategories = gpxFile.getPointsByCategories();
for (String category : pointsByCategories.keySet()) {
final BottomSheetItemWithCompoundButton[] categoryItem = new BottomSheetItemWithCompoundButton[1];
categoryItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder().setChecked(true).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
selectedCategories.add((String) categoryItem[0].getTag());
} else {
selectedCategories.remove((String) categoryItem[0].getTag());
}
}
}).setDescription(String.valueOf(pointsByCategories.get(category).size())).setIcon(getContentIcon(R.drawable.ic_action_folder)).setTitle(category.equals("") ? getString(R.string.waypoints) : category).setLayoutId(R.layout.bottom_sheet_item_with_descr_and_checkbox_56dp).setTag(category).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
categoryItem[0].setChecked(!categoryItem[0].isChecked());
selectAllItem[0].setChecked(isAllChecked());
}
}).create();
items.add(categoryItem[0]);
categoryItems.add(categoryItem[0]);
selectedCategories.add(category);
}
}
use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.
the class SelectionMarkersGroupBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.add_group)));
items.add(new DescriptionItem(getString(R.string.add_group_descr)));
BaseBottomSheetItem favoritesItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_fav_dark)).setTitle(getString(R.string.favourites_group)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.favouritesOnClick();
}
dismiss();
}
}).create();
items.add(favoritesItem);
BaseBottomSheetItem waypointsItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_polygom_dark)).setTitle(getString(R.string.track_waypoints)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.waypointsOnClick();
}
dismiss();
}
}).create();
items.add(waypointsItem);
}
Aggregations