aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/maps/google/GoogleMapView.java')
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index 610dbe1..ea815ab 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -20,7 +20,6 @@ import com.google.android.maps.MapView;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.eclipse.jdt.annotation.NonNull;
-import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
@@ -39,16 +38,23 @@ public class GoogleMapView extends MapView implements MapViewImpl {
public GoogleMapView(Context context, AttributeSet attrs) {
super(context, attrs);
- gestureDetector = new GestureDetector(context, new GestureListener());
+ initialize(context);
}
public GoogleMapView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- gestureDetector = new GestureDetector(context, new GestureListener());
+ initialize(context);
}
public GoogleMapView(Context context, String apiKey) {
super(context, apiKey);
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ if (isInEditMode()) {
+ return;
+ }
gestureDetector = new GestureDetector(context, new GestureListener());
}
@@ -120,9 +126,9 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public PositionAndScaleOverlay createAddPositionAndScaleOverlay(Activity activity) {
+ public PositionAndScaleOverlay createAddPositionAndScaleOverlay() {
- GoogleOverlay ovl = new GoogleOverlay(activity);
+ GoogleOverlay ovl = new GoogleOverlay();
getOverlays().add(ovl);
return (PositionAndScaleOverlay) ovl.getBase();
}