aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/Geocache.java9
-rw-r--r--main/src/cgeo/geocaching/connector/AbstractConnector.java16
-rw-r--r--main/src/cgeo/geocaching/connector/IConnector.java17
-rw-r--r--main/src/cgeo/geocaching/connector/UnknownConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java12
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCConnector.java10
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheRealm.java22
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java4
8 files changed, 39 insertions, 54 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index ac1c9b1..8f5b13c 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -12,7 +12,6 @@ import cgeo.geocaching.connector.gc.GCConnector;
import cgeo.geocaching.connector.gc.GCConstants;
import cgeo.geocaching.connector.gc.Tile;
import cgeo.geocaching.enumerations.CacheAttribute;
-import cgeo.geocaching.enumerations.CacheRealm;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
@@ -571,10 +570,6 @@ public class Geocache implements ICache, IWaypoint {
return getConnector().supportsOwnCoordinates();
}
- public CacheRealm getCacheRealm() {
- return getConnector().getCacheRealm();
- }
-
public ILoggingManager getLoggingManager(Activity activity) {
return getConnector().getLoggingManager(activity, this);
}
@@ -1763,4 +1758,8 @@ public class Geocache implements ICache, IWaypoint {
}
return false;
}
+
+ public int getMapMarkerId() {
+ return getConnector().getCacheMapMarkerId(isDisabled() || isArchived());
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java
index 905382f..08bdb56 100644
--- a/main/src/cgeo/geocaching/connector/AbstractConnector.java
+++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.enumerations.CacheRealm;
+import cgeo.geocaching.R;
import cgeo.geocaching.geopoint.Geopoint;
import org.apache.commons.lang3.StringUtils;
@@ -138,15 +138,15 @@ public abstract class AbstractConnector implements IConnector {
* {@link IConnector}
*/
@Override
- public CacheRealm getCacheRealm() {
- return CacheRealm.OTHER;
+ public boolean isActivated() {
+ return false;
}
- /**
- * {@link IConnector}
- */
@Override
- public boolean isActivated() {
- return false;
+ public int getCacheMapMarkerId(boolean disabled) {
+ if (disabled) {
+ return R.drawable.marker_disabled_other;
+ }
+ return R.drawable.marker_other;
}
}
diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java
index 011c507..9470e72 100644
--- a/main/src/cgeo/geocaching/connector/IConnector.java
+++ b/main/src/cgeo/geocaching/connector/IConnector.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.ICache;
-import cgeo.geocaching.enumerations.CacheRealm;
import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
@@ -169,13 +168,6 @@ public interface IConnector {
public boolean deleteModifiedCoordinates(Geocache cache);
/**
- * The CacheRealm this cache belongs to
- *
- * @return
- */
- public CacheRealm getCacheRealm();
-
- /**
* Return true if this connector is activated for online
* interaction (download details, do searches, ...)
*
@@ -200,4 +192,13 @@ public interface IConnector {
* @return
*/
public boolean canLog(Geocache geocache);
+
+ /**
+ * Return the marker id of the caches for this connector. This creates the different backgrounds for cache markers
+ * on the map.
+ *
+ * @param disabled
+ * Whether to return the enabled or disabled marker type
+ */
+ public int getCacheMapMarkerId(boolean disabled);
}
diff --git a/main/src/cgeo/geocaching/connector/UnknownConnector.java b/main/src/cgeo/geocaching/connector/UnknownConnector.java
index b6fc29a..e9fecb9 100644
--- a/main/src/cgeo/geocaching/connector/UnknownConnector.java
+++ b/main/src/cgeo/geocaching/connector/UnknownConnector.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.connector;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.Geocache;
+import cgeo.geocaching.ICache;
import org.apache.commons.lang3.StringUtils;
@@ -36,4 +36,5 @@ public class UnknownConnector extends AbstractConnector {
protected String getCacheUrlPrefix() {
return null;
}
+
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
index 82bd52a..f327dc1 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
@@ -11,7 +11,6 @@ import cgeo.geocaching.connector.ILoggingManager;
import cgeo.geocaching.connector.capability.ISearchByCenter;
import cgeo.geocaching.connector.capability.ISearchByGeocode;
import cgeo.geocaching.connector.capability.ISearchByViewPort;
-import cgeo.geocaching.enumerations.CacheRealm;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.Viewport;
@@ -258,12 +257,15 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
}
@Override
- public CacheRealm getCacheRealm() {
- return CacheRealm.GC;
+ public boolean isActivated() {
+ return Settings.isGCConnectorActive();
}
@Override
- public boolean isActivated() {
- return Settings.isGCConnectorActive();
+ public int getCacheMapMarkerId(boolean disabled) {
+ if (disabled) {
+ return R.drawable.marker_disabled;
+ }
+ return R.drawable.marker;
}
}
diff --git a/main/src/cgeo/geocaching/connector/oc/OCConnector.java b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
index a26a3c1..01738c0 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
@@ -2,8 +2,8 @@ package cgeo.geocaching.connector.oc;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.ICache;
+import cgeo.geocaching.R;
import cgeo.geocaching.connector.AbstractConnector;
-import cgeo.geocaching.enumerations.CacheRealm;
import java.util.regex.Pattern;
@@ -59,7 +59,11 @@ public class OCConnector extends AbstractConnector {
}
@Override
- public CacheRealm getCacheRealm() {
- return CacheRealm.OC;
+ public int getCacheMapMarkerId(boolean disabled) {
+ if (disabled) {
+ return R.drawable.marker_disabled_oc;
+ }
+ return R.drawable.marker_oc;
}
+
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheRealm.java b/main/src/cgeo/geocaching/enumerations/CacheRealm.java
deleted file mode 100644
index 5a203ab..0000000
--- a/main/src/cgeo/geocaching/enumerations/CacheRealm.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package cgeo.geocaching.enumerations;
-
-import cgeo.geocaching.R;
-
-public enum CacheRealm {
-
- GC("gc", "geocaching.com", R.drawable.marker, R.drawable.marker_disabled),
- OC("oc", "OpenCaching Network", R.drawable.marker_oc, R.drawable.marker_disabled_oc),
- OTHER("other", "Other", R.drawable.marker_other, R.drawable.marker_disabled_other);
-
- public final String id;
- public final String name;
- public final int markerId;
- public final int markerDisabledId;
-
- CacheRealm(String id, String name, int markerId, int markerDisabledId) {
- this.id = id;
- this.name = name;
- this.markerId = markerId;
- this.markerDisabledId = markerDisabledId;
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 19e4697..989bff4 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -1622,7 +1622,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
.append(cache.isReliableLatLon())
.append(cache.getType().id)
.append(cache.isDisabled() || cache.isArchived())
- .append(cache.getCacheRealm().id)
+ .append(cache.getMapMarkerId())
.append(cache.isOwner())
.append(cache.isFound())
.append(cache.hasUserModifiedCoords())
@@ -1645,7 +1645,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final ArrayList<int[]> insets = new ArrayList<int[]>(8);
// background: disabled or not
- final Drawable marker = getResources().getDrawable(cache.isDisabled() || cache.isArchived() ? cache.getCacheRealm().markerDisabledId : cache.getCacheRealm().markerId);
+ final Drawable marker = getResources().getDrawable(cache.getMapMarkerId());
layers.add(marker);
final int resolution = marker.getIntrinsicWidth() > 40 ? 1 : 0;
// reliable or not