diff options
| -rw-r--r-- | main/src/cgeo/geocaching/cgeo.java | 15 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoaddresses.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoadvsearch.java | 32 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 259 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeodetail.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeopoint.java | 11 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeotrackable.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/enumerations/CacheListType.java | 21 |
8 files changed, 189 insertions, 167 deletions
diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/cgeo.java index 5c8c9f1..7fafcda 100644 --- a/main/src/cgeo/geocaching/cgeo.java +++ b/main/src/cgeo/geocaching/cgeo.java @@ -285,9 +285,7 @@ public class cgeo extends AbstractActivity { context.startActivity(new Intent(context, cgeoinit.class)); return true; case MENU_HISTORY: - final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra("type", "history"); - context.startActivity(cachesIntent); + cgeocaches.startActivityHistory(context); return true; case MENU_SCAN: Intent intent = new Intent(SCAN_INTENT); @@ -619,12 +617,7 @@ public class cgeo extends AbstractActivity { } findViewById(R.id.nearest).setPressed(true); - final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra("type", "nearest"); - cachesIntent.putExtra("latitude", geo.coordsNow.getLatitude()); - cachesIntent.putExtra("longitude", geo.coordsNow.getLongitude()); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - context.startActivity(cachesIntent); + cgeocaches.startActivityNearest(context, geo.coordsNow); } /** @@ -633,9 +626,7 @@ public class cgeo extends AbstractActivity { */ public void cgeoFindByOffline(View v) { findViewById(R.id.search_offline).setPressed(true); - final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra("type", "offline"); - context.startActivity(cachesIntent); + cgeocaches.startActivityOffline(context); } /** diff --git a/main/src/cgeo/geocaching/cgeoaddresses.java b/main/src/cgeo/geocaching/cgeoaddresses.java index 688d645..2f6762b 100644 --- a/main/src/cgeo/geocaching/cgeoaddresses.java +++ b/main/src/cgeo/geocaching/cgeoaddresses.java @@ -3,7 +3,6 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import android.app.ProgressDialog; -import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.os.AsyncTask; @@ -134,14 +133,7 @@ public class cgeoaddresses extends AbstractActivity { } public void onClick(View arg0) { - Intent addressIntent = new Intent(cgeoaddresses.this, cgeocaches.class); - addressIntent.putExtra("type", "address"); - addressIntent.putExtra("latitude", latitude); - addressIntent.putExtra("longitude", longitude); - addressIntent.putExtra("address", address); - addressIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(addressIntent); - + cgeocaches.startActivityAddress(cgeoaddresses.this, latitude, longitude, address); finish(); return; } diff --git a/main/src/cgeo/geocaching/cgeoadvsearch.java b/main/src/cgeo/geocaching/cgeoadvsearch.java index 8caf67d..020fb00 100644 --- a/main/src/cgeo/geocaching/cgeoadvsearch.java +++ b/main/src/cgeo/geocaching/cgeoadvsearch.java @@ -129,12 +129,7 @@ public class cgeoadvsearch extends AbstractActivity { found = true; } else { // keyword (fallback) - final Intent cachesIntent = new Intent(this, cgeocaches.class); - cachesIntent.putExtra("type", "keyword"); - cachesIntent.putExtra("keyword", query); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(cachesIntent); - + cgeocaches.startActivityKeyword(this, query); found = true; } } catch (Exception e) { @@ -268,12 +263,7 @@ public class cgeoadvsearch extends AbstractActivity { } } else { try { - final Intent cachesIntent = new Intent(this, cgeocaches.class); - cachesIntent.putExtra("latitude", GeopointParser.parseLatitude(latText)); - cachesIntent.putExtra("longitude", GeopointParser.parseLongitude(lonText)); - cachesIntent.putExtra("type", "coordinate"); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(cachesIntent); + cgeocaches.startActivityCoordinates(this, GeopointParser.parseLatitude(latText), GeopointParser.parseLongitude(lonText)); } catch (GeopointParser.ParseException e) { showToast(res.getString(e.resource)); } @@ -309,11 +299,7 @@ public class cgeoadvsearch extends AbstractActivity { return; } - final Intent cachesIntent = new Intent(this, cgeocaches.class); - cachesIntent.putExtra("type", "keyword"); - cachesIntent.putExtra("keyword", keyText); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(cachesIntent); + cgeocaches.startActivityKeyword(this, keyText); } private class findByAddressAction implements TextView.OnEditorActionListener { @@ -377,11 +363,7 @@ public class cgeoadvsearch extends AbstractActivity { return; } - final Intent cachesIntent = new Intent(this, cgeocaches.class); - cachesIntent.putExtra("type", "username"); - cachesIntent.putExtra("username", usernameText); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(cachesIntent); + cgeocaches.startActivityUserName(this, usernameText); } private class findByOwnerAction implements TextView.OnEditorActionListener { @@ -409,11 +391,7 @@ public class cgeoadvsearch extends AbstractActivity { return; } - final Intent cachesIntent = new Intent(this, cgeocaches.class); - cachesIntent.putExtra("type", "owner"); - cachesIntent.putExtra("username", usernameText); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - startActivity(cachesIntent); + cgeocaches.startActivityOwner(this, usernameText); } private class findByGeocodeAction implements TextView.OnEditorActionListener { diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 8c49afa..a9ff380 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -5,6 +5,7 @@ import cgeo.geocaching.activity.AbstractListActivity; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.apps.cache.navi.NavigationAppFactory; import cgeo.geocaching.apps.cachelist.CacheListAppFactory; +import cgeo.geocaching.enumerations.CacheListType; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.filter.cgFilter; @@ -143,7 +144,7 @@ public class cgeocaches extends AbstractListActivity { private static final int MENU_MOVE_SELECTED_OR_ALL_TO_LIST = 1200; private String action = null; - private String type = null; + private CacheListType type = null; private Geopoint coords = null; private String cachetype = null; private String keyword = null; @@ -568,9 +569,9 @@ public class cgeocaches extends AbstractListActivity { // get parameters Bundle extras = getIntent().getExtras(); if (extras != null) { - type = extras.getString(EXTRAS_LIST_TYPE); + type = CacheListType.fromOrdinal(extras.getInt(EXTRAS_LIST_TYPE)); coords = new Geopoint(extras.getDouble("latitude"), extras.getDouble("longitude")); - cachetype = extras.getString("cachetype"); + cachetype = Settings.getCacheType(); keyword = extras.getString("keyword"); address = extras.getString("address"); username = extras.getString("username"); @@ -581,104 +582,113 @@ public class cgeocaches extends AbstractListActivity { Thread threadPure; cgSearchThread thread; - if (type.equals("offline")) { - listId = Settings.getLastList(); - if (listId <= 0) { - listId = 1; - title = res.getString(R.string.caches_stored); - } else { - final cgList list = app.getList(listId); - title = list.title; - } - - setTitle(title); - showProgress(true); - setLoadingCaches(); - - threadPure = new geocachesLoadByOffline(loadCachesHandler, coords, listId); - threadPure.start(); - } else if (type.equals("history")) { - if (adapter != null) { - adapter.setHistoric(true); - } + switch (type) { + case OFFLINE: + listId = Settings.getLastList(); + if (listId <= 0) { + listId = 1; + title = res.getString(R.string.caches_stored); + } else { + final cgList list = app.getList(listId); + title = list.title; + } - title = res.getString(R.string.caches_history); - setTitle(title); - showProgress(true); - setLoadingCaches(); + setTitle(title); + showProgress(true); + setLoadingCaches(); - threadPure = new geocachesLoadByHistory(loadCachesHandler); - threadPure.start(); - } else if (type.equals("nearest")) { - action = "pending"; - title = res.getString(R.string.caches_nearby); - setTitle(title); - showProgress(true); - setLoadingCaches(); + threadPure = new geocachesLoadByOffline(loadCachesHandler, coords, listId); + threadPure.start(); - thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else if (type.equals("coordinate")) { - action = "planning"; - title = cgBase.formatCoords(coords, true); - setTitle(title); - showProgress(true); - setLoadingCaches(); + break; + case HISTORY: + if (adapter != null) { + adapter.setHistoric(true); + } - thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else if (type.equals("keyword")) { - title = keyword; - setTitle(title); - showProgress(true); - setLoadingCaches(); + title = res.getString(R.string.caches_history); + setTitle(title); + showProgress(true); + setLoadingCaches(); - thread = new geocachesLoadByKeyword(loadCachesHandler, keyword, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else if (type.equals("address")) { - action = "planning"; - if (StringUtils.isNotBlank(address)) { - title = address; + threadPure = new geocachesLoadByHistory(loadCachesHandler); + threadPure.start(); + break; + case NEAREST: + action = "pending"; + title = res.getString(R.string.caches_nearby); setTitle(title); showProgress(true); setLoadingCaches(); - } else { + + thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + break; + case COORDINATE: + action = "planning"; title = cgBase.formatCoords(coords, true); setTitle(title); showProgress(true); setLoadingCaches(); - } - thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else if (type.equals("username")) { - title = username; - setTitle(title); - showProgress(true); - setLoadingCaches(); + thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + break; + case KEYWORD: + title = keyword; + setTitle(title); + showProgress(true); + setLoadingCaches(); - thread = new geocachesLoadByUserName(loadCachesHandler, username, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else if (type.equals("owner")) { - title = username; - setTitle(title); - showProgress(true); - setLoadingCaches(); + thread = new geocachesLoadByKeyword(loadCachesHandler, keyword, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + break; + case ADDRESS: + action = "planning"; + if (StringUtils.isNotBlank(address)) { + title = address; + setTitle(title); + showProgress(true); + setLoadingCaches(); + } else { + title = cgBase.formatCoords(coords, true); + setTitle(title); + showProgress(true); + setLoadingCaches(); + } - thread = new geocachesLoadByOwner(loadCachesHandler, username, cachetype); - thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); - thread.start(); - } else { - title = "caches"; - setTitle(title); - Log.e(Settings.tag, "cgeocaches.onCreate: No action or unknown action specified"); - } + thread = new geocachesLoadByCoords(loadCachesHandler, coords, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + break; + case USERNAME: + title = username; + setTitle(title); + showProgress(true); + setLoadingCaches(); + + thread = new geocachesLoadByUserName(loadCachesHandler, username, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + break; + case OWNER: + title = username; + setTitle(title); + showProgress(true); + setLoadingCaches(); + thread = new geocachesLoadByOwner(loadCachesHandler, username, cachetype); + thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread)); + thread.start(); + default: + title = "caches"; + setTitle(title); + Log.e(Settings.tag, "cgeocaches.onCreate: No action or unknown action specified"); + break; + } prepareFilterBar(); } @@ -793,7 +803,7 @@ public class cgeocaches extends AbstractListActivity { menu.add(0, MENU_SWITCH_SELECT_MODE, 0, res.getString(R.string.caches_select_mode)).setIcon(android.R.drawable.ic_menu_agenda); menu.add(0, MENU_INVERT_SELECTION, 0, res.getString(R.string.caches_select_invert)).setIcon(R.drawable.ic_menu_mark); - if (type.equals("offline")) { + if (type == CacheListType.OFFLINE) { SubMenu subMenu = menu.addSubMenu(0, SUBMENU_MANAGE_OFFLINE, 0, res.getString(R.string.caches_manage)).setIcon(android.R.drawable.ic_menu_save); subMenu.add(0, MENU_DROP_CACHES, 0, res.getString(R.string.caches_drop_all)); // delete saved caches subMenu.add(0, MENU_REFRESH_STORED, 0, res.getString(R.string.cache_offline_refresh)); // download details for all caches @@ -808,7 +818,7 @@ public class cgeocaches extends AbstractListActivity { subMenuImport.add(1, MENU_IMPORT_WEB, 0, res.getString(R.string.web_import_title)).setCheckable(false).setChecked(false); } } else { - if (type.equals("history")) + if (type == CacheListType.HISTORY) { SubMenu subMenu = menu.addSubMenu(0, SUBMENU_MANAGE_HISTORY, 0, res.getString(R.string.caches_manage)).setIcon(android.R.drawable.ic_menu_save); subMenu.add(0, MENU_REMOVE_FROM_HISTORY, 0, res.getString(R.string.cache_clear_history)); // remove from history @@ -819,7 +829,7 @@ public class cgeocaches extends AbstractListActivity { navigationMenu = CacheListAppFactory.addMenuItems(menu, this, res); - if (type.equals("offline")) { + if (type == CacheListType.OFFLINE) { SubMenu subMenu = menu.addSubMenu(0, SUBMENU_MANAGE_LISTS, 0, res.getString(R.string.list_menu)).setIcon(android.R.drawable.ic_menu_more); subMenu.add(0, MENU_CREATE_LIST, 0, res.getString(R.string.list_menu_create)); subMenu.add(0, MENU_DROP_LIST, 0, res.getString(R.string.list_menu_drop)); @@ -846,7 +856,7 @@ public class cgeocaches extends AbstractListActivity { } boolean hasSelection = adapter != null && adapter.getChecked() > 0; - if (type != null && type.equals("offline")) { // only offline list + if (type == CacheListType.OFFLINE) { // only offline list if (hasSelection) { menu.findItem(MENU_DROP_CACHES).setTitle(res.getString(R.string.caches_drop_selected) + " (" + adapter.getChecked() + ")"); } else { @@ -2378,7 +2388,7 @@ public class cgeocaches extends AbstractListActivity { * unused here but needed since this method is referenced from XML layout */ public void selectList(View view) { - if (type.equals("offline") == false) { + if (type != CacheListType.OFFLINE) { return; } @@ -2584,12 +2594,16 @@ public class cgeocaches extends AbstractListActivity { } public void goManual(View view) { - if (type != null && type.equals("offline")) { - ActivityMixin.goManual(this, "c:geo-stored"); - } else if (type != null && type.equals("history")) { - ActivityMixin.goManual(this, "c:geo-history"); - } else { - ActivityMixin.goManual(this, "c:geo-nearby"); + switch (type) { + case OFFLINE: + ActivityMixin.goManual(this, "c:geo-stored"); + break; + case HISTORY: + ActivityMixin.goManual(this, "c:geo-history"); + break; + default: + ActivityMixin.goManual(this, "c:geo-nearby"); + break; } } @@ -2599,7 +2613,7 @@ public class cgeocaches extends AbstractListActivity { public static void startActivityOffline(final Context context) { final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra(EXTRAS_LIST_TYPE, "offline"); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.OFFLINE.ordinal()); context.startActivity(cachesIntent); } @@ -2607,30 +2621,27 @@ public class cgeocaches extends AbstractListActivity { cgeocaches cachesActivity = new cgeocaches(); Intent cachesIntent = new Intent(context, cachesActivity.getClass()); - cachesIntent.putExtra("type", "coordinate"); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.COORDINATE.ordinal()); cachesIntent.putExtra("latitude", coords.getLatitude()); cachesIntent.putExtra("longitude", coords.getLongitude()); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); context.startActivity(cachesIntent); } - public static void startActivityCacheOwner(final AbstractActivity context, final String userName) { + public static void startActivityOwner(final AbstractActivity context, final String userName) { final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra("type", "owner"); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.OWNER.ordinal()); cachesIntent.putExtra("username", userName); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); context.startActivity(cachesIntent); } - public static void startActivityCacheUser(final AbstractActivity context, final String userName) { + public static void startActivityUserName(final AbstractActivity context, final String userName) { final Intent cachesIntent = new Intent(context, cgeocaches.class); - cachesIntent.putExtra("type", "username"); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.USERNAME.ordinal()); cachesIntent.putExtra("username", userName); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); context.startActivity(cachesIntent); } @@ -2659,4 +2670,42 @@ public class cgeocaches extends AbstractListActivity { filterBar.setVisibility(View.GONE); } } + + public static void startActivityNearest(final Context context, final Geopoint coordsNow) { + final Intent cachesIntent = new Intent(context, cgeocaches.class); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.NEAREST.ordinal()); + cachesIntent.putExtra("latitude", coordsNow.getLatitude()); + cachesIntent.putExtra("longitude", coordsNow.getLongitude()); + context.startActivity(cachesIntent); + } + + public static void startActivityHistory(Context context) { + final Intent cachesIntent = new Intent(context, cgeocaches.class); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.HISTORY.ordinal()); + context.startActivity(cachesIntent); + } + + public static void startActivityAddress(Context context, Double latitude, Double longitude, String address) { + Intent addressIntent = new Intent(context, cgeocaches.class); + addressIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.ADDRESS.ordinal()); + addressIntent.putExtra("latitude", latitude); + addressIntent.putExtra("longitude", longitude); + addressIntent.putExtra("address", address); + context.startActivity(addressIntent); + } + + public static void startActivityCoordinates(final Context context, double latitude, double longitude) { + final Intent cachesIntent = new Intent(context, cgeocaches.class); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.COORDINATE); + cachesIntent.putExtra("latitude", latitude); + cachesIntent.putExtra("longitude", longitude); + context.startActivity(cachesIntent); + } + + public static void startActivityKeyword(final Context context, final String keyword) { + final Intent cachesIntent = new Intent(context, cgeocaches.class); + cachesIntent.putExtra(EXTRAS_LIST_TYPE, CacheListType.KEYWORD); + cachesIntent.putExtra("keyword", keyword); + context.startActivity(cachesIntent); + } } diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java index c871fb7..0ac1291 100644 --- a/main/src/cgeo/geocaching/cgeodetail.java +++ b/main/src/cgeo/geocaching/cgeodetail.java @@ -491,10 +491,10 @@ public class cgeodetail extends AbstractActivity { final int id = item.getItemId(); if (id == 1) { - cgeocaches.startActivityCacheOwner(this, contextMenuUser); + cgeocaches.startActivityOwner(this, contextMenuUser); return true; } else if (id == 2) { - cgeocaches.startActivityCacheUser(this, contextMenuUser); + cgeocaches.startActivityUserName(this, contextMenuUser); return true; } else if (id == 3) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.geocaching.com/profile/?u=" + URLEncoder.encode(contextMenuUser)))); diff --git a/main/src/cgeo/geocaching/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java index 6cfd69a..cc19f4a 100644 --- a/main/src/cgeo/geocaching/cgeopoint.java +++ b/main/src/cgeo/geocaching/cgeopoint.java @@ -420,16 +420,7 @@ public class cgeopoint extends AbstractActivity { return; } - cgeocaches cachesActivity = new cgeocaches(); - - Intent cachesIntent = new Intent(this, cachesActivity.getClass()); - - cachesIntent.putExtra("type", "coordinate"); - cachesIntent.putExtra("latitude", coords.getLatitude()); - cachesIntent.putExtra("longitude", coords.getLongitude()); - cachesIntent.putExtra("cachetype", Settings.getCacheType()); - - startActivity(cachesIntent); + cgeocaches.startActivityCoordinates(this, coords.getLatitude(), coords.getLongitude()); finish(); } diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java index 921dbcb..4037853 100644 --- a/main/src/cgeo/geocaching/cgeotrackable.java +++ b/main/src/cgeo/geocaching/cgeotrackable.java @@ -418,10 +418,10 @@ public class cgeotrackable extends AbstractActivity { final int id = item.getItemId(); if (id == 1) { - cgeocaches.startActivityCacheOwner(this, contextMenuUser); + cgeocaches.startActivityOwner(this, contextMenuUser); return true; } else if (id == 2) { - cgeocaches.startActivityCacheUser(this, contextMenuUser); + cgeocaches.startActivityUserName(this, contextMenuUser); return true; } else if (id == 3) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.geocaching.com/profile/?u=" + URLEncoder.encode(contextMenuUser)))); diff --git a/main/src/cgeo/geocaching/enumerations/CacheListType.java b/main/src/cgeo/geocaching/enumerations/CacheListType.java new file mode 100644 index 0000000..a27a091 --- /dev/null +++ b/main/src/cgeo/geocaching/enumerations/CacheListType.java @@ -0,0 +1,21 @@ +package cgeo.geocaching.enumerations; + +public enum CacheListType { + OFFLINE, + HISTORY, + NEAREST, + COORDINATE, + KEYWORD, + ADDRESS, + USERNAME, + OWNER; + + public static CacheListType fromOrdinal(int ordinal) { + for (CacheListType cacheListType : CacheListType.values()) { + if (cacheListType.ordinal() == ordinal) { + return cacheListType; + } + } + return null; + } +} |
