Fixes
This commit is contained in:
parent
9669fac851
commit
9dca2d0709
6 changed files with 103 additions and 91 deletions
|
@ -66,6 +66,7 @@ import net.osmand.plus.helpers.WakeLockHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
|
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
|
||||||
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -99,6 +100,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
||||||
|
private static MapMultiSelectionMenu mapMultiSelectionMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
|
@ -162,7 +164,14 @@ public class MapActivity extends AccessibleActivity {
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
app.applyTheme(this);
|
app.applyTheme(this);
|
||||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
|
if (mapMultiSelectionMenu == null) {
|
||||||
|
mapMultiSelectionMenu = new MapMultiSelectionMenu(this);
|
||||||
|
} else {
|
||||||
|
mapMultiSelectionMenu.setMapActivity(this);
|
||||||
|
}
|
||||||
mapContextMenu.setMapActivity(this);
|
mapContextMenu.setMapActivity(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// Full screen is not used here
|
// Full screen is not used here
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
@ -970,6 +979,10 @@ public class MapActivity extends AccessibleActivity {
|
||||||
return mapContextMenu;
|
return mapContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapMultiSelectionMenu getMultiSelectionMenu() {
|
||||||
|
return mapMultiSelectionMenu;
|
||||||
|
}
|
||||||
|
|
||||||
public FavoritePointEditor getFavoritePointEditor() {
|
public FavoritePointEditor getFavoritePointEditor() {
|
||||||
if (favoritePointEditor == null) {
|
if (favoritePointEditor == null) {
|
||||||
favoritePointEditor = new FavoritePointEditor(app, this);
|
favoritePointEditor = new FavoritePointEditor(app, this);
|
||||||
|
|
|
@ -19,6 +19,10 @@ public abstract class BaseMenuController {
|
||||||
|
|
||||||
public BaseMenuController(MapActivity mapActivity) {
|
public BaseMenuController(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
||||||
light = mapActivity.getMyApplication().getSettings().isLightContent();
|
light = mapActivity.getMyApplication().getSettings().isLightContent();
|
||||||
|
@ -28,6 +32,11 @@ public abstract class BaseMenuController {
|
||||||
return mapActivity;
|
return mapActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMapActivity(MapActivity mapActivity) {
|
||||||
|
this.mapActivity = mapActivity;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLight() {
|
public boolean isLight() {
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,11 +68,16 @@ public class MapDataMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
|
String res;
|
||||||
if (region != null && region.getSuperregion() != null) {
|
if (region != null && region.getSuperregion() != null) {
|
||||||
return region.getSuperregion().getLocaleName() + "\n";
|
res = region.getSuperregion().getLocaleName();
|
||||||
} else {
|
} else {
|
||||||
return getMapActivity().getString(R.string.shared_string_map) + "\n";
|
res = getMapActivity().getString(R.string.shared_string_map);
|
||||||
}
|
}
|
||||||
|
if (getMenuType() == MenuType.STANDARD) {
|
||||||
|
res += "\n";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.mapcontextmenu.other;
|
package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -12,32 +11,30 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuTitleController;
|
import net.osmand.plus.mapcontextmenu.MenuTitleController;
|
||||||
import net.osmand.plus.views.ContextMenuLayer;
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ObjectSelectionMenu extends BaseMenuController {
|
public class MapMultiSelectionMenu extends BaseMenuController {
|
||||||
|
|
||||||
private static final String KEY_OBJ_SEL_MENU_LATLON = "key_obj_sel_menu_latlon";
|
|
||||||
private static final String KEY_OBJ_SEL_MENU_OBJECTS = "key_obj_sel_menu_objects";
|
|
||||||
|
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
private LinkedList<MenuObject> objects = new LinkedList<>();
|
private LinkedList<MenuObject> objects = new LinkedList<>();
|
||||||
private Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
private Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
||||||
|
|
||||||
public static class MenuObject extends MenuTitleController implements Serializable {
|
public static class MenuObject extends MenuTitleController {
|
||||||
|
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
private PointDescription pointDescription;
|
private PointDescription pointDescription;
|
||||||
private Object object;
|
private Object object;
|
||||||
|
|
||||||
private transient MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private transient MenuController controller;
|
private MenuController controller;
|
||||||
|
|
||||||
public MenuObject(LatLon latLon, PointDescription pointDescription, Object object, MapActivity mapActivity) {
|
public MenuObject(LatLon latLon, PointDescription pointDescription, Object object, MapActivity mapActivity) {
|
||||||
this.latLon = latLon;
|
this.latLon = latLon;
|
||||||
|
@ -87,9 +84,16 @@ public class ObjectSelectionMenu extends BaseMenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectSelectionMenu(LatLon latLon, MapActivity mapActivity) {
|
public MapMultiSelectionMenu(MapActivity mapActivity) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.latLon = latLon;
|
}
|
||||||
|
|
||||||
|
public void setMapActivity(MapActivity mapActivity) {
|
||||||
|
super.setMapActivity(mapActivity);
|
||||||
|
for (MenuObject o : objects) {
|
||||||
|
o.mapActivity = mapActivity;
|
||||||
|
o.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MenuObject> getObjects() {
|
public List<MenuObject> getObjects() {
|
||||||
|
@ -102,7 +106,9 @@ public class ObjectSelectionMenu extends BaseMenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createCollection(Map<Object, IContextMenuProvider> selectedObjects) {
|
private void createCollection(Map<Object, IContextMenuProvider> selectedObjects) {
|
||||||
|
this.selectedObjects.clear();
|
||||||
this.selectedObjects.putAll(selectedObjects);
|
this.selectedObjects.putAll(selectedObjects);
|
||||||
|
objects.clear();
|
||||||
int order = Integer.MAX_VALUE;
|
int order = Integer.MAX_VALUE;
|
||||||
MenuObject topObject = null;
|
MenuObject topObject = null;
|
||||||
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
||||||
|
@ -147,39 +153,50 @@ public class ObjectSelectionMenu extends BaseMenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(LatLon latLon, Map<Object, IContextMenuProvider> selectedObjects, MapActivity mapActivity) {
|
private void clearMenu() {
|
||||||
|
clearSelectedObjects();
|
||||||
if (isVisible(mapActivity)) {
|
objects.clear();
|
||||||
hide(mapActivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectSelectionMenu menu = new ObjectSelectionMenu(latLon, mapActivity);
|
|
||||||
menu.createCollection(selectedObjects);
|
|
||||||
ObjectSelectionMenuFragment.showInstance(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVisible(MapActivity mapActivity) {
|
public void show(LatLon latLon, Map<Object, IContextMenuProvider> selectedObjects) {
|
||||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(ObjectSelectionMenuFragment.TAG);
|
if (isVisible()) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
||||||
|
if (e.getValue() instanceof ContextMenuLayer.IContextMenuProviderSelection) {
|
||||||
|
((ContextMenuLayer.IContextMenuProviderSelection) e.getValue()).setSelectedObject(e.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.latLon = latLon;
|
||||||
|
createCollection(selectedObjects);
|
||||||
|
MapMultiSelectionMenuFragment.showInstance(getMapActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVisible() {
|
||||||
|
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(MapMultiSelectionMenuFragment.TAG);
|
||||||
return fragment != null;
|
return fragment != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hide(MapActivity mapActivity) {
|
public void hide() {
|
||||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(ObjectSelectionMenuFragment.TAG);
|
clearMenu();
|
||||||
|
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(MapMultiSelectionMenuFragment.TAG);
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
ObjectSelectionMenuFragment menuFragment = (ObjectSelectionMenuFragment) fragment;
|
MapMultiSelectionMenuFragment menuFragment = (MapMultiSelectionMenuFragment) fragment;
|
||||||
menuFragment.dismissMenu();
|
menuFragment.dismissMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDismiss() {
|
public void onStop() {
|
||||||
|
clearSelectedObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openContextMenu(MenuObject menuObject) {
|
public void openContextMenu(MenuObject menuObject) {
|
||||||
if (selectedObjects.containsKey(menuObject.getObject())) {
|
if (selectedObjects.containsKey(menuObject.getObject())) {
|
||||||
selectedObjects.remove(menuObject.getObject());
|
selectedObjects.remove(menuObject.getObject());
|
||||||
}
|
}
|
||||||
clearSelectedObjects();
|
hide();
|
||||||
hide(getMapActivity());
|
|
||||||
getMapActivity().getContextMenu()
|
getMapActivity().getContextMenu()
|
||||||
.show(menuObject.getLatLon(), menuObject.getPointDescription(), menuObject.getObject());
|
.show(menuObject.getLatLon(), menuObject.getPointDescription(), menuObject.getObject());
|
||||||
}
|
}
|
||||||
|
@ -190,32 +207,6 @@ public class ObjectSelectionMenu extends BaseMenuController {
|
||||||
((ContextMenuLayer.IContextMenuProviderSelection) p).clearSelectedObject();
|
((ContextMenuLayer.IContextMenuProviderSelection) p).clearSelectedObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
selectedObjects.clear();
|
||||||
|
|
||||||
public void saveMenu(Bundle bundle) {
|
|
||||||
bundle.putSerializable(KEY_OBJ_SEL_MENU_LATLON, latLon);
|
|
||||||
bundle.putSerializable(KEY_OBJ_SEL_MENU_OBJECTS, objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static ObjectSelectionMenu restoreMenu(Bundle bundle, MapActivity mapActivity) {
|
|
||||||
|
|
||||||
LatLon latLon = null;
|
|
||||||
Object latLonObj = bundle.getSerializable(KEY_OBJ_SEL_MENU_LATLON);
|
|
||||||
if (latLonObj != null) {
|
|
||||||
latLon = (LatLon) latLonObj;
|
|
||||||
}
|
|
||||||
Object objects = bundle.getSerializable(KEY_OBJ_SEL_MENU_OBJECTS);
|
|
||||||
|
|
||||||
ObjectSelectionMenu menu = new ObjectSelectionMenu(latLon, mapActivity);
|
|
||||||
if (objects != null) {
|
|
||||||
menu.objects = (LinkedList<MenuObject>) objects;
|
|
||||||
for (MenuObject menuObject : menu.objects) {
|
|
||||||
menuObject.mapActivity = mapActivity;
|
|
||||||
menuObject.init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,34 +22,27 @@ import android.widget.TextView;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ObjectSelectionMenu.MenuObject;
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu.MenuObject;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
|
|
||||||
public class ObjectSelectionMenuFragment extends Fragment implements AdapterView.OnItemClickListener {
|
public class MapMultiSelectionMenuFragment extends Fragment implements AdapterView.OnItemClickListener {
|
||||||
public static final String TAG = "ObjectSelectionMenuFragment";
|
public static final String TAG = "MapMultiSelectionMenuFragment";
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
private ArrayAdapter<MenuObject> listAdapter;
|
private ArrayAdapter<MenuObject> listAdapter;
|
||||||
private ObjectSelectionMenu menu;
|
private MapMultiSelectionMenu menu;
|
||||||
|
private boolean dismissing = false;
|
||||||
public ObjectSelectionMenu getMenu() {
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (savedInstanceState != null && getActivity() instanceof MapActivity) {
|
|
||||||
menu = ObjectSelectionMenu.restoreMenu(savedInstanceState, (MapActivity) getActivity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
menu = ((MapActivity) getActivity()).getMultiSelectionMenu();
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.menu_obj_selection_fragment, container, false);
|
view = inflater.inflate(R.layout.menu_obj_selection_fragment, container, false);
|
||||||
|
|
||||||
ListView listView = (ListView) view.findViewById(R.id.list);
|
ListView listView = (ListView) view.findViewById(R.id.list);
|
||||||
|
@ -72,21 +65,19 @@ public class ObjectSelectionMenuFragment extends Fragment implements AdapterView
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
menu.onDismiss();
|
if (!dismissing) {
|
||||||
|
menu.onStop();
|
||||||
|
}
|
||||||
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
|
menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static void showInstance(final MapActivity mapActivity) {
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
MapMultiSelectionMenu menu = mapActivity.getMultiSelectionMenu();
|
||||||
menu.saveMenu(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showInstance(ObjectSelectionMenu menu) {
|
|
||||||
int slideInAnim = menu.getSlideInAnimation();
|
int slideInAnim = menu.getSlideInAnimation();
|
||||||
int slideOutAnim = menu.getSlideOutAnimation();
|
int slideOutAnim = menu.getSlideOutAnimation();
|
||||||
|
|
||||||
ObjectSelectionMenuFragment fragment = new ObjectSelectionMenuFragment();
|
MapMultiSelectionMenuFragment fragment = new MapMultiSelectionMenuFragment();
|
||||||
fragment.menu = menu;
|
|
||||||
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
menu.getMapActivity().getSupportFragmentManager().beginTransaction()
|
||||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||||
.add(R.id.fragmentContainer, fragment, TAG)
|
.add(R.id.fragmentContainer, fragment, TAG)
|
||||||
|
@ -122,7 +113,7 @@ public class ObjectSelectionMenuFragment extends Fragment implements AdapterView
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayAdapter<MenuObject> createAdapter() {
|
private ArrayAdapter<MenuObject> createAdapter() {
|
||||||
final List<MenuObject> items = menu.getObjects();
|
final List<MenuObject> items = new LinkedList<>(menu.getObjects());
|
||||||
return new ArrayAdapter<MenuObject>(menu.getMapActivity(), R.layout.menu_obj_list_item, items) {
|
return new ArrayAdapter<MenuObject>(menu.getMapActivity(), R.layout.menu_obj_list_item, items) {
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
|
@ -175,6 +166,7 @@ public class ObjectSelectionMenuFragment extends Fragment implements AdapterView
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismissMenu() {
|
public void dismissMenu() {
|
||||||
|
dismissing = true;
|
||||||
if (menu.getMapActivity().getContextMenu().isVisible()) {
|
if (menu.getMapActivity().getContextMenu().isVisible()) {
|
||||||
menu.getMapActivity().getContextMenu().hide();
|
menu.getMapActivity().getContextMenu().hide();
|
||||||
} else {
|
} else {
|
|
@ -16,7 +16,7 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ObjectSelectionMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -48,6 +48,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private final MapActivity activity;
|
private final MapActivity activity;
|
||||||
private MapContextMenu menu;
|
private MapContextMenu menu;
|
||||||
|
private MapMultiSelectionMenu multiSelectionMenu;
|
||||||
private CallbackWithObject<LatLon> selectOnMap = null;
|
private CallbackWithObject<LatLon> selectOnMap = null;
|
||||||
|
|
||||||
private ImageView contextMarker;
|
private ImageView contextMarker;
|
||||||
|
@ -57,6 +58,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
public ContextMenuLayer(MapActivity activity){
|
public ContextMenuLayer(MapActivity activity){
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
menu = activity.getContextMenu();
|
menu = activity.getContextMenu();
|
||||||
|
multiSelectionMenu = activity.getMultiSelectionMenu();
|
||||||
movementListener = new GestureDetector(activity, new MenuLayerOnGestureListener());
|
movementListener = new GestureDetector(activity, new MenuLayerOnGestureListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,9 +192,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
l.collectObjectsFromPoint(point, tileBox, s);
|
l.collectObjectsFromPoint(point, tileBox, s);
|
||||||
for (Object o : s) {
|
for (Object o : s) {
|
||||||
selectedObjects.put(o, l);
|
selectedObjects.put(o, l);
|
||||||
if (l instanceof IContextMenuProviderSelection) {
|
// if (l instanceof IContextMenuProviderSelection) {
|
||||||
((IContextMenuProviderSelection) l).setSelectedObject(o);
|
// ((IContextMenuProviderSelection) l).setSelectedObject(o);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,13 +249,13 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideVisibleMenues() {
|
private void hideVisibleMenues() {
|
||||||
if (ObjectSelectionMenu.isVisible(activity)) {
|
if (multiSelectionMenu.isVisible()) {
|
||||||
ObjectSelectionMenu.hide(activity);
|
multiSelectionMenu.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showContextMenuForSelectedObjects(final LatLon latLon, final Map<Object, IContextMenuProvider> selectedObjects) {
|
private void showContextMenuForSelectedObjects(final LatLon latLon, final Map<Object, IContextMenuProvider> selectedObjects) {
|
||||||
ObjectSelectionMenu.show(latLon, selectedObjects, activity);
|
multiSelectionMenu.show(latLon, selectedObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -263,8 +265,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
if (menu.isVisible()) {
|
if (menu.isVisible()) {
|
||||||
menu.hide();
|
menu.hide();
|
||||||
}
|
}
|
||||||
if (ObjectSelectionMenu.isVisible(activity)) {
|
if (multiSelectionMenu.isVisible()) {
|
||||||
ObjectSelectionMenu.hide(activity);
|
multiSelectionMenu.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue