diff --git a/MyTracks/res/layout/mytracks_list_item.xml b/MyTracks/res/layout/mytracks_list_item.xml
index 0bb50950b..4980291db 100644
--- a/MyTracks/res/layout/mytracks_list_item.xml
+++ b/MyTracks/res/layout/mytracks_list_item.xml
@@ -15,44 +15,39 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
+ android:orientation="vertical"
+ android:paddingBottom="2dip"
+ android:paddingTop="2dip">
+ android:orientation="horizontal">
-
+
+
-
-
-
+ android:singleLine = "true"
+ android:textAppearance="?android:attr/textAppearanceSmall"/>
-
+
\ No newline at end of file
diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml
index 21cb7ae83..0f7606407 100644
--- a/MyTracks/res/values/strings.xml
+++ b/MyTracks/res/values/strings.xml
@@ -816,9 +816,7 @@ limitations under the License.
Edit
+ translation_description="In the Markers page, the accessibility description for the marker icon.">
Marker
Pick a marker. Press & hold for more options.
-
- Name
-
+ translation_description="In the 'Tracks' page, the accessibility description for the track icon.">
Track
+ %1$s: track name. E.g., 'Grand Canyon trail'">
In track \'%1$s\'.
resultMap) {
TripStatistics stats = track.getStatistics();
- resultMap.put("icon", R.drawable.track);
- resultMap.put("name", track.getName());
- resultMap.put("description", track.getDescription());
- resultMap.put("category", track.getCategory());
- resultMap.put("time", StringUtils.formatDateTime(this, stats.getStartTime()));
- resultMap.put("trackId", track.getId());
- resultMap.put("stats",
+ resultMap.put(ICON_FIELD, R.drawable.track);
+ resultMap.put(NAME_FIELD, track.getName());
+ resultMap.put(DESCRIPTION_FIELD, track.getDescription());
+ resultMap.put(CATEGORY_FIELD, track.getCategory());
+ resultMap.put(TIME_FIELD, StringUtils.formatDateTime(this, stats.getStartTime()));
+ resultMap.put(STATS_FIELD,
StringUtils.formatTimeDistance(this, stats.getTotalDistance(), stats.getTotalTime(),
metricUnits));
+ resultMap.put(TRACK_ID_FIELD, track.getId());
}
/**
@@ -214,12 +224,12 @@ public class SearchActivity extends ListActivity {
// TODO: Custom view for search results.
R.layout.mytracks_list_item,
new String[] {
- "icon",
- "name",
- "description",
- "category",
- "time",
- "stats",
+ ICON_FIELD,
+ NAME_FIELD,
+ DESCRIPTION_FIELD,
+ CATEGORY_FIELD,
+ TIME_FIELD,
+ STATS_FIELD,
},
new int[] {
R.id.track_list_item_icon,
@@ -243,12 +253,12 @@ public class SearchActivity extends ListActivity {
private Intent createViewDataIntent(Map clickedData) {
Intent intent = new Intent(Intent.ACTION_VIEW);
- if (clickedData.containsKey("waypointId")) {
- long waypointId = (Long) clickedData.get("waypointId");
+ if (clickedData.containsKey(WAYPOINT_ID_FIELD)) {
+ long waypointId = (Long) clickedData.get(WAYPOINT_ID_FIELD);
Uri uri = ContentUris.withAppendedId(WaypointsColumns.CONTENT_URI, waypointId);
intent.setDataAndType(uri, WaypointsColumns.CONTENT_ITEMTYPE);
} else {
- long trackId = (Long) clickedData.get("trackId");
+ long trackId = (Long) clickedData.get(TRACK_ID_FIELD);
Uri uri = ContentUris.withAppendedId(TracksColumns.CONTENT_URI, trackId);
intent.setDataAndType(uri, TracksColumns.CONTENT_ITEMTYPE);
}
diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java
index a78bfc1ab..6aab3f21c 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java
@@ -89,14 +89,14 @@ public class StringUtils implements DescriptionGenerator {
public static String formatTimeDistance(Context context, double totalDistance, long totalTime, boolean metric) {
String distanceUnit;
if (metric) {
- if (totalDistance > 1000.0) {
+ if (totalDistance > 2000.0) {
totalDistance /= 1000.0;
distanceUnit = context.getString(R.string.unit_kilometer);
} else {
distanceUnit = context.getString(R.string.unit_meter);
}
} else {
- if (totalDistance > UnitConversions.MI_TO_M) {
+ if (totalDistance > 2 * UnitConversions.MI_TO_M) {
totalDistance /= UnitConversions.MI_TO_M;
distanceUnit = context.getString(R.string.unit_mile);
} else {