button add rm manual location quick fix #44
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "com.uam.wmi.findmytutor"
|
applicationId "com.uam.wmi.findmytutor"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 3
|
||||||
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
|
||||||
|
@ -4,8 +4,6 @@ import android.Manifest;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -80,7 +78,7 @@ public class MapActivity extends BaseActivity
|
|||||||
private MapView mapView;
|
private MapView mapView;
|
||||||
private MapboxMap mapboxMap;
|
private MapboxMap mapboxMap;
|
||||||
private Button selectLocationButton;
|
private Button selectLocationButton;
|
||||||
private Marker droppedMarker;
|
private Button removeLocationButton;
|
||||||
private Marker tmpLocalMarker;
|
private Marker tmpLocalMarker;
|
||||||
private Coordinate droppedMarkercoordinate;
|
private Coordinate droppedMarkercoordinate;
|
||||||
private HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
private HashMap<String, Coordinate> coordsMap = new HashMap<>();
|
||||||
@ -97,7 +95,6 @@ public class MapActivity extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
final SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE);
|
|
||||||
|
|
||||||
myID = PrefUtils.getUserId(getApplicationContext());
|
myID = PrefUtils.getUserId(getApplicationContext());
|
||||||
// fetching coords service
|
// fetching coords service
|
||||||
@ -119,7 +116,7 @@ public class MapActivity extends BaseActivity
|
|||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
|
|
||||||
selectLocationButton = findViewById(R.id.select_location_button);
|
selectLocationButton = findViewById(R.id.select_location_button);
|
||||||
|
removeLocationButton = findViewById(R.id.remove_location_button);
|
||||||
Mapbox.getInstance(this, getString(R.string.access_token));
|
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||||
mapView = findViewById(R.id.mapView);
|
mapView = findViewById(R.id.mapView);
|
||||||
mapView.onCreate(savedInstanceState);
|
mapView.onCreate(savedInstanceState);
|
||||||
@ -138,15 +135,15 @@ public class MapActivity extends BaseActivity
|
|||||||
mapboxMap.setOnMarkerClickListener(marker -> {
|
mapboxMap.setOnMarkerClickListener(marker -> {
|
||||||
String id = marker.getTitle();
|
String id = marker.getTitle();
|
||||||
if (id.equals(myID)) {
|
if (id.equals(myID)) {
|
||||||
Log.e(tag + "Manual", "my own marker from API");
|
selectLocationButton.setVisibility(View.GONE);
|
||||||
Button rmButton = findViewById(R.id.remove_location_button);
|
removeLocationButton.setVisibility(View.VISIBLE);
|
||||||
rmButton.setVisibility(View.VISIBLE);
|
|
||||||
rmButton.setOnClickListener(view -> {
|
removeLocationButton.setOnClickListener(view -> {
|
||||||
Log.e(tag + "Manual", "manual coords sending stopped");
|
Log.e(tag + "Manual", "manual coords sending stopped");
|
||||||
// TODO to remove after BGserv
|
// TODO to remove after BGserv
|
||||||
manualLocHandler.removeCallbacks(manualLocStatusChecker);
|
manualLocHandler.removeCallbacks(manualLocStatusChecker);
|
||||||
|
|
||||||
rmButton.setVisibility(View.GONE);
|
removeLocationButton.setVisibility(View.GONE);
|
||||||
Toast.makeText(MapActivity.this, "Your marker will disappear in next couple minutes", Toast.LENGTH_SHORT).show();
|
Toast.makeText(MapActivity.this, "Your marker will disappear in next couple minutes", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -235,6 +232,7 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
|
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
|
||||||
selectLocationButton.setVisibility(View.VISIBLE);
|
selectLocationButton.setVisibility(View.VISIBLE);
|
||||||
|
removeLocationButton.setVisibility(View.GONE);
|
||||||
Icon icon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.green_marker);
|
Icon icon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.green_marker);
|
||||||
|
|
||||||
if (tmpLocalMarker == null) {
|
if (tmpLocalMarker == null) {
|
||||||
@ -336,12 +334,7 @@ public class MapActivity extends BaseActivity
|
|||||||
public void onSuccess(List<Coordinate> coordsList) {
|
public void onSuccess(List<Coordinate> coordsList) {
|
||||||
|
|
||||||
|
|
||||||
if (coordsList.isEmpty() && droppedMarker == null) {
|
if (coordsList.isEmpty() && tmpLocalMarker != null) {
|
||||||
Timber.e("200 empty []");
|
|
||||||
mapboxMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (coordsList.isEmpty()) {
|
|
||||||
Timber.e("200 empty []");
|
Timber.e("200 empty []");
|
||||||
mapboxMap.clear();
|
mapboxMap.clear();
|
||||||
return;
|
return;
|
||||||
|
@ -38,11 +38,11 @@ public class mapUtils {
|
|||||||
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
|
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
|
||||||
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
|
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
|
||||||
mapboxMap.setMinZoomPreference(16); // TODO export to map config
|
mapboxMap.setMinZoomPreference(16); // TODO export to map config
|
||||||
// drawBoundsArea(context, mapboxMap, mapView, check);
|
drawBoundsArea(context, mapboxMap, mapView, check);
|
||||||
} else {
|
} else {
|
||||||
mapboxMap.setLatLngBoundsForCameraTarget(null);
|
mapboxMap.setLatLngBoundsForCameraTarget(null);
|
||||||
mapboxMap.setMinZoomPreference(2);
|
mapboxMap.setMinZoomPreference(2);
|
||||||
// drawBoundsArea(context, mapboxMap, mapView, check);
|
drawBoundsArea(context, mapboxMap, mapView, check);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +59,8 @@ public class mapUtils {
|
|||||||
private static View crosshair;
|
private static View crosshair;
|
||||||
|
|
||||||
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
|
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
|
||||||
|
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
// Visualise bounds area
|
// Visualise bounds area
|
||||||
// showBoundsArea
|
// showBoundsArea
|
||||||
|
Loading…
Reference in New Issue
Block a user