use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem 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);
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem in project Osmand by osmandapp.
the class FileTypeBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.choose_file_type)));
Drawable fileIcon = getContentIcon(R.drawable.ic_type_file);
BaseBottomSheetItem oscItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.osc_file_desc)).setIcon(fileIcon).setTitle(getString(R.string.osc_file)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.FILE_TYPE_OSC);
}
dismiss();
}
}).create();
items.add(oscItem);
items.add(new DividerHalfItem(getContext()));
BaseBottomSheetItem gpxItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.gpx_file_desc)).setIcon(fileIcon).setTitle(getString(R.string.gpx_file)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.FILE_TYPE_GPX);
}
dismiss();
}
}).create();
items.add(gpxItem);
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem in project Osmand by osmandapp.
the class SaveAsNewTrackBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_save_as_gpx)));
items.add(new DescriptionItem(getString(R.string.measurement_tool_save_as_new_track_descr)));
if (Build.VERSION.SDK_INT >= 18) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View imagesRow = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_save_as_new_track_images_row, null);
final ImageView routePointImage = (ImageView) imagesRow.findViewById(R.id.route_point_image);
final ImageView lineImage = (ImageView) imagesRow.findViewById(R.id.line_image);
routePointImage.setImageResource(nightMode ? R.drawable.img_help_trip_route_points_night : R.drawable.img_help_trip_route_points_day);
lineImage.setImageResource(nightMode ? R.drawable.img_help_trip_track_night : R.drawable.img_help_trip_track_day);
routePointImage.setOnClickListener(saveAsRoutePointOnClickListener);
lineImage.setOnClickListener(saveAsLineOnClickListener);
View.OnTouchListener textOnTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
};
imagesRow.findViewById(R.id.line_text).setOnTouchListener(textOnTouchListener);
imagesRow.findViewById(R.id.route_point_text).setOnTouchListener(textOnTouchListener);
items.add(new BaseBottomSheetItem.Builder().setCustomView(imagesRow).create());
}
BaseBottomSheetItem saveAsRoutePointsItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_route_points)).setTitle(getString(R.string.save_as_route_point)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(saveAsRoutePointOnClickListener).create();
items.add(saveAsRoutePointsItem);
BaseBottomSheetItem saveAsLineItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_split_interval)).setTitle(getString(R.string.save_as_line)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(saveAsLineOnClickListener).create();
items.add(saveAsLineItem);
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem in project Osmand by osmandapp.
the class OsmEditOptionsBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
final OsmPoint osmPoint = (OsmPoint) args.getSerializable(OSM_POINT);
items.add(new TitleItem(OsmEditingPlugin.getName(osmPoint) + ":"));
BaseBottomSheetItem uploadItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_export)).setTitle(getString(R.string.local_openstreetmap_upload)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onUploadClick(osmPoint);
}
dismiss();
}
}).create();
items.add(uploadItem);
BaseBottomSheetItem showOnMapItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_show_on_map)).setTitle(getString(R.string.shared_string_show_on_map)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onShowOnMapClick(osmPoint);
}
dismiss();
}
}).create();
items.add(showOnMapItem);
items.add(new DividerHalfItem(getContext()));
if (osmPoint instanceof OpenstreetmapPoint && osmPoint.getAction() != OsmPoint.Action.DELETE) {
BaseBottomSheetItem modifyOsmChangeItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_edit_dark)).setTitle(getString(R.string.poi_context_menu_modify_osm_change)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onModifyOsmChangeClick(osmPoint);
}
dismiss();
}
}).create();
items.add(modifyOsmChangeItem);
}
if (osmPoint instanceof OsmNotesPoint) {
BaseBottomSheetItem modifyOsmNoteItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_edit_dark)).setTitle(getString(R.string.context_menu_item_modify_note)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onModifyOsmNoteClick(osmPoint);
}
dismiss();
}
}).create();
items.add(modifyOsmNoteItem);
}
BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_delete_dark)).setTitle(getString(R.string.shared_string_delete)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onDeleteClick(osmPoint);
}
dismiss();
}
}).create();
items.add(deleteItem);
}
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem in project Osmand by osmandapp.
the class HistoryMarkerMenuBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
Bundle arguments = getArguments();
if (arguments != null) {
final int pos = arguments.getInt(MARKER_POSITION);
final String markerName = arguments.getString(MARKER_NAME);
final int markerColorIndex = arguments.getInt(MARKER_COLOR_INDEX);
final long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE);
Date date = new Date(markerVisitedDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
month = Algorithms.capitalizeFirstLetter(month);
month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
BaseBottomSheetItem markerItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.passed, month + " " + day)).setIcon(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex))).setTitle(markerName).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).create();
items.add(markerItem);
items.add(new DividerItem(getContext()));
BaseBottomSheetItem makeActiveItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_reset_to_default_dark)).setTitle(getString(R.string.make_active)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onMakeMarkerActive(pos);
}
dismiss();
}
}).create();
items.add(makeActiveItem);
BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_delete_dark)).setTitle(getString(R.string.shared_string_delete)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onDeleteMarker(pos);
}
dismiss();
}
}).create();
items.add(deleteItem);
}
}
Aggregations