diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-04-21 11:27:29 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-04-21 11:27:29 +0200 |
| commit | fb453e599fed716636b6056739f17e318d55d25c (patch) | |
| tree | 0b50af7331b93c5abca433a582f16521de7e0f6c /main/src/cgeo/geocaching/enumerations | |
| parent | 47ae07d7cec5d0a4e3a6b6f7bc79f03ef055716e (diff) | |
| download | cgeo-fb453e599fed716636b6056739f17e318d55d25c.zip cgeo-fb453e599fed716636b6056739f17e318d55d25c.tar.gz cgeo-fb453e599fed716636b6056739f17e318d55d25c.tar.bz2 | |
refactorings
* always use CacheAttribute for attribute strings
* avoid concatenation in append
* use SparseArray instead of maps
Diffstat (limited to 'main/src/cgeo/geocaching/enumerations')
| -rw-r--r-- | main/src/cgeo/geocaching/enumerations/CacheAttribute.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java index 459c829..4a502fb 100644 --- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java +++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java @@ -3,6 +3,8 @@ package cgeo.geocaching.enumerations; import cgeo.geocaching.R; import cgeo.geocaching.cgeoapplication; +import org.apache.commons.lang3.StringUtils; + import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -76,9 +78,9 @@ public enum CacheAttribute { FRONTYARD(65, "frontyard", R.drawable.attribute_frontyard, R.string.attribute_frontyard_yes, R.string.attribute_frontyard_no), TEAMWORK(66, "teamwork", R.drawable.attribute_teamwork, R.string.attribute_teamwork_yes, R.string.attribute_teamwork_no); - public static final String INTERNAL_PRE = "attribute_"; - public static final String INTERNAL_YES = "_yes"; - public static final String INTERNAL_NO = "_no"; + private static final String INTERNAL_PRE = "attribute_"; + private static final String INTERNAL_YES = "_yes"; + private static final String INTERNAL_NO = "_no"; public final int id; public final String gcRawName; @@ -131,4 +133,8 @@ public enum CacheAttribute { } return attributeName.replace(INTERNAL_PRE, "").replace(INTERNAL_YES, "").replace(INTERNAL_NO, "").trim(); } + + public static boolean isEnabled(final String attributeName) { + return !StringUtils.endsWithIgnoreCase(attributeName, INTERNAL_NO); + } } |
