From ddc94e34458f76d0d699e0eac6f0e1d4913b172b Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 25 May 2014 19:05:47 +0200 Subject: avoid useless initializations in layout preview mode --- main/src/cgeo/geocaching/maps/google/GoogleMapView.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'main/src/cgeo/geocaching/maps/google/GoogleMapView.java') diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java index 094c456..ea815ab 100644 --- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java +++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java @@ -38,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()); } -- cgit v1.1