aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-05-25 19:05:47 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-05-25 19:05:47 +0200
commitddc94e34458f76d0d699e0eac6f0e1d4913b172b (patch)
tree1ee9eb3cbea8595acd261e9906cfadeab1a53500
parent3b50ace3194f1153a98cbf2edc6bc78e8993fd5d (diff)
downloadcgeo-ddc94e34458f76d0d699e0eac6f0e1d4913b172b.zip
cgeo-ddc94e34458f76d0d699e0eac6f0e1d4913b172b.tar.gz
cgeo-ddc94e34458f76d0d699e0eac6f0e1d4913b172b.tar.bz2
avoid useless initializations in layout preview mode
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java11
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java7
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java7
3 files changed, 23 insertions, 2 deletions
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());
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index fb057a4..d95cc80 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -42,6 +42,13 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
public MapsforgeMapView(Context context, AttributeSet attrs) {
super(context, attrs);
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ if (isInEditMode()) {
+ return;
+ }
gestureDetector = new GestureDetector(context, new GestureListener());
if (Settings.isScaleMapsforgeText()) {
this.setTextScale(getResources().getDisplayMetrics().density);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
index 68a03b7..8dd15fc 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
@@ -36,6 +36,13 @@ public class MapsforgeMapView024 extends MapView implements MapViewImpl {
public MapsforgeMapView024(Context context, AttributeSet attrs) {
super(context, attrs);
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ if (isInEditMode()) {
+ return;
+ }
gestureDetector = new GestureDetector(context, new GestureListener());
}