diff --git a/OsmAnd/res/layout/fragment_plan_route_options_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_plan_route_options_bottom_sheet_dialog.xml index 14af472791..1c9345234f 100644 --- a/OsmAnd/res/layout/fragment_plan_route_options_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_plan_route_options_bottom_sheet_dialog.xml @@ -89,7 +89,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" - android:text="@string/shared_string_navigate" + android:text="@string/get_directions" android:textAppearance="@style/TextAppearance.ListItemTitle"/> diff --git a/OsmAnd/res/layout/marker_menu_on_map_content.xml b/OsmAnd/res/layout/marker_menu_on_map_content.xml index 2a3f3e760a..3c8cefbff8 100644 --- a/OsmAnd/res/layout/marker_menu_on_map_content.xml +++ b/OsmAnd/res/layout/marker_menu_on_map_content.xml @@ -122,39 +122,4 @@ android:textAppearance="@style/TextAppearance.ListItemTitle"/> - - - - - - - - - diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 98c978f12d..c3228c7fd0 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Rename marker A tap on the map toggles the control buttons and widgets. Full screen mode Show on Top Bar @@ -33,7 +34,7 @@ Modify OSM note Add copy of start point as destination. Make round trip - Navigate + Markers Coordinates format Use system keyboard @@ -2302,7 +2303,7 @@ Recorded voice Voice prompts Vector maps were not loaded - Navigate using GPX + No GPX files found in the tracks folder GPX trackā€¦ Error reading GPX data diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 3d989f1929..b33f1f56ef 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -44,6 +44,7 @@ import net.osmand.plus.mapcontextmenu.editors.WptPtEditor; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.ShareMenu; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; +import net.osmand.plus.mapmarkers.RenameMarkerBottomSheetDialogFragment; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.ContextMenuLayer; @@ -87,6 +88,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL private boolean autoHide; private int favActionIconId; + private int waypointActionIconId; private MenuAction searchDoneAction; @@ -704,12 +706,27 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL return R.string.shared_string_add_to_favorites; } + public int getWaypointActionIconId() { + return waypointActionIconId; + } + + public int getWaypointActionStringId() { + if (menuController != null) { + return menuController.getWaypointActionStringId(); + } + return settings.USE_MAP_MARKERS.get() + ? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point; + } + protected void acquireIcons() { super.acquireIcons(); if (menuController != null) { favActionIconId = menuController.getFavActionIconId(); + waypointActionIconId = menuController.getWaypointActionIconId(); } else { favActionIconId = R.drawable.map_action_fav_dark; + waypointActionIconId = settings.USE_MAP_MARKERS.get() + ? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint; } } @@ -745,20 +762,25 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } public void buttonWaypointPressed() { - if (pointDescription.isDestination()) { - mapActivity.getMapActions().editWaypoints(); - } else if (settings.USE_MAP_MARKERS.get()) { - if (pointDescription.isMapMarker()) { - hide(); - MapActivity.clearPrevActivityIntent(); - MapMarkersDialogFragment.showInstance(mapActivity); - } else { - mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(), - getPointDescriptionForMarker()); - } + if (object != null && object instanceof MapMarker) { + RenameMarkerBottomSheetDialogFragment + .showInstance(mapActivity.getSupportFragmentManager(), (MapMarker) object); } else { - mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(), - getPointDescriptionForTarget()); + if (pointDescription.isDestination()) { + mapActivity.getMapActions().editWaypoints(); + } else if (settings.USE_MAP_MARKERS.get()) { + if (pointDescription.isMapMarker()) { + hide(); + MapActivity.clearPrevActivityIntent(); + MapMarkersDialogFragment.showInstance(mapActivity); + } else { + mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(), + getPointDescriptionForMarker()); + } + } else { + mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(), + getPointDescriptionForTarget()); + } } close(); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index e116f1e130..6abbc09581 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -455,15 +455,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo }); final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button); - if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) { - buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_flag_dark, - !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); - buttonWaypoint.setContentDescription(getString(R.string.shared_string_add_to_map_markers)); - } else { - buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_waypoint, - !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); - buttonWaypoint.setContentDescription(getString(R.string.context_menu_item_destination_point)); - } + buttonWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(), + !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); + buttonWaypoint.setContentDescription(getString(menu.getWaypointActionStringId())); AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode); buttonWaypoint.setOnClickListener(new View.OnClickListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index b5828dc67b..2b58f58a98 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -411,6 +411,16 @@ public abstract class MenuController extends BaseMenuController { return R.string.shared_string_add_to_favorites; } + public int getWaypointActionIconId() { + return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get() + ? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint; + } + + public int getWaypointActionStringId() { + return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get() + ? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point; + } + public String getTypeStr() { return ""; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java index 3eeaca8c90..7977446d9f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java @@ -94,4 +94,14 @@ public class MapMarkerMenuController extends MenuController { public boolean needStreetName() { return !needTypeStr(); } + + @Override + public int getWaypointActionIconId() { + return R.drawable.map_action_edit_dark; + } + + @Override + public int getWaypointActionStringId() { + return R.string.rename_marker; + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java index 9a77d5f849..76c19aaa5a 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java @@ -55,6 +55,10 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi } ListView listView = (ListView) view.findViewById(R.id.list); + if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) { + AndroidUtils.addStatusBarPadding21v(getActivity(), listView); + listView.setClipToPadding(false); + } listAdapter = createAdapter(); listView.setAdapter(listAdapter); listView.setOnItemClickListener(this); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkerMenuOnMapFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkerMenuOnMapFragment.java index 714edcdfc1..7bddf682ca 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkerMenuOnMapFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkerMenuOnMapFragment.java @@ -82,7 +82,6 @@ public class MarkerMenuOnMapFragment extends BaseOsmAndFragment implements OsmAn ((ImageView) mainView.findViewById(R.id.marker_icon)) .setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex))); ((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark)); - ((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark)); ((TextView) mainView.findViewById(R.id.marker_title)).setText(marker.getName(getActivity())); @@ -135,33 +134,11 @@ public class MarkerMenuOnMapFragment extends BaseOsmAndFragment implements OsmAn public void onClick(View view) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - RenameMarkerBottomSheetDialogFragment fragment = new RenameMarkerBottomSheetDialogFragment(); - fragment.setMarker(marker); - fragment.setRetainInstance(true); - fragment.show(mapActivity.getSupportFragmentManager(), RenameMarkerBottomSheetDialogFragment.TAG); + RenameMarkerBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(), marker); } } }); - mainView.findViewById(R.id.delete_row).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - app.getMapMarkersHelper().removeMarker(marker); - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - Snackbar.make(mapActivity.findViewById(R.id.bottomFragmentContainer), R.string.item_removed, Snackbar.LENGTH_LONG) - .setAction(R.string.shared_string_undo, new View.OnClickListener() { - @Override - public void onClick(View view) { - app.getMapMarkersHelper().addMarker(marker); - } - }) - .show(); - } - dismiss(); - } - }); - mainView.findViewById(R.id.back_row).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/RenameMarkerBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/RenameMarkerBottomSheetDialogFragment.java index 886c38794e..a3a5aabcbe 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/RenameMarkerBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/RenameMarkerBottomSheetDialogFragment.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.content.ContextCompat; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.LayoutInflater; @@ -58,6 +59,9 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag } final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); + if (nightMode) { + nameEditText.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white)); + } nameEditText.setText(marker.getName(mapActivity)); nameEditText.requestFocus(); final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -162,4 +166,16 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag } super.onDestroyView(); } + + public static boolean showInstance(FragmentManager fm, MapMarker marker) { + try { + RenameMarkerBottomSheetDialogFragment fragment = new RenameMarkerBottomSheetDialogFragment(); + fragment.setMarker(marker); + fragment.setRetainInstance(true); + fragment.show(fm, RenameMarkerBottomSheetDialogFragment.TAG); + return true; + } catch (Exception e) { + return false; + } + } }