cleanup: MapView

This commit is contained in:
Hannes Janetzek 2014-03-22 20:26:31 +01:00
parent 78f3d82d2f
commit b85713b437

View File

@ -44,24 +44,20 @@ public class MapView extends RelativeLayout {
protected final GestureDetector mGestureDetector; protected final GestureDetector mGestureDetector;
protected final AndroidMotionEvent mMotionEvent; protected final AndroidMotionEvent mMotionEvent;
protected int mWidth;
protected int mHeight;
public MapView(Context context) { public MapView(Context context) {
this(context, null); this(context, null);
} }
public MapView(Context context, AttributeSet attributeSet) { public MapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet); super(context, attributeSet);
this.setWillNotDraw(true);
this.setClickable(true);
this.setFocusable(true);
AndroidGraphics.init(); AndroidGraphics.init();
AndroidAssets.init(context); AndroidAssets.init(context);
GLAdapter.init(new AndroidGL()); GLAdapter.init(new AndroidGL());
this.setWillNotDraw(true);
this.setClickable(true);
this.setFocusable(true);
DisplayMetrics metrics = getResources().getDisplayMetrics(); DisplayMetrics metrics = getResources().getDisplayMetrics();
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi); CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
@ -81,7 +77,7 @@ public class MapView extends RelativeLayout {
} }
public void onStop() { public void onStop() {
log.debug("onStop");
} }
void onPause() { void onPause() {
@ -111,10 +107,7 @@ public class MapView extends RelativeLayout {
super.onSizeChanged(width, height, oldWidth, oldHeight); super.onSizeChanged(width, height, oldWidth, oldHeight);
mWidth = width; if (width > 0 && height > 0)
mHeight = height;
if (mWidth > 0 && mHeight > 0)
mMap.viewport().setScreenSize(width, height); mMap.viewport().setScreenSize(width, height);
} }