This commit is contained in:
Adam Domagalski 2018-11-27 16:50:32 +01:00
parent 66dba76ed4
commit 6bd3300768
3 changed files with 21 additions and 28 deletions

View File

@ -10,7 +10,7 @@ android {
applicationId "com.uam.wmi.findmytutor" applicationId "com.uam.wmi.findmytutor"
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 27 targetSdkVersion 27
versionCode 3 versionCode 4
versionName "0.9.0-alpha" versionName "0.9.0-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@ -139,7 +139,9 @@ public class MapActivity extends BaseActivity
String id = markerUserHash.get(marker.getId()); String id = markerUserHash.get(marker.getId());
String locationLevel = PrefUtils.getLocationLevel(getApplicationContext()); 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); selectLocationButton.setVisibility(View.GONE);
removeLocationButton.setVisibility(View.VISIBLE); removeLocationButton.setVisibility(View.VISIBLE);
@ -254,11 +256,19 @@ public class MapActivity extends BaseActivity
if (tmpLocalMarker == null) { if (tmpLocalMarker == null) {
tmpLocalMarker = mapboxMap.addMarker(new MarkerOptions() Icon defaultIcon = getMapIcon(SharingLevel.MANUAL.toString(), myId);
.position(latLng)
.icon(icon) MarkerOptions markerOptions = new MarkerOptions()
.title("My Loc") .setIcon(defaultIcon)
.setSnippet("Snipecik")); .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 { } else {
ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position", ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position",
@ -272,33 +282,15 @@ public class MapActivity extends BaseActivity
// Toast instructing user to tap on the mapboxMap // Toast instructing user to tap on the mapboxMap
// TODO PUT MANUAL CORD // TODO PUT MANUAL CORD
try { try {
// droppedMarkercoordinate = new Coordinate( // manualLocationUtils.showLocationDialog("Name the location", latLng);
// latLng.getLatitude(), Log.e(tag, "asdasdasd");
// latLng.getLongitude(), PrefUtils.putManualLocation(this,latLng);
// latLng.getAltitude(),
// "approx",
// PrefUtils.getUserFirstName(getApplicationContext()) + " " + PrefUtils.getUserLastName(getApplicationContext()),
// PrefUtils.getUserId(getApplicationContext()),
// PrefUtils.getLocationLevel(getApplicationContext())
// );
manualLocationUtils.showLocationDialog("Name the location", latLng);
handleBackgroundTaskLifeCycle(); handleBackgroundTaskLifeCycle();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Timber.e(String.valueOf(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); selectLocationButton.setVisibility(View.GONE);
mapboxMap.removeMarker(tmpLocalMarker); mapboxMap.removeMarker(tmpLocalMarker);
tmpLocalMarker = null; tmpLocalMarker = null;

View File

@ -68,6 +68,7 @@ public class ManualLocationUtils {
PrefUtils.putManualLocation(activityContext, latLng); PrefUtils.putManualLocation(activityContext, latLng);
sendLocation(body,latLng); sendLocation(body,latLng);
alertDialog.dismiss(); alertDialog.dismiss();
} }
} }
}); });