From 6bd33007688e0bff0c18ab06c77e4cea82a6c896 Mon Sep 17 00:00:00 2001 From: Adam Domagalski Date: Tue, 27 Nov 2018 16:50:32 +0100 Subject: [PATCH] pozar --- app/build.gradle | 2 +- .../wmi/findmytutor/activity/MapActivity.java | 46 ++++++++----------- .../utils/ManualLocationUtils.java | 1 + 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ddf3e1a..b07d979 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { applicationId "com.uam.wmi.findmytutor" minSdkVersion 22 targetSdkVersion 27 - versionCode 3 + versionCode 4 versionName "0.9.0-alpha" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true 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 4d9e06e..3aefa54 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 @@ -139,7 +139,9 @@ public class MapActivity extends BaseActivity String id = markerUserHash.get(marker.getId()); String locationLevel = PrefUtils.getLocationLevel(getApplicationContext()); - if (id.equals(myId) && (locationLevel.equals(SharingLevel.MANUAL.toString()) || locationLevel.equals(SharingLevel.PREDEFINED.toString()))) { +// if (id.equals(myId) && (locationLevel.equals(SharingLevel.MANUAL.toString()) || locationLevel.equals(SharingLevel.PREDEFINED.toString()))) { + Log.e(tag + "ididid", id + "+++" + myId); + if (id.equals(myId)) { selectLocationButton.setVisibility(View.GONE); removeLocationButton.setVisibility(View.VISIBLE); @@ -254,11 +256,19 @@ public class MapActivity extends BaseActivity if (tmpLocalMarker == null) { - tmpLocalMarker = mapboxMap.addMarker(new MarkerOptions() - .position(latLng) - .icon(icon) - .title("My Loc") - .setSnippet("Snipecik")); + Icon defaultIcon = getMapIcon(SharingLevel.MANUAL.toString(), myId); + + MarkerOptions markerOptions = new MarkerOptions() + .setIcon(defaultIcon) + .position(latLng); + + + tmpLocalMarker = mapboxMap.addMarker(markerOptions); + MapMarker marker = new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, SharingLevel.MANUAL.toString()); + + markerHash.put(myId, marker); + updateUserHashMap(myId, marker.getMarker().getId()); + } else { ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position", @@ -272,33 +282,15 @@ public class MapActivity extends BaseActivity // Toast instructing user to tap on the mapboxMap // TODO PUT MANUAL CORD try { -// droppedMarkercoordinate = new Coordinate( -// latLng.getLatitude(), -// latLng.getLongitude(), -// latLng.getAltitude(), -// "approx", -// PrefUtils.getUserFirstName(getApplicationContext()) + " " + PrefUtils.getUserLastName(getApplicationContext()), -// PrefUtils.getUserId(getApplicationContext()), -// PrefUtils.getLocationLevel(getApplicationContext()) -// ); - manualLocationUtils.showLocationDialog("Name the location", latLng); +// manualLocationUtils.showLocationDialog("Name the location", latLng); + Log.e(tag, "asdasdasd"); + PrefUtils.putManualLocation(this,latLng); handleBackgroundTaskLifeCycle(); } catch (IllegalArgumentException e) { Timber.e(String.valueOf(e)); } -// Toast.makeText( -// MapActivity.this, -// "Manual Locations selected!" + latLng, -// Toast.LENGTH_LONG -// ).show(); -// LayoutInflater layoutInflaterAndroid = LayoutInflater.from(MapActivity.this); -// View dialogView = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null); -// AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(MapActivity.this ); -// alertDialogBuilderUserInput.setView(dialogView).setPositiveButton("dupa", null); -// final AlertDialog alertDialog = alertDialogBuilderUserInput.create(); -// alertDialog.show(); selectLocationButton.setVisibility(View.GONE); mapboxMap.removeMarker(tmpLocalMarker); tmpLocalMarker = null; diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java index e88f7d7..8ece21f 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/ManualLocationUtils.java @@ -68,6 +68,7 @@ public class ManualLocationUtils { PrefUtils.putManualLocation(activityContext, latLng); sendLocation(body,latLng); alertDialog.dismiss(); + } } });