move Android specific code to 'android' package

This commit is contained in:
Hannes Janetzek 2013-06-21 19:09:35 +02:00
parent 07c02cc58d
commit 58942dbf59
5 changed files with 17 additions and 10 deletions

View File

@ -12,7 +12,9 @@
* You should have received a copy of the GNU Lesser General Public License along with * You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.oscim.view; package org.oscim.android;
import org.oscim.view.MapView;
import android.content.Context; import android.content.Context;
import android.hardware.Sensor; import android.hardware.Sensor;
@ -54,12 +56,12 @@ public class Compass {
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
} }
void enable() { public void enable() {
mSensorManager.registerListener(mListener, mSensor, mSensorManager.registerListener(mListener, mSensor,
SensorManager.SENSOR_DELAY_UI); SensorManager.SENSOR_DELAY_UI);
} }
void disable() { public void disable() {
mSensorManager.unregisterListener(mListener); mSensorManager.unregisterListener(mListener);
mMapView.getMapViewPosition().setRotation(0); mMapView.getMapViewPosition().setRotation(0);
} }

View File

@ -12,10 +12,11 @@
* You should have received a copy of the GNU Lesser General Public License along with * You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.oscim.view; package org.oscim.android;
import org.oscim.core.GeoPoint; import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition; import org.oscim.core.MapPosition;
import org.oscim.view.MapView;
import android.app.Activity; import android.app.Activity;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -98,7 +99,7 @@ public abstract class MapActivity extends Activity {
* @param mapView * @param mapView
* the calling MapView. * the calling MapView.
*/ */
final void registerMapView(MapView mapView) { public final void registerMapView(MapView mapView) {
mMapView = mapView; mMapView = mapView;
SharedPreferences sharedPreferences = getSharedPreferences(PREFERENCES_FILE, SharedPreferences sharedPreferences = getSharedPreferences(PREFERENCES_FILE,

View File

@ -1,3 +1,4 @@
package org.oscim.android;
///* ///*
// * Copyright 2010, 2011, 2012 mapsforge.org // * Copyright 2010, 2011, 2012 mapsforge.org
// * // *

View File

@ -17,6 +17,8 @@ package org.oscim.view;
import java.util.List; import java.util.List;
import org.oscim.android.Compass;
import org.oscim.android.MapActivity;
import org.oscim.core.BoundingBox; import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint; import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition; import org.oscim.core.MapPosition;
@ -151,7 +153,8 @@ public class MapView extends RelativeLayout {
//mLayerManager.add(new GenericOverlay(this, new GridRenderLayer(this))); //mLayerManager.add(new GenericOverlay(this, new GridRenderLayer(this)));
mLayerManager.add(new BuildingOverlay(this, baseLayer.getTileLayer())); mLayerManager.add(new BuildingOverlay(this, baseLayer.getTileLayer()));
mLayerManager.add(new LabelLayer(this, baseLayer.getTileLayer())); LabelLayer ll = new LabelLayer(this, baseLayer.getTileLayer());
mLayerManager.add(ll);
return baseLayer; return baseLayer;
} }
@ -166,7 +169,7 @@ public class MapView extends RelativeLayout {
return null; return null;
} }
void destroy() { public void destroy() {
mLayerManager.destroy(); mLayerManager.destroy();
} }
@ -177,7 +180,7 @@ public class MapView extends RelativeLayout {
private boolean mPausing = false; private boolean mPausing = false;
void onPause() { public void onPause() {
mPausing = true; mPausing = true;
if (this.mCompassEnabled) if (this.mCompassEnabled)
@ -185,7 +188,7 @@ public class MapView extends RelativeLayout {
} }
void onResume() { public void onResume() {
if (this.mCompassEnabled) if (this.mCompassEnabled)
mCompass.enable(); mCompass.enable();

View File

@ -567,7 +567,7 @@ public class MapViewPosition {
mAbsY = MercatorProjection.latitudeToY(latitude); mAbsY = MercatorProjection.latitudeToY(latitude);
} }
synchronized void setMapPosition(MapPosition mapPosition) { public synchronized void setMapPosition(MapPosition mapPosition) {
setZoomLevelLimit(mapPosition.zoomLevel); setZoomLevelLimit(mapPosition.zoomLevel);
mAbsX = mapPosition.x; mAbsX = mapPosition.x;
mAbsY = mapPosition.y; mAbsY = mapPosition.y;