use of io.jawg.osmcontributor.ui.utils.views.LocationMarkerViewAdapter in project osm-contributor by jawg.
the class MapFragment method instantiateMapBox.
private void instantiateMapBox(Bundle savedInstanceState) {
// LocationView settings
mapboxMap.getMyLocationViewSettings().setAccuracyAlpha(0);
mapboxMap.getMyLocationViewSettings().setForegroundTintColor(ContextCompat.getColor(getActivity(), R.color.colorPrimaryTransparent));
// Set the map center and zoom to the saved values or use the default values
getUserLocation();
CameraPosition.Builder cameraBuilder = new CameraPosition.Builder();
if (savedInstanceState == null) {
double lat = sharedPreferences.getFloat("latitude", 0);
double lon = sharedPreferences.getFloat("longitude", 0);
if (lat != 0 && lon != 0) {
cameraBuilder.target(new LatLng(lat, lon)).zoom(11);
}
} else {
cameraBuilder.target((LatLng) savedInstanceState.getParcelable(LOCATION)).zoom(savedInstanceState.getFloat(ZOOM_LEVEL));
}
mapboxMap.setCameraPosition(cameraBuilder.build());
presenter.setForceRefreshPoi();
presenter.setForceRefreshNotes();
presenter.loadPoisIfNeeded();
eventBus.post(new PleaseInitializeNoteDrawerEvent(displayOpenNotes, displayClosedNotes));
if (poiTypePickerAdapter != null) {
poiTypePickerAdapter.setExpertMode(sharedPreferences.getBoolean(getString(R.string.shared_prefs_expert_mode), false));
}
mapboxListener.listen(mapboxMap, mapView);
mapboxMap.getMarkerViewManager().addMarkerViewAdapter(new LocationMarkerViewAdapter(getActivity().getApplicationContext()));
}
Aggregations