Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-11-04 10:37:20 +01:00
commit cc80448b3d

View file

@ -693,18 +693,6 @@ public class MapActivityActions implements DialogProvider {
}).createItem()); }).createItem());
} }
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
.setIcon(R.drawable.ic_action_layers_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
app.logEvent(mapActivity, "drawer_config_map_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
return false;
}
}).createItem());
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity) optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity)
.setIcon(R.drawable.ic_action_gdirections_dark) .setIcon(R.drawable.ic_action_gdirections_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() { .setListener(new ContextMenuAdapter.ItemClickListener() {
@ -719,6 +707,41 @@ public class MapActivityActions implements DialogProvider {
} }
}).createItem()); }).createItem());
/*
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.show_point_options, mapActivity)
.setIcon(R.drawable.ic_action_marker_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true);
return true;
}
}).createItem());
*/
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity)
.setIcon(R.drawable.ic_action_ruler)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;
}
}).createItem());
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
.setIcon(R.drawable.ic_action_layers_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
app.logEvent(mapActivity, "drawer_config_map_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
return false;
}
}).createItem());
String d = getString(R.string.welmode_download_maps); String d = getString(R.string.welmode_download_maps);
if (app.getDownloadThread().getIndexes().isDownloadedFromInternet) { if (app.getDownloadThread().getIndexes().isDownloadedFromInternet) {
List<IndexItem> updt = app.getDownloadThread().getIndexes().getItemsToUpdate(); List<IndexItem> updt = app.getDownloadThread().getIndexes().getItemsToUpdate();
@ -755,29 +778,6 @@ public class MapActivityActions implements DialogProvider {
}).createItem()); }).createItem());
} }
/*
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.show_point_options, mapActivity)
.setIcon(R.drawable.ic_action_marker_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
MapActivity.clearPrevActivityIntent();
mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true);
return true;
}
}).createItem());
*/
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity)
.setIcon(R.drawable.ic_action_ruler)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;
}
}).createItem());
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.prefs_plugins, mapActivity) optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.prefs_plugins, mapActivity)
.setIcon(R.drawable.ic_extension_dark) .setIcon(R.drawable.ic_extension_dark)
.setListener(new ItemClickListener() { .setListener(new ItemClickListener() {
@ -847,16 +847,17 @@ public class MapActivityActions implements DialogProvider {
//////////// Others //////////// Others
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper); OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
int measureDistanceItemIndex = -1; // Place divider between functionality and configuration related menu items
int dividerItemIndex = -1;
for (int i = 0; i < optionsMenuHelper.length(); i++) { for (int i = 0; i < optionsMenuHelper.length(); i++) {
if (optionsMenuHelper.getItem(i).getTitleId() == R.string.measurement_tool) { if (optionsMenuHelper.getItem(i).getTitleId() == R.string.configure_map) {
measureDistanceItemIndex = i; dividerItemIndex = i;
break; break;
} }
} }
ItemBuilder divider = new ItemBuilder().setLayout(R.layout.drawer_divider); ItemBuilder divider = new ItemBuilder().setLayout(R.layout.drawer_divider);
divider.setPosition(measureDistanceItemIndex >= 0 ? measureDistanceItemIndex : 8); divider.setPosition(dividerItemIndex >= 0 ? dividerItemIndex : 8);
optionsMenuHelper.addItem(divider.createItem()); optionsMenuHelper.addItem(divider.createItem());
getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper); getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper);