diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-01-07 21:50:10 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-01-07 21:50:10 +0100 |
| commit | 3fb0e5f2d74b851836473a780a593cc7893cca9a (patch) | |
| tree | b5b621cd92483c0810524fc1e89385df573ecb2f /main | |
| parent | 34add6e4844c9de685a8a16c1f164e896fdb18be (diff) | |
| download | cgeo-3fb0e5f2d74b851836473a780a593cc7893cca9a.zip cgeo-3fb0e5f2d74b851836473a780a593cc7893cca9a.tar.gz cgeo-3fb0e5f2d74b851836473a780a593cc7893cca9a.tar.bz2 | |
Refactoring: rename cgWaypoint into Waypoint
Diffstat (limited to 'main')
24 files changed, 135 insertions, 135 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 03759d0..e63f48d 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -375,9 +375,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc final ViewGroup parent = ((ViewGroup) view.getParent()); for (int i = 0; i < parent.getChildCount(); i++) { if (parent.getChildAt(i) == view) { - final List<cgWaypoint> sortedWaypoints = new ArrayList<cgWaypoint>(cache.getWaypoints()); + final List<Waypoint> sortedWaypoints = new ArrayList<Waypoint>(cache.getWaypoints()); Collections.sort(sortedWaypoints); - final cgWaypoint waypoint = sortedWaypoints.get(i); + final Waypoint waypoint = sortedWaypoints.get(i); final int index = cache.getWaypoints().indexOf(waypoint); menu.setHeaderTitle(res.getString(R.string.waypoint)); if (waypoint.getWaypointType().equals(WaypointType.ORIGINAL)) { @@ -460,40 +460,40 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc break; case CONTEXT_MENU_WAYPOINT_EDIT: - final cgWaypoint waypointEdit = cache.getWaypoint(index); + final Waypoint waypointEdit = cache.getWaypoint(index); if (waypointEdit != null) { EditWaypointActivity.startActivityEditWaypoint(this, waypointEdit.getId()); refreshOnResume = true; } break; case CONTEXT_MENU_WAYPOINT_DUPLICATE: - final cgWaypoint waypointDuplicate = cache.getWaypoint(index); + final Waypoint waypointDuplicate = cache.getWaypoint(index); if (cache.duplicateWaypoint(waypointDuplicate)) { cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); notifyDataSetChanged(); } break; case CONTEXT_MENU_WAYPOINT_DELETE: - final cgWaypoint waypointDelete = cache.getWaypoint(index); + final Waypoint waypointDelete = cache.getWaypoint(index); if (cache.deleteWaypoint(waypointDelete)) { cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); notifyDataSetChanged(); } break; case CONTEXT_MENU_WAYPOINT_DEFAULT_NAVIGATION: - final cgWaypoint waypointNavigation = cache.getWaypoint(index); + final Waypoint waypointNavigation = cache.getWaypoint(index); if (waypointNavigation != null) { NavigationAppFactory.startDefaultNavigationApplication(1, this, waypointNavigation); } break; case CONTEXT_MENU_WAYPOINT_NAVIGATE: - final cgWaypoint waypointNav = cache.getWaypoint(contextMenuWPIndex); + final Waypoint waypointNav = cache.getWaypoint(contextMenuWPIndex); if (waypointNav != null) { NavigationAppFactory.showNavigationMenu(this, null, waypointNav, null); } break; case CONTEXT_MENU_WAYPOINT_CACHES_AROUND: - final cgWaypoint waypointAround = cache.getWaypoint(index); + final Waypoint waypointAround = cache.getWaypoint(index); if (waypointAround != null) { cgeocaches.startActivityCoordinates(this, waypointAround.getCoords()); } @@ -2098,10 +2098,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc final LinearLayout waypoints = (LinearLayout) view.findViewById(R.id.waypoints); // sort waypoints: PP, Sx, FI, OWN - final List<cgWaypoint> sortedWaypoints = new ArrayList<cgWaypoint>(cache.getWaypoints()); + final List<Waypoint> sortedWaypoints = new ArrayList<Waypoint>(cache.getWaypoints()); Collections.sort(sortedWaypoints); - for (final cgWaypoint wpt : sortedWaypoints) { + for (final Waypoint wpt : sortedWaypoints) { final LinearLayout waypointView = (LinearLayout) getLayoutInflater().inflate(R.layout.waypoint_item, null); // coordinates @@ -2250,7 +2250,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc final CheckBox uploadOption; final CheckBox resetLocalyOption; - public ResetCacheCoordinatesDialog(final cgCache cache, final cgWaypoint wpt, final Activity activity) { + public ResetCacheCoordinatesDialog(final cgCache cache, final Waypoint wpt, final Activity activity) { super(activity); View layout = activity.getLayoutInflater().inflate(R.layout.reset_cache_coords_dialog, null); @@ -2309,12 +2309,12 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc private final Handler handler; private final boolean local; private final boolean remote; - private final cgWaypoint wpt; + private final Waypoint wpt; private ProgressDialog progress; public static final int LOCAL = 0; public static final int ON_WEBSITE = 1; - public ResetCoordsThread(cgCache cache, Handler handler, final cgWaypoint wpt, boolean local, boolean remote, final ProgressDialog progress) { + public ResetCoordsThread(cgCache cache, Handler handler, final Waypoint wpt, boolean local, boolean remote, final ProgressDialog progress) { this.cache = cache; this.handler = handler; this.local = local; diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java index 13c2d3e..923afce 100644 --- a/main/src/cgeo/geocaching/EditWaypointActivity.java +++ b/main/src/cgeo/geocaching/EditWaypointActivity.java @@ -43,7 +43,7 @@ public class EditWaypointActivity extends AbstractActivity { private String geocode = null; private int id = -1; private ProgressDialog waitDialog = null; - private cgWaypoint waypoint = null; + private Waypoint waypoint = null; private Geopoint gpTemp = null; private WaypointType type = WaypointType.OWN; private String prefix = "OWN"; @@ -419,7 +419,7 @@ public class EditWaypointActivity extends AbstractActivity { } final String note = ((EditText) findViewById(R.id.note)).getText().toString().trim(); - final cgWaypoint waypoint = new cgWaypoint(name, type, own); + final Waypoint waypoint = new Waypoint(name, type, own); waypoint.setGeocode(geocode); waypoint.setPrefix(prefix); waypoint.setLookup(lookup); @@ -436,7 +436,7 @@ public class EditWaypointActivity extends AbstractActivity { } if (setAsCacheCoordsCheckBox.isChecked()) { if (!cache.hasUserModifiedCoords()) { - final cgWaypoint origWaypoint = new cgWaypoint(cgeoapplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false); + final Waypoint origWaypoint = new Waypoint(cgeoapplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false); origWaypoint.setCoords(cache.getCoords()); cache.addOrChangeWaypoint(origWaypoint, false); cache.setUserModifiedCoords(true); diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index c0a7f47..a15aa73 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -183,7 +183,7 @@ public class StaticMapsActivity extends AbstractActivity { StaticMapsProvider.storeCacheStaticMap(cache, true); return cache.hasStaticMap(); } - final cgWaypoint waypoint = cache.getWaypointById(waypoint_id); + final Waypoint waypoint = cache.getWaypointById(waypoint_id); if (waypoint != null) { showToast(res.getString(R.string.info_storing_static_maps)); StaticMapsProvider.storeWaypointStaticMap(cache, waypoint, true); @@ -193,7 +193,7 @@ public class StaticMapsActivity extends AbstractActivity { return false; } - public static void startActivity(final Context activity, final String geocode, final boolean download, final cgWaypoint waypoint) { + public static void startActivity(final Context activity, final String geocode, final boolean download, final Waypoint waypoint) { final Intent intent = new Intent(activity, StaticMapsActivity.class); // if resuming our app within this activity, finish it and return to the cache activity intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index 132619a..d587efd 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -99,18 +99,18 @@ public class StaticMapsProvider { if (Settings.isStoreOfflineWpMaps() && CollectionUtils.isNotEmpty(cache.getWaypoints())) { // remove all waypoint static map files due to origin cache waypoint id changed on saveCache LocalStorage.deleteFilesWithPrefix(cache.getGeocode(), MAP_FILENAME_PREFIX + WAYPOINT_PREFIX); - for (cgWaypoint waypoint : cache.getWaypoints()) { + for (Waypoint waypoint : cache.getWaypoints()) { storeWaypointStaticMap(cache.getGeocode(), edge, waypoint, false); } } } - public static void storeWaypointStaticMap(cgCache cache, cgWaypoint waypoint, boolean waitForResult) { + public static void storeWaypointStaticMap(cgCache cache, Waypoint waypoint, boolean waitForResult) { int edge = StaticMapsProvider.guessMaxDisplaySide(); storeWaypointStaticMap(cache.getGeocode(), edge, waypoint, waitForResult); } - private static void storeWaypointStaticMap(final String geocode, int edge, cgWaypoint waypoint, final boolean waitForResult) { + private static void storeWaypointStaticMap(final String geocode, int edge, Waypoint waypoint, final boolean waitForResult) { if (geocode == null) { Log.e("storeWaypointStaticMap - missing input parameter geocode"); return; @@ -136,7 +136,7 @@ public class StaticMapsProvider { private static void storeCacheStaticMap(final cgCache 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 cgWaypoint waypoint : cache.getWaypoints()) { + for (final Waypoint waypoint : cache.getWaypoints()) { if (waypoint.getCoords() == null) { continue; } @@ -205,7 +205,7 @@ public class StaticMapsProvider { return url.toString(); } - private static String getWpMarkerUrl(final cgWaypoint waypoint) { + private static String getWpMarkerUrl(final Waypoint waypoint) { String type = waypoint.getWaypointType() != null ? waypoint.getWaypointType().id : null; return MARKERS_URL + "marker_waypoint_" + type + ".png"; } diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/Waypoint.java index 4b7b95e..7a8b787 100644 --- a/main/src/cgeo/geocaching/cgWaypoint.java +++ b/main/src/cgeo/geocaching/Waypoint.java @@ -10,7 +10,7 @@ import android.widget.TextView; import java.util.List; -public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { +public class Waypoint implements IWaypoint, Comparable<Waypoint> { public static final String PREFIX_OWN = "OWN"; private static final int ORDER_UNDEFINED = -2; @@ -32,7 +32,7 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { * @param name * @param type */ - public cgWaypoint(final String name, final WaypointType type, final boolean own) { + public Waypoint(final String name, final WaypointType type, final boolean own) { this.name = name; this.waypointType = type; this.own = own; @@ -43,7 +43,7 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { * * @param other */ - public cgWaypoint(final cgWaypoint other) { + public Waypoint(final Waypoint other) { merge(other); this.waypointType = other.waypointType; id = 0; @@ -53,7 +53,7 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { nameView.setCompoundDrawablesWithIntrinsicBounds(res.getDrawable(waypointType.markerId), null, null, null); } - public void merge(final cgWaypoint old) { + public void merge(final Waypoint old) { if (StringUtils.isBlank(prefix)) { setPrefix(old.prefix); } @@ -79,15 +79,15 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { } } - public static void mergeWayPoints(List<cgWaypoint> newPoints, - List<cgWaypoint> oldPoints, boolean forceMerge) { + public static void mergeWayPoints(List<Waypoint> newPoints, + List<Waypoint> oldPoints, boolean forceMerge) { // copy user modified details of the waypoints if (newPoints != null && oldPoints != null) { - for (cgWaypoint old : oldPoints) { + for (Waypoint old : oldPoints) { if (old != null) { boolean merged = false; if (StringUtils.isNotEmpty(old.name)) { - for (cgWaypoint waypoint : newPoints) { + for (Waypoint waypoint : newPoints) { if (waypoint != null && waypoint.name != null) { if (old.name.equalsIgnoreCase(waypoint.name)) { waypoint.merge(old); @@ -142,7 +142,7 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { } @Override - public int compareTo(cgWaypoint other) { + public int compareTo(Waypoint other) { return order() - other.order(); } diff --git a/main/src/cgeo/geocaching/WaypointPopup.java b/main/src/cgeo/geocaching/WaypointPopup.java index eb0bc17..cc99abd 100644 --- a/main/src/cgeo/geocaching/WaypointPopup.java +++ b/main/src/cgeo/geocaching/WaypointPopup.java @@ -19,7 +19,7 @@ import android.widget.TextView; public class WaypointPopup extends AbstractPopupActivity { private static final String EXTRA_WAYPOINT_ID = "waypoint_id"; private int waypointId = 0; - private cgWaypoint waypoint = null; + private Waypoint waypoint = null; public WaypointPopup() { super("c:geo-waypoint-info", R.layout.waypoint_popup); diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java index 8f61e72..ad421f6 100644 --- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps; import cgeo.geocaching.R; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -68,8 +68,8 @@ public abstract class AbstractLocusApp extends AbstractApp { // get icon and Point if (o instanceof cgCache) { p = getCachePoint((cgCache) o, withCacheWaypoints, withCacheDetails); - } else if (o instanceof cgWaypoint) { - p = getWaypointPoint((cgWaypoint) o); + } else if (o instanceof Waypoint) { + p = getWaypointPoint((Waypoint) o); } if (p != null) { pd.addPoint(p); @@ -146,7 +146,7 @@ public abstract class AbstractLocusApp extends AbstractApp { if (withWaypoints && cache.hasWaypoints()) { pg.waypoints = new ArrayList<PointGeocachingDataWaypoint>(); - for (cgWaypoint waypoint : cache.getWaypoints()) { + for (Waypoint waypoint : cache.getWaypoints()) { if (waypoint == null || waypoint.getCoords() == null) { continue; } @@ -182,7 +182,7 @@ public abstract class AbstractLocusApp extends AbstractApp { * @param waypoint * @return null, when the <code>Point</code> could not be constructed */ - private static Point getWaypointPoint(cgWaypoint waypoint) { + private static Point getWaypointPoint(Waypoint waypoint) { if (waypoint == null || waypoint.getCoords() == null) { return null; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java index ca8c7db..67aa849 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.apps.AbstractApp; import android.app.Activity; @@ -25,7 +25,7 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { navigate(activity, waypoint.getCoords()); } @@ -35,7 +35,7 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return waypoint.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 85a4b93..e6bf9f4 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java @@ -4,9 +4,9 @@ import cgeo.geocaching.ILogable; import cgeo.geocaching.R; import cgeo.geocaching.StaticMapsActivity; import cgeo.geocaching.StaticMapsProvider; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.apps.AbstractApp; @@ -29,7 +29,7 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat return false; } - protected static boolean hasStaticMap(cgWaypoint waypoint) { + protected static boolean hasStaticMap(Waypoint waypoint) { if (waypoint==null) { return false; } @@ -41,7 +41,7 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat return false; } - protected static boolean invokeStaticMaps(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final boolean download) { + protected static boolean invokeStaticMaps(final Activity activity, final cgCache 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/CompassApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java index 5275d53..330c338 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.R; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeonavigate; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.geopoint.Geopoint; @@ -27,13 +27,13 @@ class CompassApp extends AbstractApp implements CacheNavigationApp, WaypointNavi } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { cgeonavigate.startActivity(activity, waypoint.getPrefix() + "/" + waypoint.getLookup(), waypoint.getName(), waypoint.getCoords(), null, waypoint.getWaypointType().getL10n()); } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return waypoint.getCoords() != null; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java index faf3c36..846b9bc 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java @@ -2,7 +2,7 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import android.app.Activity; @@ -18,7 +18,7 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp { } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return !hasStaticMap(waypoint); } @@ -28,7 +28,7 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp { } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { invokeStaticMaps(activity, null, waypoint, true); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java index 8185f40..db842ad 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.R; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; @@ -27,12 +27,12 @@ class InternalMap extends AbstractApp implements CacheNavigationApp, WaypointNav } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { CGeoMap.startActivityCoords(activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName()); } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return waypoint.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 a20f2ce..b326105 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.apps.AbstractLocusApp; import android.app.Activity; @@ -11,7 +11,7 @@ import java.util.Collections; class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointNavigationApp { @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return waypoint.getCoords() != null; } @@ -21,7 +21,7 @@ class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointN * */ @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { showInLocus(Collections.singletonList(waypoint), 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 2f8ce16..8effc05 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -2,8 +2,8 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; import cgeo.geocaching.Settings; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; 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, cgWaypoint, Geopoint, boolean, boolean)} with + * Delegates to {@link #showNavigationMenu(Activity, cgCache, 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 cgWaypoint waypoint, final Geopoint destination) { + final cgCache 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, cgWaypoint, Geopoint) + * @see #showNavigationMenu(Activity, cgCache, cgeo.geocaching.Waypoint, Geopoint) */ public static void showNavigationMenu(final Activity activity, - final cgCache cache, final cgWaypoint waypoint, final Geopoint destination, + final cgCache 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); @@ -219,7 +219,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * Use {@link #onMenuItemSelected(MenuItem, Activity, cgCache)} on * selection event to start the selected navigation tool. * - * <b>Only use this way if {@link #showNavigationMenu(Activity, cgCache, cgWaypoint, Geopoint, boolean, boolean)} is + * <b>Only use this way if {@link #showNavigationMenu(Activity, cgCache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} is * not suitable for the given usecase.</b> * * @param menu @@ -235,7 +235,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { } } - public static void addMenuItems(final Menu menu, final cgWaypoint waypoint) { + public static void addMenuItems(final Menu menu, final Waypoint waypoint) { for (NavigationAppsEnum navApp : getInstalledNavigationApps()) { if (navApp.app instanceof WaypointNavigationApp) { WaypointNavigationApp waypointApp = (WaypointNavigationApp) navApp.app; @@ -267,13 +267,13 @@ public final class NavigationAppFactory extends AbstractAppFactory { } } - public static boolean onMenuItemSelected(final MenuItem item, Activity activity, cgWaypoint waypoint) { + public static boolean onMenuItemSelected(final MenuItem item, Activity activity, Waypoint waypoint) { final App menuItem = getAppFromMenuItem(item); navigateWaypoint(activity, waypoint, menuItem); return menuItem != null; } - private static void navigateWaypoint(Activity activity, cgWaypoint waypoint, App app) { + private static void navigateWaypoint(Activity activity, Waypoint waypoint, App app) { if (app instanceof WaypointNavigationApp) { WaypointNavigationApp waypointApp = (WaypointNavigationApp) app; waypointApp.navigate(activity, waypoint); @@ -327,7 +327,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param activity * @param waypoint */ - public static void startDefaultNavigationApplication(int defaultNavigation, Activity activity, cgWaypoint waypoint) { + public static void startDefaultNavigationApplication(int defaultNavigation, Activity activity, Waypoint waypoint) { if (waypoint == null || waypoint.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 a481813..c94c4f4 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.apps.AbstractApp; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter.Format; @@ -21,7 +21,7 @@ class RMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNaviga } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { navigate(activity, waypoint.getCoords(), waypoint.getLookup(), waypoint.getName()); } @@ -34,7 +34,7 @@ class RMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNaviga } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return waypoint.getCoords() != null; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java index eb01f23..4c3b87e 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; import android.app.Activity; @@ -18,7 +18,7 @@ class StaticMapApp extends AbstractStaticMapsApp { } @Override - public boolean isEnabled(cgWaypoint waypoint) { + public boolean isEnabled(Waypoint waypoint) { return hasStaticMap(waypoint); } @@ -28,7 +28,7 @@ class StaticMapApp extends AbstractStaticMapsApp { } @Override - public void navigate(Activity activity, cgWaypoint waypoint) { + public void navigate(Activity activity, Waypoint waypoint) { invokeStaticMaps(activity, null, waypoint, false); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java index 7d3a706..c26ec3e 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java @@ -1,6 +1,6 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import android.app.Activity; @@ -9,7 +9,7 @@ import android.app.Activity; * */ public interface WaypointNavigationApp { - void navigate(final Activity activity, final cgWaypoint waypoint); + void navigate(final Activity activity, final Waypoint waypoint); - boolean isEnabled(final cgWaypoint waypoint); + boolean isEnabled(final Waypoint waypoint); } diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 919ad06..de35008 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -101,9 +101,9 @@ public class cgCache implements ICache, IWaypoint { return cgData.loadAttributes(geocode); } }; - private LazyInitializedList<cgWaypoint> waypoints = new LazyInitializedList<cgWaypoint>() { + private LazyInitializedList<Waypoint> waypoints = new LazyInitializedList<Waypoint>() { @Override - protected List<cgWaypoint> loadFromDatabase() { + protected List<Waypoint> loadFromDatabase() { return cgData.loadWaypoints(geocode); } }; @@ -146,7 +146,7 @@ public class cgCache implements ICache, IWaypoint { public cgCache(GPXParser gpxParser) { setReliableLatLon(true); setAttributes(Collections.<String> emptyList()); - setWaypoints(Collections.<cgWaypoint> emptyList(), false); + setWaypoints(Collections.<Waypoint> emptyList(), false); setLogs(Collections.<LogEntry> emptyList()); } @@ -295,8 +295,8 @@ public class cgCache implements ICache, IWaypoint { this.setWaypoints(other.waypoints.asList(), false); } else { - ArrayList<cgWaypoint> newPoints = new ArrayList<cgWaypoint>(waypoints.asList()); - cgWaypoint.mergeWayPoints(newPoints, other.waypoints.asList(), false); + ArrayList<Waypoint> newPoints = new ArrayList<Waypoint>(waypoints.asList()); + Waypoint.mergeWayPoints(newPoints, other.waypoints.asList(), false); this.setWaypoints(newPoints, false); } if (spoilers == null) { @@ -320,7 +320,7 @@ public class cgCache implements ICache, IWaypoint { // if cache has ORIGINAL type waypoint ... it is considered that it has modified coordinates, otherwise not userModifiedCoords = false; if (waypoints != null) { - for (cgWaypoint wpt : waypoints) { + for (Waypoint wpt : waypoints) { if (wpt.getWaypointType() == WaypointType.ORIGINAL) { userModifiedCoords = true; break; @@ -934,7 +934,7 @@ public class cgCache implements ICache, IWaypoint { * * @return always non <code>null</code> */ - public List<cgWaypoint> getWaypoints() { + public List<Waypoint> getWaypoints() { return waypoints.asList(); } @@ -946,11 +946,11 @@ public class cgCache implements ICache, IWaypoint { * called while loading or building a cache * @return <code>true</code> if waypoints successfully added to waypoint database */ - public boolean setWaypoints(List<cgWaypoint> waypoints, boolean saveToDatabase) { + public boolean setWaypoints(List<Waypoint> waypoints, boolean saveToDatabase) { this.waypoints.set(waypoints); finalDefined = false; if (waypoints != null) { - for (cgWaypoint waypoint : waypoints) { + for (Waypoint waypoint : waypoints) { waypoint.setGeocode(geocode); if (waypoint.isFinalWithCoords()) { finalDefined = true; @@ -1147,7 +1147,7 @@ public class cgCache implements ICache, IWaypoint { * called while loading or building a cache * @return <code>true</code> if waypoint successfully added to waypoint database */ - public boolean addOrChangeWaypoint(final cgWaypoint waypoint, boolean saveToDatabase) { + public boolean addOrChangeWaypoint(final Waypoint waypoint, boolean saveToDatabase) { waypoint.setGeocode(geocode); if (waypoint.getId() <= 0) { // this is a new waypoint @@ -1185,7 +1185,7 @@ public class cgCache implements ICache, IWaypoint { */ private void resetFinalDefined() { finalDefined = false; - for (cgWaypoint wp : waypoints) { + for (Waypoint wp : waypoints) { if (wp.isFinalWithCoords()) { finalDefined = true; break; @@ -1208,12 +1208,12 @@ public class cgCache implements ICache, IWaypoint { * the waypoint to duplicate * @return <code>true</code> if the waypoint was duplicated, <code>false</code> otherwise (invalid index) */ - public boolean duplicateWaypoint(final cgWaypoint original) { + public boolean duplicateWaypoint(final Waypoint original) { if (original == null) { return false; } final int index = getWaypointIndex(original); - final cgWaypoint copy = new cgWaypoint(original); + final Waypoint copy = new Waypoint(original); copy.setUserDefined(); copy.setName(cgeoapplication.getInstance().getString(R.string.waypoint_copy_of) + " " + copy.getName()); waypoints.add(index + 1, copy); @@ -1227,7 +1227,7 @@ public class cgCache implements ICache, IWaypoint { * to be removed from cache * @return <code>true</code>, if the waypoint was deleted */ - public boolean deleteWaypoint(final cgWaypoint waypoint) { + public boolean deleteWaypoint(final Waypoint waypoint) { if (waypoint == null) { return false; } @@ -1254,7 +1254,7 @@ public class cgCache implements ICache, IWaypoint { * @param waypoint */ - public void deleteWaypointForce(cgWaypoint waypoint) { + public void deleteWaypointForce(Waypoint waypoint) { final int index = getWaypointIndex(waypoint); waypoints.remove(index); cgData.deleteWaypoint(waypoint.getId()); @@ -1269,7 +1269,7 @@ public class cgCache implements ICache, IWaypoint { * to find index for * @return index in <code>waypoints</code> if found, -1 otherwise */ - private int getWaypointIndex(final cgWaypoint waypoint) { + private int getWaypointIndex(final Waypoint waypoint) { final int id = waypoint.getId(); for (int index = 0; index < waypoints.size(); index++) { if (waypoints.get(index).getId() == id) { @@ -1286,7 +1286,7 @@ public class cgCache implements ICache, IWaypoint { * the index of the waypoint * @return waypoint or <code>null</code> if index is out of range */ - public cgWaypoint getWaypoint(final int index) { + public Waypoint getWaypoint(final int index) { return index >= 0 && index < waypoints.size() ? waypoints.get(index) : null; } @@ -1297,8 +1297,8 @@ public class cgCache implements ICache, IWaypoint { * the id of the waypoint to look for * @return waypoint or <code>null</code> */ - public cgWaypoint getWaypointById(final int id) { - for (final cgWaypoint waypoint : waypoints) { + public Waypoint getWaypointById(final int id) { + for (final Waypoint waypoint : waypoints) { if (waypoint.getId() == id) { return waypoint; } @@ -1321,7 +1321,7 @@ public class cgCache implements ICache, IWaypoint { // coords must have non zero latitude and longitude and at least one part shall have fractional degrees if (point.getLatitudeE6() != 0 && point.getLongitudeE6() != 0 && ((point.getLatitudeE6() % 1000) != 0 || (point.getLongitudeE6() % 1000) != 0)) { final String name = cgeoapplication.getInstance().getString(R.string.cache_personal_note) + " " + count; - final cgWaypoint waypoint = new cgWaypoint(name, WaypointType.WAYPOINT, false); + final Waypoint waypoint = new Waypoint(name, WaypointType.WAYPOINT, false); waypoint.setCoords(point); addOrChangeWaypoint(waypoint, false); count++; diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 23fdef9..1042959 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1112,11 +1112,11 @@ public class cgData { String geocode = cache.getGeocode(); database.delete(dbTableWaypoints, "geocode = ? and type <> ? and own = 0", new String[]{geocode, "own"}); - List<cgWaypoint> waypoints = cache.getWaypoints(); + List<Waypoint> waypoints = cache.getWaypoints(); if (CollectionUtils.isNotEmpty(waypoints)) { ContentValues values = new ContentValues(); long timeStamp = System.currentTimeMillis(); - for (cgWaypoint oneWaypoint : waypoints) { + for (Waypoint oneWaypoint : waypoints) { if (oneWaypoint.isUserDefined()) { continue; } @@ -1171,7 +1171,7 @@ public class cgData { return new Geopoint(cursor.getDouble(indexLat), cursor.getDouble(indexLon)); } - private static boolean saveWaypointInternal(int id, String geocode, cgWaypoint waypoint) { + private static boolean saveWaypointInternal(int id, String geocode, Waypoint waypoint) { if ((StringUtils.isBlank(geocode) && id <= 0) || waypoint == null) { return false; } @@ -1473,7 +1473,7 @@ public class cgData { } if (loadFlags.contains(LoadFlag.LOAD_WAYPOINTS)) { - final List<cgWaypoint> waypoints = loadWaypoints(cache.getGeocode()); + final List<Waypoint> waypoints = loadWaypoints(cache.getGeocode()); if (CollectionUtils.isNotEmpty(waypoints)) { cache.setWaypoints(waypoints, false); } @@ -1683,7 +1683,7 @@ public class cgData { return attributes; } - public static cgWaypoint loadWaypoint(int id) { + public static Waypoint loadWaypoint(int id) { if (id == 0) { return null; } @@ -1702,21 +1702,21 @@ public class cgData { Log.d("cgData.loadWaypoint(" + id + ")"); - final cgWaypoint waypoint = cursor.moveToFirst() ? createWaypointFromDatabaseContent(cursor) : null; + final Waypoint waypoint = cursor.moveToFirst() ? createWaypointFromDatabaseContent(cursor) : null; cursor.close(); return waypoint; } - public static List<cgWaypoint> loadWaypoints(final String geocode) { + public static List<Waypoint> loadWaypoints(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; } init(); - final List<cgWaypoint> waypoints = new ArrayList<cgWaypoint>(); + final List<Waypoint> waypoints = new ArrayList<Waypoint>(); final Cursor cursor = database.query( dbTableWaypoints, @@ -1737,11 +1737,11 @@ public class cgData { return waypoints; } - private static cgWaypoint createWaypointFromDatabaseContent(final Cursor cursor) { + private static Waypoint createWaypointFromDatabaseContent(final Cursor cursor) { final String name = cursor.getString(cursor.getColumnIndex("name")); final WaypointType type = WaypointType.findById(cursor.getString(cursor.getColumnIndex("type"))); final boolean own = cursor.getInt(cursor.getColumnIndex("own")) != 0; - final cgWaypoint waypoint = new cgWaypoint(name, type, own); + final Waypoint waypoint = new Waypoint(name, type, own); waypoint.setId(cursor.getInt(cursor.getColumnIndex("_id"))); waypoint.setGeocode(cursor.getString(cursor.getColumnIndex("geocode"))); @@ -2729,7 +2729,7 @@ public class cgData { * @return */ - public static Set<cgWaypoint> loadWaypoints(final Viewport viewport, boolean excludeMine, boolean excludeDisabled, CacheType type) { + public static Set<Waypoint> loadWaypoints(final Viewport viewport, boolean excludeMine, boolean excludeDisabled, CacheType type) { final StringBuilder where = new StringBuilder(buildCoordinateWhere(dbTableWaypoints, viewport)); if (excludeMine) { where.append(" and ").append(dbTableCaches).append(".own == 0 and ").append(dbTableCaches).append(".found == 0"); @@ -2748,7 +2748,7 @@ public class cgData { } query.append(" FROM ").append(dbTableWaypoints).append(", ").append(dbTableCaches).append(" WHERE ").append(dbTableWaypoints).append(".geocode == ").append(dbTableCaches).append(".geocode and ").append(where); - final Set<cgWaypoint> waypoints = new HashSet<cgWaypoint>(); + final Set<Waypoint> waypoints = new HashSet<Waypoint>(); final Cursor cursor = database.rawQuery(query.toString(), null); while (cursor.moveToNext()) { waypoints.add(createWaypointFromDatabaseContent(cursor)); @@ -2925,7 +2925,7 @@ public class cgData { return new SearchResult(geocodes, cgData.getAllHistoryCachesCount()); } - public static boolean saveWaypoint(int id, String geocode, cgWaypoint waypoint) { + public static boolean saveWaypoint(int id, String geocode, Waypoint waypoint) { if (cgData.saveWaypointInternal(id, geocode, waypoint)) { cgData.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE)); return true; diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index c42008b..323d65c 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -5,11 +5,11 @@ import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; import cgeo.geocaching.TrackableLog; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgImage; import cgeo.geocaching.cgTrackable; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -611,14 +611,14 @@ public abstract class GCParser { } // waypoints - reset collection - cache.setWaypoints(Collections.<cgWaypoint> emptyList(), false); + cache.setWaypoints(Collections.<Waypoint> emptyList(), false); // add waypoint for original coordinates in case of user-modified listing-coordinates try { final String originalCoords = BaseUtils.getMatch(page, GCConstants.PATTERN_LATLON_ORIG, false, null); if (null != originalCoords) { - final cgWaypoint waypoint = new cgWaypoint(cgeoapplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false); + final Waypoint waypoint = new Waypoint(cgeoapplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false); waypoint.setCoords(new Geopoint(originalCoords)); cache.addOrChangeWaypoint(waypoint, false); cache.setUserModifiedCoords(true); @@ -662,7 +662,7 @@ public abstract class GCParser { // waypoint type final String resulttype = BaseUtils.getMatch(wp[3], GCConstants.PATTERN_WPTYPE, null); - final cgWaypoint waypoint = new cgWaypoint(name, WaypointType.findById(resulttype), false); + final Waypoint waypoint = new Waypoint(name, WaypointType.findById(resulttype), false); // waypoint prefix waypoint.setPrefix(BaseUtils.getMatch(wp[4], GCConstants.PATTERN_WPPREFIXORLOOKUPORLATLON, true, 2, waypoint.getPrefix(), false)); diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java index 3aec114..9f6642f 100644 --- a/main/src/cgeo/geocaching/export/GpxExport.java +++ b/main/src/cgeo/geocaching/export/GpxExport.java @@ -3,9 +3,9 @@ package cgeo.geocaching.export; 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.cgWaypoint; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.activity.Progress; import cgeo.geocaching.enumerations.CacheAttribute; @@ -282,10 +282,10 @@ class GpxExport extends AbstractExport { } private void writeWaypoints(final cgCache cache) throws IOException { - List<cgWaypoint> waypoints = cache.getWaypoints(); - List<cgWaypoint> ownWaypoints = new ArrayList<cgWaypoint>(waypoints.size()); - List<cgWaypoint> originWaypoints = new ArrayList<cgWaypoint>(waypoints.size()); - for (cgWaypoint wp : cache.getWaypoints()) { + List<Waypoint> waypoints = cache.getWaypoints(); + List<Waypoint> ownWaypoints = new ArrayList<Waypoint>(waypoints.size()); + List<Waypoint> originWaypoints = new ArrayList<Waypoint>(waypoints.size()); + for (Waypoint wp : cache.getWaypoints()) { if (wp.isUserDefined()) { ownWaypoints.add(wp); } else { @@ -293,7 +293,7 @@ class GpxExport extends AbstractExport { } } int maxPrefix = 0; - for (cgWaypoint wp : originWaypoints) { + for (Waypoint wp : originWaypoints) { String prefix = wp.getPrefix(); try { maxPrefix = Math.max(Integer.parseInt(prefix), maxPrefix); @@ -302,7 +302,7 @@ class GpxExport extends AbstractExport { } writeCacheWaypoint(wp, prefix); } - for (cgWaypoint wp : ownWaypoints) { + for (Waypoint wp : ownWaypoints) { maxPrefix++; String prefix = StringUtils.leftPad(String.valueOf(maxPrefix), 2, '0'); writeCacheWaypoint(wp, prefix); @@ -318,7 +318,7 @@ class GpxExport extends AbstractExport { * @param prefix * @throws IOException */ - private void writeCacheWaypoint(final cgWaypoint wp, final String prefix) throws IOException { + private void writeCacheWaypoint(final Waypoint wp, final String prefix) throws IOException { gpx.write("<wpt lat=\""); final Geopoint coords = wp.getCoords(); gpx.write(coords != null ? Double.toString(coords.getLatitude()) : ""); // TODO: check whether is the best way to handle unknown waypoint coordinates diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index e2d7205..809eb80 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -3,10 +3,10 @@ package cgeo.geocaching.files; 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.cgTrackable; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.enumerations.CacheSize; @@ -331,7 +331,7 @@ public abstract class GPXParser extends FileParser { // lookup cache for waypoint in already parsed caches final cgCache cacheForWaypoint = cgData.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB); if (cacheForWaypoint != null) { - final cgWaypoint waypoint = new cgWaypoint(cache.getShortdesc(), convertWaypointSym2Type(sym), false); + final Waypoint waypoint = new Waypoint(cache.getShortdesc(), convertWaypointSym2Type(sym), false); waypoint.setId(-1); waypoint.setGeocode(cacheGeocodeForWaypoint); waypoint.setPrefix(cache.getName().substring(0, 2)); @@ -340,12 +340,12 @@ public abstract class GPXParser extends FileParser { waypoint.setCoords(cache.getCoords()); waypoint.setNote(cache.getDescription()); - final ArrayList<cgWaypoint> mergedWayPoints = new ArrayList<cgWaypoint>(); + final ArrayList<Waypoint> mergedWayPoints = new ArrayList<Waypoint>(); mergedWayPoints.addAll(cacheForWaypoint.getWaypoints()); - final ArrayList<cgWaypoint> newPoints = new ArrayList<cgWaypoint>(); + final ArrayList<Waypoint> newPoints = new ArrayList<Waypoint>(); newPoints.add(waypoint); - cgWaypoint.mergeWayPoints(newPoints, mergedWayPoints, true); + Waypoint.mergeWayPoints(newPoints, mergedWayPoints, true); cacheForWaypoint.setWaypoints(newPoints, false); cgData.saveCache(cacheForWaypoint, EnumSet.of(SaveFlag.SAVE_DB)); showProgressMessage(progressHandler, progressStream.getProgress()); diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 356f763..a470672 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -8,9 +8,9 @@ import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; import cgeo.geocaching.StoredList; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; -import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.cgeocaches; import cgeo.geocaching.activity.ActivityMixin; @@ -180,7 +180,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto /** List of caches in the viewport */ private LeastRecentlyUsedSet<cgCache> caches = null; /** List of waypoints in the viewport */ - private final LeastRecentlyUsedSet<cgWaypoint> waypoints = new LeastRecentlyUsedSet<cgWaypoint>(MAX_CACHES); + private final LeastRecentlyUsedSet<Waypoint> waypoints = new LeastRecentlyUsedSet<Waypoint>(MAX_CACHES); // storing for offline private ProgressDialog waitDialog = null; private int detailTotal = 0; @@ -1156,7 +1156,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (isLiveEnabled || mapMode == MapMode.COORDS) { //All visible waypoints CacheType type = Settings.getCacheType(); - Set<cgWaypoint> waypointsInViewport = cgData.loadWaypoints(viewport, Settings.isExcludeMyCaches(), Settings.isExcludeDisabledCaches(), type); + Set<Waypoint> waypointsInViewport = cgData.loadWaypoints(viewport, Settings.isExcludeMyCaches(), Settings.isExcludeDisabledCaches(), type); waypoints.addAll(waypointsInViewport); } else @@ -1261,14 +1261,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto // display caches final List<cgCache> cachesToDisplay = caches.getAsList(); - final List<cgWaypoint> waypointsToDisplay = new ArrayList<cgWaypoint>(waypoints); + final List<Waypoint> waypointsToDisplay = new ArrayList<Waypoint>(waypoints); final List<CachesOverlayItemImpl> itemsToDisplay = new ArrayList<CachesOverlayItemImpl>(); if (!cachesToDisplay.isEmpty()) { // Only show waypoints for single view or setting // when less than showWaypointsthreshold Caches shown if (mapMode == MapMode.SINGLE || (cachesCnt < Settings.getWayPointsThreshold())) { - for (cgWaypoint waypoint : waypointsToDisplay) { + for (Waypoint waypoint : waypointsToDisplay) { if (waypoint == null || waypoint.getCoords() == null) { continue; @@ -1316,7 +1316,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } if (coordsIntent != null) { - final cgWaypoint waypoint = new cgWaypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false); + final Waypoint waypoint = new Waypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false); waypoint.setCoords(coordsIntent); final CachesOverlayItemImpl item = getItem(waypoint, null, waypoint); @@ -1626,7 +1626,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto * Waypoint. Mutally exclusive with cache * @return */ - private CachesOverlayItemImpl getItem(final IWaypoint coord, final cgCache cache, final cgWaypoint waypoint) { + private CachesOverlayItemImpl getItem(final IWaypoint coord, final cgCache cache, final Waypoint waypoint) { if (cache != null) { final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(coord, cache.getType()); diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java index 60fb3e6..4d23952 100644 --- a/main/src/cgeo/geocaching/ui/Formatter.java +++ b/main/src/cgeo/geocaching/ui/Formatter.java @@ -2,7 +2,7 @@ package cgeo.geocaching.ui; import cgeo.geocaching.R; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgWaypoint; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheListType; import cgeo.geocaching.enumerations.CacheSize; @@ -152,13 +152,13 @@ public abstract class Formatter { return StringUtils.join(infos, Formatter.SEPARATOR); } - public static String formatWaypointInfo(cgWaypoint waypoint) { + public static String formatWaypointInfo(Waypoint waypoint) { final List<String> infos = new ArrayList<String>(3); WaypointType waypointType = waypoint.getWaypointType(); if (waypointType != WaypointType.OWN && waypointType != null) { infos.add(waypointType.getL10n()); } - if (cgWaypoint.PREFIX_OWN.equalsIgnoreCase(waypoint.getPrefix())) { + if (Waypoint.PREFIX_OWN.equalsIgnoreCase(waypoint.getPrefix())) { infos.add(cgeoapplication.getInstance().getString(R.string.waypoint_custom)); } else { if (StringUtils.isNotBlank(waypoint.getPrefix())) { |
