mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge pull request #1320 from commons-app/changeCurrentLocationMarkerIcon
Change current location marker icon
This commit is contained in:
commit
499591d0ca
3 changed files with 7 additions and 5 deletions
|
|
@ -32,6 +32,8 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.mapbox.mapboxsdk.Mapbox;
|
import com.mapbox.mapboxsdk.Mapbox;
|
||||||
|
import com.mapbox.mapboxsdk.annotations.Icon;
|
||||||
|
import com.mapbox.mapboxsdk.annotations.IconFactory;
|
||||||
import com.mapbox.mapboxsdk.annotations.Marker;
|
import com.mapbox.mapboxsdk.annotations.Marker;
|
||||||
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
||||||
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
|
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
|
||||||
|
|
@ -423,10 +425,14 @@ public class NearbyMapFragment extends DaggerFragment {
|
||||||
if (currentLocationMarker != null) {
|
if (currentLocationMarker != null) {
|
||||||
currentLocationMarker.remove(); // Remove previous marker, we are not Hansel and Gretel
|
currentLocationMarker.remove(); // Remove previous marker, we are not Hansel and Gretel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Icon icon = IconFactory.getInstance(getContext()).fromResource(R.drawable.current_location_marker);
|
||||||
|
|
||||||
MarkerOptions currentLocationMarkerOptions = new MarkerOptions()
|
MarkerOptions currentLocationMarkerOptions = new MarkerOptions()
|
||||||
.position(new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude()));
|
.position(new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude()));
|
||||||
currentLocationMarker = mapboxMap.addMarker(currentLocationMarkerOptions);
|
currentLocationMarkerOptions.setIcon(icon); // Set custom icon
|
||||||
|
|
||||||
|
currentLocationMarker = mapboxMap.addMarker(currentLocationMarkerOptions);
|
||||||
|
|
||||||
List<LatLng> circle = createCircleArray(curLatLng.getLatitude(), curLatLng.getLongitude(),
|
List<LatLng> circle = createCircleArray(curLatLng.getLatitude(), curLatLng.getLongitude(),
|
||||||
curLatLng.getAccuracy() * 2, 100);
|
curLatLng.getAccuracy() * 2, 100);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
</selector>
|
|
||||||
BIN
app/src/main/res/drawable/current_location_marker.png
Normal file
BIN
app/src/main/res/drawable/current_location_marker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 882 B |
Loading…
Add table
Add a link
Reference in a new issue