From ac27fc3f349199ee4cbdd49e2ae4e88bbd4e6ecc Mon Sep 17 00:00:00 2001 From: Adam Domagalski Date: Thu, 22 Nov 2018 13:39:48 +0100 Subject: [PATCH] alpha3 without dev fucnitons --- .../wmi/findmytutor/activity/MapActivity.java | 14 ------- .../uam/wmi/findmytutor/utils/mapUtils.java | 37 +---------------- app/src/main/res/layout/activity_map.xml | 41 ------------------- 3 files changed, 2 insertions(+), 90 deletions(-) diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java index 0b6f8b6..543bf03 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java @@ -113,8 +113,6 @@ public class MapActivity extends BaseActivity }; - Bundle extras = getIntent().getExtras(); - selectLocationButton = findViewById(R.id.select_location_button); removeLocationButton = findViewById(R.id.remove_location_button); Mapbox.getInstance(this, getString(R.string.access_token)); @@ -157,24 +155,12 @@ public class MapActivity extends BaseActivity setToggleMapBoundsArea(); setOnMapLongClickListener(); -// addStaticLayer(); } private void setToggleMapBoundsArea() { mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true); - FloatingActionButton toggleBoundsAreaFab = findViewById(R.id.fab_toggle_bound_area); - toggleBoundsAreaFab.setOnClickListener(view -> { - if (toggleBoundsAreaFab.getTitle().equals("Bounds OFF")) { - toggleBoundsAreaFab.setTitle("Bounds ON"); - mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, false); - } else { - toggleBoundsAreaFab.setTitle("Bounds OFF"); - mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true); - } - - }); } private void createMarkerModal(String userId) { diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/mapUtils.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/mapUtils.java index 79b9f01..6d80d3e 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/utils/mapUtils.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/mapUtils.java @@ -26,8 +26,8 @@ public class mapUtils { // Boundires private static final LatLngBounds WMI_BOUNDS = new LatLngBounds.Builder() - .include(new LatLng(52.467886048833094, 16.92912980245876)) - .include(new LatLng(52.46548540224137, 16.925255680881094)) + .include(new LatLng(52.46588041661952, 16.92543089389801)) + .include(new LatLng(52.467824943492374, 16.928574442863464)) .build(); // Map Bounds Area @@ -38,45 +38,12 @@ public class mapUtils { mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS); makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000); mapboxMap.setMinZoomPreference(16); // TODO export to map config - drawBoundsArea(context, mapboxMap, mapView, check); } else { mapboxMap.setLatLngBoundsForCameraTarget(null); mapboxMap.setMinZoomPreference(2); - drawBoundsArea(context, mapboxMap, mapView, check); } } - // TODO: remove b4 release - private static final PolygonOptions boundsArea = new PolygonOptions() - .add(WMI_BOUNDS.getNorthWest()) - .add(WMI_BOUNDS.getNorthEast()) - .add(WMI_BOUNDS.getSouthEast()) - .add(WMI_BOUNDS.getSouthWest()) - .alpha(0.1f) - .fillColor(Color.YELLOW); - // For adding and removing - private static Polygon polygon; - private static View crosshair; - - private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) { - - - if (check) { - // Visualise bounds area - // showBoundsArea - polygon = mapboxMap.addPolygon(boundsArea); - // showCrosshair - crosshair = new View(context); - crosshair.setLayoutParams(new FrameLayout.LayoutParams(15, 15, Gravity.CENTER)); - crosshair.setBackgroundColor(Color.GREEN); - mapView.addView(crosshair); - } else { - mapboxMap.removePolygon(polygon); - mapView.removeView(crosshair); - } - - } - public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) { CameraPosition position = new CameraPosition.Builder() .target(new LatLng(lat, lon)) // Sets the new camera position diff --git a/app/src/main/res/layout/activity_map.xml b/app/src/main/res/layout/activity_map.xml index 42813df..33c99a8 100644 --- a/app/src/main/res/layout/activity_map.xml +++ b/app/src/main/res/layout/activity_map.xml @@ -58,47 +58,6 @@ app:fab_colorNormal="@color/mapboxGray" app:pressedTranslationZ="12dp" /> - - - - - - - - -