diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2013-02-03 13:53:48 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2013-02-03 13:53:48 +0100 |
commit | b53b6303ae321276d8c25d6a492372ac615580a2 (patch) | |
tree | e756bbd1ac81d7117bfadde5c53bb8d5b72d9a85 /main/src | |
parent | 56106aba18200cd87bc4a51858bdf1125fe913af (diff) | |
download | cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.zip cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.tar.gz cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.tar.bz2 |
Refactoring: rename cgCache into Geocache
Diffstat (limited to 'main/src')
98 files changed, 491 insertions, 491 deletions
diff --git a/main/src/cgeo/geocaching/AbstractLoggingActivity.java b/main/src/cgeo/geocaching/AbstractLoggingActivity.java index eaeffb0..37c3643 100644 --- a/main/src/cgeo/geocaching/AbstractLoggingActivity.java +++ b/main/src/cgeo/geocaching/AbstractLoggingActivity.java @@ -51,7 +51,7 @@ public abstract class AbstractLoggingActivity extends AbstractActivity { menu.findItem(MENU_SIGNATURE).setVisible(signatureAvailable); boolean smileyVisible = false; - final cgCache cache = getLogContext().getCache(); + final Geocache cache = getLogContext().getCache(); if (cache != null && ConnectorFactory.getConnector(cache).equals(GCConnector.getInstance())) { smileyVisible = true; } diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java index 060012c..c38d5ea 100644 --- a/main/src/cgeo/geocaching/AbstractPopupActivity.java +++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java @@ -38,7 +38,7 @@ public abstract class AbstractPopupActivity extends AbstractActivity { private static final int MENU_DEFAULT_NAVIGATION = 2; private static final int MENU_SHOW_IN_BROWSER = 7; - protected cgCache cache = null; + protected Geocache cache = null; protected String geocode = null; protected CacheDetailsCreator details; diff --git a/main/src/cgeo/geocaching/CacheCache.java b/main/src/cgeo/geocaching/CacheCache.java index 4b68728..e70b7a0 100644 --- a/main/src/cgeo/geocaching/CacheCache.java +++ b/main/src/cgeo/geocaching/CacheCache.java @@ -20,10 +20,10 @@ import java.util.Set; public class CacheCache { private static final int MAX_CACHED_CACHES = 1000; - final private LeastRecentlyUsedMap<String, cgCache> cachesCache; + final private LeastRecentlyUsedMap<String, Geocache> cachesCache; public CacheCache() { - cachesCache = new LeastRecentlyUsedMap.LruCache<String, cgCache>(MAX_CACHED_CACHES); + cachesCache = new LeastRecentlyUsedMap.LruCache<String, Geocache>(MAX_CACHED_CACHES); cachesCache.setRemoveHandler(new CacheRemoveHandler()); } @@ -51,7 +51,7 @@ public class CacheCache { * Cache * */ - public void putCacheInCache(final cgCache cache) { + public void putCacheInCache(final Geocache cache) { if (cache == null) { throw new IllegalArgumentException("cache must not be null"); } @@ -69,7 +69,7 @@ public class CacheCache { * Geocode of the cache to retrieve from the cache * @return cache if found, null else */ - public cgCache getCacheFromCache(final String geocode) { + public Geocache getCacheFromCache(final String geocode) { if (StringUtils.isBlank(geocode)) { throw new IllegalArgumentException("geocode must not be empty"); } @@ -80,7 +80,7 @@ public class CacheCache { public synchronized Set<String> getInViewport(final Viewport viewport, final CacheType cacheType) { final Set<String> geocodes = new HashSet<String>(); - for (final cgCache cache : cachesCache.values()) { + for (final Geocache cache : cachesCache.values()) { if (cache.getCoords() == null) { // FIXME: this kludge must be removed, it is only present to help us debug the cases where // caches contain null coordinates. @@ -99,10 +99,10 @@ public class CacheCache { return StringUtils.join(cachesCache.keySet(), ' '); } - private static class CacheRemoveHandler implements RemoveHandler<cgCache> { + private static class CacheRemoveHandler implements RemoveHandler<Geocache> { @Override - public void onRemove(final cgCache removed) { + public void onRemove(final Geocache removed) { // FIXME: as above, we sometimes get caches with null coordinates, that may then provoke // a NullPointerException down the invocation chain. if (removed.getCoords() != null) { diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 2df02dd..0724ad4 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -132,7 +132,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc private static final Pattern DARK_COLOR_PATTERN = Pattern.compile(Pattern.quote("color=\"#") + "(0[0-9]){3}" + "\""); public static final String STATE_PAGE_INDEX = "cgeo.geocaching.pageIndex"; - private cgCache cache; + private Geocache cache; private final Progress progress = new Progress(); private SearchResult search; @@ -696,7 +696,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void run() { - search = cgCache.searchByGeocode(geocode, StringUtils.isBlank(geocode) ? guid : null, 0, false, handler); + search = Geocache.searchByGeocode(geocode, StringUtils.isBlank(geocode) ? guid : null, 0, false, handler); handler.sendMessage(Message.obtain()); } } @@ -776,14 +776,14 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } /** - * Tries to navigate to the {@link cgCache} of this activity. + * Tries to navigate to the {@link Geocache} of this activity. */ private void startDefaultNavigation() { NavigationAppFactory.startDefaultNavigationApplication(1, this, cache); } /** - * Tries to navigate to the {@link cgCache} of this activity. + * Tries to navigate to the {@link Geocache} of this activity. */ private void startDefaultNavigation2() { NavigationAppFactory.startDefaultNavigationApplication(2, this, cache); @@ -1641,7 +1641,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } } - private Bitmap decode(final cgCache cache) { + private Bitmap decode(final Geocache cache) { return StaticMapsProvider.getPreviewMap(cache.getGeocode()); } @@ -2231,7 +2231,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc /** * A dialog to allow the user to select reseting coordinates local/remote/both. */ - private AlertDialog createResetCacheCoordinatesDialog(final cgCache cache, final Waypoint wpt) { + private AlertDialog createResetCacheCoordinatesDialog(final Geocache cache, final Waypoint wpt) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.waypoint_reset_cache_coords); @@ -2283,7 +2283,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc private class ResetCoordsThread extends Thread { - private final cgCache cache; + private final Geocache cache; private final Handler handler; private final boolean local; private final boolean remote; @@ -2292,7 +2292,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc public static final int LOCAL = 0; public static final int ON_WEBSITE = 1; - public ResetCoordsThread(cgCache cache, Handler handler, final Waypoint wpt, boolean local, boolean remote, final ProgressDialog progress) { + public ResetCoordsThread(Geocache cache, Handler handler, final Waypoint wpt, boolean local, boolean remote, final ProgressDialog progress) { this.cache = cache; this.handler = handler; this.local = local; @@ -2409,7 +2409,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } } - static void updateOfflineBox(final View view, final cgCache cache, final Resources res, + static void updateOfflineBox(final View view, final Geocache cache, final Resources res, final OnClickListener refreshCacheClickListener, final OnClickListener dropCacheClickListener, final OnClickListener storeCacheClickListener) { diff --git a/main/src/cgeo/geocaching/CachePopup.java b/main/src/cgeo/geocaching/CachePopup.java index 731a30c..7441b79 100644 --- a/main/src/cgeo/geocaching/CachePopup.java +++ b/main/src/cgeo/geocaching/CachePopup.java @@ -195,7 +195,7 @@ public class CachePopup extends AbstractPopupActivity { } /** - * Tries to navigate to the {@link cgCache} of this activity. + * Tries to navigate to the {@link Geocache} of this activity. */ @Override protected void startDefaultNavigation2() { diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java index 444e297..3c8789f 100644 --- a/main/src/cgeo/geocaching/EditWaypointActivity.java +++ b/main/src/cgeo/geocaching/EditWaypointActivity.java @@ -83,7 +83,7 @@ public class EditWaypointActivity extends AbstractActivity { else { ((EditText) findViewById(R.id.note)).setText(StringUtils.trimToEmpty(waypoint.getNote())); } - cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY); + Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY); setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache); } @@ -161,7 +161,7 @@ public class EditWaypointActivity extends AbstractActivity { } if (geocode != null) { - cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); IConnector con = ConnectorFactory.getConnector(geocode); setCoordsModificationVisibility(con, cache); } @@ -171,7 +171,7 @@ public class EditWaypointActivity extends AbstractActivity { disableSuggestions((EditText) findViewById(R.id.distance)); } - private void setCoordsModificationVisibility(IConnector con, cgCache cache) { + private void setCoordsModificationVisibility(IConnector con, Geocache cache) { if (cache != null && (cache.getType() == CacheType.MYSTERY || cache.getType() == CacheType.MULTI)) { findViewById(R.id.modify_cache_coordinates_group).setVisibility(View.VISIBLE); findViewById(R.id.modify_cache_coordinates_local_and_remote).setVisibility(con.supportsOwnCoordinates() ? View.VISIBLE : View.GONE); @@ -292,7 +292,7 @@ public class EditWaypointActivity extends AbstractActivity { } else if (gpTemp != null) { gp = gpTemp; } - cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); + Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); CoordinatesInputDialog coordsDialog = new CoordinatesInputDialog(EditWaypointActivity.this, cache, gp, app.currentGeo()); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new CoordinatesInputDialog.CoordinateUpdate() { @@ -468,7 +468,7 @@ public class EditWaypointActivity extends AbstractActivity { waypoint.setNote(note); waypoint.setId(id); - cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); + Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); if (null != cache && cache.addOrChangeWaypoint(waypoint, true)) { cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); StaticMapsProvider.removeWpStaticMaps(id, geocode); @@ -510,7 +510,7 @@ public class EditWaypointActivity extends AbstractActivity { } } - private static boolean uploadModifiedCoords(final cgCache cache, final Geopoint waypointUploaded) { + private static boolean uploadModifiedCoords(final Geocache cache, final Geopoint waypointUploaded) { final IConnector con = ConnectorFactory.getConnector(cache); return con.supportsOwnCoordinates() && con.uploadModifiedCoordinates(cache, waypointUploaded); } @@ -525,7 +525,7 @@ public class EditWaypointActivity extends AbstractActivity { .putExtra(Intents.EXTRA_WAYPOINT_ID, waypointId)); } - public static void startActivityAddWaypoint(final Context context, final cgCache cache) { + public static void startActivityAddWaypoint(final Context context, final Geocache cache) { context.startActivity(new Intent(context, EditWaypointActivity.class) .putExtra(Intents.EXTRA_GEOCODE, cache.getGeocode()) .putExtra(Intents.EXTRA_COUNT, cache.getWaypoints().size())); diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/Geocache.java index 34263b1..2b8e03b 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -55,7 +55,7 @@ import java.util.regex.Pattern; /** * Internal c:geo representation of a "cache" */ -public class cgCache implements ICache, IWaypoint { +public class Geocache implements ICache, IWaypoint { private long updated = 0; private long detailedUpdate = 0; @@ -133,7 +133,7 @@ public class cgCache implements ICache, IWaypoint { /** * Create a new cache. To be used everywhere except for the GPX parser */ - public cgCache() { + public Geocache() { // empty } @@ -143,7 +143,7 @@ public class cgCache implements ICache, IWaypoint { * * @param gpxParser */ - public cgCache(GPXParser gpxParser) { + public Geocache(GPXParser gpxParser) { setReliableLatLon(true); setAttributes(Collections.<String> emptyList()); setWaypoints(Collections.<Waypoint> emptyList(), false); @@ -170,7 +170,7 @@ public class cgCache implements ICache, IWaypoint { * the other version, or null if non-existent * @return true if this cache is "equal" to the other version */ - public boolean gatherMissingFrom(final cgCache other) { + public boolean gatherMissingFrom(final Geocache other) { if (other == null) { return false; } @@ -344,7 +344,7 @@ public class cgCache implements ICache, IWaypoint { * the other cache to compare this one to * @return true if both caches have the same content */ - private boolean isEqualTo(final cgCache other) { + private boolean isEqualTo(final Geocache other) { return detailed == other.detailed && StringUtils.equalsIgnoreCase(geocode, other.geocode) && StringUtils.equalsIgnoreCase(name, other.name) && @@ -425,7 +425,7 @@ public class cgCache implements ICache, IWaypoint { return false; } final Boolean found = Pattern.compile(guid, Pattern.CASE_INSENSITIVE).matcher(page).find(); - Log.i("cgCache.isGuidContainedInPage: guid '" + guid + "' " + (found ? "" : "not ") + "found"); + Log.i("Geocache.isGuidContainedInPage: guid '" + guid + "' " + (found ? "" : "not ") + "found"); return found; } @@ -1326,7 +1326,7 @@ public class cgCache implements ICache, IWaypoint { matcher = new MatcherWrapper(coordPattern, note); } } catch (Exception e) { - Log.e("cgCache.parseWaypointsFromNote", e); + Log.e("Geocache.parseWaypointsFromNote", e); } } @@ -1351,11 +1351,11 @@ public class cgCache implements ICache, IWaypoint { if (this == obj) { return true; } - if (!(obj instanceof cgCache)) { + if (!(obj instanceof Geocache)) { return false; } // just compare the geocode even if that is not what "equals" normally does - return StringUtils.isNotBlank(geocode) && geocode.equals(((cgCache) obj).geocode); + return StringUtils.isNotBlank(geocode) && geocode.equals(((Geocache) obj).geocode); } public void store(CancellableHandler handler) { @@ -1440,9 +1440,9 @@ public class cgCache implements ICache, IWaypoint { storeCache(null, geocode, newListId, true, handler); } - public static void storeCache(cgCache origCache, String geocode, int listId, boolean forceRedownload, CancellableHandler handler) { + public static void storeCache(Geocache origCache, String geocode, int listId, boolean forceRedownload, CancellableHandler handler) { try { - cgCache cache; + Geocache cache; // get cache details, they may not yet be complete if (origCache != null) { // only reload the cache if it was already stored or doesn't have full details (by checking the description) @@ -1527,7 +1527,7 @@ public class cgCache implements ICache, IWaypoint { public static SearchResult searchByGeocode(final String geocode, final String guid, final int listId, final boolean forceReload, final CancellableHandler handler) { if (StringUtils.isBlank(geocode) && StringUtils.isBlank(guid)) { - Log.e("cgCache.searchByGeocode: No geocode nor guid given"); + Log.e("Geocache.searchByGeocode: No geocode nor guid given"); return null; } @@ -1605,7 +1605,7 @@ public class cgCache implements ICache, IWaypoint { * @return */ public boolean hasAttribute(CacheAttribute attribute, boolean yes) { - cgCache fullCache = cgData.loadCache(getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); + Geocache fullCache = cgData.loadCache(getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); if (fullCache == null) { fullCache = this; } diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java index 557234a..b0540f2 100644 --- a/main/src/cgeo/geocaching/SearchResult.java +++ b/main/src/cgeo/geocaching/SearchResult.java @@ -102,7 +102,7 @@ public class SearchResult implements Parcelable { * @param cache the cache to include */ - public SearchResult(final cgCache cache) { + public SearchResult(final Geocache cache) { this(Collections.singletonList(cache)); } @@ -111,9 +111,9 @@ public class SearchResult implements Parcelable { * * @param caches the non-null collection of caches to include */ - public SearchResult(final Collection<cgCache> caches) { + public SearchResult(final Collection<Geocache> caches) { this(); - for (final cgCache cache : caches) { + for (final Geocache cache : caches) { addCache(cache); } } @@ -191,9 +191,9 @@ public class SearchResult implements Parcelable { SearchResult result = new SearchResult(this); result.geocodes.clear(); - final ArrayList<cgCache> cachesForVote = new ArrayList<cgCache>(); - final Set<cgCache> caches = cgData.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB); - for (cgCache cache : caches) { + final ArrayList<Geocache> cachesForVote = new ArrayList<Geocache>(); + final Set<Geocache> caches = cgData.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB); + for (Geocache cache : caches) { // Is there any reason to exclude the cache from the list? final boolean excludeCache = (excludeDisabled && cache.isDisabled()) || (excludeMine && (cache.isOwner() || cache.isFound())) || @@ -207,11 +207,11 @@ public class SearchResult implements Parcelable { return result; } - public cgCache getFirstCacheFromResult(final EnumSet<LoadFlag> loadFlags) { + public Geocache getFirstCacheFromResult(final EnumSet<LoadFlag> loadFlags) { return CollectionUtils.isNotEmpty(geocodes) ? cgData.loadCache(geocodes.iterator().next(), loadFlags) : null; } - public Set<cgCache> getCachesFromSearchResult(final EnumSet<LoadFlag> loadFlags) { + public Set<Geocache> getCachesFromSearchResult(final EnumSet<LoadFlag> loadFlags) { return cgData.loadCaches(geocodes, loadFlags); } @@ -229,7 +229,7 @@ public class SearchResult implements Parcelable { } /** Add the cache geocode to the search and store the cache in the CacheCache */ - public boolean addCache(final cgCache cache) { + public boolean addCache(final Geocache cache) { addGeocode(cache.getGeocode()); return cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE)); } diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index 263b6b8..d7cef65 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -177,7 +177,7 @@ public class StaticMapsActivity extends AbstractActivity { } private boolean downloadStaticMaps() { - final cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); if (waypoint_id == null) { showToast(res.getString(R.string.info_storing_static_maps)); StaticMapsProvider.storeCacheStaticMap(cache, true); diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index b418400..6feacc2 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -80,7 +80,7 @@ public class StaticMapsProvider { } } - public static void downloadMaps(cgCache cache) { + public static void downloadMaps(Geocache cache) { if (cache == null) { Log.e("downloadMaps - missing input parameter cache"); return; @@ -105,7 +105,7 @@ public class StaticMapsProvider { } } - public static void storeWaypointStaticMap(cgCache cache, Waypoint waypoint, boolean waitForResult) { + public static void storeWaypointStaticMap(Geocache cache, Waypoint waypoint, boolean waitForResult) { int edge = StaticMapsProvider.guessMaxDisplaySide(); storeWaypointStaticMap(cache.getGeocode(), edge, waypoint, waitForResult); } @@ -128,12 +128,12 @@ public class StaticMapsProvider { downloadMaps(geocode, wpMarkerUrl, WAYPOINT_PREFIX + waypoint.getId() + '_', wpLatlonMap, edge, null, waitForResult); } - public static void storeCacheStaticMap(cgCache cache, final boolean waitForResult) { + public static void storeCacheStaticMap(Geocache cache, final boolean waitForResult) { int edge = guessMaxDisplaySide(); storeCacheStaticMap(cache, edge, waitForResult); } - private static void storeCacheStaticMap(final cgCache cache, final int edge, final boolean waitForResult) { + private static void storeCacheStaticMap(final Geocache cache, final int edge, final boolean waitForResult) { final String latlonMap = cache.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA); final Parameters waypoints = new Parameters(); for (final Waypoint waypoint : cache.getWaypoints()) { @@ -148,7 +148,7 @@ public class StaticMapsProvider { downloadMaps(cache.getGeocode(), cacheMarkerUrl, "", latlonMap, edge, waypoints, waitForResult); } - public static void storeCachePreviewMap(final cgCache cache) { + public static void storeCachePreviewMap(final Geocache cache) { if (cache == null) { Log.e("storeCachePreviewMap - missing input parameter cache"); return; @@ -193,7 +193,7 @@ public class StaticMapsProvider { } } - private static String getCacheMarkerUrl(final cgCache cache) { + private static String getCacheMarkerUrl(final Geocache cache) { StringBuilder url = new StringBuilder(MARKERS_URL); url.append("marker_cache_").append(cache.getType().id); if (cache.isFound()) { @@ -229,7 +229,7 @@ public class StaticMapsProvider { * @param cache * @return <code>true</code> if at least one mapfile exists; <code>false</code> otherwise */ - public static boolean hasStaticMap(final cgCache cache) { + public static boolean hasStaticMap(final Geocache cache) { if (cache == null) { return false; } diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java index 54c261d..3da4ecc 100644 --- a/main/src/cgeo/geocaching/VisitCacheActivity.java +++ b/main/src/cgeo/geocaching/VisitCacheActivity.java @@ -59,7 +59,7 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD private static final String SAVED_STATE_DATE = "cgeo.geocaching.saved_state_date"; private LayoutInflater inflater = null; - private cgCache cache = null; + private Geocache cache = null; private ProgressDialog waitDialog = null; private String cacheid = null; private String geocode = null; diff --git a/main/src/cgeo/geocaching/WaypointPopup.java b/main/src/cgeo/geocaching/WaypointPopup.java index 1d18987..766d43d 100644 --- a/main/src/cgeo/geocaching/WaypointPopup.java +++ b/main/src/cgeo/geocaching/WaypointPopup.java @@ -82,7 +82,7 @@ public class WaypointPopup extends AbstractPopupActivity { } /** - * Tries to navigate to the {@link cgCache} of this activity. + * Tries to navigate to the {@link Geocache} of this activity. */ @Override protected void startDefaultNavigation2() { diff --git a/main/src/cgeo/geocaching/apps/AbstractApp.java b/main/src/cgeo/geocaching/apps/AbstractApp.java index 678b98c..c95e8b4 100644 --- a/main/src/cgeo/geocaching/apps/AbstractApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgeo; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.utils.ProcessUtils; @@ -56,7 +56,7 @@ public abstract class AbstractApp implements App { } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache != null; } } diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java index ad421f6..53620e4 100644 --- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; @@ -66,8 +66,8 @@ public abstract class AbstractLocusApp extends AbstractApp { for (Object o : objectsToShow) { Point p = null; // get icon and Point - if (o instanceof cgCache) { - p = getCachePoint((cgCache) o, withCacheWaypoints, withCacheDetails); + if (o instanceof Geocache) { + p = getCachePoint((Geocache) o, withCacheWaypoints, withCacheDetails); } else if (o instanceof Waypoint) { p = getWaypointPoint((Waypoint) o); } @@ -104,7 +104,7 @@ public abstract class AbstractLocusApp extends AbstractApp { * should be false for all if more then 200 Caches are transferred * @return null, when the <code>Point</code> could not be constructed */ - private static Point getCachePoint(cgCache cache, boolean withWaypoints, boolean withCacheDetails) { + private static Point getCachePoint(Geocache cache, boolean withWaypoints, boolean withCacheDetails) { if (cache == null || cache.getCoords() == null) { return null; } diff --git a/main/src/cgeo/geocaching/apps/App.java b/main/src/cgeo/geocaching/apps/App.java index 9d6d371..bc99526 100644 --- a/main/src/cgeo/geocaching/apps/App.java +++ b/main/src/cgeo/geocaching/apps/App.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; public interface App { public boolean isInstalled(); @@ -17,5 +17,5 @@ public interface App { * @param cache * @return */ - boolean isEnabled(final cgCache cache); + boolean isEnabled(final Geocache cache); } diff --git a/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java b/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java index 8087d6d..fd7d4b5 100644 --- a/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java +++ b/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps.cache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.apps.cache.navi.CacheNavigationApp; @@ -14,7 +14,7 @@ abstract class AbstractGeneralApp extends AbstractApp implements CacheNavigation } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { final Intent intent = getLaunchIntent(); if (intent != null) { intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); diff --git a/main/src/cgeo/geocaching/apps/cache/CacheBeaconApp.java b/main/src/cgeo/geocaching/apps/cache/CacheBeaconApp.java index 4ba336f..1f38ca7 100644 --- a/main/src/cgeo/geocaching/apps/cache/CacheBeaconApp.java +++ b/main/src/cgeo/geocaching/apps/cache/CacheBeaconApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheAttribute; public class CacheBeaconApp extends AbstractGeneralApp { @@ -11,7 +11,7 @@ public class CacheBeaconApp extends AbstractGeneralApp { } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.hasAttribute(CacheAttribute.WIRELESS_BEACON, true); } diff --git a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java index 8c06d7a..39e1963 100644 --- a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java +++ b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheType; public class WhereYouGoApp extends AbstractGeneralApp { @@ -10,7 +10,7 @@ public class WhereYouGoApp extends AbstractGeneralApp { } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.getType() == CacheType.WHERIGO; } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java index 67aa849..a3ea57e 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Waypoint; import cgeo.geocaching.apps.AbstractApp; @@ -20,7 +20,7 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { navigate(activity, cache.getCoords()); } @@ -30,7 +30,7 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.getCoords() != null; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java index e6bf9f4..d089e82 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java @@ -5,7 +5,7 @@ import cgeo.geocaching.R; import cgeo.geocaching.StaticMapsActivity; import cgeo.geocaching.StaticMapsProvider; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.apps.AbstractApp; @@ -41,7 +41,7 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat return false; } - protected static boolean invokeStaticMaps(final Activity activity, final cgCache cache, final Waypoint waypoint, final boolean download) { + protected static boolean invokeStaticMaps(final Activity activity, final Geocache cache, final Waypoint waypoint, final boolean download) { final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint; // If the cache is not stored for offline, cache seems to be null and waypoint may be null too if (logable==null || logable.getGeocode()==null ) { diff --git a/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java index e47150f..d47bdc0 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.App; import android.app.Activity; @@ -10,8 +10,8 @@ import android.app.Activity; * */ public interface CacheNavigationApp extends App { - void navigate(final Activity activity, final cgCache cache); + void navigate(final Activity activity, final Geocache cache); @Override - boolean isEnabled(final cgCache cache); + boolean isEnabled(final Geocache cache); }
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java index 330c338..1ded9ac 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeonavigate; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.geopoint.Geopoint; @@ -38,13 +38,13 @@ class CompassApp extends AbstractApp implements CacheNavigationApp, WaypointNavi } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { cgeonavigate.startActivity(activity, cache.getGeocode(), cache.getName(), cache.getCoords(), null, Formatter.formatCacheInfoShort(cache)); } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.getGeocode() != null; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java index 846b9bc..bc422d4 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.Waypoint; import android.app.Activity; @@ -13,7 +13,7 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp { } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return !cache.hasStaticMap(); } @@ -23,7 +23,7 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp { } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { invokeStaticMaps(activity, cache, null, true); } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java index db842ad..2990f93 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; @@ -37,12 +37,12 @@ class InternalMap extends AbstractApp implements CacheNavigationApp, WaypointNav } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { CGeoMap.startActivityGeoCode(activity, cache.getGeocode()); } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.getCoords() != null; } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java index b326105..2d7702d 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Waypoint; import cgeo.geocaching.apps.AbstractLocusApp; @@ -26,7 +26,7 @@ class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointN } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { showInLocus(Collections.singletonList(cache), true, false, activity); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index 8effc05..5545936 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -1,9 +1,9 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.apps.AbstractAppFactory; @@ -96,7 +96,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * Default way to handle selection of navigation tool.<br /> * A dialog is created for tool selection and the selected tool is started afterwards. * <p /> - * Delegates to {@link #showNavigationMenu(Activity, cgCache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} with + * Delegates to {@link #showNavigationMenu(Activity, cgeo.geocaching.Geocache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} with * <code>showInternalMap = true</code> and <code>showDefaultNavigation = false</code> * * @param activity @@ -105,7 +105,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param destination */ public static void showNavigationMenu(final Activity activity, - final cgCache cache, final Waypoint waypoint, final Geopoint destination) { + final Geocache cache, final Waypoint waypoint, final Geopoint destination) { showNavigationMenu(activity, cache, waypoint, destination, true, false); } @@ -125,10 +125,10 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param showDefaultNavigation * should be <code>false</code> by default * - * @see #showNavigationMenu(Activity, cgCache, cgeo.geocaching.Waypoint, Geopoint) + * @see #showNavigationMenu(Activity, cgeo.geocaching.Geocache, cgeo.geocaching.Waypoint, Geopoint) */ public static void showNavigationMenu(final Activity activity, - final cgCache cache, final Waypoint waypoint, final Geopoint destination, + final Geocache cache, final Waypoint waypoint, final Geopoint destination, final boolean showInternalMap, final boolean showDefaultNavigation) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_navigate); @@ -216,15 +216,15 @@ public final class NavigationAppFactory extends AbstractAppFactory { /** * Adds the installed navigation tools to the given menu. - * Use {@link #onMenuItemSelected(MenuItem, Activity, cgCache)} on + * Use {@link #onMenuItemSelected(MenuItem, Activity, cgeo.geocaching.Geocache)} on * selection event to start the selected navigation tool. * - * <b>Only use this way if {@link #showNavigationMenu(Activity, cgCache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} is + * <b>Only use this way if {@link #showNavigationMenu(Activity, cgeo.geocaching.Geocache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} is * not suitable for the given usecase.</b> * * @param menu */ - public static void addMenuItems(final Menu menu, final cgCache cache) { + public static void addMenuItems(final Menu menu, final Geocache cache) { for (NavigationAppsEnum navApp : getInstalledNavigationApps()) { if (navApp.app instanceof CacheNavigationApp) { CacheNavigationApp cacheApp = (CacheNavigationApp) navApp.app; @@ -247,20 +247,20 @@ public final class NavigationAppFactory extends AbstractAppFactory { } /** - * Handles menu selections for menu entries created with {@link #addMenuItems(Menu, cgCache)}. + * Handles menu selections for menu entries created with {@link #addMenuItems(Menu, cgeo.geocaching.Geocache)}. * * @param item * @param activity * @param cache * @return */ - public static boolean onMenuItemSelected(final MenuItem item, Activity activity, cgCache cache) { + public static boolean onMenuItemSelected(final MenuItem item, Activity activity, Geocache cache) { final App menuItem = getAppFromMenuItem(item); navigateCache(activity, cache, menuItem); return menuItem != null; } - private static void navigateCache(Activity activity, cgCache cache, App app) { + private static void navigateCache(Activity activity, Geocache cache, App app) { if (app instanceof CacheNavigationApp) { CacheNavigationApp cacheApp = (CacheNavigationApp) app; cacheApp.navigate(activity, cache); @@ -305,7 +305,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param activity * @param cache */ - public static void startDefaultNavigationApplication(int defaultNavigation, Activity activity, cgCache cache) { + public static void startDefaultNavigationApplication(int defaultNavigation, Activity activity, Geocache cache) { if (cache == null || cache.getCoords() == null) { ActivityMixin.showToast(activity, cgeoapplication.getInstance().getString(R.string.err_location_unknown)); return; diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java index c94c4f4..2c6a8fc 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter.Format; @@ -39,7 +39,7 @@ class RMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNaviga } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { navigate(activity, cache.getCoords(), cache.getGeocode(), cache.getName()); } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java index 4c3b87e..1dd57a3 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import android.app.Activity; @@ -13,7 +13,7 @@ class StaticMapApp extends AbstractStaticMapsApp { } @Override - public boolean isEnabled(cgCache cache) { + public boolean isEnabled(Geocache cache) { return cache.hasStaticMap(); } @@ -23,7 +23,7 @@ class StaticMapApp extends AbstractStaticMapsApp { } @Override - public void navigate(Activity activity, cgCache cache) { + public void navigate(Activity activity, Geocache cache) { invokeStaticMaps(activity, cache, null, false); } diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java index 519b394..ac5809e 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cachelist; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.App; import android.app.Activity; @@ -10,7 +10,7 @@ import java.util.List; interface CacheListApp extends App { - boolean invoke(final List<cgCache> caches, + boolean invoke(final List<Geocache> caches, final Activity activity, final SearchResult search); } diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java index b01c0ac..b747eee 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cachelist; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.activity.IAbstractActivity; import cgeo.geocaching.apps.AbstractAppFactory; import cgeo.geocaching.utils.Log; @@ -55,7 +55,7 @@ public final class CacheListAppFactory extends AbstractAppFactory { } } - public static boolean onMenuItemSelected(final MenuItem item, final List<cgCache> caches, final IAbstractActivity activity, + public static boolean onMenuItemSelected(final MenuItem item, final List<Geocache> caches, final IAbstractActivity activity, final SearchResult search) { final CacheListApp app = (CacheListApp) getAppFromMenuItem(item, LazyHolder.apps); if (app != null) { diff --git a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java index d6e1fed..38fb499 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java +++ b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cachelist; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.maps.CGeoMap; @@ -22,7 +22,7 @@ class InternalCacheListMap extends AbstractApp implements CacheListApp { } @Override - public boolean invoke(List<cgCache> caches, Activity activity, final SearchResult search) { + public boolean invoke(List<Geocache> caches, Activity activity, final SearchResult search) { CGeoMap.startActivitySearch(activity, search, null); return true; } diff --git a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java index 65760c7..cd0289a 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cachelist; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.apps.AbstractLocusApp; import org.apache.commons.collections.CollectionUtils; @@ -27,7 +27,7 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp { * @see AbstractLocusApp#showInLocus */ @Override - public boolean invoke(List<cgCache> cacheList, Activity activity, final SearchResult search) { + public boolean invoke(List<Geocache> cacheList, Activity activity, final SearchResult search) { if (CollectionUtils.isEmpty(cacheList)) { return false; } diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 57984a7..2a62f0b 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -67,7 +67,7 @@ public class cgData { "favourite_cnt", "rating", "votes", "myvote", "disabled", "archived", "members", "found", "favourite", // 33 34 35 36 37 38 39 40 41 42 "inventoryunknown", "onWatchlist", "reliable_latlon", "coordsChanged", "latitude", "longitude", "finalDefined", "_id", "inventorycoins", "inventorytags" - // reason is replaced by listId in cgCache + // reason is replaced by listId in Geocache }; /** The list of fields needed for mapping. */ private static final String[] WAYPOINT_COLUMNS = new String[] { "_id", "geocode", "updated", "type", "prefix", "lookup", "name", "latlon", "latitude", "longitude", "note", "own" }; @@ -943,7 +943,7 @@ public class cgData { * * @return true = cache saved successfully to the CacheCache/DB */ - public static boolean saveCache(cgCache cache, EnumSet<LoadFlags.SaveFlag> saveFlags) { + public static boolean saveCache(Geocache cache, EnumSet<LoadFlags.SaveFlag> saveFlags) { if (cache == null) { throw new IllegalArgumentException("cache must not be null"); } @@ -1053,7 +1053,7 @@ public class cgData { return result; } - private static void saveAttributesWithoutTransaction(final cgCache cache) { + private static void saveAttributesWithoutTransaction(final Geocache cache) { String geocode = cache.getGeocode(); database.delete(dbTableAttributes, "geocode = ?", new String[]{geocode}); @@ -1093,7 +1093,7 @@ public class cgData { } } - public static boolean saveWaypoints(final cgCache cache) { + public static boolean saveWaypoints(final Geocache cache) { init(); database.beginTransaction(); @@ -1110,7 +1110,7 @@ public class cgData { return result; } - private static void saveOriginalWaypointsWithoutTransaction(final cgCache cache) { + private static void saveOriginalWaypointsWithoutTransaction(final Geocache cache) { String geocode = cache.getGeocode(); List<Waypoint> waypoints = cache.getWaypoints(); @@ -1224,7 +1224,7 @@ public class cgData { return database.delete(dbTableWaypoints, "_id = " + id, null) > 0; } - private static void saveSpoilersWithoutTransaction(final cgCache cache) { + private static void saveSpoilersWithoutTransaction(final Geocache cache) { String geocode = cache.getGeocode(); database.delete(dbTableSpoilers, "geocode = ?", new String[]{geocode}); @@ -1281,7 +1281,7 @@ public class cgData { } } - private static void saveLogCountsWithoutTransaction(final cgCache cache) { + private static void saveLogCountsWithoutTransaction(final Geocache cache) { String geocode = cache.getGeocode(); database.delete(dbTableLogCount, "geocode = ?", new String[]{geocode}); @@ -1357,7 +1357,7 @@ public class cgData { return null; } - final Set<cgCache> caches = loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB); + final Set<Geocache> caches = loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB); return Viewport.containing(caches); } @@ -1368,12 +1368,12 @@ public class cgData { * The Geocode GCXXXX * @return the loaded cache (if found). Can be null */ - public static cgCache loadCache(final String geocode, final EnumSet<LoadFlag> loadFlags) { + public static Geocache loadCache(final String geocode, final EnumSet<LoadFlag> loadFlags) { if (StringUtils.isBlank(geocode)) { throw new IllegalArgumentException("geocode must not be empty"); } - final Set<cgCache> caches = loadCaches(Collections.singleton(geocode), loadFlags); + final Set<Geocache> caches = loadCaches(Collections.singleton(geocode), loadFlags); return caches.isEmpty() ? null : caches.iterator().next(); } @@ -1383,17 +1383,17 @@ public class cgData { * @param geocodes * @return Set of loaded caches. Never null. */ - public static Set<cgCache> loadCaches(final Set<String> geocodes, final EnumSet<LoadFlag> loadFlags) { + public static Set<Geocache> loadCaches(final Set<String> geocodes, final EnumSet<LoadFlag> loadFlags) { if (CollectionUtils.isEmpty(geocodes)) { - return new HashSet<cgCache>(); + return new HashSet<Geocache>(); } - Set<cgCache> result = new HashSet<cgCache>(); + Set<Geocache> result = new HashSet<Geocache>(); Set<String> remaining = new HashSet<String>(geocodes); if (loadFlags.contains(LoadFlag.LOAD_CACHE_BEFORE)) { for (String geocode : new HashSet<String>(remaining)) { - cgCache cache = cacheCache.getCacheFromCache(geocode); + Geocache cache = cacheCache.getCacheFromCache(geocode); if (cache != null) { result.add(cache); remaining.remove(cache.getGeocode()); @@ -1409,16 +1409,16 @@ public class cgData { loadFlags.contains(LoadFlag.LOAD_INVENTORY) || loadFlags.contains(LoadFlag.LOAD_OFFLINE_LOG)) { - final Set<cgCache> cachesFromDB = loadCachesFromGeocodes(remaining, loadFlags); + final Set<Geocache> cachesFromDB = loadCachesFromGeocodes(remaining, loadFlags); result.addAll(cachesFromDB); - for (final cgCache cache : cachesFromDB) { + for (final Geocache cache : cachesFromDB) { remaining.remove(cache.getGeocode()); } } if (loadFlags.contains(LoadFlag.LOAD_CACHE_AFTER)) { for (String geocode : new HashSet<String>(remaining)) { - cgCache cache = cacheCache.getCacheFromCache(geocode); + Geocache cache = cacheCache.getCacheFromCache(geocode); if (cache != null) { result.add(cache); remaining.remove(cache.getGeocode()); @@ -1439,7 +1439,7 @@ public class cgData { * @param loadFlags * @return Set of loaded caches. Never null. */ - private static Set<cgCache> loadCachesFromGeocodes(final Set<String> geocodes, final EnumSet<LoadFlag> loadFlags) { + private static Set<Geocache> loadCachesFromGeocodes(final Set<String> geocodes, final EnumSet<LoadFlag> loadFlags) { if (CollectionUtils.isEmpty(geocodes)) { return Collections.emptySet(); } @@ -1467,11 +1467,11 @@ public class cgData { Cursor cursor = database.rawQuery(query.toString(), null); try { - final Set<cgCache> caches = new HashSet<cgCache>(); + final Set<Geocache> caches = new HashSet<Geocache>(); int logIndex = -1; while (cursor.moveToNext()) { - cgCache cache = cgData.createCacheFromDatabaseContent(cursor); + Geocache cache = cgData.createCacheFromDatabaseContent(cursor); if (loadFlags.contains(LoadFlag.LOAD_ATTRIBUTES)) { cache.setAttributes(loadAttributes(cache.getGeocode())); @@ -1546,8 +1546,8 @@ public class cgData { * @param cursor * @return Cache from DB */ - private static cgCache createCacheFromDatabaseContent(Cursor cursor) { - cgCache cache = new cgCache(); + private static Geocache createCacheFromDatabaseContent(Cursor cursor) { + Geocache cache = new Geocache(); if (cacheColumnIndex == null) { final int[] local_cci = new int[CACHE_COLUMNS.length]; // use a local variable to avoid having the not yet fully initialized array be visible to other threads @@ -2581,7 +2581,7 @@ public class cgData { return status; } - public static void moveToList(final List<cgCache> caches, final int listId) { + public static void moveToList(final List<Geocache> caches, final int listId) { if (listId == StoredList.ALL_LIST_ID) { return; } @@ -2594,7 +2594,7 @@ public class cgData { database.beginTransaction(); try { - for (cgCache cache : caches) { + for (Geocache cache : caches) { move.bindLong(1, listId); move.bindString(2, cache.getGeocode()); move.execute(); @@ -2753,7 +2753,7 @@ public class cgData { return result; } - public static boolean saveChangedCache(cgCache cache) { + public static boolean saveChangedCache(Geocache cache) { return cgData.saveCache(cache, cache.getStorageLocation().contains(StorageLocation.DATABASE) ? LoadFlags.SAVE_ALL : EnumSet.of(SaveFlag.SAVE_CACHE)); } @@ -2861,7 +2861,7 @@ public class cgData { setVisitDate(Collections.singletonList(geocode), System.currentTimeMillis()); } - public static void markDropped(List<cgCache> caches) { + public static void markDropped(List<Geocache> caches) { moveToList(caches, StoredList.TEMPORARY_LIST_ID); } @@ -2873,9 +2873,9 @@ public class cgData { return cgData.getBounds(Collections.singleton(geocode)); } - public static void clearVisitDate(List<cgCache> caches) { + public static void clearVisitDate(List<Geocache> caches) { ArrayList<String> geocodes = new ArrayList<String>(caches.size()); - for (cgCache cache : caches) { + for (Geocache cache : caches) { geocodes.add(cache.getGeocode()); } setVisitDate(geocodes, 0); diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 64224f6..372bb68 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -108,7 +108,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity private Geopoint coords = null; private SearchResult search = null; /** The list of shown caches shared with Adapter. Don't manipulate outside of main thread only with Handler */ - private final List<cgCache> cacheList = new ArrayList<cgCache>(); + private final List<Geocache> cacheList = new ArrayList<Geocache>(); private CacheListAdapter adapter = null; private LayoutInflater inflater = null; private View listFooter = null; @@ -281,7 +281,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity private void replaceCacheListFromSearch() { if (search != null) { - final Set<cgCache> cachesFromSearchResult = search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + final Set<Geocache> cachesFromSearchResult = search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); runOnUiThread(new Runnable() { @Override public void run() { @@ -339,7 +339,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity startGeoAndDir(); } else { if (search != null) { - final Set<cgCache> cacheListTmp = search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + final Set<Geocache> cacheListTmp = search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); if (CollectionUtils.isNotEmpty(cacheListTmp)) { cacheList.clear(); cacheList.addAll(cacheListTmp); @@ -798,7 +798,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } private boolean containsEvents() { - for (cgCache cache : adapter.getCheckedOrAllCaches()) { + for (Geocache cache : adapter.getCheckedOrAllCaches()) { if (cache.isEventCache()) { return true; } @@ -898,8 +898,8 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity public void deletePastEvents() { progress.show(this, null, res.getString(R.string.caches_drop_progress), true, dropDetailsHandler.obtainMessage(MSG_CANCEL)); - final List<cgCache> deletion = new ArrayList<cgCache>(); - for (cgCache cache : adapter.getCheckedOrAllCaches()) { + final List<Geocache> deletion = new ArrayList<Geocache>(); + for (Geocache cache : adapter.getCheckedOrAllCaches()) { if (cache.isEventCache()) { final Date eventDate = cache.getHiddenDate(); if (DateUtils.daysSince(eventDate.getTime()) > 0) { @@ -947,7 +947,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity if (adapterInfo == null || adapterInfo.position >= adapter.getCount()) { return; } - final cgCache cache = adapter.getItem(adapterInfo.position); + final Geocache cache = adapter.getItem(adapterInfo.position); menu.setHeaderTitle(StringUtils.defaultIfBlank(cache.getName(), cache.getGeocode())); @@ -1000,7 +1000,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity Log.w("cgeocaches.onContextItemSelected", e); } - final cgCache cache = adapterInfo != null ? getCacheFromAdapter(adapterInfo) : null; + final Geocache cache = adapterInfo != null ? getCacheFromAdapter(adapterInfo) : null; // just in case the list got resorted while we are executing this code if (cache == null) { @@ -1066,8 +1066,8 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity * an adapterInfo * @return the pointed cache */ - private cgCache getCacheFromAdapter(final AdapterContextMenuInfo adapterInfo) { - final cgCache cache = adapter.getItem(adapterInfo.position); + private Geocache getCacheFromAdapter(final AdapterContextMenuInfo adapterInfo) { + final Geocache cache = adapter.getItem(adapterInfo.position); if (cache.getGeocode().equalsIgnoreCase(contextMenuGeocode)) { return cache; } @@ -1413,7 +1413,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity final private int listIdLD; private volatile boolean needToStop = false; private long last = 0L; - final private List<cgCache> selected; + final private List<Geocache> selected; public LoadDetailsThread(Handler handlerIn, int listId) { handler = handlerIn; @@ -1431,8 +1431,8 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity public void run() { removeGeoAndDir(); - final List<cgCache> cachesWithStaticMaps = new ArrayList<cgCache>(selected.size()); - for (cgCache cache : selected) { + final List<Geocache> cachesWithStaticMaps = new ArrayList<Geocache>(selected.size()); + for (Geocache cache : selected) { if (Settings.isStoreOfflineMaps() && cache.hasStaticMap()) { cachesWithStaticMaps.add(cache); continue; @@ -1444,7 +1444,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } - for (cgCache cache : cachesWithStaticMaps) { + for (Geocache cache : cachesWithStaticMaps) { if (!refreshCache(cache)) { break; } @@ -1462,7 +1462,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity * @return * <code>false</code> if the storing was interrupted, <code>true</code> otherwise */ - private boolean refreshCache(cgCache cache) { + private boolean refreshCache(Geocache cache) { try { if (needToStop) { throw new InterruptedException("Stopped storing process."); @@ -1544,7 +1544,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity handler.sendMessage(handler.obtainMessage(1, response)); yield(); - cgCache.storeCache(null, response, listIdLFW, false, null); + Geocache.storeCache(null, response, listIdLFW, false, null); handler.sendMessage(handler.obtainMessage(2, response)); yield(); @@ -1590,9 +1590,9 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity private class DropDetailsThread extends Thread { final private Handler handler; - final private List<cgCache> selected; + final private List<Geocache> selected; - public DropDetailsThread(Handler handlerIn, List<cgCache> selectedIn) { + public DropDetailsThread(Handler handlerIn, List<Geocache> selectedIn) { handler = handlerIn; selected = selectedIn; } @@ -1610,7 +1610,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity private class RemoveFromHistoryThread extends Thread { final private Handler handler; - final private List<cgCache> selected; + final private List<Geocache> selected; public RemoveFromHistoryThread(Handler handlerIn) { handler = handlerIn; @@ -1711,7 +1711,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity @Override public void run() { - final List<cgCache> caches = adapter.getCheckedCaches(); + final List<Geocache> caches = adapter.getCheckedCaches(); cgData.moveToList(caches, listId); handler.sendEmptyMessage(listId); } @@ -1783,7 +1783,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity // apply filter settings (if there's a filter) Set<String> geocodes = new HashSet<String>(); - for (cgCache cache : adapter.getFilteredList()) { + for (Geocache cache : adapter.getFilteredList()) { geocodes.add(cache.getGeocode()); } @@ -1873,7 +1873,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity private void setDateComparatorForEventList() { if (CollectionUtils.isNotEmpty(cacheList)) { boolean eventsOnly = true; - for (cgCache cache : cacheList) { + for (Geocache cache : cacheList) { if (!cache.isEventCache()) { eventsOnly = false; break; diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java index 9604b5f..1eb8fbb 100644 --- a/main/src/cgeo/geocaching/connector/AbstractConnector.java +++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheRealm; import cgeo.geocaching.geopoint.Geopoint; @@ -31,7 +31,7 @@ public abstract class AbstractConnector implements IConnector { * @return success */ @Override - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { throw new UnsupportedOperationException(); } @@ -39,7 +39,7 @@ public abstract class AbstractConnector implements IConnector { * {@link IConnector} */ @Override - public boolean deleteModifiedCoordinates(cgCache cache) { + public boolean deleteModifiedCoordinates(Geocache cache) { throw new UnsupportedOperationException(); } @@ -54,7 +54,7 @@ public abstract class AbstractConnector implements IConnector { } @Override - public String getLicenseText(final cgCache cache) { + public String getLicenseText(final Geocache cache) { return null; } diff --git a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java index 15113da..ac2fb37 100644 --- a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java +++ b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class GeocachingAustraliaConnector extends AbstractConnector { } @Override - public String getCacheUrl(final cgCache cache) { + public String getCacheUrl(final Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } diff --git a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java index c20b8f8..500f752 100644 --- a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java +++ b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class GeopeitusConnector extends AbstractConnector { } @Override - public String getCacheUrl(final cgCache cache) { + public String getCacheUrl(final Geocache cache) { return getCacheUrlPrefix() + StringUtils.stripStart(cache.getGeocode().substring(2), "0"); } diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java index d45368a..da626f2 100644 --- a/main/src/cgeo/geocaching/connector/IConnector.java +++ b/main/src/cgeo/geocaching/connector/IConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheRealm; import cgeo.geocaching.geopoint.Geopoint; @@ -27,7 +27,7 @@ public interface IConnector { * @param cache * @return */ - public String getCacheUrl(final cgCache cache); + public String getCacheUrl(final Geocache cache); /** * enable/disable watchlist controls in cache details @@ -63,7 +63,7 @@ public interface IConnector { * @param cache * @return */ - public String getLicenseText(final cgCache cache); + public String getLicenseText(final Geocache cache); /** * enable/disable user actions in cache details @@ -118,7 +118,7 @@ public interface IConnector { * @param wpt * @return success */ - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt); + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt); /** * Reseting of modified coordinates on website to details @@ -126,7 +126,7 @@ public interface IConnector { * @param cache * @return success */ - public boolean deleteModifiedCoordinates(cgCache cache); + public boolean deleteModifiedCoordinates(Geocache cache); /** * The CacheRealm this cache belongs to diff --git a/main/src/cgeo/geocaching/connector/UnknownConnector.java b/main/src/cgeo/geocaching/connector/UnknownConnector.java index 3edd8a6..b6fc29a 100644 --- a/main/src/cgeo/geocaching/connector/UnknownConnector.java +++ b/main/src/cgeo/geocaching/connector/UnknownConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class UnknownConnector extends AbstractConnector { } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return null; // we have no url for these caches } diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index 7716b8f..2a38bd9 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -1,10 +1,10 @@ package cgeo.geocaching.connector.gc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.connector.capability.ISearchByCenter; @@ -51,7 +51,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { // it would also be possible to use "http://www.geocaching.com/seek/cache_details.aspx?wp=" + cache.getGeocode(); return "http://www.geocaching.com//seek/cache_details.aspx?wp=" + cache.getGeocode(); } @@ -143,7 +143,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } - public static boolean addToWatchlist(cgCache cache) { + public static boolean addToWatchlist(Geocache cache) { final boolean added = GCParser.addToWatchlist(cache); if (added) { cgData.saveChangedCache(cache); @@ -151,7 +151,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, return added; } - public static boolean removeFromWatchlist(cgCache cache) { + public static boolean removeFromWatchlist(Geocache cache) { final boolean removed = GCParser.removeFromWatchlist(cache); if (removed) { cgData.saveChangedCache(cache); @@ -168,7 +168,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, * @return <code>true</code> if the cache was sucessfully added, <code>false</code> otherwise */ - public static boolean addToFavorites(cgCache cache) { + public static boolean addToFavorites(Geocache cache) { final boolean added = GCParser.addToFavorites(cache); if (added) { cgData.saveChangedCache(cache); @@ -185,7 +185,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, * @return <code>true</code> if the cache was sucessfully added, <code>false</code> otherwise */ - public static boolean removeFromFavorites(cgCache cache) { + public static boolean removeFromFavorites(Geocache cache) { final boolean removed = GCParser.removeFromFavorites(cache); if (removed) { cgData.saveChangedCache(cache); @@ -194,7 +194,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { final boolean uploaded = GCParser.uploadModifiedCoordinates(cache, wpt); if (uploaded) { cgData.saveChangedCache(cache); @@ -203,7 +203,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public boolean deleteModifiedCoordinates(cgCache cache) { + public boolean deleteModifiedCoordinates(Geocache cache) { final boolean deleted = GCParser.deleteModifiedCoordinates(cache); if (deleted) { cgData.saveChangedCache(cache); diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java index 20739db..2e1dff0 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCMap.java +++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java @@ -2,7 +2,7 @@ package cgeo.geocaching.connector.gc; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; @@ -68,7 +68,7 @@ public class GCMap { } for (int j = 0; j < dataArray.length(); j++) { - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); JSONObject dataObject = dataArray.getJSONObject(j); cache.setName(dataObject.getString("name")); @@ -202,7 +202,7 @@ public class GCMap { String id = entry.getKey(); List<UTFGridPosition> pos = entry.getValue(); UTFGridPosition xy = UTFGrid.getPositionInGrid(pos); - cgCache cache = new cgCache(); + Geocache cache = new Geocache(); cache.setDetailed(false); cache.setReliableLatLon(false); cache.setGeocode(id); diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index d9d9c0b..b54e00c 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -1,5 +1,6 @@ package cgeo.geocaching.connector.gc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; @@ -7,7 +8,6 @@ import cgeo.geocaching.Settings; import cgeo.geocaching.Trackable; import cgeo.geocaching.TrackableLog; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.Image; import cgeo.geocaching.cgeoapplication; @@ -119,7 +119,7 @@ public abstract class GCParser { final int rows_count = rows.length; for (int z = 1; z < rows_count; z++) { - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); String row = rows[z]; // check for cache type presence @@ -287,8 +287,8 @@ public abstract class GCParser { // get direction images if (Settings.getLoadDirImg()) { - final Set<cgCache> caches = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); - for (cgCache cache : caches) { + final Set<Geocache> caches = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + for (Geocache cache : caches) { if (cache.getCoords() == null && StringUtils.isNotEmpty(cache.getDirectionImg())) { DirectionImage.getDrawable(cache.getGeocode(), cache.getDirectionImg()); } @@ -301,7 +301,7 @@ public abstract class GCParser { static SearchResult parseCache(final String page, final CancellableHandler handler) { final SearchResult searchResult = parseCacheFromText(page, handler); if (searchResult != null && !searchResult.getGeocodes().isEmpty()) { - final cgCache cache = searchResult.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cache = searchResult.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); getExtraOnlineInfo(cache, page, handler); cache.setDetailedUpdatedNow(); if (CancellableHandler.isCancelled(handler)) { @@ -345,7 +345,7 @@ public abstract class GCParser { return searchResult; } - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); cache.setDisabled(page.contains(GCConstants.STRING_DISABLED)); cache.setArchived(page.contains(GCConstants.STRING_ARCHIVED)); @@ -744,7 +744,7 @@ public abstract class GCParser { } // search results don't need to be filtered so load GCVote ratings here - GCVote.loadRatings(new ArrayList<cgCache>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB))); + GCVote.loadRatings(new ArrayList<Geocache>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB))); // save to application search.setError(searchResult.getError()); @@ -1125,7 +1125,7 @@ public abstract class GCParser { * the cache to add * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean addToWatchlist(final cgCache cache) { + static boolean addToWatchlist(final Geocache cache) { final String uri = "http://www.geocaching.com/my/watchlist.aspx?w=" + cache.getCacheId(); String page = Login.postRequestLogged(uri, null); @@ -1151,7 +1151,7 @@ public abstract class GCParser { * the cache to remove * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean removeFromWatchlist(final cgCache cache) { + static boolean removeFromWatchlist(final Geocache cache) { final String uri = "http://www.geocaching.com/my/watchlist.aspx?ds=1&action=rem&id=" + cache.getCacheId(); String page = Login.postRequestLogged(uri, null); @@ -1200,11 +1200,11 @@ public abstract class GCParser { * the cache to add * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean addToFavorites(final cgCache cache) { + static boolean addToFavorites(final Geocache cache) { return changeFavorite(cache, true); } - private static boolean changeFavorite(final cgCache cache, final boolean add) { + private static boolean changeFavorite(final Geocache cache, final boolean add) { final String page = requestHtmlPage(cache.getGeocode(), null, "n", "0"); final String userToken = BaseUtils.getMatch(page, GCConstants.PATTERN_USERTOKEN, ""); if (StringUtils.isEmpty(userToken)) { @@ -1234,7 +1234,7 @@ public abstract class GCParser { * the cache to remove * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean removeFromFavorites(final cgCache cache) { + static boolean removeFromFavorites(final Geocache cache) { return changeFavorite(cache, false); } @@ -1436,7 +1436,7 @@ public abstract class GCParser { * @param friends * retrieve friend logs */ - private static List<LogEntry> loadLogsFromDetails(final String page, final cgCache cache, final boolean friends, final boolean getDataFromPage) { + private static List<LogEntry> loadLogsFromDetails(final String page, final Geocache cache, final boolean friends, final boolean getDataFromPage) { String rawResponse; if (!getDataFromPage) { @@ -1623,7 +1623,7 @@ public abstract class GCParser { params.put("tx", cacheType.guid); } - private static void getExtraOnlineInfo(final cgCache cache, final String page, final CancellableHandler handler) { + private static void getExtraOnlineInfo(final Geocache cache, final String page, final CancellableHandler handler) { if (CancellableHandler.isCancelled(handler)) { return; } @@ -1668,15 +1668,15 @@ public abstract class GCParser { } } - public static boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public static boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { return editModifiedCoordinates(cache, wpt); } - public static boolean deleteModifiedCoordinates(cgCache cache) { + public static boolean deleteModifiedCoordinates(Geocache cache) { return editModifiedCoordinates(cache, null); } - public static boolean editModifiedCoordinates(cgCache cache, Geopoint wpt) { + public static boolean editModifiedCoordinates(Geocache cache, Geopoint wpt) { final String page = requestHtmlPage(cache.getGeocode(), null, "n", "0"); final String userToken = BaseUtils.getMatch(page, GCConstants.PATTERN_USERTOKEN, ""); if (StringUtils.isEmpty(userToken)) { diff --git a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java index 0bebd02..98bd28a 100644 --- a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java +++ b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.gc; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheType; import android.graphics.Bitmap; @@ -25,7 +25,7 @@ public abstract class IconDecoder { private static final int CT_VIRTUAL = 11; private static final int CT_LETTERBOX = 12; - public static boolean parseMapPNG(final cgCache cache, Bitmap bitmap, UTFGridPosition xy, int zoomlevel) { + public static boolean parseMapPNG(final Geocache cache, Bitmap bitmap, UTFGridPosition xy, int zoomlevel) { final int topX = xy.getX() * 4; final int topY = xy.getY() * 4; final int bitmapWidth = bitmap.getWidth(); diff --git a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java index 5776c12..5cba53d 100644 --- a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java +++ b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java @@ -1,10 +1,10 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Image; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -53,7 +53,7 @@ public class OC11XMLParser { private static ImageHolder imageHolder = null; private static class CacheHolder { - public cgCache cache; + public Geocache cache; public String latitude; public String longitude; } @@ -177,7 +177,7 @@ public class OC11XMLParser { } } - private static void setCacheStatus(final int statusId, final cgCache cache) { + private static void setCacheStatus(final int statusId, final Geocache cache) { switch (statusId) { case 1: cache.setArchived(false); @@ -195,7 +195,7 @@ public class OC11XMLParser { } private static void resetCache(final CacheHolder cacheHolder) { - cacheHolder.cache = new cgCache(null); + cacheHolder.cache = new Geocache(null); cacheHolder.cache.setReliableLatLon(true); cacheHolder.cache.setDescription(StringUtils.EMPTY); cacheHolder.latitude = "0.0"; @@ -216,9 +216,9 @@ public class OC11XMLParser { protected static int attributeId; - public static Collection<cgCache> parseCaches(final InputStream stream) throws IOException { + public static Collection<Geocache> parseCaches(final InputStream stream) throws IOException { - final Map<String, cgCache> caches = new HashMap<String, cgCache>(); + final Map<String, Geocache> caches = new HashMap<String, Geocache>(); final Map<String, LogEntry> logs = new HashMap<String, LogEntry>(); final CacheHolder cacheHolder = new CacheHolder(); @@ -242,7 +242,7 @@ public class OC11XMLParser { @Override public void end() { - cgCache cache = cacheHolder.cache; + Geocache cache = cacheHolder.cache; Geopoint coords = new Geopoint(cacheHolder.latitude, cacheHolder.longitude); cache.setCoords(coords); if (caches.size() < CACHE_PARSE_LIMIT && isValid(cache) && !isExcluded(cache)) { @@ -251,7 +251,7 @@ public class OC11XMLParser { } } - private boolean isExcluded(cgCache cache) { + private boolean isExcluded(Geocache cache) { if (cache.isArchived() && Settings.isExcludeDisabledCaches()) { return true; } @@ -261,7 +261,7 @@ public class OC11XMLParser { return !Settings.getCacheType().contains(cache); } - private boolean isValid(cgCache cache) { + private boolean isValid(Geocache cache) { return StringUtils.isNotBlank(cache.getGeocode()) && !cache.getCoords().equals(Geopoint.ZERO); } }); @@ -452,7 +452,7 @@ public class OC11XMLParser { @Override public void end() { - final cgCache cache = caches.get(descHolder.cacheId); + final Geocache cache = caches.get(descHolder.cacheId); if (cache != null) { cache.setShortdesc(descHolder.shortDesc); cache.setDescription(cache.getDescription() + descHolder.desc); @@ -514,7 +514,7 @@ public class OC11XMLParser { @Override public void end() { - final cgCache cache = caches.get(logHolder.cacheId); + final Geocache cache = caches.get(logHolder.cacheId); if (cache != null && logHolder.logEntry.type != LogType.UNKNOWN) { logs.put(logHolder.id, logHolder.logEntry); cache.getLogs().prepend(logHolder.logEntry); @@ -609,7 +609,7 @@ public class OC11XMLParser { @Override public void end() { if (imageHolder.isSpoiler) { - final cgCache cache = caches.get(imageHolder.objectId); + final Geocache cache = caches.get(imageHolder.objectId); if (cache != null) { Image spoiler = new Image(imageHolder.url, imageHolder.title); cache.addSpoiler(spoiler); diff --git a/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java b/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java index 74968e7..69cf8a4 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.capability.ISearchByGeocode; import cgeo.geocaching.network.Parameters; import cgeo.geocaching.utils.CancellableHandler; @@ -21,14 +21,14 @@ public class OCApiConnector extends OCConnector implements ISearchByGeocode { } @Override - public String getLicenseText(final cgCache cache) { + public String getLicenseText(final Geocache cache) { // NOT TO BE TRANSLATED return "<a href=\"" + getCacheUrl(cache) + "\">" + getName() + "</a> data licensed under the Creative Commons BY-SA 3.0 License"; } @Override public SearchResult searchByGeocode(final String geocode, final String guid, final CancellableHandler handler) { - final cgCache cache = OkapiClient.getCache(geocode); + final Geocache cache = OkapiClient.getCache(geocode); if (cache == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/oc/OCConnector.java b/main/src/cgeo/geocaching/connector/oc/OCConnector.java index e290e51..661f506 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.oc; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.enumerations.CacheRealm; @@ -34,7 +34,7 @@ public class OCConnector extends AbstractConnector { } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } diff --git a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java index 3a2f42e..69707b9 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java @@ -1,8 +1,8 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.capability.ISearchByCenter; import cgeo.geocaching.connector.capability.ISearchByGeocode; import cgeo.geocaching.connector.capability.ISearchByViewPort; @@ -21,7 +21,7 @@ public class OCXMLApiConnector extends OCConnector implements ISearchByGeocode, @Override public SearchResult searchByGeocode(final String geocode, final String guid, CancellableHandler handler) { - final cgCache cache = OCXMLClient.getCache(geocode); + final Geocache cache = OCXMLClient.getCache(geocode); if (cache == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java b/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java index f438db0..3e4d5b6 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector.oc; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -29,7 +29,7 @@ public class OCXMLClient { // Url for single cache requests // http://www.opencaching.de/xml/ocxml11.php?modifiedsince=20060320000000&user=0&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&session=0&doctype=0&charset=utf-8&wp=OCC9BE - public static cgCache getCache(final String geoCode) { + public static Geocache getCache(final String geoCode) { try { final Parameters params = getOCXmlQueryParameters(true, true, true); params.put("wp", geoCode); @@ -39,9 +39,9 @@ public class OCXMLClient { return null; } - Collection<cgCache> caches = OC11XMLParser.parseCaches(new GZIPInputStream(data)); + Collection<Geocache> caches = OC11XMLParser.parseCaches(new GZIPInputStream(data)); if (caches.iterator().hasNext()) { - cgCache cache = caches.iterator().next(); + Geocache cache = caches.iterator().next(); cgData.saveCache(cache, LoadFlags.SAVE_ALL); return cache; } @@ -52,7 +52,7 @@ public class OCXMLClient { } } - public static Collection<cgCache> getCachesAround(final Geopoint center, final double distance) { + public static Collection<Geocache> getCachesAround(final Geopoint center, final double distance) { try { final Parameters params = getOCXmlQueryParameters(false, false, false); params.put("lat", GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, center)); diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java index 508d0b5..dbcfea5 100644 --- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java @@ -1,8 +1,8 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Image; import cgeo.geocaching.LogEntry; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -68,7 +68,7 @@ final public class OkapiClient { private static final String SERVICE_NEAREST = "/okapi/services/caches/search/nearest"; - public static cgCache getCache(final String geoCode) { + public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode, "fields", SERVICE_CACHE_FIELDS); final JSONObject data = request(ConnectorFactory.getConnector(geoCode), SERVICE_CACHE, params); @@ -79,7 +79,7 @@ final public class OkapiClient { return parseCache(data); } - public static List<cgCache> getCachesAround(final Geopoint center, IConnector connector) { + public static List<Geocache> getCachesAround(final Geopoint center, IConnector connector) { String centerString = GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, center) + "|" + GeopointFormatter.format(GeopointFormatter.Format.LON_DECDEGREE_RAW, center); final Parameters params = new Parameters("center", centerString); final JSONObject data = request(connector, SERVICE_NEAREST, params); @@ -91,7 +91,7 @@ final public class OkapiClient { return parseCaches(data); } - private static List<cgCache> parseCaches(final JSONObject response) { + private static List<Geocache> parseCaches(final JSONObject response) { try { final JSONArray cachesResponse = response.getJSONArray("results"); if (cachesResponse != null) { @@ -102,9 +102,9 @@ final public class OkapiClient { geocodes.add(geocode); } } - List<cgCache> caches = new ArrayList<cgCache>(geocodes.size()); + List<Geocache> caches = new ArrayList<Geocache>(geocodes.size()); for (String geocode : geocodes) { - cgCache cache = getCache(geocode); + Geocache cache = getCache(geocode); if (cache != null) { caches.add(cache); } @@ -117,8 +117,8 @@ final public class OkapiClient { return null; } - private static cgCache parseCache(final JSONObject response) { - final cgCache cache = new cgCache(); + private static Geocache parseCache(final JSONObject response) { + final Geocache cache = new Geocache(); cache.setReliableLatLon(true); try { cache.setGeocode(response.getString(CACHE_CODE)); @@ -235,7 +235,7 @@ final public class OkapiClient { return null; } - private static void setLocation(final cgCache cache, final String location) { + private static void setLocation(final Geocache cache, final String location) { final String latitude = StringUtils.substringBefore(location, "|"); final String longitude = StringUtils.substringAfter(location, "|"); cache.setCoords(new Geopoint(latitude, longitude)); diff --git a/main/src/cgeo/geocaching/connector/ox/OXConnector.java b/main/src/cgeo/geocaching/connector/ox/OXConnector.java index 17d8ab4..eec07e3 100644 --- a/main/src/cgeo/geocaching/connector/ox/OXConnector.java +++ b/main/src/cgeo/geocaching/connector/ox/OXConnector.java @@ -1,9 +1,9 @@ package cgeo.geocaching.connector.ox; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.connector.capability.ISearchByCenter; import cgeo.geocaching.connector.capability.ISearchByGeocode; @@ -27,7 +27,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } @@ -42,7 +42,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I } @Override - public String getLicenseText(cgCache cache) { + public String getLicenseText(Geocache cache) { // NOT TO BE TRANSLATED return "<a href=\"" + getCacheUrl(cache) + "\">" + getName() + "</a> data licensed under the Creative Commons BY-SA 3.0 License"; } @@ -54,7 +54,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I @Override public SearchResult searchByGeocode(String geocode, String guid, CancellableHandler handler) { - final cgCache cache = OpenCachingApi.searchByGeoCode(geocode); + final Geocache cache = OpenCachingApi.searchByGeoCode(geocode); if (cache == null) { return null; } @@ -64,7 +64,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I @Override public SearchResult searchByCenter(Geopoint center) { - Collection<cgCache> caches = OpenCachingApi.searchByCenter(center); + Collection<Geocache> caches = OpenCachingApi.searchByCenter(center); if (caches == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java index 377785a..f40a3e8 100644 --- a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java +++ b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector.ox; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.files.GPX10Parser; public class OXGPXParser extends GPX10Parser { @@ -13,7 +13,7 @@ public class OXGPXParser extends GPX10Parser { } @Override - protected void afterParsing(cgCache cache) { + protected void afterParsing(Geocache cache) { cache.setUpdated(System.currentTimeMillis()); if (isDetailed) { cache.setDetailedUpdate(cache.getUpdated()); diff --git a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java index 17be540..f25e289 100644 --- a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java +++ b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.ox; +import cgeo.geocaching.Geocache; import cgeo.geocaching.StoredList; -import cgeo.geocaching.cgCache; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter; import cgeo.geocaching.network.Network; @@ -20,25 +20,25 @@ public class OpenCachingApi { private static final String DEV_KEY = CryptUtils.rot13("PtqQnHo9RUTht3Np"); - public static cgCache searchByGeoCode(final String geocode) { + public static Geocache searchByGeoCode(final String geocode) { final HttpResponse response = Network.getRequest("http://www.opencaching.com/api/geocache/" + geocode + ".gpx", new Parameters( "Authorization", DEV_KEY, "log_limit", "30", "hint", "true", "description", "html")); - final Collection<cgCache> caches = importCachesFromResponse(response, true); + final Collection<Geocache> caches = importCachesFromResponse(response, true); if (CollectionUtils.isNotEmpty(caches)) { return caches.iterator().next(); } return null; } - private static Collection<cgCache> importCachesFromResponse(final HttpResponse response, final boolean isDetailed) { + private static Collection<Geocache> importCachesFromResponse(final HttpResponse response, final boolean isDetailed) { if (response == null) { return Collections.emptyList(); } - Collection<cgCache> caches; + Collection<Geocache> caches; try { caches = new OXGPXParser(StoredList.STANDARD_LIST_ID, isDetailed).parse(response.getEntity().getContent(), null); } catch (Exception e) { @@ -48,7 +48,7 @@ public class OpenCachingApi { return caches; } - public static Collection<cgCache> searchByCenter(final Geopoint center) { + public static Collection<Geocache> searchByCenter(final Geopoint center) { final HttpResponse response = Network.getRequest("http://www.opencaching.com/api/geocache/.gpx", new Parameters( "Authorization", DEV_KEY, diff --git a/main/src/cgeo/geocaching/export/Export.java b/main/src/cgeo/geocaching/export/Export.java index 7a2b075..a1a873f 100644 --- a/main/src/cgeo/geocaching/export/Export.java +++ b/main/src/cgeo/geocaching/export/Export.java @@ -1,24 +1,24 @@ package cgeo.geocaching.export; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import android.app.Activity; import java.util.List; /** - * Represents an exporter to export a {@link List} of {@link cgCache} to various formats. + * Represents an exporter to export a {@link List} of {@link cgeo.geocaching.Geocache} to various formats. */ interface Export { /** - * Export a {@link List} of {@link cgCache} to various formats. + * Export a {@link List} of {@link cgeo.geocaching.Geocache} to various formats. * * @param caches - * The {@link List} of {@link cgCache} to be exported + * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * optional: Some exporters might have an UI which requires an {@link Activity} */ - public void export(List<cgCache> caches, Activity activity); + public void export(List<Geocache> caches, Activity activity); /** * Get the localized name of this exporter. diff --git a/main/src/cgeo/geocaching/export/ExportFactory.java b/main/src/cgeo/geocaching/export/ExportFactory.java index d32a751..a3ecb0c 100644 --- a/main/src/cgeo/geocaching/export/ExportFactory.java +++ b/main/src/cgeo/geocaching/export/ExportFactory.java @@ -1,7 +1,7 @@ package cgeo.geocaching.export; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.utils.Log; import android.app.Activity; @@ -34,11 +34,11 @@ public abstract class ExportFactory { * Creates a dialog so that the user can select an exporter. * * @param caches - * The {@link List} of {@link cgCache} to be exported + * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * The {@link Activity} in whose context the dialog should be shown */ - public static void showExportMenu(final List<cgCache> caches, final Activity activity) { + public static void showExportMenu(final List<Geocache> caches, final Activity activity) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.export).setIcon(R.drawable.ic_menu_share); diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java index 8ec2112..39eae0e 100644 --- a/main/src/cgeo/geocaching/export/FieldnoteExport.java +++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java @@ -2,7 +2,7 @@ package cgeo.geocaching.export; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.activity.Progress; @@ -56,7 +56,7 @@ class FieldnoteExport extends AbstractExport { } @Override - public void export(final List<cgCache> caches, final Activity activity) { + public void export(final List<Geocache> caches, final Activity activity) { if (null == activity) { // No activity given, so no user interaction possible. // Start export with default parameters. @@ -67,7 +67,7 @@ class FieldnoteExport extends AbstractExport { } } - private Dialog getExportOptionsDialog(final List<cgCache> caches, final Activity activity) { + private Dialog getExportOptionsDialog(final List<Geocache> caches, final Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); View layout = activity.getLayoutInflater().inflate(R.layout.fieldnote_export_dialog, null); @@ -101,7 +101,7 @@ class FieldnoteExport extends AbstractExport { } private class ExportTask extends AsyncTask<Void, Integer, Boolean> { - private final List<cgCache> caches; + private final List<Geocache> caches; private final Activity activity; private final boolean upload; private final boolean onlyNew; @@ -114,7 +114,7 @@ class FieldnoteExport extends AbstractExport { * Instantiates and configurates the task for exporting field notes. * * @param caches - * The {@link List} of {@link cgCache} to be exported + * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * optional: Show a progress bar and toasts * @param upload @@ -122,7 +122,7 @@ class FieldnoteExport extends AbstractExport { * @param onlyNew * Upload/export only new logs since last export */ - public ExportTask(final List<cgCache> caches, final Activity activity, final boolean upload, final boolean onlyNew) { + public ExportTask(final List<Geocache> caches, final Activity activity, final boolean upload, final boolean onlyNew) { this.caches = caches; this.activity = activity; this.upload = upload; @@ -141,7 +141,7 @@ class FieldnoteExport extends AbstractExport { final StringBuilder fieldNoteBuffer = new StringBuilder(); try { int i = 0; - for (cgCache cache : caches) { + for (Geocache cache : caches) { if (cache.isLogOffline()) { appendFieldNote(fieldNoteBuffer, cache, cgData.loadLogOffline(cache.getGeocode())); publishProgress(++i); @@ -257,7 +257,7 @@ class FieldnoteExport extends AbstractExport { } } - static void appendFieldNote(final StringBuilder fieldNoteBuffer, final cgCache cache, final LogEntry log) { + static void appendFieldNote(final StringBuilder fieldNoteBuffer, final Geocache cache, final LogEntry log) { fieldNoteBuffer.append(cache.getGeocode()) .append(',') .append(fieldNoteDateFormat.format(new Date(log.date))) diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java index 1cba79d..4997923 100644 --- a/main/src/cgeo/geocaching/export/GpxExport.java +++ b/main/src/cgeo/geocaching/export/GpxExport.java @@ -1,10 +1,10 @@ package cgeo.geocaching.export; +import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.activity.Progress; @@ -52,7 +52,7 @@ class GpxExport extends AbstractExport { } @Override - public void export(final List<cgCache> caches, final Activity activity) { + public void export(final List<Geocache> caches, final Activity activity) { if (null == activity) { // No activity given, so no user interaction possible. // Start export with default parameters. @@ -64,7 +64,7 @@ class GpxExport extends AbstractExport { } } - private Dialog getExportDialog(final List<cgCache> caches, final Activity activity) { + private Dialog getExportDialog(final List<Geocache> caches, final Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null); @@ -97,7 +97,7 @@ class GpxExport extends AbstractExport { } private class ExportTask extends AsyncTask<Void, Integer, File> { - private final List<cgCache> caches; + private final List<Geocache> caches; private final Activity activity; private final Progress progress = new Progress(); @@ -105,11 +105,11 @@ class GpxExport extends AbstractExport { * Instantiates and configures the task for exporting field notes. * * @param caches - * The {@link List} of {@link cgCache} to be exported + * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * optional: Show a progress bar and toasts */ - public ExportTask(final List<cgCache> caches, final Activity activity) { + public ExportTask(final List<Geocache> caches, final Activity activity) { this.caches = caches; this.activity = activity; } @@ -152,7 +152,7 @@ class GpxExport extends AbstractExport { PREFIX_GROUNDSPEAK + " http://www.groundspeak.com/cache/1/0/1/cache.xsd"); for (int i = 0; i < caches.size(); i++) { - final cgCache cache = cgData.loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY); + final Geocache cache = cgData.loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY); gpx.startTag(PREFIX_GPX, "wpt"); gpx.attribute("", "lat", Double.toString(cache.getCoords().getLatitude())); @@ -234,7 +234,7 @@ class GpxExport extends AbstractExport { return exportFile; } - private void writeWaypoints(final XmlSerializer gpx, final cgCache cache) throws IOException { + private void writeWaypoints(final XmlSerializer gpx, final Geocache cache) throws IOException { List<Waypoint> waypoints = cache.getWaypoints(); List<Waypoint> ownWaypoints = new ArrayList<Waypoint>(waypoints.size()); List<Waypoint> originWaypoints = new ArrayList<Waypoint>(waypoints.size()); @@ -285,7 +285,7 @@ class GpxExport extends AbstractExport { gpx.endTag(PREFIX_GPX, "wpt"); } - private void writeLogs(final XmlSerializer gpx, final cgCache cache) throws IOException { + private void writeLogs(final XmlSerializer gpx, final Geocache cache) throws IOException { if (cache.getLogs().isEmpty()) { return; } @@ -314,7 +314,7 @@ class GpxExport extends AbstractExport { gpx.endTag(PREFIX_GROUNDSPEAK, "logs"); } - private void writeAttributes(final XmlSerializer gpx, final cgCache cache) throws IOException { + private void writeAttributes(final XmlSerializer gpx, final Geocache cache) throws IOException { if (cache.getAttributes().isEmpty()) { return; } diff --git a/main/src/cgeo/geocaching/files/FileParser.java b/main/src/cgeo/geocaching/files/FileParser.java index 0308d81..50b65a1 100644 --- a/main/src/cgeo/geocaching/files/FileParser.java +++ b/main/src/cgeo/geocaching/files/FileParser.java @@ -1,6 +1,6 @@ package cgeo.geocaching.files; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.utils.CancellableHandler; import java.io.BufferedReader; @@ -26,7 +26,7 @@ public abstract class FileParser { * @throws ParserException * if the input stream contains data not matching the file format of the parser */ - public abstract Collection<cgCache> parse(final InputStream stream, final CancellableHandler progressHandler) throws IOException, ParserException; + public abstract Collection<Geocache> parse(final InputStream stream, final CancellableHandler progressHandler) throws IOException, ParserException; /** * Convenience method for parsing a file. @@ -37,7 +37,7 @@ public abstract class FileParser { * @throws IOException * @throws ParserException */ - public Collection<cgCache> parse(final File file, final CancellableHandler progressHandler) throws IOException, ParserException { + public Collection<Geocache> parse(final File file, final CancellableHandler progressHandler) throws IOException, ParserException { FileInputStream fis = new FileInputStream(file); try { return parse(fis, progressHandler); @@ -72,7 +72,7 @@ public abstract class FileParser { } } - protected static void fixCache(cgCache cache) { + protected static void fixCache(Geocache cache) { if (cache.getInventory() != null) { cache.setInventoryItems(cache.getInventory().size()); } else { diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java index 750d5e0..b8dcbb3 100644 --- a/main/src/cgeo/geocaching/files/GPXImporter.java +++ b/main/src/cgeo/geocaching/files/GPXImporter.java @@ -1,10 +1,10 @@ package cgeo.geocaching.files;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.StaticMapsProvider;
-import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgData;
import cgeo.geocaching.activity.IAbstractActivity;
import cgeo.geocaching.activity.Progress;
@@ -134,11 +134,11 @@ public class GPXImporter { public void run() {
try {
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_START));
- final Collection<cgCache> caches = doImport();
+ final Collection<Geocache> caches = doImport();
Log.i("Imported successfully " + caches.size() + " caches.");
final SearchResult search = new SearchResult();
- for (cgCache cache : caches) {
+ for (Geocache cache : caches) {
search.addCache(cache);
}
@@ -167,12 +167,12 @@ public class GPXImporter { }
}
- protected abstract Collection<cgCache> doImport() throws IOException, ParserException;
+ protected abstract Collection<Geocache> doImport() throws IOException, ParserException;
private boolean importStaticMaps(final SearchResult importedCaches) {
int storedCacheMaps = 0;
for (String geocode : importedCaches.getGeocodes()) {
- cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
Log.d("GPXImporter.ImportThread.importStaticMaps start downloadMaps for cache " + geocode);
StaticMapsProvider.downloadMaps(cache);
storedCacheMaps++;
@@ -194,7 +194,7 @@ public class GPXImporter { }
@Override
- protected Collection<cgCache> doImport() throws IOException, ParserException {
+ protected Collection<Geocache> doImport() throws IOException, ParserException {
Log.i("Import LOC file: " + file.getAbsolutePath());
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) file.length()));
LocParser parser = new LocParser(listId);
@@ -209,7 +209,7 @@ public class GPXImporter { }
@Override
- protected Collection<cgCache> doImport() throws IOException, ParserException {
+ protected Collection<Geocache> doImport() throws IOException, ParserException {
try {
// try to parse cache file as GPX 10
return doImport(new GPX10Parser(listId));
@@ -219,7 +219,7 @@ public class GPXImporter { }
}
- protected abstract Collection<cgCache> doImport(GPXParser parser) throws IOException, ParserException;
+ protected abstract Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException;
}
static class ImportGpxFileThread extends ImportGpxThread {
@@ -231,10 +231,10 @@ public class GPXImporter { }
@Override
- protected Collection<cgCache> doImport(GPXParser parser) throws IOException, ParserException {
+ protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
Log.i("Import GPX file: " + cacheFile.getAbsolutePath());
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) cacheFile.length()));
- Collection<cgCache> caches = parser.parse(cacheFile, progressHandler);
+ Collection<Geocache> caches = parser.parse(cacheFile, progressHandler);
final String wptsFilename = getWaypointsFileNameForGpxFile(cacheFile);
if (wptsFilename != null) {
@@ -260,7 +260,7 @@ public class GPXImporter { }
@Override
- protected Collection<cgCache> doImport(GPXParser parser) throws IOException, ParserException {
+ protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
Log.i("Import GPX from uri: " + uri);
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, -1));
InputStream is = contentResolver.openInputStream(uri);
@@ -279,8 +279,8 @@ public class GPXImporter { }
@Override
- protected Collection<cgCache> doImport(GPXParser parser) throws IOException, ParserException {
- Collection<cgCache> caches = Collections.emptySet();
+ protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
+ Collection<Geocache> caches = Collections.emptySet();
// can't assume that GPX file comes before waypoint file in zip -> so we need two passes
// 1. parse GPX files
ZipInputStream zis = new ZipInputStream(getInputStream());
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index 22a7f41..9b10d20 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -1,10 +1,10 @@ package cgeo.geocaching.files; +import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.StoredList; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.Trackable; import cgeo.geocaching.cgeoapplication; @@ -80,7 +80,7 @@ public abstract class GPXParser extends FileParser { final protected String namespace; final private String version; - private cgCache cache; + private Geocache cache; private Trackable trackable = new Trackable(); private LogEntry log = null; @@ -248,7 +248,7 @@ public abstract class GPXParser extends FileParser { } @Override - public Collection<cgCache> parse(final InputStream stream, final CancellableHandler progressHandler) throws IOException, ParserException { + public Collection<Geocache> parse(final InputStream stream, final CancellableHandler progressHandler) throws IOException, ParserException { resetCache(); final RootElement root = new RootElement(namespace, "gpx"); final Element waypoint = root.getChild(namespace, "wpt"); @@ -329,7 +329,7 @@ public abstract class GPXParser extends FileParser { if (cache.getName().length() > 2) { final String cacheGeocodeForWaypoint = "GC" + cache.getName().substring(2).toUpperCase(Locale.US); // lookup cache for waypoint in already parsed caches - final cgCache cacheForWaypoint = cgData.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cacheForWaypoint = cgData.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB); if (cacheForWaypoint != null) { final Waypoint waypoint = new Waypoint(cache.getShortdesc(), convertWaypointSym2Type(sym), false); waypoint.setId(-1); @@ -783,7 +783,7 @@ public abstract class GPXParser extends FileParser { * @param cache * currently imported cache */ - protected void afterParsing(cgCache cache) { + protected void afterParsing(Geocache cache) { // can be overridden by sub classes } @@ -858,7 +858,7 @@ public abstract class GPXParser extends FileParser { desc = null; cmt = null; - cache = new cgCache(this); + cache = new Geocache(this); for (int i = 0; i < userData.length; i++) { userData[i] = null; } diff --git a/main/src/cgeo/geocaching/files/LocParser.java b/main/src/cgeo/geocaching/files/LocParser.java index 730e224..fe290c3 100644 --- a/main/src/cgeo/geocaching/files/LocParser.java +++ b/main/src/cgeo/geocaching/files/LocParser.java @@ -1,7 +1,7 @@ package cgeo.geocaching.files; +import cgeo.geocaching.Geocache; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -56,7 +56,7 @@ public final class LocParser extends FileParser { private int listId; public static void parseLoc(final SearchResult searchResult, final String fileContent) { - final Map<String, cgCache> cidCoords = parseCoordinates(fileContent); + final Map<String, Geocache> cidCoords = parseCoordinates(fileContent); // save found cache coordinates final HashSet<String> contained = new HashSet<String>(); @@ -65,14 +65,14 @@ public final class LocParser extends FileParser { contained.add(geocode); } } - Set<cgCache> caches = cgData.loadCaches(contained, LoadFlags.LOAD_CACHE_OR_DB); - for (cgCache cache : caches) { - cgCache coord = cidCoords.get(cache.getGeocode()); + Set<Geocache> caches = cgData.loadCaches(contained, LoadFlags.LOAD_CACHE_OR_DB); + for (Geocache cache : caches) { + Geocache coord = cidCoords.get(cache.getGeocode()); copyCoordToCache(coord, cache); } } - private static void copyCoordToCache(final cgCache coord, final cgCache cache) { + private static void copyCoordToCache(final Geocache coord, final Geocache cache) { cache.setCoords(coord.getCoords()); cache.setDifficulty(coord.getDifficulty()); cache.setTerrain(coord.getTerrain()); @@ -84,8 +84,8 @@ public final class LocParser extends FileParser { } } - static Map<String, cgCache> parseCoordinates(final String fileContent) { - final Map<String, cgCache> coords = new HashMap<String, cgCache>(); + static Map<String, Geocache> parseCoordinates(final String fileContent) { + final Map<String, Geocache> coords = new HashMap<String, Geocache>(); if (StringUtils.isBlank(fileContent)) { return coords; } @@ -95,7 +95,7 @@ public final class LocParser extends FileParser { // parse coordinates for (String pointString : points) { - final cgCache pointCoord = parseCache(pointString); + final Geocache pointCoord = parseCache(pointString); if (StringUtils.isNotBlank(pointCoord.getGeocode())) { coords.put(pointCoord.getGeocode(), pointCoord); } @@ -121,17 +121,17 @@ public final class LocParser extends FileParser { } @Override - public Collection<cgCache> parse(InputStream stream, CancellableHandler progressHandler) throws IOException, ParserException { + public Collection<Geocache> parse(InputStream stream, CancellableHandler progressHandler) throws IOException, ParserException { // TODO: progress reporting happens during reading stream only, not during parsing String streamContent = readStream(stream, progressHandler).toString(); - final Map<String, cgCache> coords = parseCoordinates(streamContent); - final List<cgCache> caches = new ArrayList<cgCache>(); - for (Entry<String, cgCache> entry : coords.entrySet()) { - cgCache coord = entry.getValue(); + final Map<String, Geocache> coords = parseCoordinates(streamContent); + final List<Geocache> caches = new ArrayList<Geocache>(); + for (Entry<String, Geocache> entry : coords.entrySet()) { + Geocache coord = entry.getValue(); if (StringUtils.isBlank(coord.getGeocode()) || StringUtils.isBlank(coord.getName())) { continue; } - cgCache cache = new cgCache(); + Geocache cache = new Geocache(); cache.setReliableLatLon(true); copyCoordToCache(coord, cache); caches.add(cache); @@ -146,8 +146,8 @@ public final class LocParser extends FileParser { return caches; } - public static cgCache parseCache(final String pointString) { - final cgCache cache = new cgCache(); + public static Geocache parseCache(final String pointString) { + final Geocache cache = new Geocache(); final MatcherWrapper matcherGeocode = new MatcherWrapper(patternGeocode, pointString); if (matcherGeocode.find()) { cache.setGeocode(matcherGeocode.group(1).trim()); diff --git a/main/src/cgeo/geocaching/filter/AbstractFilter.java b/main/src/cgeo/geocaching/filter/AbstractFilter.java index f78a218..bc99959 100644 --- a/main/src/cgeo/geocaching/filter/AbstractFilter.java +++ b/main/src/cgeo/geocaching/filter/AbstractFilter.java @@ -1,6 +1,6 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import java.util.ArrayList; import java.util.List; @@ -13,9 +13,9 @@ abstract class AbstractFilter implements IFilter { } @Override - public void filter(List<cgCache> list) { - final List<cgCache> itemsToRemove = new ArrayList<cgCache>(); - for (cgCache item : list) { + public void filter(List<Geocache> list) { + final List<Geocache> itemsToRemove = new ArrayList<Geocache>(); + for (Geocache item : list) { if (!accepts(item)) { itemsToRemove.add(item); } diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java index 837e9d1..4b6f382 100644 --- a/main/src/cgeo/geocaching/filter/AttributeFilter.java +++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.filter; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.LoadFlags.LoadFlag; @@ -34,8 +34,8 @@ class AttributeFilter extends AbstractFilter { } @Override - public boolean accepts(final cgCache cache) { - cgCache fullCache = cgData.loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); + public boolean accepts(final Geocache cache) { + Geocache fullCache = cgData.loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); if (fullCache == null) { fullCache = cache; } diff --git a/main/src/cgeo/geocaching/filter/DifficultyFilter.java b/main/src/cgeo/geocaching/filter/DifficultyFilter.java index 368c20f..c0ec61a 100644 --- a/main/src/cgeo/geocaching/filter/DifficultyFilter.java +++ b/main/src/cgeo/geocaching/filter/DifficultyFilter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.filter; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import java.util.ArrayList; @@ -12,7 +12,7 @@ class DifficultyFilter extends AbstractRangeFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return rangeMin <= cache.getDifficulty() && cache.getDifficulty() < rangeMax; } diff --git a/main/src/cgeo/geocaching/filter/IFilter.java b/main/src/cgeo/geocaching/filter/IFilter.java index abc2d50..4a428f8 100644 --- a/main/src/cgeo/geocaching/filter/IFilter.java +++ b/main/src/cgeo/geocaching/filter/IFilter.java @@ -1,6 +1,6 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import java.util.List; @@ -12,7 +12,7 @@ public interface IFilter { * @param cache * @return true if the filter accepts the cache, false otherwise */ - public abstract boolean accepts(final cgCache cache); + public abstract boolean accepts(final Geocache cache); - public void filter(final List<cgCache> list); + public void filter(final List<Geocache> list); }
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/filter/ModifiedFilter.java b/main/src/cgeo/geocaching/filter/ModifiedFilter.java index f74bb4d..f3e57de 100644 --- a/main/src/cgeo/geocaching/filter/ModifiedFilter.java +++ b/main/src/cgeo/geocaching/filter/ModifiedFilter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.filter; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; class ModifiedFilter extends AbstractFilter implements IFilterFactory { @@ -11,7 +11,7 @@ class ModifiedFilter extends AbstractFilter implements IFilterFactory { } @Override - public boolean accepts(final cgCache cache) { + public boolean accepts(final Geocache cache) { // modified on GC return cache.hasUserModifiedCoords() || cache.hasFinalDefined(); } diff --git a/main/src/cgeo/geocaching/filter/SizeFilter.java b/main/src/cgeo/geocaching/filter/SizeFilter.java index b08c2ae..7a34c83 100644 --- a/main/src/cgeo/geocaching/filter/SizeFilter.java +++ b/main/src/cgeo/geocaching/filter/SizeFilter.java @@ -1,6 +1,6 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheSize; import java.util.ArrayList; @@ -14,7 +14,7 @@ class SizeFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cacheSize == cache.getSize(); } diff --git a/main/src/cgeo/geocaching/filter/StateFilter.java b/main/src/cgeo/geocaching/filter/StateFilter.java index f51329a..0df47c1 100644 --- a/main/src/cgeo/geocaching/filter/StateFilter.java +++ b/main/src/cgeo/geocaching/filter/StateFilter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.filter; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import android.content.res.Resources; @@ -25,7 +25,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.isFound(); } @@ -37,7 +37,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.isArchived(); } } @@ -48,7 +48,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.isDisabled(); } } @@ -59,7 +59,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.isPremiumMembersOnly(); } } @@ -70,7 +70,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return !cache.isPremiumMembersOnly(); } } @@ -81,7 +81,7 @@ abstract class StateFilter extends AbstractFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.isLogOffline(); } } diff --git a/main/src/cgeo/geocaching/filter/TerrainFilter.java b/main/src/cgeo/geocaching/filter/TerrainFilter.java index 5cee87e..f7703d5 100644 --- a/main/src/cgeo/geocaching/filter/TerrainFilter.java +++ b/main/src/cgeo/geocaching/filter/TerrainFilter.java @@ -2,7 +2,7 @@ package cgeo.geocaching.filter; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import java.util.ArrayList; @@ -13,7 +13,7 @@ class TerrainFilter extends AbstractRangeFilter { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return rangeMin <= cache.getTerrain() && cache.getTerrain() < rangeMax; } diff --git a/main/src/cgeo/geocaching/filter/TrackablesFilter.java b/main/src/cgeo/geocaching/filter/TrackablesFilter.java index 90def5b..3225daa 100644 --- a/main/src/cgeo/geocaching/filter/TrackablesFilter.java +++ b/main/src/cgeo/geocaching/filter/TrackablesFilter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.filter; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgeoapplication; class TrackablesFilter extends AbstractFilter implements IFilterFactory { @@ -10,7 +10,7 @@ class TrackablesFilter extends AbstractFilter implements IFilterFactory { } @Override - public boolean accepts(cgCache cache) { + public boolean accepts(Geocache cache) { return cache.hasTrackables(); } diff --git a/main/src/cgeo/geocaching/filter/TypeFilter.java b/main/src/cgeo/geocaching/filter/TypeFilter.java index 05b97e0..eeab552 100644 --- a/main/src/cgeo/geocaching/filter/TypeFilter.java +++ b/main/src/cgeo/geocaching/filter/TypeFilter.java @@ -1,6 +1,6 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheType; import java.util.ArrayList; @@ -14,7 +14,7 @@ class TypeFilter extends AbstractFilter { } @Override - public boolean accepts(final cgCache cache) { + public boolean accepts(final Geocache cache) { return cacheType == cache.getType(); } diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java index 076b081..a053f31 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVote.java +++ b/main/src/cgeo/geocaching/gcvote/GCVote.java @@ -1,7 +1,7 @@ package cgeo.geocaching.gcvote; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.network.Network; import cgeo.geocaching.network.Parameters; import cgeo.geocaching.utils.LeastRecentlyUsedMap; @@ -178,7 +178,7 @@ public final class GCVote { * @param vote * @return */ - public static boolean setRating(cgCache cache, double vote) { + public static boolean setRating(Geocache cache, double vote) { if (!cache.supportsGCVote()) { return false; } @@ -207,13 +207,13 @@ public final class GCVote { return result.trim().equalsIgnoreCase("ok"); } - public static void loadRatings(ArrayList<cgCache> caches) { + public static void loadRatings(ArrayList<Geocache> caches) { if (!Settings.isRatingWanted()) { return; } final ArrayList<String> guids = new ArrayList<String>(caches.size()); - for (final cgCache cache : caches) { + for (final Geocache cache : caches) { String guid = cache.getGuid(); if (StringUtils.isNotBlank(guid)) { guids.add(guid); @@ -229,7 +229,7 @@ public final class GCVote { if (MapUtils.isNotEmpty(ratings)) { // save found cache coordinates - for (cgCache cache : caches) { + for (Geocache cache : caches) { if (ratings.containsKey(cache.getGuid())) { GCVoteRating rating = ratings.get(cache.getGuid()); diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 44415ef..88cf2dc 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -1,6 +1,7 @@ package cgeo.geocaching.maps; import cgeo.geocaching.DirectionProvider; +import cgeo.geocaching.Geocache; import cgeo.geocaching.IGeoData; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; @@ -8,7 +9,6 @@ import cgeo.geocaching.Settings; import cgeo.geocaching.StoredList; import cgeo.geocaching.Waypoint; import cgeo.geocaching.activity.ActivityMixin; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.cgeocaches; @@ -177,7 +177,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto /** Count of caches currently visible */ private int cachesCnt = 0; /** List of caches in the viewport */ - private LeastRecentlyUsedSet<cgCache> caches = null; + private LeastRecentlyUsedSet<Geocache> caches = null; /** List of waypoints in the viewport */ private final LeastRecentlyUsedSet<Waypoint> waypoints = new LeastRecentlyUsedSet<Waypoint>(MAX_CACHES); // storing for offline @@ -335,13 +335,13 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } protected void countVisibleCaches() { - final List<cgCache> protectedCaches = caches.getAsList(); + final List<Geocache> protectedCaches = caches.getAsList(); int count = 0; if (!protectedCaches.isEmpty()) { final Viewport viewport = mapView.getViewport(); - for (final cgCache cache : protectedCaches) { + for (final Geocache cache : protectedCaches) { if (cache != null && cache.getCoords() != null) { if (viewport.contains(cache)) { count++; @@ -369,7 +369,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto app = (cgeoapplication) activity.getApplication(); int countBubbleCnt = cgData.getAllCachesCount(); - caches = new LeastRecentlyUsedSet<cgCache>(MAX_CACHES + countBubbleCnt); + caches = new LeastRecentlyUsedSet<Geocache>(MAX_CACHES + countBubbleCnt); final MapProvider mapProvider = Settings.getMapProvider(); mapItemFactory = mapProvider.getMapItemFactory(); @@ -492,7 +492,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (!CollectionUtils.isEmpty(dirtyCaches)) { for (String geocode : dirtyCaches) { - cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); + Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); if (cache != null) { // re-add to update the freshness caches.add(cache); @@ -792,11 +792,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto */ private Set<String> getGeocodesForCachesInViewport() { final Set<String> geocodes = new HashSet<String>(); - final List<cgCache> cachesProtected = caches.getAsList(); + final List<Geocache> cachesProtected = caches.getAsList(); final Viewport viewport = mapView.getViewport(); - for (final cgCache cache : cachesProtected) { + for (final Geocache cache : cachesProtected) { if (viewport.contains(cache)) { geocodes.add(cache.getGeocode()); } @@ -1120,7 +1120,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } downloaded = true; - Set<cgCache> cachesFromSearchResult = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_WAYPOINTS); + Set<Geocache> cachesFromSearchResult = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_WAYPOINTS); // update the caches caches.addAll(cachesFromSearchResult); @@ -1128,9 +1128,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto final boolean excludeMine = Settings.isExcludeMyCaches(); final boolean excludeDisabled = Settings.isExcludeDisabledCaches(); - final List<cgCache> tempList = caches.getAsList(); + final List<Geocache> tempList = caches.getAsList(); - for (cgCache cache : tempList) { + for (Geocache cache : tempList) { if ((cache.isFound() && excludeMine) || (cache.isOwner() && excludeMine) || (cache.isDisabled() && excludeDisabled)) { caches.remove(cache); } @@ -1148,7 +1148,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto else { //All waypoints from the viewed caches - for (cgCache c : caches.getAsList()) { + for (Geocache c : caches.getAsList()) { waypoints.addAll(c.getWaypoints()); } } @@ -1209,7 +1209,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } while (count < 2); if (searchResult != null) { - Set<cgCache> result = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + Set<Geocache> result = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); // update the caches caches.addAll(result); lastSearchResult = searchResult; @@ -1245,7 +1245,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } // display caches - final List<cgCache> cachesToDisplay = caches.getAsList(); + final List<Geocache> cachesToDisplay = caches.getAsList(); final List<Waypoint> waypointsToDisplay = new ArrayList<Waypoint>(waypoints); final List<CachesOverlayItemImpl> itemsToDisplay = new ArrayList<CachesOverlayItemImpl>(); @@ -1262,7 +1262,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto itemsToDisplay.add(getWaypointItem(waypoint)); } } - for (cgCache cache : cachesToDisplay) { + for (Geocache cache : cachesToDisplay) { if (cache == null || cache.getCoords() == null) { continue; @@ -1395,7 +1395,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto break; } - cgCache.storeCache(null, geocode, StoredList.STANDARD_LIST_ID, false, handler); + Geocache.storeCache(null, geocode, StoredList.STANDARD_LIST_ID, false, handler); } } catch (Exception e) { Log.e("cgeocaches.LoadDetails.run", e); @@ -1600,7 +1600,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto dirtyCaches.add(geocode); } - private CachesOverlayItemImpl getCacheItem(final cgCache cache) { + private CachesOverlayItemImpl getCacheItem(final Geocache cache) { final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(cache, cache.getType()); final int hashcode = new HashCodeBuilder() diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index ce519f4..9bb4cef 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -5,7 +5,7 @@ import cgeo.geocaching.IWaypoint; import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.WaypointPopup; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.Progress; import cgeo.geocaching.connector.gc.GCMap; @@ -227,7 +227,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { final IWaypoint coordinate = item.getCoord(); if (StringUtils.isNotBlank(coordinate.getCoordType()) && coordinate.getCoordType().equalsIgnoreCase("cache") && StringUtils.isNotBlank(coordinate.getGeocode())) { - cgCache cache = cgData.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); + Geocache cache = cgData.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); RequestDetailsThread requestDetailsThread = new RequestDetailsThread(cache); if (!requestDetailsThread.requestRequired()) { // don't show popup if we have enough details @@ -280,9 +280,9 @@ public class CachesOverlay extends AbstractItemizedOverlay { private class RequestDetailsThread extends Thread { - private final cgCache cache; + private final Geocache cache; - public RequestDetailsThread(cgCache cache) { + public RequestDetailsThread(Geocache cache) { this.cache = cache; } diff --git a/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java b/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java index aebecd2..2dee713 100644 --- a/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java +++ b/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.utils.Log; @@ -11,7 +11,7 @@ import cgeo.geocaching.utils.Log; public abstract class AbstractCacheComparator implements CacheComparator { @Override - public final int compare(final cgCache cache1, final cgCache cache2) { + public final int compare(final Geocache cache1, final Geocache cache2) { try { // first check that we have all necessary data for the comparison if (!canCompare(cache1, cache2)) { @@ -31,7 +31,7 @@ public abstract class AbstractCacheComparator implements CacheComparator { * @param cache2 * @return */ - protected abstract boolean canCompare(final cgCache cache1, final cgCache cache2); + protected abstract boolean canCompare(final Geocache cache1, final Geocache cache2); /** * Compares two caches. Logging and exception handling is implemented outside this method already. @@ -44,5 +44,5 @@ public abstract class AbstractCacheComparator implements CacheComparator { * @return an integer < 0 if cache1 is less than cache2, 0 if they are equal, and > 0 if cache1 is greater than * cache2. */ - protected abstract int compareCaches(final cgCache cache1, final cgCache cache2); + protected abstract int compareCaches(final Geocache cache1, final Geocache cache2); } diff --git a/main/src/cgeo/geocaching/sorting/CacheComparator.java b/main/src/cgeo/geocaching/sorting/CacheComparator.java index c9b5150..7932729 100644 --- a/main/src/cgeo/geocaching/sorting/CacheComparator.java +++ b/main/src/cgeo/geocaching/sorting/CacheComparator.java @@ -2,8 +2,8 @@ package cgeo.geocaching.sorting; import java.util.Comparator; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; -public interface CacheComparator extends Comparator<cgCache> { +public interface CacheComparator extends Comparator<Geocache> { } diff --git a/main/src/cgeo/geocaching/sorting/DateComparator.java b/main/src/cgeo/geocaching/sorting/DateComparator.java index 3136d47..3464103 100644 --- a/main/src/cgeo/geocaching/sorting/DateComparator.java +++ b/main/src/cgeo/geocaching/sorting/DateComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgeoapplication; import java.util.ArrayList; @@ -12,19 +12,19 @@ import java.util.Date; public class DateComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return true; } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { final Date date1 = cache1.getHiddenDate(); final Date date2 = cache2.getHiddenDate(); if (date1 != null && date2 != null) { final int dateDifference = date1.compareTo(date2); // for equal dates, sort by distance if (dateDifference == 0) { - final ArrayList<cgCache> list = new ArrayList<cgCache>(); + final ArrayList<Geocache> list = new ArrayList<Geocache>(); list.add(cache1); list.add(cache2); final DistanceComparator distanceComparator = new DistanceComparator(cgeoapplication.getInstance().currentGeo().getCoords(), list); diff --git a/main/src/cgeo/geocaching/sorting/DifficultyComparator.java b/main/src/cgeo/geocaching/sorting/DifficultyComparator.java index 123bab9..73d12fa 100644 --- a/main/src/cgeo/geocaching/sorting/DifficultyComparator.java +++ b/main/src/cgeo/geocaching/sorting/DifficultyComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by difficulty @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class DifficultyComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return cache1.getDifficulty() != 0.0 && cache2.getDifficulty() != 0.0; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return Float.compare(cache1.getDifficulty(), cache2.getDifficulty()); } }
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/sorting/DistanceComparator.java b/main/src/cgeo/geocaching/sorting/DistanceComparator.java index 781359a..7b0afbb 100644 --- a/main/src/cgeo/geocaching/sorting/DistanceComparator.java +++ b/main/src/cgeo/geocaching/sorting/DistanceComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.geopoint.Geopoint; import java.util.List; @@ -12,10 +12,10 @@ import java.util.List; public class DistanceComparator extends AbstractCacheComparator { final private Geopoint coords; - final private List<cgCache> list; + final private List<Geocache> list; private boolean cachedDistances; - public DistanceComparator(final Geopoint coords, List<cgCache> list) { + public DistanceComparator(final Geopoint coords, List<Geocache> list) { this.coords = coords; this.list = list; } @@ -27,7 +27,7 @@ public class DistanceComparator extends AbstractCacheComparator { if (cachedDistances) { return; } - for (cgCache cache : list) { + for (Geocache cache : list) { if (cache.getCoords() != null) { cache.setDistance(coords.distanceTo(cache.getCoords())); } @@ -39,12 +39,12 @@ public class DistanceComparator extends AbstractCacheComparator { } @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { calculateAllDistances(); if (cache1.getCoords() == null && cache2.getCoords() == null) { return 0; diff --git a/main/src/cgeo/geocaching/sorting/FindsComparator.java b/main/src/cgeo/geocaching/sorting/FindsComparator.java index 47e3844..ba929b8 100644 --- a/main/src/cgeo/geocaching/sorting/FindsComparator.java +++ b/main/src/cgeo/geocaching/sorting/FindsComparator.java @@ -1,24 +1,24 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.enumerations.LogType; public class FindsComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return cache1.getLogCounts() != null && cache2.getLogCounts() != null; } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { int finds1 = getFindsCount(cache1); int finds2 = getFindsCount(cache2); return finds2 - finds1; } - private static int getFindsCount(cgCache cache) { + private static int getFindsCount(Geocache cache) { if (cache.getLogCounts().isEmpty()) { cache.setLogCounts(cgData.loadLogCounts(cache.getGeocode())); } diff --git a/main/src/cgeo/geocaching/sorting/GeocodeComparator.java b/main/src/cgeo/geocaching/sorting/GeocodeComparator.java index fb93c0e..412649a 100644 --- a/main/src/cgeo/geocaching/sorting/GeocodeComparator.java +++ b/main/src/cgeo/geocaching/sorting/GeocodeComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import org.apache.commons.lang3.StringUtils; @@ -11,13 +11,13 @@ import org.apache.commons.lang3.StringUtils; public class GeocodeComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return StringUtils.isNotBlank(cache1.getGeocode()) && StringUtils.isNotBlank(cache2.getGeocode()); } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { final int lengthDiff = cache1.getGeocode().length() - cache2.getGeocode().length(); return lengthDiff != 0 ? lengthDiff : cache1.getGeocode().compareToIgnoreCase(cache2.getGeocode()); } diff --git a/main/src/cgeo/geocaching/sorting/InventoryComparator.java b/main/src/cgeo/geocaching/sorting/InventoryComparator.java index fb1360e..73ea2c5 100644 --- a/main/src/cgeo/geocaching/sorting/InventoryComparator.java +++ b/main/src/cgeo/geocaching/sorting/InventoryComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by number of items in inventory @@ -8,12 +8,12 @@ import cgeo.geocaching.cgCache; public class InventoryComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return cache2.getInventoryItems() - cache1.getInventoryItems(); } } diff --git a/main/src/cgeo/geocaching/sorting/InverseComparator.java b/main/src/cgeo/geocaching/sorting/InverseComparator.java index d2fa085..1dc76e2 100644 --- a/main/src/cgeo/geocaching/sorting/InverseComparator.java +++ b/main/src/cgeo/geocaching/sorting/InverseComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * comparator which inverses the sort order of the given other comparator @@ -15,7 +15,7 @@ public class InverseComparator implements CacheComparator { } @Override - public int compare(cgCache lhs, cgCache rhs) { + public int compare(Geocache lhs, Geocache rhs) { return originalComparator.compare(rhs, lhs); } diff --git a/main/src/cgeo/geocaching/sorting/NameComparator.java b/main/src/cgeo/geocaching/sorting/NameComparator.java index c32bc48..b432ad0 100644 --- a/main/src/cgeo/geocaching/sorting/NameComparator.java +++ b/main/src/cgeo/geocaching/sorting/NameComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import org.apache.commons.lang3.StringUtils; @@ -11,12 +11,12 @@ import org.apache.commons.lang3.StringUtils; public class NameComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return StringUtils.isNotBlank(cache1.getName()) && StringUtils.isNotBlank(cache2.getName()); } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { return cache1.getNameForSorting().compareToIgnoreCase(cache2.getNameForSorting()); } } diff --git a/main/src/cgeo/geocaching/sorting/PopularityComparator.java b/main/src/cgeo/geocaching/sorting/PopularityComparator.java index 62ad9a9..e256654 100644 --- a/main/src/cgeo/geocaching/sorting/PopularityComparator.java +++ b/main/src/cgeo/geocaching/sorting/PopularityComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by popularity (favorite count) @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class PopularityComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return cache2.getFavoritePoints() - cache1.getFavoritePoints(); } } diff --git a/main/src/cgeo/geocaching/sorting/RatingComparator.java b/main/src/cgeo/geocaching/sorting/RatingComparator.java index be071c5..72cf6c8 100644 --- a/main/src/cgeo/geocaching/sorting/RatingComparator.java +++ b/main/src/cgeo/geocaching/sorting/RatingComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by gcvote.com rating @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class RatingComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { final float rating1 = cache1.getRating(); final float rating2 = cache2.getRating(); // Voting can be disabled for caches, then assume an average rating instead diff --git a/main/src/cgeo/geocaching/sorting/SizeComparator.java b/main/src/cgeo/geocaching/sorting/SizeComparator.java index f946522..d128822 100644 --- a/main/src/cgeo/geocaching/sorting/SizeComparator.java +++ b/main/src/cgeo/geocaching/sorting/SizeComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by size @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class SizeComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return cache1.getSize() != null && cache2.getSize() != null; } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { return cache2.getSize().comparable - cache1.getSize().comparable; } }
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/sorting/StateComparator.java b/main/src/cgeo/geocaching/sorting/StateComparator.java index bda514f..b99c3c0 100644 --- a/main/src/cgeo/geocaching/sorting/StateComparator.java +++ b/main/src/cgeo/geocaching/sorting/StateComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sort caches by state (normal, disabled, archived) @@ -9,16 +9,16 @@ import cgeo.geocaching.cgCache; public class StateComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return getState(cache1) - getState(cache2); } - private static int getState(final cgCache cache) { + private static int getState(final Geocache cache) { if (cache.isDisabled()) { return 1; } diff --git a/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java b/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java index 32bef32..78ba742 100644 --- a/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java +++ b/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java @@ -1,16 +1,16 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; public class StorageTimeComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return true; } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { if (cache1.getUpdated() < cache2.getUpdated()) { return -1; } diff --git a/main/src/cgeo/geocaching/sorting/TerrainComparator.java b/main/src/cgeo/geocaching/sorting/TerrainComparator.java index 9058a3c..be1e9bb 100644 --- a/main/src/cgeo/geocaching/sorting/TerrainComparator.java +++ b/main/src/cgeo/geocaching/sorting/TerrainComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by terrain rating @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class TerrainComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return cache1.getTerrain() != 0.0 && cache2.getTerrain() != 0.0; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return Float.compare(cache1.getTerrain(), cache2.getTerrain()); } } diff --git a/main/src/cgeo/geocaching/sorting/VisitComparator.java b/main/src/cgeo/geocaching/sorting/VisitComparator.java index 46d8c58..27d3170 100644 --- a/main/src/cgeo/geocaching/sorting/VisitComparator.java +++ b/main/src/cgeo/geocaching/sorting/VisitComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by last visited date @@ -9,12 +9,12 @@ import cgeo.geocaching.cgCache; public class VisitComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(final cgCache cache1, final cgCache cache2) { + protected boolean canCompare(final Geocache cache1, final Geocache cache2) { return true; } @Override - protected int compareCaches(final cgCache cache1, final cgCache cache2) { + protected int compareCaches(final Geocache cache1, final Geocache cache2) { return Long.valueOf(cache2.getVisitedDate()).compareTo(cache1.getVisitedDate()); } } diff --git a/main/src/cgeo/geocaching/sorting/VoteComparator.java b/main/src/cgeo/geocaching/sorting/VoteComparator.java index 09d1620..dc0304b 100644 --- a/main/src/cgeo/geocaching/sorting/VoteComparator.java +++ b/main/src/cgeo/geocaching/sorting/VoteComparator.java @@ -1,6 +1,6 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; /** * sorts caches by the users own voting (if available at all) @@ -8,12 +8,12 @@ import cgeo.geocaching.cgCache; public class VoteComparator extends AbstractCacheComparator { @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { + protected boolean canCompare(Geocache cache1, Geocache cache2) { return true; } @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { + protected int compareCaches(Geocache cache1, Geocache cache2) { // if there is no vote available, put that cache at the end of the list return Float.compare(cache2.getMyVote(), cache1.getMyVote()); } diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java index 668502f..f30830e 100644 --- a/main/src/cgeo/geocaching/twitter/Twitter.java +++ b/main/src/cgeo/geocaching/twitter/Twitter.java @@ -1,8 +1,8 @@ package cgeo.geocaching.twitter; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Settings; import cgeo.geocaching.Trackable; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.LoadFlags; @@ -56,7 +56,7 @@ public final class Twitter { } public static void postTweetCache(String geocode) { - final cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); String status; final String url = cache.getUrl(); if (url.length() >= 100) { diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java index e7163fc..e98bd77 100644 --- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java +++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java @@ -1,7 +1,7 @@ package cgeo.geocaching.ui; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Units; @@ -79,7 +79,7 @@ public final class CacheDetailsCreator { } } - public void addCacheState(cgCache cache) { + public void addCacheState(Geocache cache) { if (cache.isLogOffline() || cache.isArchived() || cache.isDisabled() || cache.isPremiumMembersOnly() || cache.isFound()) { final List<String> states = new ArrayList<String>(5); if (cache.isLogOffline()) { @@ -101,7 +101,7 @@ public final class CacheDetailsCreator { } } - public void addRating(cgCache cache) { + public void addRating(Geocache cache) { if (cache.getRating() > 0) { final RelativeLayout itemLayout = addStars(R.string.cache_rating, cache.getRating()); if (cache.getVotes() > 0) { @@ -112,25 +112,25 @@ public final class CacheDetailsCreator { } } - public void addSize(cgCache cache) { + public void addSize(Geocache cache) { if (null != cache.getSize() && cache.showSize()) { add(R.string.cache_size, cache.getSize().getL10n()); } } - public void addDifficulty(cgCache cache) { + public void addDifficulty(Geocache cache) { if (cache.getDifficulty() > 0) { addStars(R.string.cache_difficulty, cache.getDifficulty()); } } - public void addTerrain(cgCache cache) { + public void addTerrain(Geocache cache) { if (cache.getTerrain() > 0) { addStars(R.string.cache_terrain, cache.getTerrain()); } } - public void addDistance(final cgCache cache, final TextView cacheDistanceView) { + public void addDistance(final Geocache cache, final TextView cacheDistanceView) { Float distance = null; if (cache.getCoords() != null) { final Geopoint currentCoords = cgeoapplication.getInstance().currentGeo().getCoords(); diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index d6224a9..41e27a6 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -1,10 +1,10 @@ package cgeo.geocaching.ui; import cgeo.geocaching.CacheDetailActivity; +import cgeo.geocaching.Geocache; import cgeo.geocaching.IGeoData; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheListType; import cgeo.geocaching.enumerations.CacheType; @@ -49,7 +49,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -public class CacheListAdapter extends ArrayAdapter<cgCache> { +public class CacheListAdapter extends ArrayAdapter<Geocache> { private LayoutInflater inflater = null; private CacheComparator cacheComparator = null; @@ -58,14 +58,14 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { private long lastSort = 0L; private boolean selectMode = false; private IFilter currentFilter = null; - private List<cgCache> originalList = null; + private List<Geocache> originalList = null; final private Set<CompassMiniView> compasses = new LinkedHashSet<CompassMiniView>(); final private Set<DistanceView> distances = new LinkedHashSet<DistanceView>(); final private CacheListType cacheListType; final private Resources res; /** Resulting list of caches */ - final private List<cgCache> list; + final private List<Geocache> list; private boolean inverseSort = false; private static final int SWIPE_MIN_DISTANCE = 60; @@ -107,7 +107,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { ImageView dirImg; } - public CacheListAdapter(final Activity activity, final List<cgCache> list, CacheListType cacheListType) { + public CacheListAdapter(final Activity activity, final List<Geocache> list, CacheListType cacheListType) { super(activity, 0, list); final IGeoData currentGeo = cgeoapplication.getInstance().currentGeo(); if (currentGeo != null) { @@ -168,7 +168,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { return cacheComparator; } - public cgCache findCacheByGeocode(String geocode) { + public Geocache findCacheByGeocode(String geocode) { for (int i = 0; i < getCount(); i++) { if (getItem(i).getGeocode().equalsIgnoreCase(geocode)) { return getItem(i); @@ -183,7 +183,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { public void reFilter() { if (currentFilter != null) { // Back up the list again - originalList = new ArrayList<cgCache>(list); + originalList = new ArrayList<Geocache>(list); currentFilter.filter(list); } @@ -195,7 +195,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { public void setFilter(final IFilter filter) { // Backup current caches list if it isn't backed up yet if (originalList == null) { - originalList = new ArrayList<cgCache>(list); + originalList = new ArrayList<Geocache>(list); } // If there is already a filter in place, this is a request to change or clear the filter, so we have to @@ -224,7 +224,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { public int getCheckedCount() { int checked = 0; - for (cgCache cache : list) { + for (Geocache cache : list) { if (cache.isStatusChecked()) { checked++; } @@ -236,7 +236,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { this.selectMode = selectMode; if (!selectMode) { - for (final cgCache cache : list) { + for (final Geocache cache : list) { cache.setStatusChecked(false); } } @@ -252,7 +252,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { } public void invertSelection() { - for (cgCache cache : list) { + for (Geocache cache : list) { cache.setStatusChecked(!cache.isStatusChecked()); } notifyDataSetChanged(); @@ -302,7 +302,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { if (coords == null) { return; } - final ArrayList<cgCache> oldList = new ArrayList<cgCache>(list); + final ArrayList<Geocache> oldList = new ArrayList<Geocache>(list); Collections.sort(list, getPotentialInversion(new DistanceComparator(coords, list))); // avoid an update if the list has not changed due to location update @@ -313,7 +313,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { lastSort = System.currentTimeMillis(); } - private Comparator<? super cgCache> getPotentialInversion(final CacheComparator comparator) { + private Comparator<? super Geocache> getPotentialInversion(final CacheComparator comparator) { if (inverseSort) { return new InverseComparator(comparator); } @@ -346,7 +346,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { return null; } - final cgCache cache = getItem(position); + final Geocache cache = getItem(position); View v = rowView; @@ -533,7 +533,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { return v; } - private static Drawable getCacheIcon(cgCache cache) { + private static Drawable getCacheIcon(Geocache cache) { int hashCode = getIconHashCode(cache.getType(), cache.hasUserModifiedCoords() || cache.hasFinalDefined()); final Drawable drawable = gcIconDrawables.get(hashCode); if (drawable != null) { @@ -554,9 +554,9 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { private static class SelectionCheckBoxListener implements View.OnClickListener { - private final cgCache cache; + private final Geocache cache; - public SelectionCheckBoxListener(cgCache cache) { + public SelectionCheckBoxListener(Geocache cache) { this.cache = cache; } @@ -571,9 +571,9 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { private boolean touch = true; private final GestureDetector gestureDetector; - private final cgCache cache; + private final Geocache cache; - public TouchListener(final cgCache cache) { + public TouchListener(final Geocache cache) { this.cache = cache; final FlingGesture dGesture = new FlingGesture(cache); gestureDetector = new GestureDetector(getContext(), dGesture); @@ -622,9 +622,9 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { private class FlingGesture extends GestureDetector.SimpleOnGestureListener { - private final cgCache cache; + private final Geocache cache; - public FlingGesture(cgCache cache) { + public FlingGesture(Geocache cache) { this.cache = cache; } @@ -659,13 +659,13 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { } } - public List<cgCache> getFilteredList() { + public List<Geocache> getFilteredList() { return list; } - public List<cgCache> getCheckedCaches() { - final ArrayList<cgCache> result = new ArrayList<cgCache>(); - for (cgCache cache : list) { + public List<Geocache> getCheckedCaches() { + final ArrayList<Geocache> result = new ArrayList<Geocache>(); + for (Geocache cache : list) { if (cache.isStatusChecked()) { result.add(cache); } @@ -673,12 +673,12 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> { return result; } - public List<cgCache> getCheckedOrAllCaches() { - final List<cgCache> result = getCheckedCaches(); + public List<Geocache> getCheckedOrAllCaches() { + final List<Geocache> result = getCheckedCaches(); if (!result.isEmpty()) { return result; } - return new ArrayList<cgCache>(list); + return new ArrayList<Geocache>(list); } public int getCheckedOrAllCount() { diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java index 4d23952..412b993 100644 --- a/main/src/cgeo/geocaching/ui/Formatter.java +++ b/main/src/cgeo/geocaching/ui/Formatter.java @@ -1,7 +1,7 @@ package cgeo.geocaching.ui; +import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheListType; @@ -109,7 +109,7 @@ public abstract class Formatter { return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL); } - public static String formatCacheInfoLong(cgCache cache, CacheListType cacheListType) { + public static String formatCacheInfoLong(Geocache cache, CacheListType cacheListType) { final ArrayList<String> infos = new ArrayList<String>(); if (StringUtils.isNotBlank(cache.getGeocode())) { infos.add(cache.getGeocode()); @@ -126,7 +126,7 @@ public abstract class Formatter { return StringUtils.join(infos, Formatter.SEPARATOR); } - public static String formatCacheInfoShort(cgCache cache) { + public static String formatCacheInfoShort(Geocache cache) { final ArrayList<String> infos = new ArrayList<String>(); if (cache.hasDifficulty()) { infos.add("D " + String.format("%.1f", cache.getDifficulty())); @@ -144,7 +144,7 @@ public abstract class Formatter { return StringUtils.join(infos, Formatter.SEPARATOR); } - public static String formatCacheInfoHistory(cgCache cache) { + public static String formatCacheInfoHistory(Geocache cache) { final ArrayList<String> infos = new ArrayList<String>(3); infos.add(StringUtils.upperCase(cache.getGeocode())); infos.add(Formatter.formatDate(cache.getVisitedDate())); diff --git a/main/src/cgeo/geocaching/ui/LoggingUI.java b/main/src/cgeo/geocaching/ui/LoggingUI.java index eaa25ef..2615947 100644 --- a/main/src/cgeo/geocaching/ui/LoggingUI.java +++ b/main/src/cgeo/geocaching/ui/LoggingUI.java @@ -1,9 +1,9 @@ package cgeo.geocaching.ui; +import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.IAbstractActivity; import cgeo.geocaching.enumerations.LogType; @@ -65,7 +65,7 @@ public class LoggingUI extends AbstractUIFactory { private static final int MENU_LOG_VISIT = 100; private static final int MENU_LOG_VISIT_OFFLINE = 101; - public static void addMenuItems(final Menu menu, final cgCache cache) { + public static void addMenuItems(final Menu menu, final Geocache cache) { if (cache == null) { return; } @@ -80,7 +80,7 @@ public class LoggingUI extends AbstractUIFactory { } } - public static boolean onMenuItemSelected(final MenuItem item, IAbstractActivity activity, cgCache cache) { + public static boolean onMenuItemSelected(final MenuItem item, IAbstractActivity activity, Geocache cache) { switch (item.getItemId()) { case MENU_LOG_VISIT: cache.logVisit(activity); @@ -93,7 +93,7 @@ public class LoggingUI extends AbstractUIFactory { } } - private static void showOfflineMenu(final cgCache cache, final Activity activity) { + private static void showOfflineMenu(final Geocache cache, final Activity activity) { final LogEntry currentLog = cgData.loadLogOffline(cache.getGeocode()); final LogType currentLogType = currentLog == null ? null : currentLog.type; diff --git a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java index 7979153..224d527 100644 --- a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java +++ b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java @@ -1,9 +1,9 @@ package cgeo.geocaching.ui.dialog; +import cgeo.geocaching.Geocache; import cgeo.geocaching.IGeoData; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.Settings.coordInputFormatEnum; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.ActivityMixin; @@ -32,7 +32,7 @@ public class CoordinatesInputDialog extends Dialog { final private AbstractActivity context; final private IGeoData geo; - final private cgCache cache; + final private Geocache cache; private Geopoint gp; private EditText eLat, eLon; @@ -46,7 +46,7 @@ public class CoordinatesInputDialog extends Dialog { private coordInputFormatEnum currentFormat = null; - public CoordinatesInputDialog(final AbstractActivity context, final cgCache cache, final Geopoint gp, final IGeoData geo) { + public CoordinatesInputDialog(final AbstractActivity context, final Geocache cache, final Geopoint gp, final IGeoData geo) { super(context); this.context = context; this.geo = geo; diff --git a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java index 7171fde..0a8e547 100644 --- a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java +++ b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java @@ -3,7 +3,7 @@ package cgeo.geocaching.utils; import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.Trackable; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.connector.gc.GCConstants; import cgeo.geocaching.connector.gc.Login; import cgeo.geocaching.network.Network; @@ -28,11 +28,11 @@ public class LogTemplateProvider { * */ public static class LogContext { - private cgCache cache; + private Geocache cache; private Trackable trackable; private boolean offline = false; - public LogContext(final cgCache cache) { + public LogContext(final Geocache cache) { this(cache, false); } @@ -44,12 +44,12 @@ public class LogTemplateProvider { this(null, offline); } - public LogContext(final cgCache cache, boolean offline) { + public LogContext(final Geocache cache, boolean offline) { this.cache = cache; this.offline = offline; } - public cgCache getCache() { + public Geocache getCache() { return cache; } @@ -152,7 +152,7 @@ public class LogTemplateProvider { if (trackable != null) { return trackable.getOwner(); } - cgCache cache = context.getCache(); + Geocache cache = context.getCache(); if (cache != null) { return cache.getOwnerDisplayName(); } |