diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java index 1054754..42d6a5f 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java @@ -151,12 +151,10 @@ public class LoginActivity extends AppCompatActivity { } - private void loginProcess(String email, String password) { + ValidateUser user = new ValidateUser(email, password); - LdapUser fuser = new LdapUser(email,password,"tutor","tutor","mieszko","nocny","szmsdsdsdsdare@wmi.pl"); -// disposable.add(ldapService.validate(user) - disposable.add(ldapService.fakeValidate(fuser) + disposable.add(ldapService.validate(user) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::handleResponse, this::handleError)); 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 4a8a7e2..e515928 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 @@ -119,8 +119,10 @@ public class MapActivity extends BaseActivity mHandler.postDelayed(mStatusChecker, mInterval); } + }; + selectLocationButton = findViewById(R.id.select_location_button); removeLocationButton = findViewById(R.id.remove_location_button); Mapbox.getInstance(this, getString(R.string.access_token)); @@ -161,28 +163,7 @@ public class MapActivity extends BaseActivity return true; }); - setToggleMapBoundsArea(); - - if (isTutor) { - setOnMapLongClickListener(); - } - } - - 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); - } - - }); + setOnMapLongClickListener(); } private void updateUserHashMap(String userId, Long markerId) { @@ -249,52 +230,6 @@ public class MapActivity extends BaseActivity } - /* private void setOnMapLongClickListener() { - - mapboxMap.addOnMapLongClickListener((LatLng latLng) -> { - selectLocationButton.setVisibility(View.VISIBLE); - removeLocationButton.setVisibility(View.GONE); - - if (tmpLocalMarker == null) { - - String sharingLevel = SharingLevel.MANUAL.toString(); - Icon defaultIcon = getMapIcon(sharingLevel, myId); - - MarkerOptions markerOptions = new MarkerOptions() - .setIcon(defaultIcon) - .position(latLng); - - tmpLocalMarker = mapboxMap.addMarker(markerOptions); - MapMarker marker = new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, sharingLevel); - - markerHash.put(myId, marker); - updateUserHashMap(myId, marker.getMarker().getId()); - - } else { - ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position", - new mapUtils.LatLngEvaluator(), tmpLocalMarker.getPosition(), latLng); - markerAnimator.setDuration(2000); - markerAnimator.start(); - } - - selectLocationButton.setOnClickListener((View view) -> { - if (tmpLocalMarker != null) { - try { - manualLocationUtils.showLocationDialog("Name the location", latLng); - startBackgroundLocalizationTask(); - } catch (IllegalArgumentException e) { - Timber.e(String.valueOf(e)); - } - - selectLocationButton.setVisibility(View.GONE); - mapboxMap.removeMarker(tmpLocalMarker); - tmpLocalMarker = null; - } - }); - }); - - }*/ - private void setOnMapLongClickListener() { mapboxMap.addOnMapLongClickListener((LatLng latLng) -> { diff --git a/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java b/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java index e95a240..7763c68 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/network/ApiClient.java @@ -22,7 +22,7 @@ public class ApiClient { private static Retrofit retrofit = null; private static int REQUEST_TIMEOUT = 60; private static OkHttpClient okHttpClient; - private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/"; + private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/"; public static Retrofit getClient(Context context) { 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 e669303..5e5c5a2 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" /> - - - - - - - - -