use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem 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);
}
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem 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);
}
use of net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem in project Osmand by osmandapp.
the class SortByMenuBottomSheetDialogFragment method createMenuItems.
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_sort)));
BaseBottomSheetItem byTypeItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_groped_by_type)).setTitle(getString(R.string.by_type)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectSortByMode(NotesSortByMode.BY_TYPE);
}
}).create();
items.add(byTypeItem);
BaseBottomSheetItem byDateItem = new SimpleBottomSheetItem.Builder().setIcon(getContentIcon(R.drawable.ic_action_sort_by_date)).setTitle(getString(R.string.by_date)).setLayoutId(R.layout.bottom_sheet_item_simple).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectSortByMode(NotesSortByMode.BY_DATE);
}
}).create();
items.add(byDateItem);
}
Aggregations