diff --git a/vtm-android/src/org/oscim/android/MapActivity.java b/vtm-android/src/org/oscim/android/MapActivity.java index c74366d7..11506942 100644 --- a/vtm-android/src/org/oscim/android/MapActivity.java +++ b/vtm-android/src/org/oscim/android/MapActivity.java @@ -26,13 +26,12 @@ import android.content.SharedPreferences.Editor; import android.support.v4.app.FragmentActivity; /** - * MapActivity is the abstract base class which must be extended in order to use - * a {@link Map}. There are no abstract methods in this implementation which + * MapActivity is the abstract base class which can be extended in order to use + * a {@link MapView}. There are no abstract methods in this implementation which * subclasses need to override and no API key or registration is required. *

* A subclass may create a MapView either via one of the MapView constructors or - * by inflating an XML layout file. It is possible to use more than one MapView - * at the same time. + * by inflating an XML layout file. *

* When the MapActivity is shut down, the current center position, zoom level * and map file of the MapView are saved in a preferences file and restored in @@ -77,8 +76,6 @@ public abstract class MapActivity extends FragmentActivity { editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6); editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale); - //editor.putString(KEY_THEME, mMap.getRenderTheme()); - editor.commit(); } @@ -116,22 +113,5 @@ public abstract class MapActivity extends FragmentActivity { mMap.setMapPosition(mapPosition); } - - //String theme = sharedPreferences.getString(KEY_THEME, - // InternalRenderTheme.DEFAULT.name()); - - // if (theme.startsWith("/")) { - // try { - // map.setRenderTheme(theme); - // } catch (FileNotFoundException e) { - // map.setRenderTheme(InternalRenderTheme.DEFAULT); - // } - // } else { - // try { - // map.setRenderTheme(InternalRenderTheme.valueOf(theme)); - // } catch (IllegalArgumentException e) { - // map.setRenderTheme(InternalRenderTheme.DEFAULT); - // } - // } } } diff --git a/vtm-android/src/org/oscim/android/MapView.java b/vtm-android/src/org/oscim/android/MapView.java index c59000ba..aed1da66 100644 --- a/vtm-android/src/org/oscim/android/MapView.java +++ b/vtm-android/src/org/oscim/android/MapView.java @@ -49,15 +49,12 @@ public class MapView extends RelativeLayout { System.loadLibrary("vtm-jni"); } - public static final boolean debugFrameTime = false; - public static final boolean testRegionZoom = false; - public boolean mRotationEnabled = false; public boolean mCompassEnabled = false; public boolean enablePagedFling = false; - private final Compass mCompass; private final GestureDetector mGestureDetector; + final AndroidMotionEvent mMotionEvent; private int mWidth; private int mHeight; @@ -109,11 +106,10 @@ public class MapView extends RelativeLayout { if (context instanceof MapActivity) ((MapActivity)context).registerMapView(this); - mCompass = new Compass(context, mMap); - mMap.clearMap(); mMap.updateMap(false); + mMotionEvent = new AndroidMotionEvent(); mGestureDetector = new GestureDetector(context, new OnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { @@ -152,26 +148,16 @@ public class MapView extends RelativeLayout { public void onStop() { log.debug("onStop"); - //mMap.destroy(); } void onPause() { mMap.pause(true); - - if (this.mCompassEnabled) - mCompass.disable(); - } void onResume() { - if (this.mCompassEnabled) - mCompass.enable(); - mMap.pause(false); } - final AndroidMotionEvent mMotionEvent = new AndroidMotionEvent(); - @Override public boolean onTouchEvent(android.view.MotionEvent motionEvent) { @@ -189,7 +175,6 @@ public class MapView extends RelativeLayout { @Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { - log.debug("onSizeChanged: " + width + "x" + height); super.onSizeChanged(width, height, oldWidth, oldHeight); @@ -201,41 +186,4 @@ public class MapView extends RelativeLayout { if (mInitialized) mMap.getViewport().setViewport(width, height); } - - public void enableRotation(boolean enable) { - mRotationEnabled = enable; - - if (enable) { - enableCompass(false); - } - } - - public void enableCompass(boolean enable) { - if (enable == mCompassEnabled) - return; - - mCompassEnabled = enable; - - if (enable) - enableRotation(false); - - if (enable) - mCompass.enable(); - else - mCompass.disable(); - } - - public boolean getCompassEnabled() { - return mCompassEnabled; - } - - public boolean getRotationEnabled() { - return mRotationEnabled; - } - - public void destroy() { - log.debug("TODO Auto-generated method stub"); - - } - }