aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/enumerations
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/enumerations')
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java14
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheListType.java6
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheSize.java8
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java47
-rw-r--r--main/src/cgeo/geocaching/enumerations/LoadFlags.java4
-rw-r--r--main/src/cgeo/geocaching/enumerations/LogType.java7
-rw-r--r--main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java1
-rw-r--r--main/src/cgeo/geocaching/enumerations/StatusCode.java3
-rw-r--r--main/src/cgeo/geocaching/enumerations/WaypointType.java2
9 files changed, 62 insertions, 30 deletions
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index 585b890..770b63b 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -130,19 +130,22 @@ public enum CacheAttribute {
// THIS LIST IS GENERATED: don't change anything here but read
// project/attributes/readme.txt
+ @NonNull
private static final String INTERNAL_YES = "_yes";
+ @NonNull
private static final String INTERNAL_NO = "_no";
public static final int NO_ID = -1;
public final int gcid;
public final int ocacode;
+ @NonNull
public final String rawName;
public final int drawableId;
public final int stringIdYes;
public final int stringIdNo;
- CacheAttribute(final int gcid, final int ocacode, final String rawName,
+ CacheAttribute(final int gcid, final int ocacode, @NonNull final String rawName,
final int drawableId, final int stringIdYes, final int stringIdNo) {
this.gcid = gcid;
this.ocacode = ocacode;
@@ -159,12 +162,15 @@ public enum CacheAttribute {
* true: for positive text, false: for negative text
* @return the localized text
*/
+ @NonNull
public String getL10n(final boolean enabled) {
return CgeoApplication.getInstance().getResources().getString(
enabled ? stringIdYes : stringIdNo);
}
+ @NonNull
private final static Map<String, CacheAttribute> FIND_BY_GCRAWNAME = new HashMap<>();
+ @NonNull
private final static SparseArray<CacheAttribute> FIND_BY_OCACODE = new SparseArray<>();
static {
for (final CacheAttribute attr : values()) {
@@ -176,7 +182,7 @@ public enum CacheAttribute {
}
@Nullable
- public static CacheAttribute getByRawName(final String rawName) {
+ public static CacheAttribute getByRawName(@Nullable final String rawName) {
return rawName != null ? FIND_BY_GCRAWNAME.get(rawName) : null;
}
@@ -186,14 +192,14 @@ public enum CacheAttribute {
}
@NonNull
- public static String trimAttributeName(final String attributeName) {
+ public static String trimAttributeName(@Nullable final String attributeName) {
if (null == attributeName) {
return "";
}
return attributeName.replace(INTERNAL_YES, "").replace(INTERNAL_NO, "").trim();
}
- public static boolean isEnabled(final String attributeName) {
+ public static boolean isEnabled(@Nullable final String attributeName) {
return !StringUtils.endsWithIgnoreCase(attributeName, INTERNAL_NO);
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheListType.java b/main/src/cgeo/geocaching/enumerations/CacheListType.java
index 1fce282..297e1be 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheListType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheListType.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.enumerations;
import cgeo.geocaching.loaders.AbstractSearchLoader.CacheListLoaderType;
+import org.eclipse.jdt.annotation.NonNull;
+
public enum CacheListType {
OFFLINE(true, CacheListLoaderType.OFFLINE),
POCKET(false, CacheListLoaderType.POCKET),
@@ -19,9 +21,9 @@ public enum CacheListType {
*/
public final boolean canSwitch;
- public final CacheListLoaderType loaderType;
+ @NonNull public final CacheListLoaderType loaderType;
- CacheListType(final boolean canSwitch, final CacheListLoaderType loaderType) {
+ CacheListType(final boolean canSwitch, @NonNull final CacheListLoaderType loaderType) {
this.canSwitch = canSwitch;
this.loaderType = loaderType;
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheSize.java b/main/src/cgeo/geocaching/enumerations/CacheSize.java
index 54e12e0..10c8c9f 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheSize.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheSize.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.HashMap;
import java.util.Locale;
@@ -24,6 +25,7 @@ public enum CacheSize {
OTHER("Other", 8, R.string.cache_size_other, "other"),
UNKNOWN("Unknown", -1, R.string.cache_size_unknown, ""); // CacheSize not init. yet
+ @NonNull
public final String id;
public final int comparable;
private final int stringId;
@@ -32,13 +34,14 @@ public enum CacheSize {
*/
private final String ocSize2;
- CacheSize(final String id, final int comparable, final int stringId, final String ocSize2) {
+ CacheSize(@NonNull final String id, final int comparable, final int stringId, final String ocSize2) {
this.id = id;
this.comparable = comparable;
this.stringId = stringId;
this.ocSize2 = ocSize2;
}
+ @NonNull
final private static Map<String, CacheSize> FIND_BY_ID = new HashMap<>();
static {
for (final CacheSize cs : values()) {
@@ -50,7 +53,7 @@ public enum CacheSize {
}
@NonNull
- public static CacheSize getById(final String id) {
+ public static CacheSize getById(@Nullable final String id) {
if (id == null) {
return UNKNOWN;
}
@@ -87,6 +90,7 @@ public enum CacheSize {
return UNKNOWN;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index e66c742..a6c32d9 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -15,26 +15,26 @@ import java.util.Map;
*/
public enum CacheType {
- TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional),
- MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi),
- MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
- LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox),
- EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event),
- MEGA_EVENT("mega", "Mega-Event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega),
- GIGA_EVENT("giga", "Giga-Event Cache", "51420629-5739-4945-8bdd-ccfd434c0ead", R.string.giga, R.drawable.type_giga),
- EARTH("earth", "Earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth),
- CITO("cito", "Cache in Trash out Event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito),
- WEBCAM("webcam", "Webcam Cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam),
- VIRTUAL("virtual", "Virtual Cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual),
- WHERIGO("wherigo", "Wherigo Cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo),
- LOSTANDFOUND("lostfound", "Lost and Found Event Cache", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event), // icon missing
- PROJECT_APE("ape", "Project Ape Cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape),
- GCHQ("gchq", "Groundspeak HQ", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq),
- GPS_EXHIBIT("gps", "GPS Adventures Exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_event), // icon missing
- BLOCK_PARTY("block", "Groundspeak Block Party", "bc2f3df2-1aab-4601-b2ff-b5091f6c02e3", R.string.block, R.drawable.type_event), // icon missing
- UNKNOWN("unknown", "unknown", "", R.string.unknown, R.drawable.type_unknown),
+ TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional, "2"),
+ MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi, "3"),
+ MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery, "8"),
+ LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox, "5"),
+ EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event, "6"),
+ MEGA_EVENT("mega", "Mega-Event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega, "453"),
+ GIGA_EVENT("giga", "Giga-Event Cache", "51420629-5739-4945-8bdd-ccfd434c0ead", R.string.giga, R.drawable.type_giga, "7005"),
+ EARTH("earth", "Earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth, "137"),
+ CITO("cito", "Cache in Trash out Event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito, "13"),
+ WEBCAM("webcam", "Webcam Cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam, "11"),
+ VIRTUAL("virtual", "Virtual Cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual, "4"),
+ WHERIGO("wherigo", "Wherigo Cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo, "1858"),
+ LOSTANDFOUND("lostfound", "Lost and Found Event Cache", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event, "3653"), // icon missing
+ PROJECT_APE("ape", "Project Ape Cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape, "2"),
+ GCHQ("gchq", "Groundspeak HQ", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq, "3773"),
+ GPS_EXHIBIT("gps", "GPS Adventures Exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_event, "1304"), // icon missing
+ BLOCK_PARTY("block", "Groundspeak Block Party", "bc2f3df2-1aab-4601-b2ff-b5091f6c02e3", R.string.block, R.drawable.type_event, "4738"), // icon missing
+ UNKNOWN("unknown", "unknown", "", R.string.unknown, R.drawable.type_unknown, ""),
/** No real cache type -> filter */
- ALL("all", "display all caches", "9a79e6ce-3344-409c-bbe9-496530baf758", R.string.all_types, R.drawable.type_unknown);
+ ALL("all", "display all caches", "9a79e6ce-3344-409c-bbe9-496530baf758", R.string.all_types, R.drawable.type_unknown, "");
/**
* id field is used when for storing caches in the database.
@@ -48,17 +48,22 @@ public enum CacheType {
public final String guid;
private final int stringId;
public final int markerId;
+ @NonNull public final String wptTypeId;
- CacheType(final String id, final String pattern, final String guid, final int stringId, final int markerId) {
+ CacheType(final String id, final String pattern, final String guid, final int stringId, final int markerId, @NonNull final String wptTypeId) {
this.id = id;
this.pattern = pattern;
this.guid = guid;
this.stringId = stringId;
this.markerId = markerId;
+ this.wptTypeId = wptTypeId;
}
+ @NonNull
private final static Map<String, CacheType> FIND_BY_ID = new HashMap<>();
+ @NonNull
private final static Map<String, CacheType> FIND_BY_PATTERN = new HashMap<>();
+ @NonNull
private final static Map<String, CacheType> FIND_BY_GUID = new HashMap<>();
static {
@@ -102,6 +107,7 @@ public enum CacheType {
return result;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
@@ -118,7 +124,6 @@ public enum CacheType {
/**
* Whether this type contains the given cache.
*
- * @param cache
* @return true if this is the ALL type or if this type equals the type of the cache.
*/
public boolean contains(final Geocache cache) {
diff --git a/main/src/cgeo/geocaching/enumerations/LoadFlags.java b/main/src/cgeo/geocaching/enumerations/LoadFlags.java
index 69d8df2..0f08690 100644
--- a/main/src/cgeo/geocaching/enumerations/LoadFlags.java
+++ b/main/src/cgeo/geocaching/enumerations/LoadFlags.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.enumerations;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.util.EnumSet;
/**
@@ -33,6 +35,7 @@ public interface LoadFlags {
DB // include saving to CacheCache
}
+ @NonNull
public final static EnumSet<SaveFlag> SAVE_ALL = EnumSet.allOf(SaveFlag.class);
public enum RemoveFlag {
@@ -41,6 +44,7 @@ public interface LoadFlags {
OWN_WAYPOINTS_ONLY_FOR_TESTING // only to be used in unit testing (as we never delete own waypoints)
}
+ @NonNull
public final static EnumSet<RemoveFlag> REMOVE_ALL = EnumSet.of(RemoveFlag.CACHE, RemoveFlag.DB);
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/enumerations/LogType.java b/main/src/cgeo/geocaching/enumerations/LogType.java
index a27ec1a..bf0d66c 100644
--- a/main/src/cgeo/geocaching/enumerations/LogType.java
+++ b/main/src/cgeo/geocaching/enumerations/LogType.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.HashMap;
import java.util.Locale;
@@ -47,13 +48,16 @@ public enum LogType {
UNKNOWN(0, "unknown", "", "", R.string.err_unknown, R.drawable.mark_red); // LogType not init. yet
public final int id;
+ @Nullable
public final String iconName;
+ @NonNull
public final String type;
+ @NonNull
public final String oc_type;
private final int stringId;
public final int markerId;
- LogType(final int id, final String iconName, final String type, final String oc_type, final int stringId, final int markerId) {
+ LogType(final int id, @Nullable final String iconName, @NonNull final String type, @NonNull final String oc_type, final int stringId, final int markerId) {
this.id = id;
this.iconName = iconName;
this.type = type;
@@ -110,6 +114,7 @@ public enum LogType {
return result;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java b/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
index fefeb62..05ce6fd 100644
--- a/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
+++ b/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
@@ -18,6 +18,7 @@ public enum LogTypeTrackable {
this.resourceId = resourceId;
}
+ @NonNull
public String getLabel() {
return CgeoApplication.getInstance().getString(resourceId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/StatusCode.java b/main/src/cgeo/geocaching/enumerations/StatusCode.java
index 9030e2b..37d027f 100644
--- a/main/src/cgeo/geocaching/enumerations/StatusCode.java
+++ b/main/src/cgeo/geocaching/enumerations/StatusCode.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.enumerations;
import cgeo.geocaching.R;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.content.res.Resources;
public enum StatusCode {
@@ -35,6 +37,7 @@ public enum StatusCode {
return error_string;
}
+ @NonNull
public String getErrorString(final Resources res) {
return res.getString(error_string);
}
diff --git a/main/src/cgeo/geocaching/enumerations/WaypointType.java b/main/src/cgeo/geocaching/enumerations/WaypointType.java
index 732a665..d2281ef 100644
--- a/main/src/cgeo/geocaching/enumerations/WaypointType.java
+++ b/main/src/cgeo/geocaching/enumerations/WaypointType.java
@@ -49,6 +49,7 @@ public enum WaypointType {
}
}
}
+ @NonNull
public static final Set<WaypointType> ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL = Collections.unmodifiableSet(ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL_TMP);
/**
@@ -67,6 +68,7 @@ public enum WaypointType {
return waypointType;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}