Osm notes menu in progress

This commit is contained in:
Alexander Sytnyk 2018-01-31 18:49:27 +02:00
parent fb105d4b30
commit 0ed9cc1665
3 changed files with 44 additions and 5 deletions

View file

@ -76,6 +76,7 @@ import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter;
import net.osmand.plus.mapillary.MapillaryFiltersFragment;
import net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment;
import net.osmand.plus.osmedit.OsmNotesMenu;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
@ -189,7 +190,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
UNDERLAY_MAP,
MAPILLARY,
CONTOUR_LINES,
HILLSHADE
HILLSHADE,
OSM_NOTES
}
private Map<DashboardActionButtonType, DashboardActionButton> actionButtons = new HashMap<>();
@ -428,6 +430,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
tv.setText(R.string.srtm_plugin_name);
} else if (visibleType == DashboardType.HILLSHADE) {
tv.setText(R.string.layer_hillshade);
} else if (visibleType == DashboardType.OSM_NOTES) {
tv.setText(R.string.osm_notes);
}
ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit);
edit.setVisibility(View.GONE);
@ -822,7 +826,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
&& visibleType != DashboardType.CONFIGURE_SCREEN
&& visibleType != DashboardType.CONFIGURE_MAP
&& visibleType != DashboardType.CONTOUR_LINES
&& visibleType != DashboardType.HILLSHADE) {
&& visibleType != DashboardType.HILLSHADE
&& visibleType != DashboardType.OSM_NOTES) {
listView.setDivider(dividerDrawable);
listView.setDividerHeight(dpToPx(1f));
} else {
@ -879,6 +884,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
cm = ContourLinesMenu.createListAdapter(mapActivity);
} else if (visibleType == DashboardType.HILLSHADE) {
cm = HillshadeMenu.createListAdapter(mapActivity);
} else if (visibleType == DashboardType.OSM_NOTES) {
cm = OsmNotesMenu.createListAdapter(mapActivity);
}
if (cm != null) {
updateListAdapter(cm);

View file

@ -15,6 +15,7 @@ import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.data.Amenity;
import net.osmand.osm.PoiType;
@ -30,6 +31,7 @@ import net.osmand.plus.activities.EnumAdapter;
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
@ -258,11 +260,23 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override
public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_osm_bugs, mapActivity)
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.layer_osm_bugs, mapActivity)
.setSelected(settings.SHOW_OSM_BUGS.get())
.setIcon(R.drawable.ic_action_bug_dark)
.setColor(settings.SHOW_OSM_BUGS.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setListener(new ContextMenuAdapter.ItemClickListener() {
.setSecondaryIcon(R.drawable.ic_action_additional_option)
.setListener(new ContextMenuAdapter.OnRowItemClick() {
@Override
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
if (itemId == R.string.layer_osm_bugs) {
mapActivity.getDashboard().setDashboardVisibility(true,
DashboardType.OSM_NOTES, AndroidUtils.getCenterViewCoordinates(view));
return false;
}
return true;
}
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
@ -279,7 +293,6 @@ public class OsmEditingPlugin extends OsmandPlugin {
})
.setPosition(16)
.createItem());
}
@Override

View file

@ -0,0 +1,19 @@
package net.osmand.plus.osmedit;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
public class OsmNotesMenu {
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
ContextMenuAdapter adapter = new ContextMenuAdapter();
adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
createLayersItems(adapter, mapActivity);
return adapter;
}
private static void createLayersItems(final ContextMenuAdapter adapter, final MapActivity mapActivity) {
}
}