Alexey Kulish 2016-03-06 21:13:02 +03:00
parent fe9f64af54
commit 34850d02fd
3 changed files with 63 additions and 3 deletions

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="shared_string_move_up">Move up</string>
<string name="shared_string_move_down">Move down</string>
<string name="finish_navigation">Finish navigation</string> <string name="finish_navigation">Finish navigation</string>
<string name="avoid_road">Avoid road</string> <string name="avoid_road">Avoid road</string>
<string name="storage_directory_readonly_desc">Currently selected Data storage folder is readonly. The storage folder was temporarily switched to Internal memory. Please choose valid storage directory.</string> <string name="storage_directory_readonly_desc">Currently selected Data storage folder is readonly. The storage folder was temporarily switched to Internal memory. Please choose valid storage directory.</string>

View file

@ -320,6 +320,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
hideDashboard(); hideDashboard();
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) { if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
mapActivity.getMapActions().stopNavigationWithoutConfirm(); mapActivity.getMapActions().stopNavigationWithoutConfirm();
if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
}
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide(); mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
} }
} }
@ -1475,6 +1478,23 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
deleteSwipeItem(position); deleteSwipeItem(position);
} }
@Override
public void exchangeWaypoints(int pos1, int pos2) {
if (swipeDismissListener != null) {
swipeDismissListener.discardUndo();
}
if (pos1 != -1 && pos2 != -1) {
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
Object item1 = stableAdapter.getActiveObjects().get(pos1);
Object item2 = stableAdapter.getActiveObjects().get(pos2);
stableAdapter.getActiveObjects().set(pos1, item2);
stableAdapter.getActiveObjects().set(pos2, item1);
stableAdapter.refreshData();
onItemsSwapped(stableAdapter.getActiveObjects());
}
}
@Override @Override
public void deleteMapMarker(int position) { public void deleteMapMarker(int position) {
deleteSwipeItem(position); deleteSwipeItem(position);

View file

@ -63,6 +63,7 @@ public class WaypointDialogHelper {
public interface WaypointDialogHelperCallbacks { public interface WaypointDialogHelperCallbacks {
void reloadAdapter(); void reloadAdapter();
void deleteWaypoint(int position); void deleteWaypoint(int position);
void exchangeWaypoints(int pos1, int pos2);
} }
private static class RadiusItem { private static class RadiusItem {
@ -488,10 +489,47 @@ public class WaypointDialogHelper {
public void onClick() { public void onClick() {
final PopupMenu optionsMenu = new PopupMenu(ctx, move); final PopupMenu optionsMenu = new PopupMenu(ctx, move);
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu); DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
List<Object> activeObjects = ((StableArrayAdapter) adapter).getActiveObjects();
int count = activeObjects.size();
int t = -1;
for (int i = 0; i < activeObjects.size(); i++) {
Object o = activeObjects.get(i);
if (point == o) {
t = i;
break;
}
}
final int index = t;
MenuItem item; MenuItem item;
item = optionsMenu.getMenu().add( if (index > 0 && count > 1) {
R.string.shared_string_remove).setIcon(app.getIconsCache(). item = optionsMenu.getMenu().add(R.string.shared_string_move_up)
getContentIcon(R.drawable.ic_action_remove_dark)); .setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_up));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (helper != null && helper.helperCallbacks != null) {
helper.helperCallbacks.exchangeWaypoints(index, index - 1);
}
return true;
}
});
}
if (index < count - 1 && count > 1) {
item = optionsMenu.getMenu().add(R.string.shared_string_move_down)
.setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (helper != null && helper.helperCallbacks != null) {
helper.helperCallbacks.exchangeWaypoints(index, index + 1);
}
return true;
}
});
}
item = optionsMenu.getMenu().add(R.string.shared_string_remove)
.setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_remove_dark));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {