diff --git a/MyTracks/res/layout/aggregated_stats.xml b/MyTracks/res/layout/aggregated_stats.xml
new file mode 100644
index 000000000..7c8f01024
--- /dev/null
+++ b/MyTracks/res/layout/aggregated_stats.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/list_item.xml b/MyTracks/res/layout/list_item.xml
index 33a9afd73..bd2eb1ed4 100644
--- a/MyTracks/res/layout/list_item.xml
+++ b/MyTracks/res/layout/list_item.xml
@@ -39,14 +39,14 @@ limitations under the License.
+ style="@style/ListItemStats" />
+ style="@style/ListItemStats" />
+ style="@style/ListItemStats" />
+ style="@style/ScrollView">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/sensor_state.xml b/MyTracks/res/layout/sensor_state.xml
index 6a387c299..63e499a6c 100644
--- a/MyTracks/res/layout/sensor_state.xml
+++ b/MyTracks/res/layout/sensor_state.xml
@@ -14,67 +14,53 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/stats.xml b/MyTracks/res/layout/stats.xml
index d80189ce4..ae613cb62 100644
--- a/MyTracks/res/layout/stats.xml
+++ b/MyTracks/res/layout/stats.xml
@@ -14,349 +14,44 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:padding="8dp"
+ android:shrinkColumns="0,2"
+ android:stretchColumns="0,2" >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/stats_core.xml b/MyTracks/res/layout/stats_core.xml
new file mode 100644
index 000000000..6ad0977c2
--- /dev/null
+++ b/MyTracks/res/layout/stats_core.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/track_widget.xml b/MyTracks/res/layout/track_widget.xml
index 958417227..9000dce3d 100644
--- a/MyTracks/res/layout/track_widget.xml
+++ b/MyTracks/res/layout/track_widget.xml
@@ -52,7 +52,7 @@ limitations under the License.
android:id="@+id/appwidget_distance_text" />
+ android:text="@string/stats_total_distance" />
+ android:text="@string/stats_moving_time" />
+ android:text="@string/stats_speed" />
diff --git a/MyTracks/res/values/colors.xml b/MyTracks/res/values/colors.xml
index 9f396f181..ab5240918 100644
--- a/MyTracks/res/values/colors.xml
+++ b/MyTracks/res/values/colors.xml
@@ -17,11 +17,8 @@ limitations under the License.
#FF000000
#FF0000FF
- #FF00FF00
#FFAAAAAA
#FFFF0000
- #FFF0F0F0
- #FF0F0F0F
#FFFFFFFF
diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml
index 4c79bbc58..f7b83e32e 100644
--- a/MyTracks/res/values/strings.xml
+++ b/MyTracks/res/values/strings.xml
@@ -494,7 +494,7 @@ limitations under the License.
Accuracy (m)
+ translation_description="Label for location altitude in meters.">
Altitude (m)
-
-
+
+
Average moving pace
-
+
Average moving speed
-
+
Average pace
-
+
Average speed
-
+
Elevation
-
+
Elevation gain
-
+
Fastest pace
-
+
Latitude
-
+
Longitude
-
+
Max elevation
-
+
Max grade
-
+
Max speed
-
+
Min elevation
-
+
Min grade
-
+
Moving time
-
+
Pace
-
+
Speed
-
+
Total distance
-
+
Total time
@@ -2417,7 +2417,14 @@ limitations under the License.
recommended value.">
Smallest (recommended)
-
+
+ %1$s \u00B0
+
+
-
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
-
-
+
-
+
\ No newline at end of file
diff --git a/MyTracks/src/com/google/android/apps/mytracks/AggregatedStatsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/AggregatedStatsActivity.java
index 8f329b967..895e7c3c0 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/AggregatedStatsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/AggregatedStatsActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
@@ -5,88 +21,41 @@ import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.apps.mytracks.util.IntentUtils;
+import com.google.android.apps.mytracks.util.StatsUtils;
import com.google.android.maps.mytracks.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
-import android.util.DisplayMetrics;
-import android.util.Log;
+import android.speech.tts.TextToSpeech;
import android.view.MenuItem;
-import android.widget.ScrollView;
-import android.widget.TextView;
import java.util.List;
/**
- * Activity for viewing the combined statistics for all the recorded tracks.
- *
- * Other features to add - menu items to change setings.
+ * An activity to view aggregated stats from all recorded tracks.
*
* @author Fergus Nelson
*/
-public class AggregatedStatsActivity extends Activity implements
- OnSharedPreferenceChangeListener {
-
- private final StatsUtilities utils;
-
- private MyTracksProviderUtils tracksProvider;
-
- private boolean metricUnits = true;
-
- public AggregatedStatsActivity() {
- this.utils = new StatsUtilities(this);
- }
-
- @Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
- String key) {
- Log.d(Constants.TAG, "StatsActivity: onSharedPreferences changed "
- + key);
- if (key != null) {
- if (key.equals(getString(R.string.metric_units_key))) {
- metricUnits = sharedPreferences.getBoolean(
- getString(R.string.metric_units_key), true);
- utils.setMetricUnits(metricUnits);
- utils.updateUnits();
- loadAggregatedStats();
- }
- }
- }
+public class AggregatedStatsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- this.tracksProvider = MyTracksProviderUtils.Factory.get(this);
-
+ setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
-
- setContentView(R.layout.stats);
-
- ScrollView sv = ((ScrollView) findViewById(R.id.scrolly));
- sv.setScrollBarStyle(ScrollView.SCROLLBARS_OUTSIDE_INSET);
+ setContentView(R.layout.aggregated_stats);
SharedPreferences preferences = getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
- if (preferences != null) {
- metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
- preferences.registerOnSharedPreferenceChangeListener(this);
- }
- utils.setMetricUnits(metricUnits);
- utils.updateUnits();
- utils.setSpeedLabel(R.id.speed_label, R.string.stat_speed, R.string.stat_pace);
- utils.setSpeedLabels();
+ boolean metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
+ boolean reportSpeed = preferences.getBoolean(getString(R.string.report_speed_key), true);
- DisplayMetrics metrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(metrics);
- if (metrics.heightPixels > 600) {
- ((TextView) findViewById(R.id.speed_register)).setTextSize(80.0f);
- }
- loadAggregatedStats();
+ StatsUtils.setSpeedLabels(this, reportSpeed, false);
+ StatsUtils.setTripStatisticsValues(this, getTripStatistics(), metricUnits, reportSpeed);
+ StatsUtils.setLocationElevationValue(this, Double.NaN, metricUnits);
}
@Override
@@ -100,30 +69,18 @@ public class AggregatedStatsActivity extends Activity implements
}
/**
- * 1. Reads tracks from the db
- * 2. Merges the trip stats from the tracks
- * 3. Updates the view
+ * Gets the aggregated trip statistics for all the recorded tracks or null if
+ * there is no track.
*/
- private void loadAggregatedStats() {
- List