Search in sources :

Example 11 with TitleItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem 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 12 with TitleItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem 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 13 with TitleItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem 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 14 with TitleItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.

the class ShareMenuFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    items.add(new TitleItem(getString(R.string.share_menu_location)));
    View.OnClickListener itemOnClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
            menu.share((ShareItem) v.getTag());
        }
    };
    for (ShareItem shareItem : menu.getItems()) {
        BaseBottomSheetItem item = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(shareItem.getIconResourceId())).setTitle(getString(shareItem.getTitleResourceId())).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(itemOnClickListener).setTag(shareItem).create();
        items.add(item);
    }
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) ShareItem(net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View)

Example 15 with TitleItem

use of net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem in project Osmand by osmandapp.

the class AddWaypointBottomSheetDialogFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    Bundle args = getArguments();
    final LatLon latLon = new LatLon(args.getDouble(LAT_KEY), args.getDouble(LON_KEY));
    final PointDescription name = PointDescription.deserializeFromString(args.getString(POINT_DESCRIPTION_KEY), latLon);
    final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
    items.add(new TitleItem(getString(R.string.new_destination_point_dialog)));
    BaseBottomSheetItem replaceDestItem = new BottomSheetItemWithDescription.Builder().setDescription(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false)).setDescriptionColorId(R.color.searchbar_text_hint_light).setIcon(getIcon(R.drawable.list_destination, 0)).setTitle(getString(R.string.replace_destination_point)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            targetPointsHelper.navigateToPoint(latLon, true, -1, name);
            dismiss();
        }
    }).create();
    items.add(replaceDestItem);
    BaseBottomSheetItem replaceStartItem = new BottomSheetItemWithDescription.Builder().setDescription(getCurrentPointName(targetPointsHelper.getPointToStart(), true)).setDescriptionColorId(R.color.searchbar_text_hint_light).setIcon(getIcon(R.drawable.list_startpoint, 0)).setTitle(getString(R.string.make_as_start_point)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            TargetPoint start = targetPointsHelper.getPointToStart();
            if (start != null) {
                targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()), false, 0, start.getOriginalPointDescription());
            }
            targetPointsHelper.setStartPoint(latLon, true, name);
            dismiss();
        }
    }).create();
    items.add(replaceStartItem);
    items.add(new DividerHalfItem(getContext(), getBottomDividerColorId()));
    BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.subsequent_dest_description)).setDescriptionColorId(R.color.searchbar_text_hint_light).setIcon(getSubsequentDestIcon()).setTitle(getString(R.string.keep_and_add_destination_point)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            targetPointsHelper.navigateToPoint(latLon, true, targetPointsHelper.getIntermediatePoints().size() + 1, name);
            dismiss();
        }
    }).create();
    items.add(subsequentDestItem);
    BaseBottomSheetItem firstIntermItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.first_intermediate_dest_description)).setDescriptionColorId(R.color.searchbar_text_hint_light).setIcon(getFirstIntermDestIcon()).setTitle(getString(R.string.add_as_first_destination_point)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            targetPointsHelper.navigateToPoint(latLon, true, 0, name);
            dismiss();
        }
    }).create();
    items.add(firstIntermItem);
    BaseBottomSheetItem lastIntermItem = new BottomSheetItemWithDescription.Builder().setDescription(getString(R.string.last_intermediate_dest_description)).setDescriptionColorId(R.color.searchbar_text_hint_light).setIcon(getLastIntermDistIcon()).setTitle(getString(R.string.add_as_last_destination_point)).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            targetPointsHelper.navigateToPoint(latLon, true, targetPointsHelper.getIntermediatePoints().size(), name);
            dismiss();
        }
    }).create();
    items.add(lastIntermItem);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) LatLon(net.osmand.data.LatLon) Bundle(android.os.Bundle) PointDescription(net.osmand.data.PointDescription) DividerHalfItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) TargetPointsHelper(net.osmand.plus.TargetPointsHelper) View(android.view.View) BottomSheetItemWithDescription(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription)

Aggregations

View (android.view.View)16 TitleItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem)16 BaseBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem)15 SimpleBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem)10 DividerHalfItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem)7 Bundle (android.os.Bundle)5 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)4 DescriptionItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem)4 Drawable (android.graphics.drawable.Drawable)3 BottomSheetItemWithDescription (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription)3 ContextThemeWrapper (android.view.ContextThemeWrapper)2 ImageView (android.widget.ImageView)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 AlertDialog (android.support.v7.app.AlertDialog)1 ListPopupWindow (android.support.v7.widget.ListPopupWindow)1 MotionEvent (android.view.MotionEvent)1 AdapterView (android.widget.AdapterView)1