diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/AbstractDialogFragment.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 4 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/CacheListActivity.java | 16 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/Intents.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/NavigateAnyPointActivity.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/SearchActivity.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 10 |
7 files changed, 26 insertions, 12 deletions
diff --git a/main/src/cgeo/geocaching/AbstractDialogFragment.java b/main/src/cgeo/geocaching/AbstractDialogFragment.java index d81dde5..6e58bd3 100644 --- a/main/src/cgeo/geocaching/AbstractDialogFragment.java +++ b/main/src/cgeo/geocaching/AbstractDialogFragment.java @@ -340,7 +340,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C showToast(res.getString(R.string.err_location_unknown)); return; } - CacheListActivity.startActivityCoordinates((AbstractActivity) getActivity(), coords); + CacheListActivity.startActivityCoordinates((AbstractActivity) getActivity(), coords, cache != null ? cache.getName() : null); getActivity().finish(); } diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index ffc60f2..cccd0f5 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -449,7 +449,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc return true; case R.id.menu_waypoint_caches_around: if (selectedWaypoint != null) { - CacheListActivity.startActivityCoordinates(this, selectedWaypoint.getCoords()); + CacheListActivity.startActivityCoordinates(this, selectedWaypoint.getCoords(), selectedWaypoint.getName()); } return true; case R.id.menu_waypoint_reset_cache_coords: @@ -2205,7 +2205,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void cachesAround() { - CacheListActivity.startActivityCoordinates(this, cache.getCoords()); + CacheListActivity.startActivityCoordinates(this, cache.getCoords(), cache.getName()); } public void setNeedsRefresh() { diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index 41e7cfb..5bcdd42 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -1469,13 +1469,23 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA context.startActivity(addressIntent); } - public static void startActivityCoordinates(final AbstractActivity context, final Geopoint coords) { + /** + * start list activity, by searching around the given point. + * + * @param name + * name of coordinates, will lead to a title like "Around ..." instead of directly showing the + * coordinates as title + */ + public static void startActivityCoordinates(final AbstractActivity context, final Geopoint coords, @Nullable final String name) { if (!isValidCoords(context, coords)) { return; } final Intent cachesIntent = new Intent(context, CacheListActivity.class); Intents.putListType(cachesIntent, CacheListType.COORDINATE); cachesIntent.putExtra(Intents.EXTRA_COORDS, coords); + if (StringUtils.isNotEmpty(name)) { + cachesIntent.putExtra(Intents.EXTRA_TITLE, context.getString(R.string.around, name)); + } context.startActivity(cachesIntent); } @@ -1606,6 +1616,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA loader = new PocketGeocacheListLoader(app, guid); break; } + // if there is a title given in the activity start request, use this one instead of the default + if (StringUtils.isNotBlank(extras.getString(Intents.EXTRA_TITLE))) { + title = extras.getString(Intents.EXTRA_TITLE); + } updateTitle(); showProgress(true); showFooterLoadingCaches(); diff --git a/main/src/cgeo/geocaching/Intents.java b/main/src/cgeo/geocaching/Intents.java index 5b57aba..cbf2346 100644 --- a/main/src/cgeo/geocaching/Intents.java +++ b/main/src/cgeo/geocaching/Intents.java @@ -35,7 +35,7 @@ public class Intents { public static final String EXTRA_WPTTYPE = PREFIX + "wpttype"; public static final String EXTRA_MAPSTATE = PREFIX + "mapstate"; - public static final String EXTRA_MAP_TITLE = PREFIX + "mapTitle"; + public static final String EXTRA_TITLE = PREFIX + "title"; public static final String EXTRA_MAP_MODE = PREFIX + "mapMode"; public static final String EXTRA_LIVE_ENABLED = PREFIX + "liveEnabled"; diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java index d92e441..b0d413d 100644 --- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java +++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java @@ -457,7 +457,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen return; } - CacheListActivity.startActivityCoordinates(this, coords); + CacheListActivity.startActivityCoordinates(this, coords, null); finish(); } diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java index 8842603..ea91857 100644 --- a/main/src/cgeo/geocaching/SearchActivity.java +++ b/main/src/cgeo/geocaching/SearchActivity.java @@ -315,7 +315,7 @@ public class SearchActivity extends AbstractActionBarActivity implements Coordin buttonLongitude.setText(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE)); } else { try { - CacheListActivity.startActivityCoordinates(this, new Geopoint(latText, lonText)); + CacheListActivity.startActivityCoordinates(this, new Geopoint(latText, lonText), null); } catch (final Geopoint.ParseException e) { showToast(res.getString(e.resource)); } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 38fe6bd..e0e0c48 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -420,7 +420,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { coordsIntent = extras.getParcelable(Intents.EXTRA_COORDS); waypointTypeIntent = WaypointType.findById(extras.getString(Intents.EXTRA_WPTTYPE)); mapStateIntent = extras.getIntArray(Intents.EXTRA_MAPSTATE); - mapTitle = extras.getString(Intents.EXTRA_MAP_TITLE); + mapTitle = extras.getString(Intents.EXTRA_TITLE); } else { mapMode = MapMode.LIVE; @@ -940,7 +940,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { mapIntent.putExtra(Intents.EXTRA_COORDS, coordsIntent); } mapIntent.putExtra(Intents.EXTRA_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null); - mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, mapTitle); + mapIntent.putExtra(Intents.EXTRA_TITLE, mapTitle); mapIntent.putExtra(Intents.EXTRA_MAP_MODE, mapMode); mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, isLiveEnabled); @@ -1658,7 +1658,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { mapIntent.putExtra(Intents.EXTRA_MAP_MODE, MapMode.LIST); mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, false); if (StringUtils.isNotBlank(title)) { - mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, title); + mapIntent.putExtra(Intents.EXTRA_TITLE, title); } fromActivity.startActivity(mapIntent); } @@ -1678,7 +1678,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { mapIntent.putExtra(Intents.EXTRA_WPTTYPE, type.id); } if (StringUtils.isNotBlank(title)) { - mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, title); + mapIntent.putExtra(Intents.EXTRA_TITLE, title); } fromActivity.startActivity(mapIntent); } @@ -1688,7 +1688,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { mapIntent.putExtra(Intents.EXTRA_MAP_MODE, MapMode.SINGLE); mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, false); mapIntent.putExtra(Intents.EXTRA_GEOCODE, geocode); - mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, geocode); + mapIntent.putExtra(Intents.EXTRA_TITLE, geocode); fromActivity.startActivity(mapIntent); } |