aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
diff options
context:
space:
mode:
authorStephan Merker <merker.stephan@googlemail.com>2012-04-18 22:40:21 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-04-20 10:10:18 +0200
commit65a15ca7c3634dddb5f2863965aabffc69b49541 (patch)
treed1527b53aab435d977e937f6987e7747c67c2cbb /main/src/cgeo/geocaching/enumerations/CacheAttribute.java
parent45e1a0dc358e4a02b2394ae5c140692931eed8e7 (diff)
downloadcgeo-65a15ca7c3634dddb5f2863965aabffc69b49541.zip
cgeo-65a15ca7c3634dddb5f2863965aabffc69b49541.tar.gz
cgeo-65a15ca7c3634dddb5f2863965aabffc69b49541.tar.bz2
fix #1347: no more caching of localized texts in enums
Diffstat (limited to 'main/src/cgeo/geocaching/enumerations/CacheAttribute.java')
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index 3dbfce5..46e198f 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -81,9 +81,6 @@ public enum CacheAttribute {
public static final String INTERNAL_YES = "_yes";
public static final String INTERNAL_NO = "_no";
- private static final Resources res = cgeoapplication.getInstance().getResources();
- private static final String packageName = cgeoapplication.getInstance().getBaseContext().getPackageName();
-
public final int id;
public final String gcRawName;
@@ -95,9 +92,15 @@ public enum CacheAttribute {
public String getL10n(final boolean enabled) {
final String attributeDescriptor = INTERNAL_PRE + gcRawName + (enabled ? INTERNAL_YES : INTERNAL_NO);
- int id = res.getIdentifier(attributeDescriptor, "string", packageName);
+ cgeoapplication instance = cgeoapplication.getInstance();
+ if (instance != null) {
+ Resources res = instance.getResources();
+ int id = res.getIdentifier(attributeDescriptor, "string", instance.getBaseContext().getPackageName());
- return (id > 0) ? res.getString(id) : attributeDescriptor;
+ return (id > 0) ? res.getString(id) : attributeDescriptor;
+ } else {
+ return attributeDescriptor;
+ }
}
private final static Map<String, CacheAttribute> FIND_BY_GCRAWNAME;