Search in sources :

Example 6 with BaseBottomSheetItem

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

the class PlanRouteOptionsBottomSheetDialogFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    items.add(new TitleItem(getString(R.string.shared_string_options)));
    if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
        boolean selectAll = getArguments().getBoolean(SELECT_ALL_KEY);
        BaseBottomSheetItem selectItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all)).setTitle(getString(selectAll ? R.string.shared_string_select_all : R.string.shared_string_deselect_all)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.selectOnClick();
                }
                dismiss();
            }
        }).create();
        items.add(selectItem);
    }
    BaseBottomSheetItem navigateItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark)).setTitle(getString(R.string.get_directions)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.navigateOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(navigateItem);
    BaseBottomSheetItem roundTripItem = new BottomSheetItemWithCompoundButton.Builder().setChecked(getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get()).setDescription(getString(R.string.make_round_trip_descr)).setIcon(getContentIcon(R.drawable.ic_action_trip_round)).setTitle(getString(R.string.make_round_trip)).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.makeRoundTripOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(roundTripItem);
    items.add(new SubtitleDividerItem(getContext()));
    items.add(new SubtitleItem(getString(R.string.sort_by)));
    BaseBottomSheetItem doorToDoorItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door)).setTitle(getString(R.string.intermediate_items_sort_by_distance)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.doorToDoorOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(doorToDoorItem);
    BaseBottomSheetItem reversItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_sort_reverse_order)).setTitle(getString(R.string.shared_string_reverse_order)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.reverseOrderOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(reversItem);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) SubtitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) View(android.view.View) BottomSheetItemWithCompoundButton(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton) SubtitleDividerItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem)

Example 7 with BaseBottomSheetItem

use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem 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);
}
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) BottomSheetItemWithCompoundButton(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)

Example 8 with BaseBottomSheetItem

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

Example 9 with BaseBottomSheetItem

use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem 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);
}
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)

Example 10 with BaseBottomSheetItem

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

the class SelectedPointBottomSheetDialogFragment method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder().setDescription(getDescription()).setIcon(getActiveIcon(R.drawable.ic_action_measure_point)).setTitle(getTitle()).setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp).create();
    items.add(titleItem);
    items.add(new TitleDividerItem(getContext()));
    BaseBottomSheetItem moveItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_move_point)).setTitle(getString(R.string.shared_string_move)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.moveOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(moveItem);
    BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_remove_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.deleteOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(deleteItem);
    items.add(new DividerHalfItem(getContext()));
    BaseBottomSheetItem addAfterItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_addpoint_above)).setTitle(getString(R.string.add_point_after)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.addPointAfterOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(addAfterItem);
    BaseBottomSheetItem addBeforeItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_addpoint_below)).setTitle(getString(R.string.add_point_before)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (listener != null) {
                listener.addPointBeforeOnClick();
            }
            dismiss();
        }
    }).create();
    items.add(addBeforeItem);
}
Also used : BaseBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem) SimpleBottomSheetItem(net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem) DividerHalfItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem) TitleDividerItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleDividerItem) View(android.view.View) BottomSheetItemWithDescription(net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription)

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