diff options
| -rw-r--r-- | main/res/layout/waypoint_item.xml | 56 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 17 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCBase.java | 2 |
4 files changed, 59 insertions, 26 deletions
diff --git a/main/res/layout/waypoint_item.xml b/main/res/layout/waypoint_item.xml index d8ee2b4..2c16f6e 100644 --- a/main/res/layout/waypoint_item.xml +++ b/main/res/layout/waypoint_item.xml @@ -5,27 +5,43 @@ android:orientation="vertical" android:paddingTop="9dp" > - <TextView - android:id="@+id/name" + <RelativeLayout android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:textColor="?text_color" - android:textSize="18dp" /> - - <TextView - android:id="@+id/info" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_gravity="left" - android:layout_marginLeft="12dp" - android:ellipsize="marquee" - android:lines="1" - android:scrollHorizontally="true" - android:singleLine="true" - android:textColor="?text_color_headline" - android:textSize="14dp" - android:visibility="gone" /> - + android:layout_height="fill_parent" + android:orientation="horizontal"> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:orientation="vertical"> + <TextView + android:id="@+id/name" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:textColor="?text_color" + android:textSize="18dp" /> + <TextView + android:id="@+id/info" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="left" + android:layout_marginLeft="12dp" + android:ellipsize="marquee" + android:lines="1" + android:scrollHorizontally="true" + android:singleLine="true" + android:textColor="?text_color_headline" + android:textSize="14dp" + android:visibility="gone" /> + </LinearLayout> + <ImageView style="@style/action_bar_action" + android:id="@+id/wpDefaultNavigation" + android:src="@drawable/actionbar_compass" + android:layout_gravity="right" + android:layout_alignParentRight="true" + android:clickable="true" + android:longClickable="true" /> + </RelativeLayout> <TextView android:id="@+id/coordinates" android:layout_width="fill_parent" diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index d29ed9b..4649477 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -2386,7 +2386,7 @@ public class CacheDetailActivity extends AbstractActivity { List<cgWaypoint> sortedWaypoints = new ArrayList<cgWaypoint>(cache.getWaypoints()); Collections.sort(sortedWaypoints); - for (cgWaypoint wpt : sortedWaypoints) { + for (final cgWaypoint wpt : sortedWaypoints) { waypointView = (LinearLayout) getLayoutInflater().inflate(R.layout.waypoint_item, null); // coordinates @@ -2440,6 +2440,21 @@ public class CacheDetailActivity extends AbstractActivity { } } + View wpNavView = waypointView.findViewById(R.id.wpDefaultNavigation); + wpNavView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + NavigationAppFactory.startDefaultNavigationApplication(geolocation, CacheDetailActivity.this, null, wpt, null); + } + }); + wpNavView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + NavigationAppFactory.startDefaultNavigationApplication2(geolocation, CacheDetailActivity.this, null, wpt, null); + return true; + } + }); + registerForContextMenu(waypointView); waypointView.setOnClickListener(new WaypointInfoClickListener()); diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 91c61c0..0023499 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -293,9 +293,6 @@ public class cgBase { } } - // location is reliable because the search return correct coordinates independent of the login status - cache.setReliableLatLon(true); - searchResult.addCache(cache); } @@ -357,6 +354,11 @@ public class cgBase { } LocParser.parseLoc(searchResult, coordinates); + + // now we have the coords... + for (cgCache cache : searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)) { + cache.setReliableLatLon(true); + } } catch (Exception e) { Log.e(Settings.tag, "cgBase.parseSearch.CIDs: " + e.toString()); } @@ -364,7 +366,7 @@ public class cgBase { // get direction images if (Settings.getLoadDirImg()) { - final Set<cgCache> caches = cgeoapplication.getInstance().loadCaches(searchResult.getGeocodes(), LoadFlags.LOAD_CACHE_OR_DB); + final Set<cgCache> caches = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); for (cgCache cache : caches) { if (cache.getCoords() == null && StringUtils.isNotEmpty(cache.getDirectionImg())) { DirectionImage.getDrawable(cache.getGeocode(), cache.getDirectionImg()); diff --git a/main/src/cgeo/geocaching/connector/gc/GCBase.java b/main/src/cgeo/geocaching/connector/gc/GCBase.java index 650435a..993e062 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCBase.java +++ b/main/src/cgeo/geocaching/connector/gc/GCBase.java @@ -60,7 +60,7 @@ public class GCBase { Strategy strategy = Settings.getLiveMapStrategy(); if (strategy == Strategy.AUTO) { float speedNow = cgeoapplication.getInstance().getSpeedFromGeo(); - strategy = speedNow >= 8 ? Strategy.FASTEST : Strategy.DETAILED; // 8 m/s = 30 km/h + strategy = speedNow >= 8 ? Strategy.FAST : Strategy.DETAILED; // 8 m/s = 30 km/h } // return searchByViewport(viewport, tokens, strategy); |
