alpha3 without dev fucnitons

This commit is contained in:
Adam Domagalski 2018-11-22 13:39:48 +01:00
parent fca6cd936c
commit ac27fc3f34
3 changed files with 2 additions and 90 deletions

View File

@ -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) {

View File

@ -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

View File

@ -58,47 +58,6 @@
app:fab_colorNormal="@color/mapboxGray"
app:pressedTranslationZ="12dp" />
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/multiple_actions_parent_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
fab:fab_addButtonColorNormal="@color/mapboxRed"
fab:fab_addButtonColorPressed="@color/mapboxWhite"
fab:fab_addButtonPlusIconColor="@color/mapboxWhite"
fab:fab_labelStyle="@style/menu_labels_style"
tools:layout_editor_absoluteX="200dp"
tools:layout_editor_absoluteY="255dp">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_hotels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxBlue"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_hotels" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_parks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxGreen"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_parks" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_bound_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxRed"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_bound_area" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
<Button
android:id="@+id/select_location_button"