Search in sources :

Example 11 with BaseBottomSheetItem

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);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View) DescriptionItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem)

Example 12 with BaseBottomSheetItem

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);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) Drawable(android.graphics.drawable.Drawable) DividerHalfItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View)

Example 13 with BaseBottomSheetItem

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);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) ImageView(android.widget.ImageView) View(android.view.View) MotionEvent(android.view.MotionEvent) ContextThemeWrapper(android.view.ContextThemeWrapper) ImageView(android.widget.ImageView) DescriptionItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem)

Example 14 with BaseBottomSheetItem

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);
    }
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) Bundle(android.os.Bundle) DividerHalfItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View)

Example 15 with BaseBottomSheetItem

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);
    }
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) Bundle(android.os.Bundle) View(android.view.View) Date(java.util.Date) BottomSheetItemWithDescription(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription) DividerItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

View (android.view.View)18 BaseBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem)18 TitleItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem)15 SimpleBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem)12 DividerHalfItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem)8 Bundle (android.os.Bundle)6 BottomSheetItemWithDescription (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription)5 Drawable (android.graphics.drawable.Drawable)3 ContextThemeWrapper (android.view.ContextThemeWrapper)3 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)3 DescriptionItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem)3 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 OsmandApplication (net.osmand.plus.OsmandApplication)2 SubtitleDividerItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem)2 SubtitleItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleItem)2 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Nullable (android.support.annotation.Nullable)1 AlertDialog (android.support.v7.app.AlertDialog)1