mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Change current location marker icon
This commit is contained in:
parent
41e11b7f20
commit
0e11a00025
2 changed files with 7 additions and 1 deletions
|
|
@ -30,6 +30,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;
|
||||||
|
|
@ -421,10 +423,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);
|
||||||
|
|
|
||||||
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