Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
abaf2e730c
15 changed files with 90 additions and 148 deletions
|
@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public interface LocationPoint extends Serializable {
|
public interface LocationPoint {
|
||||||
|
|
||||||
public double getLatitude();
|
public double getLatitude();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import net.osmand.util.Algorithms;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
public class PointDescription implements Serializable {
|
public class PointDescription {
|
||||||
private String type = "";
|
private String type = "";
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
@ -24,8 +24,6 @@ public class PointDescription implements Serializable {
|
||||||
private double lat = 0;
|
private double lat = 0;
|
||||||
private double lon = 0;
|
private double lon = 0;
|
||||||
|
|
||||||
private static final long serialVersionUID = 4078409090417168638L;
|
|
||||||
|
|
||||||
public static final String POINT_TYPE_FAVORITE = "favorite";
|
public static final String POINT_TYPE_FAVORITE = "favorite";
|
||||||
public static final String POINT_TYPE_WPT = "wpt";
|
public static final String POINT_TYPE_WPT = "wpt";
|
||||||
public static final String POINT_TYPE_POI = "poi";
|
public static final String POINT_TYPE_POI = "poi";
|
||||||
|
|
|
@ -98,6 +98,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
||||||
|
|
||||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
|
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
|
@ -129,7 +130,6 @@ public class MapActivity extends AccessibleActivity {
|
||||||
private boolean intentLocation = false;
|
private boolean intentLocation = false;
|
||||||
|
|
||||||
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
||||||
private MapContextMenu contextMenuOnMap;
|
|
||||||
private FavoritePointEditor favoritePointEditor;
|
private FavoritePointEditor favoritePointEditor;
|
||||||
private AppInitializeListener initListener;
|
private AppInitializeListener initListener;
|
||||||
private IMapDownloaderCallback downloaderCallback;
|
private IMapDownloaderCallback downloaderCallback;
|
||||||
|
@ -161,8 +161,8 @@ public class MapActivity extends AccessibleActivity {
|
||||||
app = getMyApplication();
|
app = getMyApplication();
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
app.applyTheme(this);
|
app.applyTheme(this);
|
||||||
contextMenuOnMap = new MapContextMenu(this);
|
|
||||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
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);
|
||||||
|
@ -529,9 +529,9 @@ public class MapActivity extends AccessibleActivity {
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
if (mapLabelToShow != null) {
|
if (mapLabelToShow != null) {
|
||||||
contextMenuOnMap.setMapCenter(latLonToShow);
|
mapContextMenu.setMapCenter(latLonToShow);
|
||||||
contextMenuOnMap.setMapPosition(mapView.getMapPosition());
|
mapContextMenu.setMapPosition(mapView.getMapPosition());
|
||||||
contextMenuOnMap.show(latLonToShow, mapLabelToShow, toShow);
|
mapContextMenu.show(latLonToShow, mapLabelToShow, toShow);
|
||||||
}
|
}
|
||||||
if (!latLonToShow.equals(cur)) {
|
if (!latLonToShow.equals(cur)) {
|
||||||
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
||||||
|
@ -967,7 +967,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapContextMenu getContextMenu() {
|
public MapContextMenu getContextMenu() {
|
||||||
return contextMenuOnMap;
|
return mapContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavoritePointEditor getFavoritePointEditor() {
|
public FavoritePointEditor getFavoritePointEditor() {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SearchHistoryHelper {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static class HistoryEntry implements Serializable {
|
public static class HistoryEntry {
|
||||||
double lat;
|
double lat;
|
||||||
double lon;
|
double lon;
|
||||||
PointDescription name;
|
PointDescription name;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
|
||||||
public class MapContextMenu extends MenuTitleController {
|
public class MapContextMenu extends MenuTitleController {
|
||||||
|
|
||||||
private final MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private LatLon latLon;
|
private LatLon latLon;
|
||||||
|
@ -29,22 +28,20 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
|
|
||||||
private int favActionIconId;
|
private int favActionIconId;
|
||||||
|
|
||||||
private static final String KEY_CTX_MENU_OBJECT = "key_ctx_menu_object";
|
|
||||||
private static final String KEY_CTX_MENU_ACTIVE = "key_ctx_menu_active";
|
|
||||||
private static final String KEY_CTX_MENU_LATLON = "key_ctx_menu_latlon";
|
|
||||||
private static final String KEY_CTX_MENU_POINT_DESC = "key_ctx_menu_point_desc";
|
|
||||||
private static final String KEY_CTX_MENU_NAME_STR = "key_ctx_menu_name_str";
|
|
||||||
private static final String KEY_CTX_MENU_TYPE_STR = "key_ctx_menu_type_str";
|
|
||||||
private static final String KEY_CTX_MENU_STREET_STR = "key_ctx_menu_street_str";
|
|
||||||
private static final String KEY_CTX_MENU_ADDR_UNKNOWN = "key_ctx_menu_addr_unknown";
|
|
||||||
private static final String KEY_CTX_MENU_MAP_CENTER = "key_ctx_menu_map_center";
|
|
||||||
private static final String KEY_CTX_MENU_MAP_POSITION = "key_ctx_menu_map_position";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapActivity getMapActivity() {
|
public MapActivity getMapActivity() {
|
||||||
return mapActivity;
|
return mapActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMapActivity(MapActivity mapActivity) {
|
||||||
|
this.mapActivity = mapActivity;
|
||||||
|
if (active) {
|
||||||
|
acquireMenuController();
|
||||||
|
} else {
|
||||||
|
menuController = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +86,7 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
return menuController;
|
return menuController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapContextMenu(MapActivity mapActivity) {
|
public MapContextMenu() {
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean init(LatLon latLon, PointDescription pointDescription, Object object) {
|
public boolean init(LatLon latLon, PointDescription pointDescription, Object object) {
|
||||||
|
@ -267,56 +263,6 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
|
mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveMenuState(Bundle bundle) {
|
|
||||||
if (menuController != null) {
|
|
||||||
menuController.saveEntityState(bundle, KEY_CTX_MENU_OBJECT);
|
|
||||||
}
|
|
||||||
bundle.putString(KEY_CTX_MENU_ACTIVE, Boolean.toString(active));
|
|
||||||
bundle.putSerializable(KEY_CTX_MENU_LATLON, latLon);
|
|
||||||
bundle.putSerializable(KEY_CTX_MENU_POINT_DESC, pointDescription);
|
|
||||||
bundle.putString(KEY_CTX_MENU_NAME_STR, nameStr);
|
|
||||||
bundle.putString(KEY_CTX_MENU_TYPE_STR, typeStr);
|
|
||||||
bundle.putString(KEY_CTX_MENU_STREET_STR, streetStr);
|
|
||||||
bundle.putString(KEY_CTX_MENU_ADDR_UNKNOWN, Boolean.toString(addressUnknown));
|
|
||||||
bundle.putSerializable(KEY_CTX_MENU_MAP_CENTER, mapCenter);
|
|
||||||
bundle.putInt(KEY_CTX_MENU_MAP_POSITION, mapPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restoreMenuState(Bundle bundle) {
|
|
||||||
object = bundle.getSerializable(KEY_CTX_MENU_OBJECT);
|
|
||||||
Object pDescObj = bundle.getSerializable(KEY_CTX_MENU_POINT_DESC);
|
|
||||||
if (pDescObj != null) {
|
|
||||||
pointDescription = (PointDescription) pDescObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
active = Boolean.parseBoolean(bundle.getString(KEY_CTX_MENU_ACTIVE));
|
|
||||||
Object latLonObj = bundle.getSerializable(KEY_CTX_MENU_LATLON);
|
|
||||||
if (latLonObj != null) {
|
|
||||||
latLon = (LatLon) latLonObj;
|
|
||||||
} else {
|
|
||||||
active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
acquireMenuController();
|
|
||||||
|
|
||||||
Object mapCenterObj = bundle.getSerializable(KEY_CTX_MENU_MAP_CENTER);
|
|
||||||
if (mapCenterObj != null) {
|
|
||||||
mapCenter = (LatLon) mapCenterObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
nameStr = bundle.getString(KEY_CTX_MENU_NAME_STR);
|
|
||||||
typeStr = bundle.getString(KEY_CTX_MENU_TYPE_STR);
|
|
||||||
streetStr = bundle.getString(KEY_CTX_MENU_STREET_STR);
|
|
||||||
addressUnknown = Boolean.parseBoolean(bundle.getString(KEY_CTX_MENU_ADDR_UNKNOWN));
|
|
||||||
mapPosition = bundle.getInt(KEY_CTX_MENU_MAP_POSITION, 0);
|
|
||||||
|
|
||||||
acquireIcons();
|
|
||||||
|
|
||||||
if (menuController != null) {
|
|
||||||
menuController.addPlainMenuItems(typeStr, pointDescription, latLon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBaseFragmentVisibility(boolean visible) {
|
public void setBaseFragmentVisibility(boolean visible) {
|
||||||
MapContextMenuFragment menuFragment = findMenuFragment();
|
MapContextMenuFragment menuFragment = findMenuFragment();
|
||||||
if (menuFragment != null) {
|
if (menuFragment != null) {
|
||||||
|
|
|
@ -111,12 +111,6 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
menu.saveMenuState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -127,9 +121,6 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
||||||
|
|
||||||
menu = getMapActivity().getContextMenu();
|
menu = getMapActivity().getContextMenu();
|
||||||
if (savedInstanceState != null) {
|
|
||||||
menu.restoreMenuState(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
map = getMapActivity().getMapView();
|
map = getMapActivity().getMapView();
|
||||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
|
@ -10,7 +9,6 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
|
@ -18,9 +16,12 @@ import net.osmand.plus.mapcontextmenu.details.AmenityMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.FavouritePointMenuController;
|
import net.osmand.plus.mapcontextmenu.details.FavouritePointMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.HistoryMenuController;
|
import net.osmand.plus.mapcontextmenu.details.HistoryMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.MyLocationMenuController;
|
import net.osmand.plus.mapcontextmenu.details.MyLocationMenuController;
|
||||||
|
import net.osmand.plus.mapcontextmenu.details.OsMoMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.ParkingPositionMenuController;
|
import net.osmand.plus.mapcontextmenu.details.ParkingPositionMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.PointDescriptionMenuController;
|
import net.osmand.plus.mapcontextmenu.details.PointDescriptionMenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.details.TargetPointMenuController;
|
import net.osmand.plus.mapcontextmenu.details.TargetPointMenuController;
|
||||||
|
import net.osmand.plus.osmo.OsMoGroupsStorage;
|
||||||
|
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||||
|
|
||||||
public abstract class MenuController extends BaseMenuController {
|
public abstract class MenuController extends BaseMenuController {
|
||||||
|
|
||||||
|
@ -56,11 +57,13 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
menuController = new HistoryMenuController(app, mapActivity, (SearchHistoryHelper.HistoryEntry) object);
|
menuController = new HistoryMenuController(app, mapActivity, (SearchHistoryHelper.HistoryEntry) object);
|
||||||
} else if (object instanceof TargetPoint) {
|
} else if (object instanceof TargetPoint) {
|
||||||
menuController = new TargetPointMenuController(app, mapActivity, (TargetPoint) object);
|
menuController = new TargetPointMenuController(app, mapActivity, (TargetPoint) object);
|
||||||
|
} else if (object instanceof OsMoDevice) {
|
||||||
|
menuController = new OsMoMenuController(app, mapActivity, (OsMoDevice) object);
|
||||||
} else if (object instanceof LatLon) {
|
} else if (object instanceof LatLon) {
|
||||||
if (pointDescription.isParking()) {
|
if (pointDescription.isParking()) {
|
||||||
menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription, (LatLon) object);
|
menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription);
|
||||||
} else if (pointDescription.isMyLocation()) {
|
} else if (pointDescription.isMyLocation()) {
|
||||||
menuController = new MyLocationMenuController(app, mapActivity, pointDescription, (LatLon) object);
|
menuController = new MyLocationMenuController(app, mapActivity, pointDescription);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -182,6 +185,4 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
public String getTypeStr() { return ""; }
|
public String getTypeStr() { return ""; }
|
||||||
|
|
||||||
public String getNameStr() { return ""; }
|
public String getNameStr() { return ""; }
|
||||||
|
|
||||||
public abstract void saveEntityState(Bundle bundle, String key);
|
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
@ -86,9 +84,4 @@ public class AmenityMenuController extends MenuController {
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get());
|
return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, amenity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
|
@ -77,10 +76,4 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return fav.getName();
|
return fav.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, fav);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -27,7 +26,7 @@ public class HistoryMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getSupportedMenuStatesPortrait() {
|
protected int getSupportedMenuStatesPortrait() {
|
||||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,9 +67,4 @@ public class HistoryMenuController extends MenuController {
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return !entry.getName().isAddress();
|
return !entry.getName().isAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -13,13 +11,11 @@ import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
|
||||||
public class MyLocationMenuController extends MenuController {
|
public class MyLocationMenuController extends MenuController {
|
||||||
|
|
||||||
private LatLon latLon;
|
|
||||||
private PointDescription pointDescription;
|
private PointDescription pointDescription;
|
||||||
|
|
||||||
public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription, LatLon latLon) {
|
public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), mapActivity);
|
||||||
this.pointDescription = pointDescription;
|
this.pointDescription = pointDescription;
|
||||||
this.latLon = latLon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,9 +38,4 @@ public class MyLocationMenuController extends MenuController {
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
return pointDescription.getTypeName();
|
return pointDescription.getTypeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, latLon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||||
|
|
||||||
|
public class OsMoMenuController extends MenuController {
|
||||||
|
|
||||||
|
private OsMoDevice device;
|
||||||
|
|
||||||
|
public OsMoMenuController(OsmandApplication app, MapActivity mapActivity, final OsMoDevice device) {
|
||||||
|
super(new MenuBuilder(app), mapActivity);
|
||||||
|
this.device = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getInitialMenuStatePortrait() {
|
||||||
|
return MenuState.HEADER_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getSupportedMenuStatesPortrait() {
|
||||||
|
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean needTypeStr() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Drawable getLeftIcon() {
|
||||||
|
if (isLight()) {
|
||||||
|
return getIconOrig(R.drawable.widget_osmo_connected_location_day);
|
||||||
|
} else {
|
||||||
|
return getIconOrig(R.drawable.widget_osmo_connected_location_night);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNameStr() {
|
||||||
|
return device.getVisibleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeStr() {
|
||||||
|
// todo
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean needStreetName() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,7 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
@ -17,14 +15,12 @@ import net.osmand.util.Algorithms;
|
||||||
public class ParkingPositionMenuController extends MenuController {
|
public class ParkingPositionMenuController extends MenuController {
|
||||||
|
|
||||||
private PointDescription pointDescription;
|
private PointDescription pointDescription;
|
||||||
private LatLon latLon;
|
|
||||||
ParkingPositionPlugin plugin;
|
ParkingPositionPlugin plugin;
|
||||||
String parkingDescription = "";
|
String parkingDescription = "";
|
||||||
|
|
||||||
public ParkingPositionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription, LatLon latLon) {
|
public ParkingPositionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) {
|
||||||
super(new MenuBuilder(app), mapActivity);
|
super(new MenuBuilder(app), mapActivity);
|
||||||
this.pointDescription = pointDescription;
|
this.pointDescription = pointDescription;
|
||||||
this.latLon = latLon;
|
|
||||||
plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class);
|
plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class);
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -88,9 +84,4 @@ public class ParkingPositionMenuController extends MenuController {
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, latLon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -73,8 +72,4 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return !pointDescription.isAddress();
|
return !pointDescription.isAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
package net.osmand.plus.mapcontextmenu.details;
|
package net.osmand.plus.mapcontextmenu.details;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
public class TargetPointMenuController extends MenuController {
|
public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
|
@ -97,9 +91,4 @@ public class TargetPointMenuController extends MenuController {
|
||||||
public boolean needStreetName() {
|
public boolean needStreetName() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveEntityState(Bundle bundle, String key) {
|
|
||||||
bundle.putSerializable(key, targetPoint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue