本文整理汇总了Java中org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider类的典型用法代码示例。如果您正苦于以下问题:Java InternalCompassOrientationProvider类的具体用法?Java InternalCompassOrientationProvider怎么用?Java InternalCompassOrientationProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InternalCompassOrientationProvider类属于org.osmdroid.views.overlay.compass包,在下文中一共展示了InternalCompassOrientationProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapSetup
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
private void mapSetup() {
map = (MapView) getActivity().findViewById(R.id.createPoiMap);
//important! set your user agent to prevent getting banned from the osm servers
Configuration.getInstance().load(getActivity(), PreferenceManager.getDefaultSharedPreferences(getActivity()));
map.setTileSource(TileSourceFactory.MAPNIK);
map.setTilesScaledToDpi(true);
// add multi-touch capability
map.setMultiTouchControls(true);
// add compass to map
CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
compassOverlay.enableCompass();
map.getOverlays().add(compassOverlay);
// get map controller
IMapController controller = map.getController();
GeoPoint position = new GeoPoint(latitude, longitude);
controller.setCenter(position);
controller.setZoom(18);
MapUtils.addMarker(getActivity(), map, latitude, longitude);
}
示例2: mapSetup
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
private void mapSetup() {
map = (MapView) getActivity().findViewById(R.id.map); // create basic map
mController = map.getController(); // get map controller
map.setTileSource(TileSourceFactory.MAPNIK);
map.setTilesScaledToDpi(true);
map.setMultiTouchControls(true);
// add compass to map
CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
compassOverlay.enableCompass();
map.getOverlays().add(compassOverlay);
//attach listeners
MapEventsOverlay mapEventsOverlay = new MapEventsOverlay(this);
map.getOverlays().add(0, mapEventsOverlay);
setupMyLocation();
}
示例3: setupMapPreview
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
private void setupMapPreview(double lat, double lon, String markerTitle) {
//important! set your user agent to prevent getting banned from the osm servers
Configuration.getInstance().load(getDialog().getContext(), PreferenceManager.getDefaultSharedPreferences(getDialog().getContext()));
map = (MapView) getDialog().findViewById(R.id.poiDialogMap);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setTilesScaledToDpi(true);
map.setMultiTouchControls(true);
// add compass to map
CompassOverlay compassOverlay = new CompassOverlay(getDialog().getContext(), new InternalCompassOrientationProvider(getDialog().getContext()), map);
compassOverlay.enableCompass();
map.getOverlays().add(compassOverlay);
// get map controller
IMapController controller = map.getController();
GeoPoint position = new GeoPoint(lat, lon);
controller.setCenter(position);
controller.setZoom(18);
MapUtils.addMarker(getActivity(), map, lat, lon, markerTitle);
}
示例4: mapSetup
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
private void mapSetup() {
map = (MapView) getActivity().findViewById(R.id.createPoiMap);
//important! set your user agent to prevent getting banned from the osm servers
Configuration.getInstance().load(getActivity(), PreferenceManager.getDefaultSharedPreferences(getActivity()));
map.setTileSource(TileSourceFactory.MAPNIK);
map.setTilesScaledToDpi(true);
map.setMultiTouchControls(true);
CompassOverlay compassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
compassOverlay.enableCompass();
map.getOverlays().add(compassOverlay);
IMapController controller = map.getController();
GeoPoint position = new GeoPoint(POI.getLatitude(), POI.getLongitude());
controller.setCenter(position);
controller.setZoom(18);
MapUtils.addMarker(getActivity(), map, POI.getLatitude(), POI.getLongitude());
}
示例5: onResume
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
final String tileSourceName = mPrefs.getString(PREFS_TILE_SOURCE,
TileSourceFactory.DEFAULT_TILE_SOURCE.name());
try {
final ITileSource tileSource = TileSourceFactory.getTileSource(tileSourceName);
mMapView.setTileSource(tileSource);
} catch (final IllegalArgumentException e) {
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
}
if (mPrefs.getBoolean(PREFS_SHOW_LOCATION, false)) {
this.mLocationOverlay.enableMyLocation();
}
//sorry for the spaghetti code this is to filter out the compass on api 8
//Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
if (mPrefs.getBoolean(PREFS_SHOW_COMPASS, false)) {
if (mCompassOverlay!=null) {
//this call is needed because onPause, the orientation provider is destroyed to prevent context leaks
this.mCompassOverlay.setOrientationProvider(new InternalCompassOrientationProvider(getActivity()));
this.mCompassOverlay.enableCompass();
}
}
mMapView.onResume();
}
示例6: setUpMapIfNeeded
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
//BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(),R.drawable.ic_map_pin_orange, null);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例7: setUpMapIfNeeded
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例8: setUpMapIfNeeded
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例9: onCreateView
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
fragmentView = (LinearLayout) inflater.inflate(R.layout.main, container, false);
layout1 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout1);
layout2 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout2);
layout4 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout4);
layout5 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout5);
defineWidgets(fragmentView);
if (savedInstanceState != null)
chrono.setBase(chronoBaseValue);
chrono.setOnChronometerTickListener(new OnChronometerTickListener() {
public void onChronometerTick(Chronometer arg0) {
showCalculatedData(arg0);
if (prefs.getInt("practice_display5", TypesOfPractices.BASIC_PRACTICE.getTypes()) == TypesOfPractices.HIIT_PRACTICE
.getTypes())
showHiitTrainingDataInDisplay(arg0);
}
});
mapView = (MapView) fragmentView.findViewById(R.id.practice_mapview);
mapView.getOverlays().clear();
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.setUseSafeCanvas(true);
setHardwareAccelerationOff();
mapController = (MapController) mapView.getController();
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(mContext);
mapView.getOverlays().add(mScaleBarOverlay);
pathOverlay = new PathOverlay(Color.BLUE, mContext);
pathOverlay.getPaint().setStyle(Style.STROKE);
pathOverlay.getPaint().setStrokeWidth(3);
pathOverlay.getPaint().setAntiAlias(true);
mapView.getOverlays().add(pathOverlay);
this.mCompassOverlay = new CompassOverlay(mContext, new InternalCompassOrientationProvider(mContext),
mapView);
mCompassOverlay.setEnabled(true);
mapView.getOverlays().add(mCompassOverlay);
this.mLocationOverlay = new MyLocationNewOverlay(mContext, new GpsMyLocationProvider(mContext),
mapView);
mLocationOverlay.setDrawAccuracyEnabled(true);
mapView.getOverlays().add(mLocationOverlay);
MapOverlay touchOverlay = new MapOverlay(mContext);
mapView.getOverlays().add(touchOverlay);
mLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
if (centerPoint == null)
centerPoint = mLocationOverlay.getMyLocation();
centerMyLocation(centerPoint);
}
});
mapView.postInvalidate();
return fragmentView;
}
示例10: addOverlays
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
protected void addOverlays() {
//sorry for the spaghetti code this is to filter out the compass on api 8
//Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
mCompassOverlay = new CompassOverlay(getContext(), new InternalCompassOrientationProvider(getContext()),
mMapView);
mCompassOverlay.enableCompass();
mMapView.getOverlays().add(this.mCompassOverlay);
}
}
示例11: onResume
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
//sorry for the spaghetti code this is to filter out the compass on api 8
//Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
if (mCompassOverlay != null) {
//this call is needed because onPause, the orientation provider is destroyed to prevent context leaks
this.mCompassOverlay.setOrientationProvider(new InternalCompassOrientationProvider(getActivity()));
this.mCompassOverlay.enableCompass();
}
}
示例12: onCreate
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starter_mapview);
Intent intent = getIntent();
//if (intent)
final double lat1 = 25.633;
final double long1 = 71.094;
//super important. Many tile servers, including open street maps, will BAN applications by user
//agent. Do not use the sample application's user agent for your app! Use your own setting, such
//as the app id.
Configuration.getInstance().setUserAgentValue(getPackageName());
mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this),
mMapView);
mCompassOverlay.enableCompass();
mMapView.getOverlays().add(this.mCompassOverlay);
addOverlays();
GeoPoint startPoint = new GeoPoint(lat1, long1);
IMapController mapController = mMapView.getController();
mapController.setZoom(9);
mapController.setCenter(startPoint);
Marker startMarker = new Marker(mMapView);
startMarker.setPosition(startPoint);
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mMapView.getOverlays().add(startMarker);
mMapView.invalidate();
}
示例13: setUpMapIfNeeded
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
//BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_pin_orange, null);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例14: refreshLocationsOnMap
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
public void refreshLocationsOnMap(){
map.getOverlays().clear();
map.invalidate();
placeMarkers.clear();
allPlaces = Place.getAll();
for(Place place: allPlaces){
OverlayItem placeOverlayItem = new OverlayItem(
place.getAddress(), place.getDescription(), new GeoPoint(place.getLatitude(), place.getLongitude()));
Drawable myCurrentLocationMarker = this.getResources().getDrawable(R.drawable.marker_cloud);
placeOverlayItem.setMarker(myCurrentLocationMarker);
placeMarkers.add(placeOverlayItem);
}
// add my current location overlay
if(currentLocation != null){
OverlayItem myLocationOverlayItem = new OverlayItem("Here", "Current location",
new GeoPoint(currentLocation.getLatitude(), currentLocation.getLongitude()));
myLocationOverlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
placeMarkers.add(myLocationOverlayItem);
}
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay
= new ItemizedIconOverlay<OverlayItem>(
getActivity(), placeMarkers, null);
map.getOverlays().add(anotherItemizedIconOverlay);
ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(map);
map.getOverlays().add(myScaleBarOverlay);
MyLocationNewOverlay mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(getActivity()), map);
map.getOverlays().add(mLocationOverlay);
CompassOverlay mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
map.getOverlays().add(mCompassOverlay);
/*RotationGestureOverlay mRotationGestureOverlay = new RotationGestureOverlay(getActivity(), map);
mRotationGestureOverlay.setEnabled(true);
map.setMultiTouchControls(true);
map.getOverlays().add(mRotationGestureOverlay);*/
setBoundingBox();
}
示例15: onActivityCreated
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Context context = this.getActivity();
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
// mResourceProxy = new ResourceProxyImpl(getActivity().getApplicationContext());
mPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
this.mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(context),
mMapView);
mMinimapOverlay = new MinimapOverlay(context, mMapView.getTileRequestCompleteHandler());
mMinimapOverlay.setWidth(dm.widthPixels / 5);
mMinimapOverlay.setHeight(dm.heightPixels / 5);
mCopyrightOverlay = new CopyrightOverlay(context);
//i hate this very much, but it seems as if certain versions of android and/or
//device types handle screen offsets differently
if (Build.VERSION.SDK_INT <= 10)
mCopyrightOverlay.setOffset(0,(int)(55*dm.density));
mScaleBarOverlay = new ScaleBarOverlay(mMapView);
mScaleBarOverlay.setCentred(true);
mScaleBarOverlay.setScaleBarOffset(dm.widthPixels / 2, 10);
mRotationGestureOverlay = new RotationGestureOverlay(mMapView);
mRotationGestureOverlay.setEnabled(true);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
mMapView.setTilesScaledToDpi(false);
mMapView.getOverlays().add(this.mLocationOverlay);
mMapView.getOverlays().add(this.mCopyrightOverlay);
mMapView.getOverlays().add(this.mMinimapOverlay);
mMapView.getOverlays().add(this.mScaleBarOverlay);
mMapView.getOverlays().add(this.mRotationGestureOverlay);
final float zoomLevel = mPrefs.getFloat(PREFS_ZOOM_LEVEL_DOUBLE, mPrefs.getInt(PREFS_ZOOM_LEVEL, 1));
mMapView.getController().setZoom(zoomLevel);
final float orientation = mPrefs.getFloat(PREFS_ORIENTATION, 0);
mMapView.setMapOrientation(orientation, false);
final String latitudeString = mPrefs.getString(PREFS_LATITUDE_STRING, null);
final String longitudeString = mPrefs.getString(PREFS_LONGITUDE_STRING, null);
if (latitudeString == null || longitudeString == null) { // case handled for historical reasons only
final int scrollX = mPrefs.getInt(PREFS_SCROLL_X, 0);
final int scrollY = mPrefs.getInt(PREFS_SCROLL_Y, 0);
mMapView.scrollTo(scrollX, scrollY);
} else {
final double latitude = Double.valueOf(latitudeString);
final double longitude = Double.valueOf(longitudeString);
mMapView.setExpectedCenter(new GeoPoint(latitude, longitude));
}
mLocationOverlay.enableMyLocation();
//sorry for the spaghetti code this is to filter out the compass on api 8
//Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) {
mCompassOverlay = new CompassOverlay(context, new InternalCompassOrientationProvider(context),
mMapView);
mCompassOverlay.enableCompass();
mMapView.getOverlays().add(this.mCompassOverlay);
}
setHasOptionsMenu(true);
}