aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java2
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java23
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java2
3 files changed, 16 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 7921bc4..a3535a6 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -1092,7 +1092,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
if (attrib == null) {
attrib = CacheAttribute.UNKNOWN;
}
- attributeName = attrib.getGcL10n(enabled);
+ attributeName = attrib.getL10n(enabled);
if (buffer.length() > 0) {
buffer.append('\n');
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index 48b2c63..530869f 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -5,6 +5,8 @@ import cgeo.geocaching.cgeoapplication;
import org.apache.commons.lang3.StringUtils;
+import android.util.SparseArray;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -131,7 +133,14 @@ public enum CacheAttribute {
this.stringIdNo = stringIdNo;
}
- public String getGcL10n(final boolean enabled) {
+ /**
+ * get localized text
+ *
+ * @param enabled
+ * true: for positive text, false: for negative text
+ * @return the localized text
+ */
+ public String getL10n(final boolean enabled) {
return cgeoapplication.getInstance().getResources().getString(
enabled ? stringIdYes : stringIdNo);
}
@@ -145,26 +154,22 @@ public enum CacheAttribute {
FIND_BY_GCRAWNAME = Collections.unmodifiableMap(mapGcRawNames);
}
- private final static Map<Integer, CacheAttribute> FIND_BY_GCID;
+ private final static SparseArray<CacheAttribute> FIND_BY_GCID = new SparseArray<CacheAttribute>();
static {
- final HashMap<Integer, CacheAttribute> mapGcIds = new HashMap<Integer, CacheAttribute>();
for (CacheAttribute attr : values()) {
if (attr.gcid != NO_ID) {
- mapGcIds.put(attr.gcid, attr);
+ FIND_BY_GCID.put(attr.gcid, attr);
}
}
- FIND_BY_GCID = Collections.unmodifiableMap(mapGcIds);
}
- private final static Map<Integer, CacheAttribute> FIND_BY_OCID;
+ private final static SparseArray<CacheAttribute> FIND_BY_OCID = new SparseArray<CacheAttribute>();
static {
- final HashMap<Integer, CacheAttribute> mapOcIds = new HashMap<Integer, CacheAttribute>();
for (CacheAttribute attr : values()) {
if (attr.ocid != NO_ID) {
- mapOcIds.put(attr.ocid, attr);
+ FIND_BY_OCID.put(attr.ocid, attr);
}
}
- FIND_BY_OCID = Collections.unmodifiableMap(mapOcIds);
}
public static CacheAttribute getByRawName(final String rawName) {
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 05bea5a..d130e1f 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -331,7 +331,7 @@ class GpxExport extends AbstractExport {
gpx.startTag(PREFIX_GROUNDSPEAK, "attribute");
gpx.attribute("", "id", Integer.toString(attr.gcid));
gpx.attribute("", "inc", enabled ? "1" : "0");
- gpx.text(attr.getGcL10n(enabled));
+ gpx.text(attr.getL10n(enabled));
gpx.endTag(PREFIX_GROUNDSPEAK, "attribute");
}