merge heads
@@ -19,6 +19,7 @@ limitations under the License.
|
|||||||
android:versionCode="39"
|
android:versionCode="39"
|
||||||
android:versionName="1.1.16"
|
android:versionName="1.1.16"
|
||||||
package="com.google.android.maps.mytracks" >
|
package="com.google.android.maps.mytracks" >
|
||||||
|
|
||||||
<!-- Permission to initialize services -->
|
<!-- Permission to initialize services -->
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<!-- Permissions to record locations -->
|
<!-- Permissions to record locations -->
|
||||||
@@ -78,6 +79,7 @@ limitations under the License.
|
|||||||
android:name="com.google.android.apps.mytracks.WRITE_TRACK_DATA"
|
android:name="com.google.android.apps.mytracks.WRITE_TRACK_DATA"
|
||||||
android:permissionGroup="android.permission-group.LOCATION"
|
android:permissionGroup="android.permission-group.LOCATION"
|
||||||
android:protectionLevel="dangerous" />
|
android:protectionLevel="dangerous" />
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="7"
|
android:minSdkVersion="7"
|
||||||
android:targetSdkVersion="15" />
|
android:targetSdkVersion="15" />
|
||||||
@@ -113,18 +115,21 @@ limitations under the License.
|
|||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.touchscreen.multitouch"
|
android:name="android.hardware.touchscreen.multitouch"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
android:largeScreens="true"
|
android:largeScreens="true"
|
||||||
android:normalScreens="true"
|
android:normalScreens="true"
|
||||||
android:smallScreens="true"
|
android:smallScreens="true"
|
||||||
android:xlargeScreens="true" />
|
android:xlargeScreens="true" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent"
|
android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent"
|
||||||
android:icon="@drawable/arrow_icon"
|
android:icon="@drawable/my_tracks_icon"
|
||||||
android:label="@string/my_tracks_app_name"
|
android:label="@string/my_tracks_app_name"
|
||||||
android:name="com.google.android.apps.mytracks.MyTracksApplication"
|
android:name="com.google.android.apps.mytracks.MyTracksApplication"
|
||||||
android:theme="@style/ThemeSelector" >
|
android:theme="@style/ThemeSelector" >
|
||||||
|
|
||||||
<!-- For data backup -->
|
<!-- For data backup -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.backup.api_key"
|
android:name="com.google.android.backup.api_key"
|
||||||
@@ -133,18 +138,18 @@ limitations under the License.
|
|||||||
<activity
|
<activity
|
||||||
android:label="@string/menu_aggregated_statistics"
|
android:label="@string/menu_aggregated_statistics"
|
||||||
android:name="com.google.android.apps.mytracks.AggregatedStatsActivity" />
|
android:name="com.google.android.apps.mytracks.AggregatedStatsActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.ExportActivity" />
|
|
||||||
<activity
|
<activity
|
||||||
android:label="@string/menu_help"
|
android:label="@string/menu_help"
|
||||||
android:name="com.google.android.apps.mytracks.HelpActivity" />
|
android:name="com.google.android.apps.mytracks.HelpActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:label="@string/my_tracks_importer"
|
|
||||||
android:name="com.google.android.apps.mytracks.ImportActivity" >
|
android:name="com.google.android.apps.mytracks.ImportActivity" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.ATTACH_DATA" />
|
<action android:name="android.intent.action.ATTACH_DATA" />
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
<data android:mimeType="application/gpx" />
|
<data android:mimeType="application/gpx" />
|
||||||
<data android:mimeType="application/gpx+xml" />
|
<data android:mimeType="application/gpx+xml" />
|
||||||
<data android:mimeType="application/vnd.google-earth.gpx" />
|
<data android:mimeType="application/vnd.google-earth.gpx" />
|
||||||
@@ -153,20 +158,21 @@ limitations under the License.
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.google.android.apps.mytracks.MarkerEditActivity"
|
android:name="com.google.android.apps.mytracks.MarkerEditActivity" />
|
||||||
android:windowSoftInputMode="stateHidden" />
|
|
||||||
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
<activity android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.default_searchable"
|
android:name="android.app.default_searchable"
|
||||||
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name="com.google.android.apps.mytracks.SaveAllActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:name="com.google.android.apps.mytracks.SearchListActivity" >
|
android:name="com.google.android.apps.mytracks.SearchListActivity" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.searchable"
|
android:name="android.app.searchable"
|
||||||
android:resource="@xml/search" />
|
android:resource="@xml/search" />
|
||||||
@@ -179,13 +185,14 @@ limitations under the License.
|
|||||||
android:name="com.google.android.apps.mytracks.SettingsActivity" />
|
android:name="com.google.android.apps.mytracks.SettingsActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" />
|
<activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.google.android.apps.mytracks.TrackEditActivity"
|
android:name="com.google.android.apps.mytracks.TrackEditActivity" />
|
||||||
android:windowSoftInputMode="stateHidden" />
|
|
||||||
<activity android:name="com.google.android.apps.mytracks.TrackListActivity" >
|
<activity android:name="com.google.android.apps.mytracks.TrackListActivity" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.default_searchable"
|
android:name="android.app.default_searchable"
|
||||||
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
||||||
@@ -227,6 +234,7 @@ limitations under the License.
|
|||||||
<action android:name="com.google.android.apps.mytracks.TRACK_STARTED" />
|
<action android:name="com.google.android.apps.mytracks.TRACK_STARTED" />
|
||||||
<action android:name="com.google.android.apps.mytracks.TRACK_STOPPED" />
|
<action android:name="com.google.android.apps.mytracks.TRACK_STOPPED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.appwidget.provider"
|
android:name="android.appwidget.provider"
|
||||||
android:resource="@xml/track_widget_info" />
|
android:resource="@xml/track_widget_info" />
|
||||||
@@ -244,6 +252,8 @@ limitations under the License.
|
|||||||
android:authorities="com.google.android.maps.mytracks.search"
|
android:authorities="com.google.android.maps.mytracks.search"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:name="com.google.android.apps.mytracks.content.SearchEngineProvider" />
|
android:name="com.google.android.apps.mytracks.content.SearchEngineProvider" />
|
||||||
|
|
||||||
<uses-library android:name="com.google.android.maps" />
|
<uses-library android:name="com.google.android.maps" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 812 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2010 Google Inc.
|
Copyright 2012 Google Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
style="@style/ScrollView" >
|
<item android:state_pressed="true"
|
||||||
<include layout="@layout/help_content" />
|
android:drawable="@drawable/my_location_pressed" />
|
||||||
</ScrollView>
|
<item android:drawable="@drawable/my_location_normal" />
|
||||||
|
</selector>
|
||||||
@@ -22,7 +22,7 @@ limitations under the License.
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="8dp" >
|
android:padding="8dp" >
|
||||||
<TextView
|
<TextView
|
||||||
android:drawableLeft="@drawable/arrow_icon"
|
android:drawableLeft="@drawable/my_tracks_icon"
|
||||||
android:text="@string/about_copyright_notice"
|
android:text="@string/about_copyright_notice"
|
||||||
style="@style/TextMedium.WithIcon" />
|
style="@style/TextMedium.WithIcon" />
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -19,7 +19,102 @@ limitations under the License.
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
<ScrollView style="@style/ScrollView.WithBottomButtons" >
|
<ScrollView style="@style/ScrollView.WithBottomButtons" >
|
||||||
<include layout="@layout/help_content" />
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="8dp" >
|
||||||
|
<ImageView
|
||||||
|
android:contentDescription="@string/my_tracks_app_name"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:scaleType="fitStart"
|
||||||
|
android:src="@drawable/my_tracks_icon" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_my_tracks_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_my_tracks_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_location_precision_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_location_precision_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_gps_fix_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_gps_fix_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_data_connection_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_data_connection_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_elevation_precision_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_elevation_precision_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_battery_life_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_battery_life_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_share_friends_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_share_friends_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_share_visibility_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_share_visibility_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_split_track_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_split_track_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_saved_files_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_saved_files_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_waypoint_marker_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_waypoint_marker_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_statistics_marker_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_statistics_marker_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_delete_tracks_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_delete_tracks_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_edit_tracks_question"
|
||||||
|
style="@style/HelpQuestion" />
|
||||||
|
<TextView
|
||||||
|
android:text="@string/help_edit_tracks_answer"
|
||||||
|
style="@style/HelpAnswer" />
|
||||||
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<LinearLayout style="@style/BottomButtonBar" >
|
<LinearLayout style="@style/BottomButtonBar" >
|
||||||
<include layout="@layout/help_buttons" />
|
<include layout="@layout/help_buttons" />
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp" >
|
|
||||||
<ImageView
|
|
||||||
android:contentDescription="@string/my_tracks_app_name"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:scaleType="fitStart"
|
|
||||||
android:src="@drawable/arrow_icon" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_my_tracks_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_my_tracks_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_location_precision_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_location_precision_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_gps_fix_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_gps_fix_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_data_connection_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_data_connection_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_elevation_precision_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_elevation_precision_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_battery_life_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_battery_life_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_share_friends_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_share_friends_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_share_visibility_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_share_visibility_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_split_track_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_split_track_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_saved_files_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_saved_files_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_waypoint_marker_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_waypoint_marker_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_statistics_marker_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_statistics_marker_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_delete_tracks_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_delete_tracks_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_edit_tracks_question"
|
|
||||||
style="@style/WelcomeQuestionTextView" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/help_edit_tracks_answer"
|
|
||||||
style="@style/WelcomeAnswerTextView" />
|
|
||||||
</LinearLayout>
|
|
||||||
</merge>
|
|
||||||
@@ -26,8 +26,18 @@ limitations under the License.
|
|||||||
android:id="@+id/map_view"
|
android:id="@+id/map_view"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="fill_parent" />
|
android:layout_width="fill_parent" />
|
||||||
|
<ImageButton
|
||||||
|
android:background="@drawable/my_location"
|
||||||
|
android:contentDescription="@string/my_location"
|
||||||
|
android:id="@+id/map_my_location"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_width="wrap_content" />
|
||||||
<TextView
|
<TextView
|
||||||
android:background="@color/background_warning"
|
android:background="@color/warning_background"
|
||||||
android:drawableLeft="@android:drawable/ic_dialog_alert"
|
android:drawableLeft="@android:drawable/ic_dialog_alert"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:id="@+id/map_message"
|
android:id="@+id/map_message"
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="@style/ScrollView" >
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:padding="8dp" >
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/marker_add_type"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content" >
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/marker_add_statistics"
|
||||||
|
android:text="@string/marker_statistics"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/marker_add_waypoint"
|
||||||
|
android:text="@string/marker_waypoint"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
</RadioGroup>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/marker_add_more_options"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/generic_more_options" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</ScrollView>
|
||||||
@@ -30,10 +30,10 @@ limitations under the License.
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/marker_detail_marker_type"
|
android:id="@+id/marker_detail_waypoint_marker_type"
|
||||||
style="@style/TextLarge" />
|
style="@style/TextLarge" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/marker_detail_description"
|
android:id="@+id/marker_detail_waypoint_description"
|
||||||
style="@style/TextLarge" />
|
style="@style/TextLarge" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<TableLayout
|
<TableLayout
|
||||||
|
|||||||
@@ -30,48 +30,62 @@ limitations under the License.
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/marker_edit_type"
|
android:text="@string/marker_type"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel" />
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/marker_edit_type"
|
android:id="@+id/marker_edit_type"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content" >
|
android:layout_width="wrap_content" >
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/marker_edit_type_statistics"
|
android:id="@+id/marker_edit_statistics"
|
||||||
android:text="@string/marker_edit_type_statistics"
|
android:text="@string/marker_statistics"
|
||||||
style="@style/TextMedium" />
|
style="@style/TextMedium" />
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/marker_edit_type_waypoint"
|
android:id="@+id/marker_edit_waypoint"
|
||||||
android:text="@string/marker_edit_type_waypoint"
|
android:text="@string/marker_waypoint"
|
||||||
style="@style/TextMedium" />
|
style="@style/TextMedium" />
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/generic_name"
|
android:text="@string/generic_name"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel" />
|
||||||
<EditText
|
<LinearLayout
|
||||||
android:hint="@string/generic_name"
|
android:id="@+id/marker_edit_statistics_section"
|
||||||
android:id="@+id/marker_edit_name"
|
android:layout_height="wrap_content"
|
||||||
style="@style/EditName" />
|
android:layout_width="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
<EditText
|
||||||
|
android:drawableLeft="@drawable/yellow_pushpin"
|
||||||
|
android:hint="@string/generic_name"
|
||||||
|
android:id="@+id/marker_edit_statistics_name"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
style="@style/EditName" />
|
||||||
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/marker_edit_waypoint_section"
|
android:id="@+id/marker_edit_waypoint_section"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
<EditText
|
||||||
|
android:drawableLeft="@drawable/blue_pushpin"
|
||||||
|
android:hint="@string/generic_name"
|
||||||
|
android:id="@+id/marker_edit_waypoint_name"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
style="@style/EditName" />
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/marker_edit_marker_type"
|
android:text="@string/marker_edit_waypoint_marker_type"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel.WithPaddingTop" />
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:hint="@string/marker_edit_marker_type_hint"
|
android:hint="@string/marker_edit_waypoint_marker_type_hint"
|
||||||
android:id="@+id/marker_edit_marker_type"
|
android:id="@+id/marker_edit_waypoint_marker_type"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
style="@style/EditCategory" />
|
style="@style/EditCategory" />
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/generic_description"
|
android:text="@string/generic_description"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel.WithPaddingTop" />
|
||||||
<EditText
|
<EditText
|
||||||
android:hint="@string/generic_description"
|
android:hint="@string/generic_description"
|
||||||
android:id="@+id/marker_edit_description"
|
android:id="@+id/marker_edit_waypoint_description"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
style="@style/EditDescription" />
|
style="@style/EditDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ limitations under the License.
|
|||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<include layout="@layout/stats_core" />
|
<include layout="@layout/stats_core" />
|
||||||
<!-- Latitude and longitude -->
|
<TableRow android:id="@+id/stats_coordinate_label_table_row" >
|
||||||
<TableRow>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_latitude"
|
android:text="@string/stats_latitude"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
@@ -44,7 +43,7 @@ limitations under the License.
|
|||||||
android:text="@string/stats_longitude"
|
android:text="@string/stats_longitude"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_coordinate_value_table_row" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_latitude_value"
|
android:id="@+id/stats_latitude_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
|
|||||||
@@ -15,11 +15,33 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<!-- Total distance and max speed (fastest pace) -->
|
<!-- Total distance -->
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_total_distance"
|
android:text="@string/stats_total_distance"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/stats_total_distance_value"
|
||||||
|
style="@style/StatsValue" />
|
||||||
|
</TableRow>
|
||||||
|
<!-- Total time/moving time -->
|
||||||
|
<TableRow>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/stats_total_time_label"
|
||||||
|
style="@style/StatsLabel" />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/stats_total_time_value"
|
||||||
|
style="@style/StatsValue" />
|
||||||
|
</TableRow>
|
||||||
|
<!-- Average speed/average moving speed and max speed (average pace/average moving pace and fastest pace) -->
|
||||||
|
<TableRow>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/stats_average_speed_label"
|
||||||
|
style="@style/StatsLabel" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_max_speed_label"
|
android:id="@+id/stats_max_speed_label"
|
||||||
android:layout_column="2"
|
android:layout_column="2"
|
||||||
@@ -27,53 +49,15 @@ limitations under the License.
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_total_distance_value"
|
android:id="@+id/stats_average_speed_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
<TextView style="@style/StatsSpacer" />
|
<TextView style="@style/StatsSpacer" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_max_speed_value"
|
android:id="@+id/stats_max_speed_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<!-- Total time and average speed (average pace) -->
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
|
||||||
android:text="@string/stats_total_time"
|
|
||||||
style="@style/StatsLabel" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_average_speed_label"
|
|
||||||
android:layout_column="2"
|
|
||||||
style="@style/StatsLabel" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_total_time_value"
|
|
||||||
style="@style/StatsValue" />
|
|
||||||
<TextView style="@style/StatsSpacer" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_average_speed_value"
|
|
||||||
style="@style/StatsValue" />
|
|
||||||
</TableRow>
|
|
||||||
<!-- Moving time and average moving speed (average moving pace) -->
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
|
||||||
android:text="@string/stats_moving_time"
|
|
||||||
style="@style/StatsLabel" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_average_moving_speed_label"
|
|
||||||
android:layout_column="2"
|
|
||||||
style="@style/StatsLabel" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_moving_time_value"
|
|
||||||
style="@style/StatsValue" />
|
|
||||||
<TextView style="@style/StatsSpacer" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/stats_average_moving_speed_value"
|
|
||||||
style="@style/StatsValue" />
|
|
||||||
</TableRow>
|
|
||||||
<!-- Elevation and elevation gain -->
|
<!-- Elevation and elevation gain -->
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_elevation_label_table_row1" >
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_elevation"
|
android:text="@string/stats_elevation"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
@@ -82,7 +66,7 @@ limitations under the License.
|
|||||||
android:text="@string/stats_elevation_gain"
|
android:text="@string/stats_elevation_gain"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_elevation_value_table_row1" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_elevation_value"
|
android:id="@+id/stats_elevation_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
@@ -92,7 +76,7 @@ limitations under the License.
|
|||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<!-- Min and max elevation -->
|
<!-- Min and max elevation -->
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_elevation_label_table_row2" >
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_min_elevation"
|
android:text="@string/stats_min_elevation"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
@@ -101,7 +85,7 @@ limitations under the License.
|
|||||||
android:text="@string/stats_max_elevation"
|
android:text="@string/stats_max_elevation"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_elevation_value_table_row2" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_min_elevation_value"
|
android:id="@+id/stats_min_elevation_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
@@ -111,7 +95,7 @@ limitations under the License.
|
|||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<!-- Min and max grade -->
|
<!-- Min and max grade -->
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_grade_label_table_row" >
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/stats_min_grade"
|
android:text="@string/stats_min_grade"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
@@ -120,7 +104,7 @@ limitations under the License.
|
|||||||
android:text="@string/stats_max_grade"
|
android:text="@string/stats_max_grade"
|
||||||
style="@style/StatsLabel" />
|
style="@style/StatsLabel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow android:id="@+id/stats_grade_value_table_row" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stats_min_grade_value"
|
android:id="@+id/stats_min_grade_value"
|
||||||
style="@style/StatsValue" />
|
style="@style/StatsValue" />
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="@style/ScrollView" >
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="8dp" >
|
||||||
|
<TextView
|
||||||
|
android:text="@string/stats_settings_time"
|
||||||
|
style="@style/TextLarge" />
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/stats_settings_time"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content" >
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/stats_settings_total_time"
|
||||||
|
android:text="@string/stats_total_time"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/stats_settings_moving_time"
|
||||||
|
android:text="@string/stats_moving_time"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
</RadioGroup>
|
||||||
|
<TextView
|
||||||
|
android:text="@string/stats_settings_show"
|
||||||
|
style="@style/TextLarge" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/stats_settings_elevation"
|
||||||
|
android:text="@string/stats_elevation"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/stats_settings_grade"
|
||||||
|
android:text="@string/stats_settings_grade"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/stats_settings_coordinate"
|
||||||
|
android:text="@string/stats_settings_coordinate"
|
||||||
|
style="@style/TextMedium" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
@@ -16,17 +16,17 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@android:id/tabhost"
|
android:id="@android:id/tabhost"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="match_parent" >
|
android:layout_width="fill_parent" >
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="match_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
<TabWidget
|
<TabWidget
|
||||||
android:id="@android:id/tabs"
|
android:id="@android:id/tabs"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="horizontal" />
|
android:orientation="horizontal" />
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@android:id/tabcontent"
|
android:id="@android:id/tabcontent"
|
||||||
@@ -37,6 +37,6 @@ limitations under the License.
|
|||||||
android:id="@+id/realtabcontent"
|
android:id="@+id/realtabcontent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="match_parent" />
|
android:layout_width="fill_parent" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</TabHost>
|
</TabHost>
|
||||||
@@ -26,7 +26,7 @@ limitations under the License.
|
|||||||
android:padding="8dp" >
|
android:padding="8dp" >
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/generic_name"
|
android:text="@string/generic_name"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel" />
|
||||||
<EditText
|
<EditText
|
||||||
android:drawableLeft="@drawable/track"
|
android:drawableLeft="@drawable/track"
|
||||||
android:hint="@string/generic_name"
|
android:hint="@string/generic_name"
|
||||||
@@ -35,7 +35,7 @@ limitations under the License.
|
|||||||
style="@style/EditName" />
|
style="@style/EditName" />
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/track_edit_activity_type"
|
android:text="@string/track_edit_activity_type"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel.WithPaddingTop" />
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:hint="@string/track_edit_activity_type_hint"
|
android:hint="@string/track_edit_activity_type_hint"
|
||||||
android:id="@+id/track_edit_activity_type"
|
android:id="@+id/track_edit_activity_type"
|
||||||
@@ -43,7 +43,7 @@ limitations under the License.
|
|||||||
style="@style/EditCategory" />
|
style="@style/EditCategory" />
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/generic_description"
|
android:text="@string/generic_description"
|
||||||
style="@style/TextMedium" />
|
style="@style/EditLabel.WithPaddingTop" />
|
||||||
<EditText
|
<EditText
|
||||||
android:hint="@string/generic_description"
|
android:hint="@string/generic_description"
|
||||||
android:id="@+id/track_edit_description"
|
android:id="@+id/track_edit_description"
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ limitations under the License.
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/track_list_empty_message"
|
||||||
android:text="@string/track_list_empty_message"
|
android:text="@string/track_list_empty_message"
|
||||||
|
android:visibility="gone"
|
||||||
style="@style/ListEmptyTextView" >
|
style="@style/ListEmptyTextView" >
|
||||||
</TextView>
|
</TextView>
|
||||||
<ImageButton
|
<ImageButton
|
||||||
@@ -38,6 +40,7 @@ limitations under the License.
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:src="@drawable/menu_record_track"
|
android:src="@drawable/menu_record_track"
|
||||||
|
android:visibility="gone"
|
||||||
style="@android:style/Widget.DeviceDefault.ImageButton" />
|
style="@android:style/Widget.DeviceDefault.ImageButton" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
||||||
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:background="@drawable/appwidget_background"
|
android:background="@drawable/app_widget_background"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
@@ -30,7 +30,7 @@ limitations under the License.
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
android:src="@drawable/appwidget_button_disabled" />
|
android:src="@drawable/app_widget_button_disabled" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:id="@+id/appwidget_track_statistics"
|
android:id="@+id/appwidget_track_statistics"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ limitations under the License.
|
|||||||
<TableRow android:id="@+id/send_google_maps_row" >
|
<TableRow android:id="@+id/send_google_maps_row" >
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@string/send_google_maps"
|
android:contentDescription="@string/send_google_maps"
|
||||||
android:src="@drawable/maps_icon"
|
android:src="@drawable/google_maps_icon"
|
||||||
style="@style/UploadServiceChooserImageView" />
|
style="@style/UploadServiceChooserImageView" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/send_google_maps"
|
android:id="@+id/send_google_maps"
|
||||||
@@ -50,7 +50,7 @@ limitations under the License.
|
|||||||
<TableRow android:id="@+id/send_google_fusion_tables_row" >
|
<TableRow android:id="@+id/send_google_fusion_tables_row" >
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@string/send_google_fusion_tables"
|
android:contentDescription="@string/send_google_fusion_tables"
|
||||||
android:src="@drawable/googledocs_icon"
|
android:src="@drawable/google_fusion_tables_icon"
|
||||||
style="@style/UploadServiceChooserImageView" />
|
style="@style/UploadServiceChooserImageView" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/send_google_fusion_tables"
|
android:id="@+id/send_google_fusion_tables"
|
||||||
@@ -60,7 +60,7 @@ limitations under the License.
|
|||||||
<TableRow android:id="@+id/send_google_docs_row" >
|
<TableRow android:id="@+id/send_google_docs_row" >
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@string/send_google_docs"
|
android:contentDescription="@string/send_google_docs"
|
||||||
android:src="@drawable/googledocs_icon"
|
android:src="@drawable/google_docs_icon"
|
||||||
style="@style/UploadServiceChooserImageView" />
|
style="@style/UploadServiceChooserImageView" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/send_google_docs"
|
android:id="@+id/send_google_docs"
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ limitations under the License.
|
|||||||
android:title="@string/menu_share">
|
android:title="@string/menu_share">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/track_detail_share_map"
|
android:id="@+id/track_detail_share_map_url"
|
||||||
android:title="@string/menu_share_map"/>
|
android:title="@string/menu_share_map_url"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/track_detail_share_fusion_table"
|
android:id="@+id/track_detail_share_fusion_table_url"
|
||||||
android:title="@string/menu_share_fusion_table"/>
|
android:title="@string/menu_share_fusion_table_url"/>
|
||||||
<item android:id="@+id/track_detail_share_gpx"/>
|
<item android:id="@+id/track_detail_share_gpx"/>
|
||||||
<item android:id="@+id/track_detail_share_kml"/>
|
<item android:id="@+id/track_detail_share_kml"/>
|
||||||
<item android:id="@+id/track_detail_share_csv"/>
|
<item android:id="@+id/track_detail_share_csv"/>
|
||||||
@@ -76,22 +76,22 @@ limitations under the License.
|
|||||||
android:icon="@drawable/menu_delete"
|
android:icon="@drawable/menu_delete"
|
||||||
android:id="@+id/track_detail_delete"
|
android:id="@+id/track_detail_delete"
|
||||||
android:title="@string/menu_delete"/>
|
android:title="@string/menu_delete"/>
|
||||||
<item
|
|
||||||
android:icon="@drawable/menu_my_location"
|
|
||||||
android:id="@+id/track_detail_my_location"
|
|
||||||
android:title="@string/menu_my_location"/>
|
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_satellite_mode"
|
android:icon="@drawable/menu_satellite_mode"
|
||||||
android:id="@+id/track_detail_satellite_mode"
|
android:id="@+id/track_detail_satellite_mode"
|
||||||
android:title="@string/menu_satellite_mode"/>
|
android:title="@string/menu_satellite_mode"/>
|
||||||
|
<item
|
||||||
|
android:icon="@drawable/menu_sensor_state"
|
||||||
|
android:id="@+id/track_detail_sensor_state"
|
||||||
|
android:title="@string/menu_sensor_state"/>
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_chart_settings"
|
android:icon="@drawable/menu_chart_settings"
|
||||||
android:id="@+id/track_detail_chart_settings"
|
android:id="@+id/track_detail_chart_settings"
|
||||||
android:title="@string/menu_chart_settings"/>
|
android:title="@string/menu_chart_settings"/>
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_sensor_state"
|
android:icon="@drawable/menu_stats_settings"
|
||||||
android:id="@+id/track_detail_sensor_state"
|
android:id="@+id/track_detail_stats_settings"
|
||||||
android:title="@string/menu_sensor_state"/>
|
android:title="@string/menu_stats_settings"/>
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_settings"
|
android:icon="@drawable/menu_settings"
|
||||||
android:id="@+id/track_detail_settings"
|
android:id="@+id/track_detail_settings"
|
||||||
|
|||||||
@@ -32,18 +32,18 @@ limitations under the License.
|
|||||||
android:showAsAction="always|collapseActionView"
|
android:showAsAction="always|collapseActionView"
|
||||||
android:title="@string/menu_search"/>
|
android:title="@string/menu_search"/>
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_import_all"
|
android:icon="@drawable/menu_import"
|
||||||
android:id="@+id/track_list_import_all"
|
android:id="@+id/track_list_import"
|
||||||
android:title="@string/menu_import_all"/>
|
android:title="@string/menu_import"/>
|
||||||
<item
|
<item
|
||||||
android:icon="@drawable/menu_export_all"
|
android:icon="@drawable/menu_save_all"
|
||||||
android:id="@+id/track_list_export_all"
|
android:id="@+id/track_list_save_all"
|
||||||
android:title="@string/menu_export_all">
|
android:title="@string/menu_save_all">
|
||||||
<menu>
|
<menu>
|
||||||
<item android:id="@+id/track_list_export_gpx"/>
|
<item android:id="@+id/track_list_save_all_gpx"/>
|
||||||
<item android:id="@+id/track_list_export_kml"/>
|
<item android:id="@+id/track_list_save_all_kml"/>
|
||||||
<item android:id="@+id/track_list_export_csv"/>
|
<item android:id="@+id/track_list_save_all_csv"/>
|
||||||
<item android:id="@+id/track_list_export_tcx"/>
|
<item android:id="@+id/track_list_save_all_tcx"/>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ limitations under the License.
|
|||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
<!-- holo_orange_dark -->
|
<!-- holo_orange_dark -->
|
||||||
<color name="background_warning">#FFFF8800</color>
|
<color name="warning_background">#FFFF8800</color>
|
||||||
|
|
||||||
<!-- Chart colors by series. -->
|
<!-- Chart colors by series. -->
|
||||||
<!-- Green and a transparent green -->
|
<!-- Green and a transparent green -->
|
||||||
@@ -46,7 +46,6 @@ limitations under the License.
|
|||||||
<color name="power_fill">#40401465</color>
|
<color name="power_fill">#40401465</color>
|
||||||
|
|
||||||
<!-- AppWidget colors -->
|
<!-- AppWidget colors -->
|
||||||
<color name="appwidget_text">#EDEDED</color>
|
|
||||||
<color name="appwidget_hr">#99999999</color>
|
<color name="appwidget_hr">#99999999</color>
|
||||||
|
|
||||||
<!-- Colors for dynamic track drawing -->
|
<!-- Colors for dynamic track drawing -->
|
||||||
|
|||||||
@@ -15,13 +15,15 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Keys for application preferences. Sorted alphabetically. - DO NOT TRANSLATE -->
|
|
||||||
|
<!-- Keys for persisted preferences. Sorted alphabetically. - DO NOT TRANSLATE -->
|
||||||
<string name="allow_access_key">allowAccess</string>
|
<string name="allow_access_key">allowAccess</string>
|
||||||
<string name="announcement_frequency_key">announcementFrequency</string>
|
<string name="announcement_frequency_key">announcementFrequency</string>
|
||||||
<string name="ant_cadence_sensor_id_key">antCadenceSensorId</string>
|
<string name="ant_cadence_sensor_id_key">antCadenceSensorId</string>
|
||||||
<string name="ant_cadence_speed_sensor_id_key">antCadenceSpeedSensorId</string>
|
<string name="ant_cadence_speed_sensor_id_key">antCadenceSpeedSensorId</string>
|
||||||
<string name="ant_heart_rate_sensor_id_key">antHeartRateSensorId</string>
|
<string name="ant_heart_rate_sensor_id_key">antHeartRateSensorId</string>
|
||||||
<string name="ant_srm_bridge_sensor_id_key">antSRMBridgeSensorId</string>
|
<string name="ant_srm_bridge_sensor_id_key">antSRMBridgeSensorId</string>
|
||||||
|
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
|
||||||
<string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string>
|
<string name="auto_resume_track_timeout_key">autoResumeTrackTimeout</string>
|
||||||
<string name="bluetooth_pairing_key">bluetoothPairing</string>
|
<string name="bluetooth_pairing_key">bluetoothPairing</string>
|
||||||
<string name="bluetooth_sensor_key">bluetoothSensor</string>
|
<string name="bluetooth_sensor_key">bluetoothSensor</string>
|
||||||
@@ -33,31 +35,31 @@ limitations under the License.
|
|||||||
<string name="min_recording_interval_key">minRecordingInterval</string>
|
<string name="min_recording_interval_key">minRecordingInterval</string>
|
||||||
<string name="min_required_accuracy_key">minRequiredAccuracy</string>
|
<string name="min_required_accuracy_key">minRequiredAccuracy</string>
|
||||||
<string name="pick_existing_map_key">pickExistingMap</string>
|
<string name="pick_existing_map_key">pickExistingMap</string>
|
||||||
|
<string name="pick_statistics_marker_key">pickStatisticsMarker</string>
|
||||||
<string name="preferred_account_key">preferredAccount</string>
|
<string name="preferred_account_key">preferredAccount</string>
|
||||||
|
<string name="recording_track_id_key">recordingTrackId</string>
|
||||||
<string name="report_speed_key">reportSpeed</string>
|
<string name="report_speed_key">reportSpeed</string>
|
||||||
|
<string name="selected_track_id_key">selectedTrackId</string>
|
||||||
<string name="send_to_docs_key">sendToDocs</string>
|
<string name="send_to_docs_key">sendToDocs</string>
|
||||||
<string name="send_to_fusion_tables_key">sendToFusionTables</string>
|
<string name="send_to_fusion_tables_key">sendToFusionTables</string>
|
||||||
<string name="send_to_maps_key">sendToMaps</string>
|
<string name="send_to_maps_key">sendToMaps</string>
|
||||||
<string name="sensor_type_key">sensorType</string>
|
<string name="sensor_type_key">sensorType</string>
|
||||||
<string name="share_url_only_key">shareUrlOnly</string>
|
<string name="share_url_only_key">shareUrlOnly</string>
|
||||||
|
<string name="show_check_units_dialog_key">showCheckUnitsDialog</string>
|
||||||
|
<string name="show_welcome_dialog_key">showWelcomeDialog</string>
|
||||||
<string name="split_frequency_key">splitFrequency</string>
|
<string name="split_frequency_key">splitFrequency</string>
|
||||||
<string name="track_color_mode_dynamic_speed_variation_key">trackColorModeDynamicVariation
|
<string name="stats_show_coordinate_key">statsShowCoordinate</string>
|
||||||
</string>
|
<string name="stats_show_elevation_key">statsShowElevation</string>
|
||||||
<string name="track_color_mode_fixed_speed_medium_display_key">trackColorModeFixedMediumDisplay
|
<string name="stats_show_grade_key">statsShowGrade</string>
|
||||||
</string>
|
<string name="stats_show_total_time_key">statsShowTotalTime</string>
|
||||||
|
<string name="track_color_mode_dynamic_speed_variation_key">trackColorModeDynamicVariation</string>
|
||||||
|
<string name="track_color_mode_fixed_speed_medium_display_key">trackColorModeFixedMediumDisplay</string>
|
||||||
<string name="track_color_mode_fixed_speed_medium_key">trackColorModeFixedMedium</string>
|
<string name="track_color_mode_fixed_speed_medium_key">trackColorModeFixedMedium</string>
|
||||||
<string name="track_color_mode_fixed_speed_slow_display_key">trackColorModeFixedSlowDisplay
|
<string name="track_color_mode_fixed_speed_slow_display_key">trackColorModeFixedSlowDisplay</string>
|
||||||
</string>
|
|
||||||
<string name="track_color_mode_fixed_speed_slow_key">trackColorModeFixedSlow</string>
|
<string name="track_color_mode_fixed_speed_slow_key">trackColorModeFixedSlow</string>
|
||||||
<string name="track_color_mode_key">trackColorMode</string>
|
<string name="track_color_mode_key">trackColorMode</string>
|
||||||
<string name="track_name_key">trackName</string>
|
<string name="track_name_key">trackName</string>
|
||||||
|
|
||||||
<!-- Preference keys which keep transient state (not user preferences). Sorted alphabetically.
|
|
||||||
- DO NOT TRANSLATE -->
|
|
||||||
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
|
|
||||||
<string name="recording_track_id_key">recordingTrackId</string>
|
|
||||||
<string name="selected_track_id_key">selectedTrackId</string>
|
|
||||||
|
|
||||||
<!-- Keys for non-persisted preferences. Sorted alphabetically. - DO NOT TRANSLATE -->
|
<!-- Keys for non-persisted preferences. Sorted alphabetically. - DO NOT TRANSLATE -->
|
||||||
<string name="ant_options_key">antOptions</string>
|
<string name="ant_options_key">antOptions</string>
|
||||||
<string name="backup_to_sd_key">backupToSd</string>
|
<string name="backup_to_sd_key">backupToSd</string>
|
||||||
@@ -65,4 +67,4 @@ limitations under the License.
|
|||||||
<string name="restore_from_sd_key">restoreFromSd</string>
|
<string name="restore_from_sd_key">restoreFromSd</string>
|
||||||
<string name="sensor_options_key">sensorOptions</string>
|
<string name="sensor_options_key">sensorOptions</string>
|
||||||
<string name="track_color_mode_fixed_speed_options_key">trackColorModeFixedOptions</string>
|
<string name="track_color_mode_fixed_speed_options_key">trackColorModeFixedOptions</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -637,23 +637,11 @@ limitations under the License.
|
|||||||
Terms of Service
|
Terms of Service
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Export -->
|
|
||||||
<string name="export_error"
|
|
||||||
translation_description="When exporting all the tracks to the SD card, a toast message
|
|
||||||
indicating error.">
|
|
||||||
Unable to export.
|
|
||||||
</string>
|
|
||||||
<string name="export_progress_message"
|
|
||||||
translation_description="When exporting all the tracks to the SD card, the progress message.">
|
|
||||||
Exporting all tracks...
|
|
||||||
</string>
|
|
||||||
<string name="export_success"
|
|
||||||
translation_description="When exporting all the tracks to the SD card, a toast message
|
|
||||||
indicating success.">
|
|
||||||
Export finished.
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<!-- Generic Strings -->
|
<!-- Generic Strings -->
|
||||||
|
<string name="generic_add"
|
||||||
|
translation_description="The text on a button to say add.">
|
||||||
|
Add
|
||||||
|
</string>
|
||||||
<string name="generic_cancel"
|
<string name="generic_cancel"
|
||||||
translation_description="The text on a button to say cancel.">
|
translation_description="The text on a button to say cancel.">
|
||||||
Cancel
|
Cancel
|
||||||
@@ -670,6 +658,10 @@ limitations under the License.
|
|||||||
translation_description="The title on an alert dialog indicating error.">
|
translation_description="The title on an alert dialog indicating error.">
|
||||||
Error
|
Error
|
||||||
</string>
|
</string>
|
||||||
|
<string name="generic_more_options"
|
||||||
|
translation_description="The text on a button to say more options.">
|
||||||
|
More options
|
||||||
|
</string>
|
||||||
<string name="generic_name"
|
<string name="generic_name"
|
||||||
translation_description="The text label for entering a name.">
|
translation_description="The text label for entering a name.">
|
||||||
Name
|
Name
|
||||||
@@ -951,67 +943,47 @@ limitations under the License.
|
|||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Marker -->
|
<!-- Marker -->
|
||||||
|
<string name="marker_add_error"
|
||||||
|
translation_description="When adding a marker, the message indicating error.">
|
||||||
|
Unable to insert a marker. Try again.
|
||||||
|
</string>
|
||||||
|
<string name="marker_add_success"
|
||||||
|
translation_description="When adding a marker, the message indicating success.">
|
||||||
|
A marker was inserted.
|
||||||
|
</string>
|
||||||
<string name="marker_delete_one_marker_confirm_message"
|
<string name="marker_delete_one_marker_confirm_message"
|
||||||
translation_description="When deleting a marker, the confirmation dialog message informing the
|
translation_description="When deleting a marker, the confirmation dialog message informing the
|
||||||
user that the marker will be permanently deleted from the phone.">
|
user that the marker will be permanently deleted from the phone.">
|
||||||
The marker will be permanently deleted from the phone.
|
The marker will be permanently deleted from the phone.
|
||||||
</string>
|
</string>
|
||||||
<string name="marker_detail_description"
|
<string name="marker_detail_name"
|
||||||
translation_description="In the marker detail page, the label for the description.
|
translation_description="In the marker detail page, the label for the marker name.
|
||||||
|
|
||||||
|
%1$s marker name. E.g., 'Waypoint 1'.">
|
||||||
|
Name: %1$s
|
||||||
|
</string>
|
||||||
|
<string name="marker_detail_waypoint_description"
|
||||||
|
translation_description="In the marker detail page, the label for the waypoint description.
|
||||||
|
|
||||||
%1$s marker description. E.g., 'At the top'.">
|
%1$s marker description. E.g., 'At the top'.">
|
||||||
Description: %1$s
|
Description: %1$s
|
||||||
</string>
|
</string>
|
||||||
<string name="marker_detail_marker_type"
|
<string name="marker_detail_waypoint_marker_type"
|
||||||
translation_description="In the marker detail page, the label for the marker type.
|
translation_description="In the marker detail page, the label for the waypoint marker type.
|
||||||
|
|
||||||
%1$s marker type. E.g., 'building'.">
|
%1$s marker type. E.g., 'building'.">
|
||||||
Marker type: %1$s
|
Marker type: %1$s
|
||||||
</string>
|
</string>
|
||||||
<string name="marker_detail_name"
|
<string name="marker_edit_waypoint_marker_type"
|
||||||
translation_description="In the marker detail page, the label for the marker name.
|
translation_description="In the marker edit page, the label for the waypoint marker type,
|
||||||
|
including some exmaples.">
|
||||||
%1$s marker name. E.g., 'Waypoint1'.">
|
|
||||||
Name: %1$s
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_add"
|
|
||||||
translation_description="The label on the button to add a marker.">
|
|
||||||
Add
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_add_error"
|
|
||||||
translation_description="When adding a marker, the message indicating error.">
|
|
||||||
Unable to insert a marker. Try again.
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_add_success"
|
|
||||||
translation_description="When adding a marker, the message indicating success.">
|
|
||||||
A marker was inserted.
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_add_title"
|
|
||||||
translation_description="The title of the page to add a new marker.">
|
|
||||||
New Marker
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_marker_type"
|
|
||||||
translation_description="The label for the text field to edit the marker type, including some
|
|
||||||
exmaples.">
|
|
||||||
Marker type (e.g. building, pothole...)
|
Marker type (e.g. building, pothole...)
|
||||||
</string>
|
</string>
|
||||||
<string name="marker_edit_marker_type_hint"
|
<string name="marker_edit_waypoint_marker_type_hint"
|
||||||
translation_description="The hint in the 'Marker type' text field when it is empty.">
|
translation_description="In the marker edit page, the hint in the waypoint marker type text
|
||||||
|
field when it is empty.">
|
||||||
Marker type
|
Marker type
|
||||||
</string>
|
</string>
|
||||||
<string name="marker_edit_type"
|
|
||||||
translation_description="When adding a marker, the label to select a type, statistics or
|
|
||||||
waypoint.">
|
|
||||||
Type
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_type_statistics"
|
|
||||||
translation_description="The label to add a statistics marker.">
|
|
||||||
Statistics
|
|
||||||
</string>
|
|
||||||
<string name="marker_edit_type_waypoint"
|
|
||||||
translation_description="The label to add a waypoint marker.">
|
|
||||||
Waypoint
|
|
||||||
</string>
|
|
||||||
<string name="marker_label_end"
|
<string name="marker_label_end"
|
||||||
translation_description="When inserting a marker to indicate the end of a track, the marker's
|
translation_description="When inserting a marker to indicate the end of a track, the marker's
|
||||||
name. E.g., 'track_name (End)'.
|
name. E.g., 'track_name (End)'.
|
||||||
@@ -1030,7 +1002,33 @@ limitations under the License.
|
|||||||
translation_description="The message when the marker list is empty.">
|
translation_description="The message when the marker list is empty.">
|
||||||
You don\'t have any markers.
|
You don\'t have any markers.
|
||||||
</string>
|
</string>
|
||||||
|
<string name="marker_statistics"
|
||||||
|
translation_description="The label to add a statistics marker.">
|
||||||
|
Statistics
|
||||||
|
</string>
|
||||||
|
<string name="marker_statistics_name_format"
|
||||||
|
translation_description="When adding a statistics marker, the string format for the default
|
||||||
|
name.
|
||||||
|
|
||||||
|
%1$d: number. E.g., '1'.">
|
||||||
|
Statistics %1$d
|
||||||
|
</string>
|
||||||
|
<string name="marker_type"
|
||||||
|
translation_description="When adding a marker, the label to select a type, statistics or
|
||||||
|
waypoint.">
|
||||||
|
Type
|
||||||
|
</string>
|
||||||
|
<string name="marker_waypoint"
|
||||||
|
translation_description="The label to add a waypoint marker.">
|
||||||
|
Waypoint
|
||||||
|
</string>
|
||||||
|
<string name="marker_waypoint_name_format"
|
||||||
|
translation_description="When adding a waypoint marker, the string format for the default name.
|
||||||
|
|
||||||
|
%1$d: number. E.g., '1'.">
|
||||||
|
Waypoint %1$d
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- Menu Items -->
|
<!-- Menu Items -->
|
||||||
<string name="menu_aggregated_statistics"
|
<string name="menu_aggregated_statistics"
|
||||||
translation_description="In the menu, to go to the aggregated statistics page.">
|
translation_description="In the menu, to go to the aggregated statistics page.">
|
||||||
@@ -1052,25 +1050,13 @@ limitations under the License.
|
|||||||
translation_description="In the menu, to edit a track or a marker.">
|
translation_description="In the menu, to edit a track or a marker.">
|
||||||
Edit
|
Edit
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_export_all"
|
|
||||||
translation_description="In the menu, to export all the tracks to the SD card. This menu item
|
|
||||||
has a submenu.">
|
|
||||||
Export all...
|
|
||||||
</string>
|
|
||||||
<string name="menu_export_all_format"
|
|
||||||
translation_description="Under the 'Export all' menu option, the option to export all tracks as
|
|
||||||
a certain file format.
|
|
||||||
|
|
||||||
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
|
|
||||||
Export as %1$s
|
|
||||||
</string>
|
|
||||||
<string name="menu_help"
|
<string name="menu_help"
|
||||||
translation_description="In the menu, to go to the help page.">
|
translation_description="In the menu, to go to the help page.">
|
||||||
Help
|
Help
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_import_all"
|
<string name="menu_import"
|
||||||
translation_description="In the menu, to import all the tracks from the SD card.">
|
translation_description="In the menu, to import tracks from the SD card.">
|
||||||
Import all
|
Import from SD card
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_insert_marker"
|
<string name="menu_insert_marker"
|
||||||
translation_description="In the menu, to insert a marker.">
|
translation_description="In the menu, to insert a marker.">
|
||||||
@@ -1084,10 +1070,6 @@ limitations under the License.
|
|||||||
translation_description="In the menu, to show a list of markers for the current track.">
|
translation_description="In the menu, to show a list of markers for the current track.">
|
||||||
Markers
|
Markers
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_my_location"
|
|
||||||
translation_description="In the menu, to display the user's current location.">
|
|
||||||
My location
|
|
||||||
</string>
|
|
||||||
<string name="menu_play"
|
<string name="menu_play"
|
||||||
translation_description="In the menu, to play a track.">
|
translation_description="In the menu, to play a track.">
|
||||||
Play
|
Play
|
||||||
@@ -1105,12 +1087,17 @@ limitations under the License.
|
|||||||
submenu.">
|
submenu.">
|
||||||
Save to SD card...
|
Save to SD card...
|
||||||
</string>
|
</string>
|
||||||
|
<string name="menu_save_all"
|
||||||
|
translation_description="In the menu, to save all the tracks to the SD card. This menu item has
|
||||||
|
a submenu.">
|
||||||
|
Save all to SD card...
|
||||||
|
</string>
|
||||||
<string name="menu_save_format"
|
<string name="menu_save_format"
|
||||||
translation_description="Under the 'Save to SD card...' menu option, the option to save a track
|
translation_description="Under the save to SD card menu option, the option to save a track
|
||||||
as a certain file format.
|
as a certain file format.
|
||||||
|
|
||||||
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
|
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
|
||||||
As a %1$s file
|
Save as %1$s
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_search"
|
<string name="menu_search"
|
||||||
translation_description="In the menu, to start a textual search for tracks or waypoints.">
|
translation_description="In the menu, to start a textual search for tracks or waypoints.">
|
||||||
@@ -1128,40 +1115,47 @@ limitations under the License.
|
|||||||
translation_description="In the menu, to go to the settings page.">
|
translation_description="In the menu, to go to the settings page.">
|
||||||
Settings
|
Settings
|
||||||
</string>
|
</string>
|
||||||
|
<string name="menu_share"
|
||||||
|
translation_description="In the menu, to share a track.">
|
||||||
|
Share
|
||||||
|
</string>
|
||||||
|
<string name="menu_share_file"
|
||||||
|
translation_description="Under the 'Share' menu option, the option to share a track as a
|
||||||
|
certain file format.
|
||||||
|
|
||||||
|
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
|
||||||
|
%1$s file
|
||||||
|
</string>
|
||||||
|
<string name="menu_share_fusion_table_url"
|
||||||
|
translation_description="Under the 'Share' menu option, the option to save a track to Google
|
||||||
|
Fusion Tables and share the Fusion Table URL with friends. 'Fusion Table URL' in this context
|
||||||
|
means a Google Fusion Table URL.">
|
||||||
|
Fusion Table URL
|
||||||
|
</string>
|
||||||
|
<string name="menu_share_map_url"
|
||||||
|
translation_description="Under the 'Share' menu option, the option to save a track to Google
|
||||||
|
Maps and share the Map URL with friends. 'Map URL' in this context means a Google Map URL.">
|
||||||
|
Map URL
|
||||||
|
</string>
|
||||||
<string name="menu_show_on_map"
|
<string name="menu_show_on_map"
|
||||||
translation_description="In the menu, to show a marker on map.">
|
translation_description="In the menu, to show a marker on map.">
|
||||||
Show on map
|
Show on map
|
||||||
|
</string>
|
||||||
|
<string name="menu_stats_settings"
|
||||||
|
translation_description="In the menu, to change the stats settings.">
|
||||||
|
Stats settings
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_stop_recording"
|
<string name="menu_stop_recording"
|
||||||
translation_description="In the menu, to stop recording a track.">
|
translation_description="In the menu, to stop recording a track.">
|
||||||
Stop recording
|
Stop recording
|
||||||
</string>
|
</string>
|
||||||
<string name="menu_share"
|
|
||||||
translation_description="In the menu, to share a track with friends through other
|
|
||||||
applications.">
|
|
||||||
Share with friends...
|
|
||||||
</string>
|
|
||||||
<string name="menu_share_file"
|
|
||||||
translation_description="Under the 'Share with friends...' menu option, the option to share a
|
|
||||||
track as a certain file format.
|
|
||||||
|
|
||||||
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
|
|
||||||
A %1$s file
|
|
||||||
</string>
|
|
||||||
<string name="menu_share_fusion_table"
|
|
||||||
translation_description="Under the 'Share with friends...' menu option, the option to save a
|
|
||||||
track to Google Fusion Tables and share the Fusion Table url with friends. 'Fusion Table' in
|
|
||||||
this context means a Google Fusion Table.">
|
|
||||||
Fusion Table
|
|
||||||
</string>
|
|
||||||
<string name="menu_share_map"
|
|
||||||
translation_description="Under the 'Share with friends...' menu option, the option to save a
|
|
||||||
track to Google Maps and share the Map url with friends. 'Map' in this context means a Google
|
|
||||||
Map.">
|
|
||||||
Map
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<!-- My Location -->
|
<!-- My Location -->
|
||||||
|
<string name="my_location"
|
||||||
|
translation_description="The accessibility description for the My Location button on the map
|
||||||
|
view.">
|
||||||
|
My Location
|
||||||
|
</string>
|
||||||
<string name="my_location_approximate_location"
|
<string name="my_location_approximate_location"
|
||||||
translation_description="When displaying the user's current location, a status message
|
translation_description="When displaying the user's current location, a status message
|
||||||
indicating that GPS is not available and an approximate location is used instead.">
|
indicating that GPS is not available and an approximate location is used instead.">
|
||||||
@@ -1179,11 +1173,6 @@ limitations under the License.
|
|||||||
translation_description="The My Tracks application name.">
|
translation_description="The My Tracks application name.">
|
||||||
My Tracks
|
My Tracks
|
||||||
</string>
|
</string>
|
||||||
<string name="my_tracks_importer"
|
|
||||||
translation_description="When opening a GPX file from a file manager, the name of the My Tracks
|
|
||||||
application that can import the file to My Tracks.">
|
|
||||||
My Tracks Importer
|
|
||||||
</string>
|
|
||||||
<string name="my_tracks_recording_service"
|
<string name="my_tracks_recording_service"
|
||||||
translation_description="When viewing the 'Running services' on Android, the name of the My
|
translation_description="When viewing the 'Running services' on Android, the name of the My
|
||||||
Tracks service that is recording a track in the background.
|
Tracks service that is recording a track in the background.
|
||||||
@@ -1228,19 +1217,35 @@ limitations under the License.
|
|||||||
<string name="preferred_units_imperial"
|
<string name="preferred_units_imperial"
|
||||||
translation_description="In the dialog asking the user to choose a preferred units, the option
|
translation_description="In the dialog asking the user to choose a preferred units, the option
|
||||||
to choose the imperial units.">
|
to choose the imperial units.">
|
||||||
Imperial
|
Imperial (mi, ft)
|
||||||
</string>
|
</string>
|
||||||
<string name="preferred_units_metric"
|
<string name="preferred_units_metric"
|
||||||
translation_description="In the dialog asking the user to choose a preferred units, the option
|
translation_description="In the dialog asking the user to choose a preferred units, the option
|
||||||
to choose the metric units.">
|
to choose the metric units.">
|
||||||
Metric
|
Metric (km, m)
|
||||||
</string>
|
</string>
|
||||||
<string name="preferred_units_title"
|
<string name="preferred_units_title"
|
||||||
translation_description="The title of the dialog asking the user to choose a preferred units,
|
translation_description="The title of the dialog asking the user to choose a preferred units,
|
||||||
metric or imperial.">
|
metric or imperial.">
|
||||||
Preferred units
|
Preferred Units
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<!-- Save All -->
|
||||||
|
<string name="save_all_error"
|
||||||
|
translation_description="When saving all the tracks to the SD card, a toast message indicating
|
||||||
|
error.">
|
||||||
|
Unable to save.
|
||||||
|
</string>
|
||||||
|
<string name="save_all_progress_message"
|
||||||
|
translation_description="When saving all the tracks to the SD card, the progress message.">
|
||||||
|
Saving all tracks...
|
||||||
|
</string>
|
||||||
|
<string name="save_all_success"
|
||||||
|
translation_description="When saving all the tracks to the SD card, a toast message indicating
|
||||||
|
success.">
|
||||||
|
Save finished.
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- SD Card -->
|
<!-- SD Card -->
|
||||||
<string name="sd_card_canceled"
|
<string name="sd_card_canceled"
|
||||||
translation_description="When exporting a track to the SD card, a message indicating that the
|
translation_description="When exporting a track to the SD card, a message indicating that the
|
||||||
@@ -2140,6 +2145,28 @@ limitations under the License.
|
|||||||
Total time
|
Total time
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<!-- Stats Settings -->
|
||||||
|
<string name="stats_settings_show"
|
||||||
|
translation_description="In the 'Stats settings' dialog, the section label to show additional
|
||||||
|
stats.">
|
||||||
|
Show
|
||||||
|
</string>
|
||||||
|
<string name="stats_settings_grade"
|
||||||
|
translation_description="In the 'Stats settings' dialog, the option to show grade. Grade is
|
||||||
|
the amount of inclination to the horizontal, also known as slope or incline.">
|
||||||
|
Grade
|
||||||
|
</string>
|
||||||
|
<string name="stats_settings_coordinate"
|
||||||
|
translation_description="In the 'Stats settings' dialog, the option to show latitude and
|
||||||
|
longitude.">
|
||||||
|
Latitude/Longitude
|
||||||
|
</string>
|
||||||
|
<string name="stats_settings_time"
|
||||||
|
translation_description="In the 'Stats settings' dialog, the section label to choose between
|
||||||
|
displaying total time or moving time.">
|
||||||
|
Time
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- Track -->
|
<!-- Track -->
|
||||||
<string name="track_detail_chart_tab"
|
<string name="track_detail_chart_tab"
|
||||||
translation_description="In the track detail page, the title of the tab showing the chart.">
|
translation_description="In the track detail page, the title of the tab showing the chart.">
|
||||||
@@ -2926,6 +2953,14 @@ limitations under the License.
|
|||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- Welcome -->
|
<!-- Welcome -->
|
||||||
|
<string name="welcome_message"
|
||||||
|
translation_description="The message of the welcome dialog.">
|
||||||
|
Use My Tracks while you run, bike, hike, or do anything outdoor to record your path. While
|
||||||
|
recording, you can visualize your track and watch live statistics. You can also add
|
||||||
|
markers, have markers inserted periodically, or hear automatic voice announcements of
|
||||||
|
your progress. For recorded tracks, you can play them on Google Earth, share with friends, or
|
||||||
|
upload to Google Maps, Google Fusion Tables, or Google Docs.
|
||||||
|
</string>
|
||||||
<string name="welcome_title"
|
<string name="welcome_title"
|
||||||
translation_description="The title of the welcome dialog.">
|
translation_description="The title of the welcome dialog.">
|
||||||
Welcome to My Tracks
|
Welcome to My Tracks
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ limitations under the License.
|
|||||||
<item name="android:selectAllOnFocus">true</item>
|
<item name="android:selectAllOnFocus">true</item>
|
||||||
<item name="android:singleLine">false</item>
|
<item name="android:singleLine">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
<!-- The style for the edit label -->
|
||||||
|
<style name="EditLabel" parent="@style/TextMedium" />
|
||||||
|
<!-- The style for the edit lable with padding top -->
|
||||||
|
<style name="EditLabel.WithPaddingTop">
|
||||||
|
<item name="android:paddingTop">16dp</item>
|
||||||
|
</style>
|
||||||
<!-- The style for the edit name -->
|
<!-- The style for the edit name -->
|
||||||
<style name="EditName" parent="@style/TextMedium.WithIcon">
|
<style name="EditName" parent="@style/TextMedium.WithIcon">
|
||||||
<item name="android:inputType">textAutoCorrect|textCapWords</item>
|
<item name="android:inputType">textAutoCorrect|textCapWords</item>
|
||||||
@@ -52,6 +58,15 @@ limitations under the License.
|
|||||||
<item name="android:selectAllOnFocus">true</item>
|
<item name="android:selectAllOnFocus">true</item>
|
||||||
<item name="android:singleLine">true</item>
|
<item name="android:singleLine">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
<!-- The style for the help answer -->
|
||||||
|
<style name="HelpAnswer" parent="@style/TextSmall">
|
||||||
|
<item name="android:paddingBottom">8dp</item>
|
||||||
|
</style>
|
||||||
|
<!-- The style for help question -->
|
||||||
|
<style name="HelpQuestion" parent="@style/TextMedium">
|
||||||
|
<item name="android:paddingTop">8dp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
<!-- The style for the list empty text view -->
|
<!-- The style for the list empty text view -->
|
||||||
<style name="ListEmptyTextView" parent="@style/TextLarge">
|
<style name="ListEmptyTextView" parent="@style/TextLarge">
|
||||||
<item name="android:gravity">center</item>
|
<item name="android:gravity">center</item>
|
||||||
@@ -147,13 +162,4 @@ limitations under the License.
|
|||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- The style for the welcome page answer -->
|
|
||||||
<style name="WelcomeAnswerTextView" parent="@style/TextSmall">
|
|
||||||
<item name="android:paddingBottom">8dp</item>
|
|
||||||
</style>
|
|
||||||
<!-- The style for welcome page question -->
|
|
||||||
<style name="WelcomeQuestionTextView" parent="@style/TextMedium">
|
|
||||||
<item name="android:paddingTop">8dp</item>
|
|
||||||
<item name="android:textStyle">bold</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:hint="@string/search_hint"
|
android:hint="@string/search_hint"
|
||||||
android:includeInGlobalSearch="true"
|
android:imeOptions="actionSearch"
|
||||||
android:label="@string/my_tracks_app_name"
|
android:includeInGlobalSearch="true"
|
||||||
android:searchSettingsDescription="@string/search_global_description"
|
android:label="@string/my_tracks_app_name"
|
||||||
android:voicePromptText="@string/search_voice_prompt"
|
android:queryAfterZeroResults="true"
|
||||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
|
android:searchSettingsDescription="@string/search_global_description"
|
||||||
android:searchSuggestAuthority="com.google.android.maps.mytracks.search"
|
android:searchSuggestAuthority="com.google.android.maps.mytracks.search"
|
||||||
android:searchSuggestThreshold="2"
|
android:searchSuggestSelection=" ? "
|
||||||
android:searchSuggestSelection=" ? " />
|
android:searchSuggestThreshold="1"
|
||||||
|
android:voicePromptText="@string/search_voice_prompt"
|
||||||
|
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" />
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import com.google.android.apps.mytracks.stats.TripStatistics;
|
|||||||
import com.google.android.apps.mytracks.util.StatsUtils;
|
import com.google.android.apps.mytracks.util.StatsUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,15 +37,8 @@ public class AggregatedStatsActivity extends AbstractMyTracksActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.aggregated_stats);
|
setContentView(R.layout.aggregated_stats);
|
||||||
|
StatsUtils.setTripStatisticsValues(this, getTripStatistics());
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
StatsUtils.setLocationValues(this, null, false);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
boolean metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
|
|
||||||
boolean reportSpeed = preferences.getBoolean(getString(R.string.report_speed_key), true);
|
|
||||||
|
|
||||||
StatsUtils.setSpeedLabels(this, reportSpeed, false);
|
|
||||||
StatsUtils.setTripStatisticsValues(this, getTripStatistics(), metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setLocationElevationValue(this, Double.NaN, metricUnits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class ChartView extends View {
|
|||||||
/**
|
/**
|
||||||
* Unscaled top border of the chart.
|
* Unscaled top border of the chart.
|
||||||
*/
|
*/
|
||||||
private static final int TOP_BORDER = 15;
|
private static final int TOP_BORDER = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device scaled top border of the chart.
|
* Device scaled top border of the chart.
|
||||||
@@ -86,7 +86,7 @@ public class ChartView extends View {
|
|||||||
/**
|
/**
|
||||||
* Unscaled bottom border of the chart.
|
* Unscaled bottom border of the chart.
|
||||||
*/
|
*/
|
||||||
private static final float BOTTOM_BORDER = 40;
|
private static final float BOTTOM_BORDER = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device scaled bottom border of the chart.
|
* Device scaled bottom border of the chart.
|
||||||
@@ -191,7 +191,7 @@ public class ChartView extends View {
|
|||||||
pointer.setBounds(0, 0,
|
pointer.setBounds(0, 0,
|
||||||
pointer.getIntrinsicWidth(), pointer.getIntrinsicHeight());
|
pointer.getIntrinsicWidth(), pointer.getIntrinsicHeight());
|
||||||
|
|
||||||
statsMarker = getResources().getDrawable(R.drawable.ylw_pushpin);
|
statsMarker = getResources().getDrawable(R.drawable.yellow_pushpin);
|
||||||
markerWidth = statsMarker.getIntrinsicWidth();
|
markerWidth = statsMarker.getIntrinsicWidth();
|
||||||
markerHeight = statsMarker.getIntrinsicHeight();
|
markerHeight = statsMarker.getIntrinsicHeight();
|
||||||
statsMarker.setBounds(0, 0, markerWidth, markerHeight);
|
statsMarker.setBounds(0, 0, markerWidth, markerHeight);
|
||||||
@@ -509,10 +509,16 @@ public class ChartView extends View {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
updateEffectiveDimensionsIfChanged(
|
||||||
|
View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(heightMeasureSpec));
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas c) {
|
protected void onDraw(Canvas c) {
|
||||||
synchronized (data) {
|
synchronized (data) {
|
||||||
updateEffectiveDimensionsIfChanged(c);
|
|
||||||
|
|
||||||
// Keep original state.
|
// Keep original state.
|
||||||
c.save();
|
c.save();
|
||||||
@@ -742,13 +748,16 @@ public class ChartView extends View {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the effective dimensions where the graph will be drawn, only if the
|
* Updates the effective dimensions where the graph will be drawn, only if the
|
||||||
* dimensions of the given canvas have changed since the last call.
|
* dimensions have changed since the last call.
|
||||||
|
*
|
||||||
|
* @param newWidth the new width
|
||||||
|
* @param newHeight the new height
|
||||||
*/
|
*/
|
||||||
private void updateEffectiveDimensionsIfChanged(Canvas c) {
|
private void updateEffectiveDimensionsIfChanged(int newWidth, int newHeight) {
|
||||||
if (w != c.getWidth() || h != c.getHeight()) {
|
if (w != newWidth || h != newHeight) {
|
||||||
// Dimensions have changed (for example due to orientation change).
|
// Dimensions have changed (for example due to orientation change).
|
||||||
w = c.getWidth();
|
w = newWidth;
|
||||||
h = c.getHeight();
|
h = newHeight;
|
||||||
updateEffectiveDimensions();
|
updateEffectiveDimensions();
|
||||||
setUpPath();
|
setUpPath();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class MapOverlay extends Overlay implements OnSharedPreferenceChangeListe
|
|||||||
arrow.setBounds(0, 0, arrowWidth, arrowHeight);
|
arrow.setBounds(0, 0, arrowWidth, arrowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
statsMarker = resources.getDrawable(R.drawable.ylw_pushpin);
|
statsMarker = resources.getDrawable(R.drawable.yellow_pushpin);
|
||||||
markerWidth = statsMarker.getIntrinsicWidth();
|
markerWidth = statsMarker.getIntrinsicWidth();
|
||||||
markerHeight = statsMarker.getIntrinsicHeight();
|
markerHeight = statsMarker.getIntrinsicHeight();
|
||||||
statsMarker.setBounds(0, 0, markerWidth, markerHeight);
|
statsMarker.setBounds(0, 0, markerWidth, markerHeight);
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ import com.google.android.apps.mytracks.util.IntentUtils;
|
|||||||
import com.google.android.apps.mytracks.util.StatsUtils;
|
import com.google.android.apps.mytracks.util.StatsUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -74,23 +72,17 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
|
|||||||
waypointSection.setVisibility(View.VISIBLE);
|
waypointSection.setVisibility(View.VISIBLE);
|
||||||
statisticsSection.setVisibility(View.GONE);
|
statisticsSection.setVisibility(View.GONE);
|
||||||
|
|
||||||
TextView markerType = (TextView) findViewById(R.id.marker_detail_marker_type);
|
TextView markerType = (TextView) findViewById(R.id.marker_detail_waypoint_marker_type);
|
||||||
markerType.setText(getString(R.string.marker_detail_marker_type, waypoint.getCategory()));
|
markerType.setText(getString(
|
||||||
TextView description = (TextView) findViewById(R.id.marker_detail_description);
|
R.string.marker_detail_waypoint_marker_type, waypoint.getCategory()));
|
||||||
description.setText(getString(R.string.marker_detail_description, waypoint.getDescription()));
|
TextView description = (TextView) findViewById(R.id.marker_detail_waypoint_description);
|
||||||
|
description.setText(getString(
|
||||||
|
R.string.marker_detail_waypoint_description, waypoint.getDescription()));
|
||||||
} else {
|
} else {
|
||||||
waypointSection.setVisibility(View.GONE);
|
waypointSection.setVisibility(View.GONE);
|
||||||
statisticsSection.setVisibility(View.VISIBLE);
|
statisticsSection.setVisibility(View.VISIBLE);
|
||||||
|
StatsUtils.setTripStatisticsValues(this, waypoint.getStatistics());
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
StatsUtils.setLocationValues(this, waypoint.getLocation(), false);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
boolean metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
|
|
||||||
boolean reportSpeed = preferences.getBoolean(getString(R.string.report_speed_key), true);
|
|
||||||
|
|
||||||
StatsUtils.setSpeedLabels(this, reportSpeed, false);
|
|
||||||
StatsUtils.setTripStatisticsValues(this, waypoint.getStatistics(), metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setLocationElevationValue(this, waypoint.getLocation().getAltitude(), metricUnits);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,23 +20,20 @@ import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
|||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest.WaypointType;
|
import com.google.android.apps.mytracks.content.WaypointCreationRequest.WaypointType;
|
||||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity to add/edit a marker.
|
* An activity to add/edit a marker.
|
||||||
@@ -47,19 +44,25 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
|
|
||||||
private static final String TAG = MarkerEditActivity.class.getSimpleName();
|
private static final String TAG = MarkerEditActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
public static final String EXTRA_TRACK_ID = "track_id";
|
||||||
public static final String EXTRA_MARKER_ID = "marker_id";
|
public static final String EXTRA_MARKER_ID = "marker_id";
|
||||||
|
public static final String EXTRA_STATISTICS_MARKER = "statistics_marker";
|
||||||
|
|
||||||
|
private long trackId;
|
||||||
private long markerId;
|
private long markerId;
|
||||||
|
private boolean statisticsMarker;
|
||||||
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
||||||
private Waypoint waypoint;
|
private Waypoint waypoint;
|
||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
private View typeSection;
|
private View typeSection;
|
||||||
private RadioGroup type;
|
private RadioGroup type;
|
||||||
private EditText name;
|
private View statisticsSection;
|
||||||
|
private EditText statisticsName;
|
||||||
private View waypointSection;
|
private View waypointSection;
|
||||||
private AutoCompleteTextView markerType;
|
private EditText waypointName;
|
||||||
private EditText description;
|
private AutoCompleteTextView waypointMarkerType;
|
||||||
|
private EditText waypointDescription;
|
||||||
private Button done;
|
private Button done;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,30 +70,48 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
setContentView(R.layout.marker_edit);
|
setContentView(R.layout.marker_edit);
|
||||||
|
|
||||||
|
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
||||||
markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
|
markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
statisticsMarker = getIntent().getBooleanExtra(EXTRA_STATISTICS_MARKER, true);
|
||||||
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||||
|
|
||||||
// Setup UI elements
|
// Setup UI elements
|
||||||
typeSection = findViewById(R.id.marker_edit_type_section);
|
typeSection = findViewById(R.id.marker_edit_type_section);
|
||||||
type = (RadioGroup) findViewById(R.id.marker_edit_type);
|
type = (RadioGroup) findViewById(R.id.marker_edit_type);
|
||||||
type.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
type.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
boolean statistics = checkedId == R.id.marker_edit_type_statistics;
|
boolean statistics = checkedId == R.id.marker_edit_statistics;
|
||||||
name.setText(
|
statisticsSection.setVisibility(statistics ? View.VISIBLE : View.GONE);
|
||||||
statistics ? R.string.marker_edit_type_statistics : R.string.marker_edit_type_waypoint);
|
waypointSection.setVisibility(statistics ? View.GONE : View.VISIBLE);
|
||||||
// Call selectAll so that all EditText have selectAllOnFocus style.
|
int nextMarkerNumber = trackId == -1L ? -1
|
||||||
name.selectAll();
|
: MyTracksProviderUtils.Factory.get(MarkerEditActivity.this)
|
||||||
updateUiByMarkerType(statistics);
|
.getNextMarkerNumber(trackId, statistics);
|
||||||
|
if (statistics) {
|
||||||
|
String name = nextMarkerNumber == -1 ? getString(R.string.marker_type_statistics)
|
||||||
|
: getString(R.string.marker_statistics_name_format, nextMarkerNumber);
|
||||||
|
statisticsName.setText(name);
|
||||||
|
statisticsName.selectAll();
|
||||||
|
} else {
|
||||||
|
String name = nextMarkerNumber == -1 ? getString(R.string.marker_type_waypoint)
|
||||||
|
: getString(R.string.marker_waypoint_name_format, nextMarkerNumber);
|
||||||
|
waypointName.setText(name);
|
||||||
|
waypointName.selectAll();
|
||||||
|
waypointMarkerType.setText("");
|
||||||
|
waypointDescription.setText("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
name = (EditText) findViewById(R.id.marker_edit_name);
|
statisticsSection = findViewById(R.id.marker_edit_statistics_section);
|
||||||
|
statisticsName = (EditText) findViewById(R.id.marker_edit_statistics_name);
|
||||||
|
|
||||||
waypointSection = findViewById(R.id.marker_edit_waypoint_section);
|
waypointSection = findViewById(R.id.marker_edit_waypoint_section);
|
||||||
markerType = (AutoCompleteTextView) findViewById(R.id.marker_edit_marker_type);
|
waypointName = (EditText) findViewById(R.id.marker_edit_waypoint_name);
|
||||||
|
waypointMarkerType = (AutoCompleteTextView) findViewById(R.id.marker_edit_waypoint_marker_type);
|
||||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
||||||
this, R.array.waypoint_types, android.R.layout.simple_dropdown_item_1line);
|
this, R.array.waypoint_types, android.R.layout.simple_dropdown_item_1line);
|
||||||
markerType.setAdapter(adapter);
|
waypointMarkerType.setAdapter(adapter);
|
||||||
description = (EditText) findViewById(R.id.marker_edit_description);
|
waypointDescription = (EditText) findViewById(R.id.marker_edit_waypoint_description);
|
||||||
|
|
||||||
Button cancel = (Button) findViewById(R.id.marker_edit_cancel);
|
Button cancel = (Button) findViewById(R.id.marker_edit_cancel);
|
||||||
cancel.setOnClickListener(new OnClickListener() {
|
cancel.setOnClickListener(new OnClickListener() {
|
||||||
@@ -109,9 +130,9 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
private void updateUiByMarkerId() {
|
private void updateUiByMarkerId() {
|
||||||
final boolean newMarker = markerId == -1L;
|
final boolean newMarker = markerId == -1L;
|
||||||
|
|
||||||
setTitle(newMarker ? R.string.marker_edit_add_title : R.string.menu_edit);
|
setTitle(newMarker ? R.string.menu_insert_marker : R.string.menu_edit);
|
||||||
typeSection.setVisibility(newMarker ? View.VISIBLE : View.GONE);
|
typeSection.setVisibility(newMarker ? View.VISIBLE : View.GONE);
|
||||||
done.setText(newMarker ? R.string.marker_edit_add : R.string.generic_save);
|
done.setText(newMarker ? R.string.generic_add : R.string.generic_save);
|
||||||
done.setOnClickListener(new View.OnClickListener() {
|
done.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -125,7 +146,7 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (newMarker) {
|
if (newMarker) {
|
||||||
type.check(R.id.marker_edit_type_statistics);
|
type.check(statisticsMarker ? R.id.marker_edit_statistics : R.id.marker_edit_waypoint);
|
||||||
} else {
|
} else {
|
||||||
waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
||||||
if (waypoint == null) {
|
if (waypoint == null) {
|
||||||
@@ -133,29 +154,19 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
name.setText(waypoint.getName());
|
|
||||||
boolean statistics = waypoint.getType() == Waypoint.TYPE_STATISTICS;
|
boolean statistics = waypoint.getType() == Waypoint.TYPE_STATISTICS;
|
||||||
updateUiByMarkerType(statistics);
|
statisticsSection.setVisibility(statistics ? View.VISIBLE : View.GONE);
|
||||||
if (!statistics) {
|
waypointSection.setVisibility(statistics ? View.GONE : View.VISIBLE);
|
||||||
markerType.setText(waypoint.getCategory());
|
if (statistics) {
|
||||||
description.setText(waypoint.getDescription());
|
statisticsName.setText(waypoint.getName());
|
||||||
}
|
} else {
|
||||||
|
waypointName.setText(waypoint.getName());
|
||||||
|
waypointMarkerType.setText(waypoint.getCategory());
|
||||||
|
waypointDescription.setText(waypoint.getDescription());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the UI by marker type.
|
|
||||||
*
|
|
||||||
* @param statistics true for a statistics marker
|
|
||||||
*/
|
|
||||||
private void updateUiByMarkerType(boolean statistics) {
|
|
||||||
name.setCompoundDrawablesWithIntrinsicBounds(
|
|
||||||
statistics ? R.drawable.ylw_pushpin : R.drawable.blue_pushpin, 0, 0, 0);
|
|
||||||
name.setImeOptions(statistics ? EditorInfo.IME_ACTION_DONE : EditorInfo.IME_ACTION_NEXT);
|
|
||||||
waypointSection.setVisibility(statistics ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@@ -172,41 +183,33 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
|
|||||||
* Adds a marker.
|
* Adds a marker.
|
||||||
*/
|
*/
|
||||||
private void addMarker() {
|
private void addMarker() {
|
||||||
boolean statistics = type.getCheckedRadioButtonId() == R.id.marker_edit_type_statistics;
|
boolean statistics = type.getCheckedRadioButtonId() == R.id.marker_edit_statistics;
|
||||||
WaypointType waypointType = statistics ? WaypointType.STATISTICS : WaypointType.MARKER;
|
PreferencesUtils.setBoolean(this, R.string.pick_statistics_marker_key, statistics);
|
||||||
String markerCategory = statistics ? null : markerType.getText().toString();
|
|
||||||
String markerDescription = statistics ? null : description.getText().toString();
|
WaypointType waypointType = statistics ? WaypointType.STATISTICS : WaypointType.WAYPOINT;
|
||||||
String markerIconUrl = getString(
|
String markerName = statistics ? statisticsName.getText().toString()
|
||||||
statistics ? R.string.marker_statistics_icon_url : R.string.marker_waypoint_icon_url);
|
: waypointName.getText().toString();
|
||||||
|
String markerCategory = statistics ? null : waypointMarkerType.getText().toString();
|
||||||
|
String markerDescription = statistics ? null : waypointDescription.getText().toString();
|
||||||
|
String markerIconUrl = getString(statistics ? R.string.marker_statistics_icon_url
|
||||||
|
: R.string.marker_waypoint_icon_url);
|
||||||
WaypointCreationRequest waypointCreationRequest = new WaypointCreationRequest(
|
WaypointCreationRequest waypointCreationRequest = new WaypointCreationRequest(
|
||||||
waypointType, name.getText().toString(), markerCategory, markerDescription, markerIconUrl);
|
waypointType, markerName, markerCategory, markerDescription, markerIconUrl);
|
||||||
ITrackRecordingService trackRecordingService =
|
TrackRecordingServiceConnectionUtils.addMarker(
|
||||||
trackRecordingServiceConnection.getServiceIfBound();
|
this, trackRecordingServiceConnection, waypointCreationRequest);
|
||||||
if (trackRecordingService == null) {
|
|
||||||
Log.d(TAG, "Unable to add marker, no track recording service");
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
if (trackRecordingService.insertWaypoint(waypointCreationRequest) != -1L) {
|
|
||||||
Toast.makeText(this, R.string.marker_edit_add_success, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, "Unable to add marker", e);
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
Log.e(TAG, "Unable to add marker.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Toast.makeText(this, R.string.marker_edit_add_error, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves a marker.
|
* Saves a marker.
|
||||||
*/
|
*/
|
||||||
private void saveMarker() {
|
private void saveMarker() {
|
||||||
waypoint.setName(name.getText().toString());
|
boolean statistics = waypoint.getType() == Waypoint.TYPE_STATISTICS;
|
||||||
if (waypoint.getType() == Waypoint.TYPE_WAYPOINT) {
|
if (statistics) {
|
||||||
waypoint.setCategory(markerType.getText().toString());
|
waypoint.setName(statisticsName.getText().toString());
|
||||||
waypoint.setDescription(description.getText().toString());
|
} else {
|
||||||
|
waypoint.setName(waypointName.getText().toString());
|
||||||
|
waypoint.setCategory(waypointMarkerType.getText().toString());
|
||||||
|
waypoint.setDescription(waypointDescription.getText().toString());
|
||||||
}
|
}
|
||||||
MyTracksProviderUtils.Factory.get(this).updateWaypoint(waypoint);
|
MyTracksProviderUtils.Factory.get(this).updateWaypoint(waypoint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
|||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.MarkerAddDialogFragment;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -137,13 +138,13 @@ public class MarkerListActivity extends AbstractMyTracksActivity {
|
|||||||
|
|
||||||
boolean statistics = cursor.getInt(typeIndex) == Waypoint.TYPE_STATISTICS;
|
boolean statistics = cursor.getInt(typeIndex) == Waypoint.TYPE_STATISTICS;
|
||||||
String name = cursor.getString(nameIndex);
|
String name = cursor.getString(nameIndex);
|
||||||
int iconId = statistics ? R.drawable.ylw_pushpin : R.drawable.blue_pushpin;
|
int iconId = statistics ? R.drawable.yellow_pushpin : R.drawable.blue_pushpin;
|
||||||
String category = statistics ? null : cursor.getString(categoryIndex);
|
String category = statistics ? null : cursor.getString(categoryIndex);
|
||||||
long time = cursor.getLong(timeIndex);
|
long time = cursor.getLong(timeIndex);
|
||||||
String startTime = time == 0
|
String startTime = time == 0
|
||||||
? null : StringUtils.formatDateTime(MarkerListActivity.this, time);
|
? null : StringUtils.formatDateTime(MarkerListActivity.this, time);
|
||||||
String description = statistics ? null : cursor.getString(descriptionIndex);
|
String description = statistics ? null : cursor.getString(descriptionIndex);
|
||||||
ListItemUtil.setListItem(view, name, iconId, category, null, null, startTime, description);
|
ListItemUtils.setListItem(view, name, iconId, category, null, null, startTime, description);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
listView.setAdapter(resourceCursorAdapter);
|
listView.setAdapter(resourceCursorAdapter);
|
||||||
@@ -195,8 +196,8 @@ public class MarkerListActivity extends AbstractMyTracksActivity {
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.marker_list_insert_marker:
|
case R.id.marker_list_insert_marker:
|
||||||
Intent intent = IntentUtils.newIntent(this, MarkerEditActivity.class);
|
MarkerAddDialogFragment.newInstance(trackId)
|
||||||
startActivity(intent);
|
.show(getSupportFragmentManager(), MarkerAddDialogFragment.MARKER_ADD_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_list_search:
|
case R.id.marker_list_search:
|
||||||
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
||||||
|
|||||||
@@ -28,17 +28,17 @@ import android.os.Bundle;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity to export all the tracks to the SD card.
|
* An activity to save all the tracks to the SD card.
|
||||||
*
|
*
|
||||||
* @author Sandor Dornbush
|
* @author Sandor Dornbush
|
||||||
*/
|
*/
|
||||||
public class ExportActivity extends Activity {
|
public class SaveAllActivity extends Activity {
|
||||||
|
|
||||||
public static final String EXTRA_TRACK_FILE_FORMAT = "track_file_format";
|
public static final String EXTRA_TRACK_FILE_FORMAT = "track_file_format";
|
||||||
|
|
||||||
private static final int DIALOG_PROGRESS_ID = 0;
|
private static final int DIALOG_PROGRESS_ID = 0;
|
||||||
|
|
||||||
private ExportAsyncTask exportAsyncTask;
|
private SaveAllAsyncTask saveAllAsyncTask;
|
||||||
private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,22 +46,22 @@ public class ExportActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Object retained = getLastNonConfigurationInstance();
|
Object retained = getLastNonConfigurationInstance();
|
||||||
if (retained instanceof ExportAsyncTask) {
|
if (retained instanceof SaveAllAsyncTask) {
|
||||||
exportAsyncTask = (ExportAsyncTask) retained;
|
saveAllAsyncTask = (SaveAllAsyncTask) retained;
|
||||||
exportAsyncTask.setActivity(this);
|
saveAllAsyncTask.setActivity(this);
|
||||||
} else {
|
} else {
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
TrackFileFormat trackFileFormat = intent.getParcelableExtra(EXTRA_TRACK_FILE_FORMAT);
|
TrackFileFormat trackFileFormat = intent.getParcelableExtra(EXTRA_TRACK_FILE_FORMAT);
|
||||||
|
|
||||||
exportAsyncTask = new ExportAsyncTask(this, trackFileFormat);
|
saveAllAsyncTask = new SaveAllAsyncTask(this, trackFileFormat);
|
||||||
exportAsyncTask.execute();
|
saveAllAsyncTask.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object onRetainNonConfigurationInstance() {
|
public Object onRetainNonConfigurationInstance() {
|
||||||
exportAsyncTask.setActivity(null);
|
saveAllAsyncTask.setActivity(null);
|
||||||
return exportAsyncTask;
|
return saveAllAsyncTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,10 +70,10 @@ public class ExportActivity extends Activity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
progressDialog = DialogUtils.createHorizontalProgressDialog(
|
progressDialog = DialogUtils.createHorizontalProgressDialog(
|
||||||
this, R.string.export_progress_message, new DialogInterface.OnCancelListener() {
|
this, R.string.save_all_progress_message, new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
exportAsyncTask.cancel(true);
|
saveAllAsyncTask.cancel(true);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -102,7 +102,7 @@ public class ExportActivity extends Activity {
|
|||||||
/**
|
/**
|
||||||
* Sets the progress dialog value.
|
* Sets the progress dialog value.
|
||||||
*
|
*
|
||||||
* @param number the number of tracks exported
|
* @param number the number of tracks saved
|
||||||
* @param max the maximum number of tracks
|
* @param max the maximum number of tracks
|
||||||
*/
|
*/
|
||||||
public void setProgressDialogValue(int number, int max) {
|
public void setProgressDialogValue(int number, int max) {
|
||||||
@@ -31,13 +31,13 @@ import android.os.AsyncTask;
|
|||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AsyncTask to export all the tracks to the SD card.
|
* AsyncTask to save all the tracks to the SD card.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
public class SaveAllAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
||||||
|
|
||||||
private ExportActivity exportActivity;
|
private SaveAllActivity saveAllActivity;
|
||||||
private final TrackFileFormat trackFileFormat;
|
private final TrackFileFormat trackFileFormat;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final MyTracksProviderUtils myTracksProviderUtils;
|
private final MyTracksProviderUtils myTracksProviderUtils;
|
||||||
@@ -56,40 +56,40 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
/**
|
/**
|
||||||
* Creates an AsyncTask.
|
* Creates an AsyncTask.
|
||||||
*
|
*
|
||||||
* @param exportActivity the activity currently associated with this AsyncTask
|
* @param saveAllActivity the activity currently associated with this AsyncTask
|
||||||
* @param trackFileFormat the track file format
|
* @param trackFileFormat the track file format
|
||||||
*/
|
*/
|
||||||
public ExportAsyncTask(ExportActivity exportActivity, TrackFileFormat trackFileFormat) {
|
public SaveAllAsyncTask(SaveAllActivity saveAllActivity, TrackFileFormat trackFileFormat) {
|
||||||
this.exportActivity = exportActivity;
|
this.saveAllActivity = saveAllActivity;
|
||||||
this.trackFileFormat = trackFileFormat;
|
this.trackFileFormat = trackFileFormat;
|
||||||
context = exportActivity.getApplicationContext();
|
context = saveAllActivity.getApplicationContext();
|
||||||
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(exportActivity);
|
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(saveAllActivity);
|
||||||
|
|
||||||
// Get the wake lock if not recording
|
// Get the wake lock if not recording
|
||||||
if (PreferencesUtils.getRecordingTrackId(exportActivity) == -1L) {
|
if (PreferencesUtils.getRecordingTrackId(saveAllActivity) == -1L) {
|
||||||
wakeLock = SystemUtils.acquireWakeLock(exportActivity, wakeLock);
|
wakeLock = SystemUtils.acquireWakeLock(saveAllActivity, wakeLock);
|
||||||
}
|
}
|
||||||
success = false;
|
success = false;
|
||||||
completed = false;
|
completed = false;
|
||||||
messageId = R.string.export_error;
|
messageId = R.string.save_all_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current {@link ExportActivity} associated with this AyncTask.
|
* Sets the current {@link SaveAllActivity} associated with this AyncTask.
|
||||||
*
|
*
|
||||||
* @param exportActivity the current {@link ExportActivity}, can be null
|
* @param saveAllActivity the current {@link SaveAllActivity}, can be null
|
||||||
*/
|
*/
|
||||||
public void setActivity(ExportActivity exportActivity) {
|
public void setActivity(SaveAllActivity saveAllActivity) {
|
||||||
this.exportActivity = exportActivity;
|
this.saveAllActivity = saveAllActivity;
|
||||||
if (completed && exportActivity != null) {
|
if (completed && saveAllActivity != null) {
|
||||||
exportActivity.onAsyncTaskCompleted(success, messageId);
|
saveAllActivity.onAsyncTaskCompleted(success, messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
if (exportActivity != null) {
|
if (saveAllActivity != null) {
|
||||||
exportActivity.showProgressDialog();
|
saveAllActivity.showProgressDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
try {
|
try {
|
||||||
cursor = myTracksProviderUtils.getTracksCursor(null, null, TracksColumns._ID);
|
cursor = myTracksProviderUtils.getTracksCursor(null, null, TracksColumns._ID);
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
messageId = R.string.export_success;
|
messageId = R.string.save_all_success;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int count = cursor.getCount();
|
int count = cursor.getCount();
|
||||||
@@ -123,7 +123,7 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
}
|
}
|
||||||
publishProgress(i + 1, count);
|
publishProgress(i + 1, count);
|
||||||
}
|
}
|
||||||
messageId = R.string.export_success;
|
messageId = R.string.save_all_success;
|
||||||
return true;
|
return true;
|
||||||
} finally {
|
} finally {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
@@ -138,8 +138,8 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(Integer... values) {
|
protected void onProgressUpdate(Integer... values) {
|
||||||
if (exportActivity != null) {
|
if (saveAllActivity != null) {
|
||||||
exportActivity.setProgressDialogValue(values[0], values[1]);
|
saveAllActivity.setProgressDialogValue(values[0], values[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,8 +147,8 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
success = result;
|
success = result;
|
||||||
completed = true;
|
completed = true;
|
||||||
if (exportActivity != null) {
|
if (saveAllActivity != null) {
|
||||||
exportActivity.onAsyncTaskCompleted(success, messageId);
|
saveAllActivity.onAsyncTaskCompleted(success, messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
|||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -105,7 +105,6 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
private SearchEngine searchEngine;
|
private SearchEngine searchEngine;
|
||||||
private SearchRecentSuggestions searchRecentSuggestions;
|
private SearchRecentSuggestions searchRecentSuggestions;
|
||||||
private LocationManager locationManager;
|
private LocationManager locationManager;
|
||||||
private SharedPreferences sharedPreferences;
|
|
||||||
private long recordingTrackId;
|
private long recordingTrackId;
|
||||||
private boolean metricUnits;
|
private boolean metricUnits;
|
||||||
private ArrayAdapter<Map<String, Object>> arrayAdapter;
|
private ArrayAdapter<Map<String, Object>> arrayAdapter;
|
||||||
@@ -124,7 +123,8 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
searchEngine = new SearchEngine(myTracksProviderUtils);
|
searchEngine = new SearchEngine(myTracksProviderUtils);
|
||||||
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
|
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
|
||||||
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||||
sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
SharedPreferences sharedPreferences = getSharedPreferences(
|
||||||
|
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||||
recordingTrackId = PreferencesUtils.getRecordingTrackId(this);
|
recordingTrackId = PreferencesUtils.getRecordingTrackId(this);
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
String totalDistance = (String) resultMap.get(TOTAL_DISTANCE_FIELD);
|
String totalDistance = (String) resultMap.get(TOTAL_DISTANCE_FIELD);
|
||||||
String startTime = (String) resultMap.get(START_TIME_FIELD);
|
String startTime = (String) resultMap.get(START_TIME_FIELD);
|
||||||
String description = (String) resultMap.get(DESCRIPTION_FIELD);
|
String description = (String) resultMap.get(DESCRIPTION_FIELD);
|
||||||
ListItemUtil.setListItem(view,
|
ListItemUtils.setListItem(view,
|
||||||
name,
|
name,
|
||||||
iconId,
|
iconId,
|
||||||
category,
|
category,
|
||||||
@@ -185,12 +185,11 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
metricUnits = sharedPreferences.getBoolean(getString(R.string.metric_units_key), true);
|
metricUnits = PreferencesUtils.isMetricUnits(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
handleIntent(intent);
|
handleIntent(intent);
|
||||||
}
|
}
|
||||||
@@ -270,6 +269,8 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
// Close the search result since its content can change after edit.
|
||||||
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_delete:
|
case R.id.list_context_menu_delete:
|
||||||
if (markerId != null) {
|
if (markerId != null) {
|
||||||
@@ -378,7 +379,7 @@ public class SearchListActivity extends AbstractMyTracksActivity {
|
|||||||
|
|
||||||
boolean statistics = waypoint.getType() == Waypoint.TYPE_STATISTICS;
|
boolean statistics = waypoint.getType() == Waypoint.TYPE_STATISTICS;
|
||||||
resultMap.put(NAME_FIELD, waypoint.getName());
|
resultMap.put(NAME_FIELD, waypoint.getName());
|
||||||
resultMap.put(ICON_FIELD, statistics ? R.drawable.ylw_pushpin : R.drawable.blue_pushpin);
|
resultMap.put(ICON_FIELD, statistics ? R.drawable.yellow_pushpin : R.drawable.blue_pushpin);
|
||||||
resultMap.put(CATEGORY_FIELD, statistics ? null : waypoint.getCategory());
|
resultMap.put(CATEGORY_FIELD, statistics ? null : waypoint.getCategory());
|
||||||
|
|
||||||
long time = waypoint.getLocation().getTime();
|
long time = waypoint.getLocation().getTime();
|
||||||
|
|||||||
@@ -131,8 +131,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
// Hook up switching of displayed list entries between metric and imperial
|
// Hook up switching of displayed list entries between metric and imperial
|
||||||
// units
|
// units
|
||||||
CheckBoxPreference metricUnitsPreference =
|
CheckBoxPreference metricUnitsPreference =
|
||||||
(CheckBoxPreference) findPreference(
|
(CheckBoxPreference) findPreference(PreferencesUtils.getMetricUnitsKey(this));
|
||||||
getString(R.string.metric_units_key));
|
|
||||||
metricUnitsPreference.setOnPreferenceChangeListener(
|
metricUnitsPreference.setOnPreferenceChangeListener(
|
||||||
new OnPreferenceChangeListener() {
|
new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -643,9 +642,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
* If the units are not metric convert the value before displaying.
|
* If the units are not metric convert the value before displaying.
|
||||||
*/
|
*/
|
||||||
private void viewTrackColorModeSettings(EditTextPreference preference, int id) {
|
private void viewTrackColorModeSettings(EditTextPreference preference, int id) {
|
||||||
CheckBoxPreference metricUnitsPreference = (CheckBoxPreference) findPreference(
|
if (PreferencesUtils.isMetricUnits(this)) {
|
||||||
getString(R.string.metric_units_key));
|
|
||||||
if(metricUnitsPreference.isChecked()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Convert miles/h to km/h
|
// Convert miles/h to km/h
|
||||||
@@ -665,10 +662,10 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
* If the units are not metric convert the value before saving.
|
* If the units are not metric convert the value before saving.
|
||||||
*/
|
*/
|
||||||
private void validateTrackColorModeSettings(String newValue, int id) {
|
private void validateTrackColorModeSettings(String newValue, int id) {
|
||||||
CheckBoxPreference metricUnitsPreference = (CheckBoxPreference) findPreference(
|
|
||||||
getString(R.string.metric_units_key));
|
|
||||||
String metricspeed;
|
String metricspeed;
|
||||||
if(!metricUnitsPreference.isChecked()) {
|
if (PreferencesUtils.isMetricUnits(this)) {
|
||||||
|
metricspeed = newValue;
|
||||||
|
} else {
|
||||||
// Convert miles/h to km/h
|
// Convert miles/h to km/h
|
||||||
try {
|
try {
|
||||||
metricspeed = String.valueOf(
|
metricspeed = String.valueOf(
|
||||||
@@ -676,8 +673,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
metricspeed = "0";
|
metricspeed = "0";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
metricspeed = newValue;
|
|
||||||
}
|
}
|
||||||
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||||
Editor editor = prefs.edit();
|
Editor editor = prefs.edit();
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ import com.google.android.apps.mytracks.fragments.ChartSettingsDialogFragment;
|
|||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.MapFragment;
|
import com.google.android.apps.mytracks.fragments.MapFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.MarkerAddDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.StatsFragment;
|
import com.google.android.apps.mytracks.fragments.StatsFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.StatsSettingsDialogFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.StatsSettingsDialogFragment.OnStatsSettingsChangedListener;
|
||||||
import com.google.android.apps.mytracks.io.file.SaveActivity;
|
import com.google.android.apps.mytracks.io.file.SaveActivity;
|
||||||
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
|
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadServiceChooserActivity;
|
import com.google.android.apps.mytracks.io.sendtogoogle.UploadServiceChooserActivity;
|
||||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
@@ -47,7 +49,6 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -55,7 +56,6 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
import android.widget.TabHost.TabSpec;
|
import android.widget.TabHost.TabSpec;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -65,7 +65,8 @@ import java.util.List;
|
|||||||
* @author Leif Hendrik Wilden
|
* @author Leif Hendrik Wilden
|
||||||
* @author Rodrigo Damazio
|
* @author Rodrigo Damazio
|
||||||
*/
|
*/
|
||||||
public class TrackDetailActivity extends AbstractMyTracksActivity {
|
public class TrackDetailActivity extends AbstractMyTracksActivity
|
||||||
|
implements OnStatsSettingsChangedListener {
|
||||||
|
|
||||||
public static final String EXTRA_TRACK_ID = "track_id";
|
public static final String EXTRA_TRACK_ID = "track_id";
|
||||||
public static final String EXTRA_MARKER_ID = "marker_id";
|
public static final String EXTRA_MARKER_ID = "marker_id";
|
||||||
@@ -160,7 +161,6 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
handleIntent(intent);
|
handleIntent(intent);
|
||||||
}
|
}
|
||||||
@@ -235,16 +235,22 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
String currentTabTag = tabHost.getCurrentTabTag();
|
String currentTabTag = tabHost.getCurrentTabTag();
|
||||||
menu.findItem(R.id.track_detail_chart_settings).setVisible(
|
menu.findItem(R.id.track_detail_chart_settings).setVisible(
|
||||||
ChartFragment.CHART_FRAGMENT_TAG.equals(currentTabTag));
|
ChartFragment.CHART_FRAGMENT_TAG.equals(currentTabTag));
|
||||||
menu.findItem(R.id.track_detail_my_location)
|
menu.findItem(R.id.track_detail_stats_settings).setVisible(
|
||||||
|
StatsFragment.STATS_FRAGMENT_TAG.equals(currentTabTag));
|
||||||
|
MenuItem satelliteMode = menu.findItem(R.id.track_detail_satellite_mode)
|
||||||
.setVisible(MapFragment.MAP_FRAGMENT_TAG.equals(currentTabTag));
|
.setVisible(MapFragment.MAP_FRAGMENT_TAG.equals(currentTabTag));
|
||||||
|
|
||||||
// Set map or satellite mode
|
if (satelliteMode.isVisible()) {
|
||||||
MapFragment mapFragment = (MapFragment) getSupportFragmentManager()
|
MapFragment mapFragment = (MapFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(MapFragment.MAP_FRAGMENT_TAG);
|
.findFragmentByTag(MapFragment.MAP_FRAGMENT_TAG);
|
||||||
boolean isSatelliteMode = mapFragment != null ? mapFragment.isSatelliteView() : false;
|
/*
|
||||||
menu.findItem(R.id.track_detail_satellite_mode)
|
* The current tag is mapFragment, thus safe to call its methods like
|
||||||
.setVisible(MapFragment.MAP_FRAGMENT_TAG.equals(currentTabTag))
|
* isSatelliteView.
|
||||||
.setTitle(isSatelliteMode ? R.string.menu_map_mode : R.string.menu_satellite_mode);
|
*/
|
||||||
|
boolean isSatelliteMode = mapFragment != null ? mapFragment.isSatelliteView() : false;
|
||||||
|
menu.findItem(R.id.track_detail_satellite_mode).setTitle(
|
||||||
|
isSatelliteMode ? R.string.menu_map_mode : R.string.menu_satellite_mode);
|
||||||
|
}
|
||||||
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
@@ -265,8 +271,8 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
TrackRecordingServiceConnectionUtils.stop(this, trackRecordingServiceConnection);
|
TrackRecordingServiceConnectionUtils.stop(this, trackRecordingServiceConnection);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_insert_marker:
|
case R.id.track_detail_insert_marker:
|
||||||
intent = IntentUtils.newIntent(this, MarkerEditActivity.class);
|
MarkerAddDialogFragment.newInstance(trackId)
|
||||||
startActivity(intent);
|
.show(getSupportFragmentManager(), MarkerAddDialogFragment.MARKER_ADD_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_play:
|
case R.id.track_detail_play:
|
||||||
if (isEarthInstalled()) {
|
if (isEarthInstalled()) {
|
||||||
@@ -281,12 +287,12 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
getSupportFragmentManager(), InstallEarthDialogFragment.INSTALL_EARTH_DIALOG_TAG);
|
getSupportFragmentManager(), InstallEarthDialogFragment.INSTALL_EARTH_DIALOG_TAG);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_share_map:
|
case R.id.track_detail_share_map_url:
|
||||||
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, false, false));
|
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, false, false));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_share_fusion_table:
|
case R.id.track_detail_share_fusion_table_url:
|
||||||
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, false, true, false));
|
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, false, true, false));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@@ -334,13 +340,6 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
DeleteOneTrackDialogFragment.newInstance(trackId).show(
|
DeleteOneTrackDialogFragment.newInstance(trackId).show(
|
||||||
getSupportFragmentManager(), DeleteOneTrackDialogFragment.DELETE_ONE_TRACK_DIALOG_TAG);
|
getSupportFragmentManager(), DeleteOneTrackDialogFragment.DELETE_ONE_TRACK_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_my_location:
|
|
||||||
mapFragment = (MapFragment) getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(MapFragment.MAP_FRAGMENT_TAG);
|
|
||||||
if (mapFragment != null) {
|
|
||||||
mapFragment.showMyLocation();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case R.id.track_detail_satellite_mode:
|
case R.id.track_detail_satellite_mode:
|
||||||
mapFragment = (MapFragment) getSupportFragmentManager()
|
mapFragment = (MapFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(MapFragment.MAP_FRAGMENT_TAG);
|
.findFragmentByTag(MapFragment.MAP_FRAGMENT_TAG);
|
||||||
@@ -348,13 +347,17 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
mapFragment.setSatelliteView(!mapFragment.isSatelliteView());
|
mapFragment.setSatelliteView(!mapFragment.isSatelliteView());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.track_detail_sensor_state:
|
||||||
|
intent = IntentUtils.newIntent(this, SensorStateActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
case R.id.track_detail_chart_settings:
|
case R.id.track_detail_chart_settings:
|
||||||
new ChartSettingsDialogFragment().show(
|
new ChartSettingsDialogFragment().show(
|
||||||
getSupportFragmentManager(), ChartSettingsDialogFragment.CHART_SETTINGS_DIALOG_TAG);
|
getSupportFragmentManager(), ChartSettingsDialogFragment.CHART_SETTINGS_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_sensor_state:
|
case R.id.track_detail_stats_settings:
|
||||||
intent = IntentUtils.newIntent(this, SensorStateActivity.class);
|
new StatsSettingsDialogFragment().show(
|
||||||
startActivity(intent);
|
getSupportFragmentManager(), StatsSettingsDialogFragment.STATS_SETTINGS_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_settings:
|
case R.id.track_detail_settings:
|
||||||
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
||||||
@@ -373,25 +376,8 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
public boolean onTrackballEvent(MotionEvent event) {
|
public boolean onTrackballEvent(MotionEvent event) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
if (TrackRecordingServiceConnectionUtils.isRecording(this, trackRecordingServiceConnection)) {
|
if (TrackRecordingServiceConnectionUtils.isRecording(this, trackRecordingServiceConnection)) {
|
||||||
ITrackRecordingService trackRecordingService = trackRecordingServiceConnection
|
TrackRecordingServiceConnectionUtils.addMarker(
|
||||||
.getServiceIfBound();
|
this, trackRecordingServiceConnection, WaypointCreationRequest.DEFAULT_STATISTICS);
|
||||||
if (trackRecordingService == null) {
|
|
||||||
Log.e(TAG, "The track recording service is null");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
boolean success = false;
|
|
||||||
try {
|
|
||||||
long waypointId = trackRecordingService.insertWaypoint(
|
|
||||||
WaypointCreationRequest.DEFAULT_STATISTICS);
|
|
||||||
if (waypointId != -1L) {
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, "Unable to insert waypoint", e);
|
|
||||||
}
|
|
||||||
Toast.makeText(this,
|
|
||||||
success ? R.string.marker_edit_add_success : R.string.marker_edit_add_error,
|
|
||||||
success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,6 +391,13 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
|
|||||||
return mapViewContainer;
|
return mapViewContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatsSettingsChanged() {
|
||||||
|
StatsFragment statsFragment = (StatsFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentByTag(StatsFragment.STATS_FRAGMENT_TAG);
|
||||||
|
statsFragment.updateUi();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the data in the intent.
|
* Handles the data in the intent.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,16 +17,18 @@
|
|||||||
package com.google.android.apps.mytracks;
|
package com.google.android.apps.mytracks;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
import com.google.android.apps.mytracks.content.TracksColumns;
|
||||||
|
import com.google.android.apps.mytracks.fragments.CheckUnitsDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteAllTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteAllTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.WelcomeDialogFragment;
|
||||||
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
|
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
|
||||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.EulaUtils;
|
import com.google.android.apps.mytracks.util.EulaUtils;
|
||||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||||
@@ -99,7 +101,6 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
TrackListActivity.this, R.string.track_list_record_success, Toast.LENGTH_SHORT).show();
|
TrackListActivity.this, R.string.track_list_record_success, Toast.LENGTH_SHORT).show();
|
||||||
Log.d(TAG, "Started a new recording");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(TrackListActivity.this, R.string.track_list_record_error, Toast.LENGTH_LONG)
|
Toast.makeText(TrackListActivity.this, R.string.track_list_record_error, Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
@@ -116,9 +117,11 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
sharedPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
|
sharedPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||||
|
boolean updateList = false;
|
||||||
// Note that key can be null
|
// Note that key can be null
|
||||||
if (getString(R.string.metric_units_key).equals(key)) {
|
if (PreferencesUtils.getMetricUnitsKey(TrackListActivity.this).equals(key)) {
|
||||||
metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
|
metricUnits = PreferencesUtils.isMetricUnits(TrackListActivity.this);
|
||||||
|
updateList = true;
|
||||||
}
|
}
|
||||||
if (PreferencesUtils.getRecordingTrackIdKey(TrackListActivity.this).equals(key)) {
|
if (PreferencesUtils.getRecordingTrackIdKey(TrackListActivity.this).equals(key)) {
|
||||||
recordingTrackId = PreferencesUtils.getRecordingTrackId(TrackListActivity.this);
|
recordingTrackId = PreferencesUtils.getRecordingTrackId(TrackListActivity.this);
|
||||||
@@ -127,8 +130,11 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
trackRecordingServiceConnection.startAndBind();
|
trackRecordingServiceConnection.startAndBind();
|
||||||
}
|
}
|
||||||
updateMenu();
|
updateMenu();
|
||||||
|
updateList = true;
|
||||||
|
}
|
||||||
|
if (updateList) {
|
||||||
|
resourceCursorAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
resourceCursorAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,8 +159,8 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
private MenuItem recordTrackMenuItem;
|
private MenuItem recordTrackMenuItem;
|
||||||
private MenuItem stopRecordingMenuItem;
|
private MenuItem stopRecordingMenuItem;
|
||||||
private MenuItem searchMenuItem;
|
private MenuItem searchMenuItem;
|
||||||
private MenuItem importAllMenuItem;
|
private MenuItem importMenuItem;
|
||||||
private MenuItem exportAllMenuItem;
|
private MenuItem saveAllMenuItem;
|
||||||
private MenuItem deleteAllMenuItem;
|
private MenuItem deleteAllMenuItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -170,7 +176,7 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
SharedPreferences sharedPreferences = getSharedPreferences(
|
SharedPreferences sharedPreferences = getSharedPreferences(
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||||
metricUnits = sharedPreferences.getBoolean(getString(R.string.metric_units_key), true);
|
metricUnits = PreferencesUtils.isMetricUnits(this);
|
||||||
recordingTrackId = PreferencesUtils.getRecordingTrackId(this);
|
recordingTrackId = PreferencesUtils.getRecordingTrackId(this);
|
||||||
|
|
||||||
ImageButton recordImageButton = (ImageButton) findViewById(R.id.track_list_record_button);
|
ImageButton recordImageButton = (ImageButton) findViewById(R.id.track_list_record_button);
|
||||||
@@ -217,7 +223,7 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
startTime = null;
|
startTime = null;
|
||||||
}
|
}
|
||||||
String description = cursor.getString(descriptionIndex);
|
String description = cursor.getString(descriptionIndex);
|
||||||
ListItemUtil.setListItem(view,
|
ListItemUtils.setListItem(view,
|
||||||
name,
|
name,
|
||||||
iconId,
|
iconId,
|
||||||
category,
|
category,
|
||||||
@@ -254,15 +260,48 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
showStartupDialogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows start up dialogs.
|
||||||
|
*/
|
||||||
|
public void showStartupDialogs() {
|
||||||
if (!EulaUtils.getEulaValue(this)) {
|
if (!EulaUtils.getEulaValue(this)) {
|
||||||
Fragment fragment = getSupportFragmentManager()
|
Fragment fragment = getSupportFragmentManager()
|
||||||
.findFragmentByTag(EulaDialogFragment.EULA_DIALOG_TAG);
|
.findFragmentByTag(EulaDialogFragment.EULA_DIALOG_TAG);
|
||||||
if (fragment == null) {
|
if (fragment == null) {
|
||||||
EulaDialogFragment.newInstance(false).show(
|
EulaDialogFragment.newInstance(false)
|
||||||
getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
|
.show(getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
|
||||||
}
|
}
|
||||||
|
} else if (PreferencesUtils.isShowWelcomeDialog(this)) {
|
||||||
|
Fragment fragment = getSupportFragmentManager()
|
||||||
|
.findFragmentByTag(WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
||||||
|
if (fragment == null) {
|
||||||
|
new WelcomeDialogFragment().show(
|
||||||
|
getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
||||||
|
}
|
||||||
|
} else if (PreferencesUtils.isShowCheckUnitsDialog(this)) {
|
||||||
|
Fragment fragment = getSupportFragmentManager()
|
||||||
|
.findFragmentByTag(CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
|
||||||
|
if (fragment == null) {
|
||||||
|
new CheckUnitsDialogFragment().show(
|
||||||
|
getSupportFragmentManager(), CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
enableEmptyView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the content of the empty view.
|
||||||
|
*/
|
||||||
|
private void enableEmptyView() {
|
||||||
|
View emptyMessage = findViewById(R.id.track_list_empty_message);
|
||||||
|
emptyMessage.setVisibility(View.VISIBLE);
|
||||||
|
View recordButton = findViewById(R.id.track_list_record_button);
|
||||||
|
recordButton.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
@@ -280,20 +319,20 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.track_list, menu);
|
getMenuInflater().inflate(R.menu.track_list, menu);
|
||||||
String fileTypes[] = getResources().getStringArray(R.array.file_types);
|
String fileTypes[] = getResources().getStringArray(R.array.file_types);
|
||||||
menu.findItem(R.id.track_list_export_gpx)
|
menu.findItem(R.id.track_list_save_all_gpx)
|
||||||
.setTitle(getString(R.string.menu_export_all_format, fileTypes[0]));
|
.setTitle(getString(R.string.menu_save_format, fileTypes[0]));
|
||||||
menu.findItem(R.id.track_list_export_kml)
|
menu.findItem(R.id.track_list_save_all_kml)
|
||||||
.setTitle(getString(R.string.menu_export_all_format, fileTypes[1]));
|
.setTitle(getString(R.string.menu_save_format, fileTypes[1]));
|
||||||
menu.findItem(R.id.track_list_export_csv)
|
menu.findItem(R.id.track_list_save_all_csv)
|
||||||
.setTitle(getString(R.string.menu_export_all_format, fileTypes[2]));
|
.setTitle(getString(R.string.menu_save_format, fileTypes[2]));
|
||||||
menu.findItem(R.id.track_list_export_tcx)
|
menu.findItem(R.id.track_list_save_all_tcx)
|
||||||
.setTitle(getString(R.string.menu_export_all_format, fileTypes[3]));
|
.setTitle(getString(R.string.menu_save_format, fileTypes[3]));
|
||||||
|
|
||||||
recordTrackMenuItem = menu.findItem(R.id.track_list_record_track);
|
recordTrackMenuItem = menu.findItem(R.id.track_list_record_track);
|
||||||
stopRecordingMenuItem = menu.findItem(R.id.track_list_stop_recording);
|
stopRecordingMenuItem = menu.findItem(R.id.track_list_stop_recording);
|
||||||
searchMenuItem = menu.findItem(R.id.track_list_search);
|
searchMenuItem = menu.findItem(R.id.track_list_search);
|
||||||
importAllMenuItem = menu.findItem(R.id.track_list_import_all);
|
importMenuItem = menu.findItem(R.id.track_list_import);
|
||||||
exportAllMenuItem = menu.findItem(R.id.track_list_export_all);
|
saveAllMenuItem = menu.findItem(R.id.track_list_save_all);
|
||||||
deleteAllMenuItem = menu.findItem(R.id.track_list_delete_all);
|
deleteAllMenuItem = menu.findItem(R.id.track_list_delete_all);
|
||||||
|
|
||||||
ApiAdapterFactory.getApiAdapter().configureSearchWidget(this, searchMenuItem);
|
ApiAdapterFactory.getApiAdapter().configureSearchWidget(this, searchMenuItem);
|
||||||
@@ -321,11 +360,11 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
if (stopRecordingMenuItem != null) {
|
if (stopRecordingMenuItem != null) {
|
||||||
stopRecordingMenuItem.setVisible(isRecording);
|
stopRecordingMenuItem.setVisible(isRecording);
|
||||||
}
|
}
|
||||||
if (importAllMenuItem != null) {
|
if (importMenuItem != null) {
|
||||||
importAllMenuItem.setVisible(!isRecording);
|
importMenuItem.setVisible(!isRecording);
|
||||||
}
|
}
|
||||||
if (exportAllMenuItem != null) {
|
if (saveAllMenuItem != null) {
|
||||||
exportAllMenuItem.setVisible(!isRecording);
|
saveAllMenuItem.setVisible(!isRecording);
|
||||||
}
|
}
|
||||||
if (deleteAllMenuItem != null) {
|
if (deleteAllMenuItem != null) {
|
||||||
deleteAllMenuItem.setVisible(!isRecording);
|
deleteAllMenuItem.setVisible(!isRecording);
|
||||||
@@ -346,29 +385,29 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
return true;
|
return true;
|
||||||
case R.id.track_list_search:
|
case R.id.track_list_search:
|
||||||
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
||||||
case R.id.track_list_import_all:
|
case R.id.track_list_import:
|
||||||
intent = IntentUtils.newIntent(this, ImportActivity.class)
|
intent = IntentUtils.newIntent(this, ImportActivity.class)
|
||||||
.putExtra(ImportActivity.EXTRA_IMPORT_ALL, true);
|
.putExtra(ImportActivity.EXTRA_IMPORT_ALL, true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_gpx:
|
case R.id.track_list_save_all_gpx:
|
||||||
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
|
||||||
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX);
|
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_kml:
|
case R.id.track_list_save_all_kml:
|
||||||
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
|
||||||
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML);
|
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_csv:
|
case R.id.track_list_save_all_csv:
|
||||||
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
|
||||||
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV);
|
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_tcx:
|
case R.id.track_list_save_all_tcx:
|
||||||
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
|
||||||
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX);
|
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_delete_all:
|
case R.id.track_list_delete_all:
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
// Preference keys
|
// Preference keys
|
||||||
private final String MIN_REQUIRED_ACCURACY_KEY;
|
private final String MIN_REQUIRED_ACCURACY_KEY;
|
||||||
private final String METRIC_UNITS_KEY;
|
|
||||||
private final String SPEED_REPORTING_KEY;
|
|
||||||
|
|
||||||
// Overridable constants
|
// Overridable constants
|
||||||
private final int targetNumPoints;
|
private final int targetNumPoints;
|
||||||
@@ -171,7 +169,7 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
// Cached preference values
|
// Cached preference values
|
||||||
private int minRequiredAccuracy;
|
private int minRequiredAccuracy;
|
||||||
private boolean useMetricUnits;
|
private boolean metricUnits;
|
||||||
private boolean reportSpeed;
|
private boolean reportSpeed;
|
||||||
|
|
||||||
// Cached sensor readings
|
// Cached sensor readings
|
||||||
@@ -222,8 +220,6 @@ public class TrackDataHub {
|
|||||||
this.locationFactory = new DoubleBufferedLocationFactory();
|
this.locationFactory = new DoubleBufferedLocationFactory();
|
||||||
|
|
||||||
MIN_REQUIRED_ACCURACY_KEY = context.getString(R.string.min_required_accuracy_key);
|
MIN_REQUIRED_ACCURACY_KEY = context.getString(R.string.min_required_accuracy_key);
|
||||||
METRIC_UNITS_KEY = context.getString(R.string.metric_units_key);
|
|
||||||
SPEED_REPORTING_KEY = context.getString(R.string.report_speed_key);
|
|
||||||
|
|
||||||
resetState();
|
resetState();
|
||||||
}
|
}
|
||||||
@@ -299,8 +295,8 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
private void loadSharedPreferences() {
|
private void loadSharedPreferences() {
|
||||||
selectedTrackId = PreferencesUtils.getSelectedTrackId(context);
|
selectedTrackId = PreferencesUtils.getSelectedTrackId(context);
|
||||||
useMetricUnits = preferences.getBoolean(METRIC_UNITS_KEY, true);
|
metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
reportSpeed = preferences.getBoolean(SPEED_REPORTING_KEY, true);
|
reportSpeed = PreferencesUtils.isReportSpeed(context);
|
||||||
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
||||||
DEFAULT_MIN_REQUIRED_ACCURACY);
|
DEFAULT_MIN_REQUIRED_ACCURACY);
|
||||||
}
|
}
|
||||||
@@ -495,7 +491,7 @@ public class TrackDataHub {
|
|||||||
Set<TrackDataListener> listenerSet = Collections.singleton(listener);
|
Set<TrackDataListener> listenerSet = Collections.singleton(listener);
|
||||||
|
|
||||||
if (registration.isInterestedIn(ListenerDataType.DISPLAY_PREFERENCES)) {
|
if (registration.isInterestedIn(ListenerDataType.DISPLAY_PREFERENCES)) {
|
||||||
reloadAll |= listener.onUnitsChanged(useMetricUnits);
|
reloadAll |= listener.onUnitsChanged(metricUnits);
|
||||||
reloadAll |= listener.onReportSpeedChanged(reportSpeed);
|
reloadAll |= listener.onReportSpeedChanged(reportSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +573,7 @@ public class TrackDataHub {
|
|||||||
// Ignore the return values here, we're already sending the full data set anyway
|
// Ignore the return values here, we're already sending the full data set anyway
|
||||||
for (TrackDataListener listener :
|
for (TrackDataListener listener :
|
||||||
getListenersFor(ListenerDataType.DISPLAY_PREFERENCES)) {
|
getListenersFor(ListenerDataType.DISPLAY_PREFERENCES)) {
|
||||||
listener.onUnitsChanged(useMetricUnits);
|
listener.onUnitsChanged(metricUnits);
|
||||||
listener.onReportSpeedChanged(reportSpeed);
|
listener.onReportSpeedChanged(reportSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,11 +612,11 @@ public class TrackDataHub {
|
|||||||
if (MIN_REQUIRED_ACCURACY_KEY.equals(key)) {
|
if (MIN_REQUIRED_ACCURACY_KEY.equals(key)) {
|
||||||
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
||||||
DEFAULT_MIN_REQUIRED_ACCURACY);
|
DEFAULT_MIN_REQUIRED_ACCURACY);
|
||||||
} else if (METRIC_UNITS_KEY.equals(key)) {
|
} else if (PreferencesUtils.getMetricUnitsKey(context).equals(key)) {
|
||||||
useMetricUnits = preferences.getBoolean(METRIC_UNITS_KEY, true);
|
metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
notifyUnitsChanged();
|
notifyUnitsChanged();
|
||||||
} else if (SPEED_REPORTING_KEY.equals(key)) {
|
} else if (PreferencesUtils.getReportSpeedKey(context).equals(key)) {
|
||||||
reportSpeed = preferences.getBoolean(SPEED_REPORTING_KEY, true);
|
reportSpeed = PreferencesUtils.isReportSpeed(context);
|
||||||
notifySpeedReportingChanged();
|
notifySpeedReportingChanged();
|
||||||
} else if (PreferencesUtils.getSelectedTrackIdKey(context).equals(key)) {
|
} else if (PreferencesUtils.getSelectedTrackIdKey(context).equals(key)) {
|
||||||
loadTrack(PreferencesUtils.getSelectedTrackId(context));
|
loadTrack(PreferencesUtils.getSelectedTrackId(context));
|
||||||
@@ -659,7 +655,7 @@ public class TrackDataHub {
|
|||||||
Set<TrackDataListener> displayListeners = getListenersFor(ListenerDataType.DISPLAY_PREFERENCES);
|
Set<TrackDataListener> displayListeners = getListenersFor(ListenerDataType.DISPLAY_PREFERENCES);
|
||||||
|
|
||||||
for (TrackDataListener listener : displayListeners) {
|
for (TrackDataListener listener : displayListeners) {
|
||||||
if (listener.onUnitsChanged(useMetricUnits)) {
|
if (listener.onUnitsChanged(metricUnits)) {
|
||||||
synchronized (dataListeners) {
|
synchronized (dataListeners) {
|
||||||
reloadDataForListener(listener);
|
reloadDataForListener(listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class AboutDialogFragment extends DialogFragment {
|
|||||||
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
|
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
|
||||||
aboutVersion.setText(SystemUtils.getMyTracksVersion(getActivity()));
|
aboutVersion.setText(SystemUtils.getMyTracksVersion(getActivity()));
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.chart_view_layout);
|
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.chart_view_layout);
|
||||||
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
|
@SuppressWarnings("deprecation")
|
||||||
LayoutParams.MATCH_PARENT);
|
LayoutParams layoutParams = new LayoutParams(
|
||||||
|
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
|
||||||
layout.addView(chartView, layoutParams);
|
layout.addView(chartView, layoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ public class ChartSettingsDialogFragment extends DialogFragment {
|
|||||||
? R.string.stats_speed : R.string.stats_pace);
|
? R.string.stats_speed : R.string.stats_pace);
|
||||||
|
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setNegativeButton(R.string.generic_cancel, null)
|
.setNegativeButton(R.string.generic_cancel, null)
|
||||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,22 +16,21 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.CheckUnitsUtils;
|
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFragment to check preferred units.
|
* A DialogFragment to check preferred units.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class CheckUnitsDialogFragment extends DialogFragment {
|
public class CheckUnitsDialogFragment extends DialogFragment {
|
||||||
@@ -39,31 +38,38 @@ public class CheckUnitsDialogFragment extends DialogFragment {
|
|||||||
public static final String CHECK_UNITS_DIALOG_TAG = "checkUnitsDialog";
|
public static final String CHECK_UNITS_DIALOG_TAG = "checkUnitsDialog";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public void onCancel(DialogInterface arg0) {
|
||||||
|
onDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
Locale defaultLocale = Locale.getDefault();
|
||||||
|
boolean defaultMetric = !defaultLocale.equals(Locale.US) && !defaultLocale.equals(Locale.UK);
|
||||||
|
PreferencesUtils.setMetricUnits(getActivity(), defaultMetric);
|
||||||
|
final String metric = getString(R.string.preferred_units_metric);
|
||||||
|
final String imperial = getString(R.string.preferred_units_imperial);
|
||||||
|
final CharSequence[] items = defaultMetric ? new CharSequence[] { metric, imperial }
|
||||||
|
: new CharSequence[] { imperial, metric };
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
CheckUnitsUtils.setCheckUnitsValue(getActivity());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
CheckUnitsUtils.setCheckUnitsValue(getActivity());
|
int position = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
|
||||||
|
PreferencesUtils.setMetricUnits(getActivity(), items[position].equals(metric));
|
||||||
int position = ((AlertDialog) dialog).getListView().getSelectedItemPosition();
|
onDone();
|
||||||
SharedPreferences sharedPreferences = getActivity()
|
|
||||||
.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
ApiAdapterFactory.getApiAdapter().applyPreferenceChanges(sharedPreferences.edit()
|
|
||||||
.putBoolean(getString(R.string.metric_units_key), position == 0));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setSingleChoiceItems(new CharSequence[] { getString(R.string.preferred_units_metric),
|
.setSingleChoiceItems(items, 0, null)
|
||||||
getString(R.string.preferred_units_imperial) }, 0, null)
|
.setTitle(R.string.preferred_units_title).create();
|
||||||
.setTitle(R.string.preferred_units_title)
|
}
|
||||||
.create();
|
|
||||||
|
/**
|
||||||
|
* Tasks to perform when done.
|
||||||
|
*/
|
||||||
|
private void onDone() {
|
||||||
|
PreferencesUtils.setShowCheckUnitsDialog(getActivity());
|
||||||
|
TrackListActivity trackListActivity = (TrackListActivity) getActivity();
|
||||||
|
trackListActivity.showStartupDialogs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,8 @@ public class DeleteOneMarkerDialogFragment extends DialogFragment {
|
|||||||
Intent intent = IntentUtils.newIntent(getActivity(), MarkerListActivity.class)
|
Intent intent = IntentUtils.newIntent(getActivity(), MarkerListActivity.class)
|
||||||
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
// Close the activity since its content can change after delete.
|
||||||
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class DeleteOneTrackDialogFragment extends DialogFragment {
|
|||||||
.deleteTrack(getArguments().getLong(KEY_TRACK_ID));
|
.deleteTrack(getArguments().getLong(KEY_TRACK_ID));
|
||||||
Intent intent = IntentUtils.newIntent(getActivity(), TrackListActivity.class);
|
Intent intent = IntentUtils.newIntent(getActivity(), TrackListActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
// Close the activity since its content can change after delete.
|
||||||
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.util.EulaUtils;
|
import com.google.android.apps.mytracks.util.EulaUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
@@ -49,11 +50,17 @@ public class EulaDialogFragment extends DialogFragment {
|
|||||||
return eulaDialogFragment;
|
return eulaDialogFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface arg0) {
|
||||||
|
if (!getArguments().getBoolean(KEY_HAS_ACCEPTED)) {
|
||||||
|
exitApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setMessage(EulaUtils.getEulaMessage(getActivity()))
|
.setMessage(EulaUtils.getEulaMessage(getActivity()))
|
||||||
.setTitle(R.string.eula_title);
|
.setTitle(R.string.eula_title);
|
||||||
|
|
||||||
@@ -63,24 +70,25 @@ public class EulaDialogFragment extends DialogFragment {
|
|||||||
builder.setNegativeButton(R.string.eula_decline, new DialogInterface.OnClickListener() {
|
builder.setNegativeButton(R.string.eula_decline, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
getActivity().finish();
|
exitApp();
|
||||||
}
|
|
||||||
})
|
|
||||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
getActivity().finish();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
EulaUtils.setEulaValue(getActivity());
|
EulaUtils.setEulaValue(getActivity());
|
||||||
new WelcomeDialogFragment().show(
|
TrackListActivity trackListActivity = (TrackListActivity) getActivity();
|
||||||
getActivity().getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_DIALOG_TAG);
|
trackListActivity.showStartupDialogs();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the application.
|
||||||
|
*/
|
||||||
|
private void exitApp() {
|
||||||
|
getActivity().finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,6 @@ public class InstallEarthDialogFragment extends DialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setMessage(R.string.track_detail_install_earth_message)
|
.setMessage(R.string.track_detail_install_earth_message)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -86,6 +87,7 @@ public class MapFragment extends Fragment
|
|||||||
private View mapViewContainer;
|
private View mapViewContainer;
|
||||||
private MapOverlay mapOverlay;
|
private MapOverlay mapOverlay;
|
||||||
private MapView mapView;
|
private MapView mapView;
|
||||||
|
private ImageButton myLocationImageButton;
|
||||||
private TextView messageTextView;
|
private TextView messageTextView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -100,6 +102,13 @@ public class MapFragment extends Fragment
|
|||||||
mapView.setOnTouchListener(this);
|
mapView.setOnTouchListener(this);
|
||||||
mapView.setBuiltInZoomControls(true);
|
mapView.setBuiltInZoomControls(true);
|
||||||
mapView.getOverlays().add(mapOverlay);
|
mapView.getOverlays().add(mapOverlay);
|
||||||
|
myLocationImageButton = (ImageButton) mapViewContainer.findViewById(R.id.map_my_location);
|
||||||
|
myLocationImageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showMyLocation();
|
||||||
|
}
|
||||||
|
});
|
||||||
messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message);
|
messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message);
|
||||||
|
|
||||||
return mapViewContainer;
|
return mapViewContainer;
|
||||||
@@ -150,7 +159,7 @@ public class MapFragment extends Fragment
|
|||||||
/**
|
/**
|
||||||
* Shows my location.
|
* Shows my location.
|
||||||
*/
|
*/
|
||||||
public void showMyLocation() {
|
private void showMyLocation() {
|
||||||
updateTrackDataHub();
|
updateTrackDataHub();
|
||||||
keepMyLocationVisible = true;
|
keepMyLocationVisible = true;
|
||||||
zoomToMyLocation = true;
|
zoomToMyLocation = true;
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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.fragments;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.MarkerEditActivity;
|
||||||
|
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||||
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||||
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A DialogFragment to add a marker.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
public class MarkerAddDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
public static final String MARKER_ADD_DIALOG_TAG = "markerAddDialog";
|
||||||
|
|
||||||
|
private static final String KEY_TRACK_ID = "trackId";
|
||||||
|
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
||||||
|
private RadioGroup radioGroup;
|
||||||
|
private Button moreOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of {@link MarkerAddDialogFragment}.
|
||||||
|
*
|
||||||
|
* @param trackId the track id
|
||||||
|
*/
|
||||||
|
public static MarkerAddDialogFragment newInstance(long trackId) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putLong(KEY_TRACK_ID, trackId);
|
||||||
|
|
||||||
|
MarkerAddDialogFragment markerAddDialogFragment = new MarkerAddDialogFragment();
|
||||||
|
markerAddDialogFragment.setArguments(bundle);
|
||||||
|
return markerAddDialogFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle arg0) {
|
||||||
|
super.onCreate(arg0);
|
||||||
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(getActivity(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
TrackRecordingServiceConnectionUtils.resume(getActivity(), trackRecordingServiceConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
trackRecordingServiceConnection.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.marker_add, null);
|
||||||
|
radioGroup = (RadioGroup) view.findViewById(R.id.marker_add_type);
|
||||||
|
moreOptions = (Button) view.findViewById(R.id.marker_add_more_options);
|
||||||
|
moreOptions.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
boolean statisticsMarker = radioGroup.getCheckedRadioButtonId()
|
||||||
|
== R.id.marker_add_statistics;
|
||||||
|
Intent intent = IntentUtils.newIntent(getActivity(), MarkerEditActivity.class);
|
||||||
|
intent.putExtra(MarkerEditActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
||||||
|
intent.putExtra(MarkerEditActivity.EXTRA_STATISTICS_MARKER, statisticsMarker);
|
||||||
|
startActivity(intent);
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
boolean pickStatisticsMarker = PreferencesUtils.getBoolean(
|
||||||
|
getActivity(), R.string.pick_statistics_marker_key, true);
|
||||||
|
radioGroup.check(pickStatisticsMarker ? R.id.marker_add_statistics : R.id.marker_add_waypoint);
|
||||||
|
return new AlertDialog.Builder(getActivity())
|
||||||
|
.setNegativeButton(R.string.generic_cancel, null)
|
||||||
|
.setPositiveButton(R.string.generic_add, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
boolean statisticsMarker = radioGroup.getCheckedRadioButtonId()
|
||||||
|
== R.id.marker_add_statistics;
|
||||||
|
PreferencesUtils.setBoolean(
|
||||||
|
getActivity(), R.string.pick_statistics_marker_key, statisticsMarker);
|
||||||
|
TrackRecordingServiceConnectionUtils.addMarker(getActivity(),
|
||||||
|
trackRecordingServiceConnection,
|
||||||
|
statisticsMarker ? WaypointCreationRequest.DEFAULT_STATISTICS
|
||||||
|
: WaypointCreationRequest.DEFAULT_WAYPOINT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setTitle(R.string.menu_insert_marker)
|
||||||
|
.setView(view)
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
|
||||||
import com.google.android.apps.mytracks.MyTracksApplication;
|
import com.google.android.apps.mytracks.MyTracksApplication;
|
||||||
import com.google.android.apps.mytracks.content.Track;
|
import com.google.android.apps.mytracks.content.Track;
|
||||||
import com.google.android.apps.mytracks.content.TrackDataHub;
|
import com.google.android.apps.mytracks.content.TrackDataHub;
|
||||||
@@ -28,8 +27,6 @@ import com.google.android.apps.mytracks.util.PreferencesUtils;
|
|||||||
import com.google.android.apps.mytracks.util.StatsUtils;
|
import com.google.android.apps.mytracks.util.StatsUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@@ -58,8 +55,6 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
// The start time of the current track.
|
// The start time of the current track.
|
||||||
private long startTime = -1L;
|
private long startTime = -1L;
|
||||||
|
|
||||||
private boolean metricUnits = true;
|
|
||||||
private boolean reportSpeed = true;
|
|
||||||
private Location lastLocation = null;
|
private Location lastLocation = null;
|
||||||
private TripStatistics lastTripStatistics = null;
|
private TripStatistics lastTripStatistics = null;
|
||||||
|
|
||||||
@@ -101,10 +96,6 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
SharedPreferences preferences = getActivity().getSharedPreferences(
|
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
metricUnits = preferences.getBoolean(getString(R.string.metric_units_key), true);
|
|
||||||
reportSpeed = preferences.getBoolean(getString(R.string.report_speed_key), true);
|
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +122,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
lastLocation = null;
|
lastLocation = null;
|
||||||
StatsUtils.setLocationValues(getActivity(), lastLocation, metricUnits, reportSpeed);
|
StatsUtils.setLocationValues(getActivity(), lastLocation, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -144,7 +135,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
lastLocation = location;
|
lastLocation = location;
|
||||||
StatsUtils.setLocationValues(getActivity(), lastLocation, metricUnits, reportSpeed);
|
StatsUtils.setLocationValues(getActivity(), lastLocation, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -233,7 +224,6 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
metricUnits = metric;
|
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -245,7 +235,6 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
reportSpeed = speed;
|
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -282,9 +271,8 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
return trackDataHub != null && trackDataHub.isRecordingSelected();
|
return trackDataHub != null && trackDataHub.isRecordingSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUi() {
|
public void updateUi() {
|
||||||
StatsUtils.setSpeedLabels(getActivity(), reportSpeed, true);
|
StatsUtils.setTripStatisticsValues(getActivity(), lastTripStatistics);
|
||||||
StatsUtils.setTripStatisticsValues(getActivity(), lastTripStatistics, metricUnits, reportSpeed);
|
StatsUtils.setLocationValues(getActivity(), lastLocation, true);
|
||||||
StatsUtils.setLocationValues(getActivity(), lastLocation, metricUnits, reportSpeed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* 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.fragments;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A DialogFragment to show stats settings.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
public class StatsSettingsDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
public static final String STATS_SETTINGS_DIALOG_TAG = "statsSettingsDialog";
|
||||||
|
|
||||||
|
public interface OnStatsSettingsChangedListener {
|
||||||
|
public void onStatsSettingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OnStatsSettingsChangedListener listener;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
try {
|
||||||
|
listener = (OnStatsSettingsChangedListener) activity;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
throw new ClassCastException(activity.toString()
|
||||||
|
+ " must implement OnArticleSelectedListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
View view = getActivity().getLayoutInflater().inflate(R.layout.stats_settings, null);
|
||||||
|
final RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.stats_settings_time);
|
||||||
|
boolean totalTime = PreferencesUtils.getBoolean(
|
||||||
|
getActivity(), R.string.stats_show_total_time_key, true);
|
||||||
|
radioGroup.check(totalTime ? R.id.stats_settings_total_time : R.id.stats_settings_moving_time);
|
||||||
|
|
||||||
|
final CheckBox elevation = (CheckBox) view.findViewById(R.id.stats_settings_elevation);
|
||||||
|
final CheckBox grade = (CheckBox) view.findViewById(R.id.stats_settings_grade);
|
||||||
|
final CheckBox coordinate = (CheckBox) view.findViewById(R.id.stats_settings_coordinate);
|
||||||
|
|
||||||
|
elevation.setChecked(
|
||||||
|
PreferencesUtils.getBoolean(getActivity(), R.string.stats_show_elevation_key, false));
|
||||||
|
grade.setChecked(
|
||||||
|
PreferencesUtils.getBoolean(getActivity(), R.string.stats_show_grade_key, false));
|
||||||
|
coordinate.setChecked(
|
||||||
|
PreferencesUtils.getBoolean(getActivity(), R.string.stats_show_coordinate_key, false));
|
||||||
|
|
||||||
|
return new AlertDialog.Builder(getActivity()).setNegativeButton(R.string.generic_cancel, null)
|
||||||
|
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
PreferencesUtils.setBoolean(getActivity(), R.string.stats_show_total_time_key,
|
||||||
|
radioGroup.getCheckedRadioButtonId() == R.id.stats_settings_total_time);
|
||||||
|
PreferencesUtils.setBoolean(
|
||||||
|
getActivity(), R.string.stats_show_elevation_key, elevation.isChecked());
|
||||||
|
PreferencesUtils.setBoolean(
|
||||||
|
getActivity(), R.string.stats_show_grade_key, grade.isChecked());
|
||||||
|
PreferencesUtils.setBoolean(
|
||||||
|
getActivity(), R.string.stats_show_coordinate_key, coordinate.isChecked());
|
||||||
|
listener.onStatsSettingsChanged();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setTitle(R.string.menu_stats_settings)
|
||||||
|
.setView(view)
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
package com.google.android.apps.mytracks.fragments;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@@ -23,7 +25,6 @@ import android.app.Dialog;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFrament to show the welcome info.
|
* A DialogFrament to show the welcome info.
|
||||||
@@ -34,30 +35,28 @@ public class WelcomeDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
public static final String WELCOME_DIALOG_TAG = "welcomeDialog";
|
public static final String WELCOME_DIALOG_TAG = "welcomeDialog";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface arg0) {
|
||||||
|
onDone();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.welcome, null);
|
|
||||||
return new AlertDialog.Builder(getActivity())
|
return new AlertDialog.Builder(getActivity())
|
||||||
.setCancelable(true)
|
|
||||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
checkUnits();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
checkUnits();
|
onDone();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setTitle(R.string.welcome_title)
|
.setTitle(R.string.welcome_title)
|
||||||
.setView(view)
|
.setMessage(R.string.welcome_message)
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUnits() {
|
private void onDone() {
|
||||||
new CheckUnitsDialogFragment().show(
|
PreferencesUtils.setShowWelcome(getActivity());
|
||||||
getActivity().getSupportFragmentManager(), CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
|
TrackListActivity trackListActivity = (TrackListActivity) getActivity();
|
||||||
|
trackListActivity.showStartupDialogs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.io.gdata.docs.DocumentsClient;
|
|||||||
import com.google.android.apps.mytracks.io.gdata.docs.SpreadsheetsClient;
|
import com.google.android.apps.mytracks.io.gdata.docs.SpreadsheetsClient;
|
||||||
import com.google.android.apps.mytracks.io.gdata.docs.SpreadsheetsClient.WorksheetEntry;
|
import com.google.android.apps.mytracks.io.gdata.docs.SpreadsheetsClient.WorksheetEntry;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.ResourceUtils;
|
import com.google.android.apps.mytracks.util.ResourceUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
@@ -33,7 +34,6 @@ import com.google.wireless.gdata.parser.ParseException;
|
|||||||
import com.google.wireless.gdata2.client.AuthenticationException;
|
import com.google.wireless.gdata2.client.AuthenticationException;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -270,10 +270,7 @@ public class SendDocsUtils {
|
|||||||
Track track, String spreadsheetId, String worksheetId, String authToken, Context context)
|
Track track, String spreadsheetId, String worksheetId, String authToken, Context context)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String worksheetUri = String.format(GET_WORKSHEET_URI, spreadsheetId, worksheetId);
|
String worksheetUri = String.format(GET_WORKSHEET_URI, spreadsheetId, worksheetId);
|
||||||
SharedPreferences prefs = context.getSharedPreferences(
|
boolean metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
boolean metricUnits = prefs.getBoolean(context.getString(R.string.metric_units_key), true);
|
|
||||||
|
|
||||||
addRow(worksheetUri, getRowContent(track, metricUnits, context), authToken);
|
addRow(worksheetUri, getRowContent(track, metricUnits, context), authToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class CsvTrackWriter implements TrackFormatWriter {
|
|||||||
@Override
|
@Override
|
||||||
public void writeBeginWaypoints() {
|
public void writeBeginWaypoints() {
|
||||||
writeCommaSeparatedLine(context.getString(R.string.generic_name),
|
writeCommaSeparatedLine(context.getString(R.string.generic_name),
|
||||||
context.getString(R.string.marker_edit_marker_type_hint),
|
context.getString(R.string.marker_edit_waypoint_marker_type_hint),
|
||||||
context.getString(R.string.generic_description),
|
context.getString(R.string.generic_description),
|
||||||
context.getString(R.string.description_location_latitude),
|
context.getString(R.string.description_location_latitude),
|
||||||
context.getString(R.string.description_location_longitude),
|
context.getString(R.string.description_location_longitude),
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
|||||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.SystemUtils;
|
import com.google.android.apps.mytracks.util.SystemUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -32,7 +33,6 @@ import android.accounts.AccountManager;
|
|||||||
import android.accounts.AuthenticatorException;
|
import android.accounts.AuthenticatorException;
|
||||||
import android.accounts.OperationCanceledException;
|
import android.accounts.OperationCanceledException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -205,9 +205,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask {
|
|||||||
private boolean uploadAllTrackPoints(Track track) {
|
private boolean uploadAllTrackPoints(Track track) {
|
||||||
Cursor locationsCursor = null;
|
Cursor locationsCursor = null;
|
||||||
try {
|
try {
|
||||||
SharedPreferences prefs = context.getSharedPreferences(
|
boolean metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
boolean metricUnits = prefs.getBoolean(context.getString(R.string.metric_units_key), true);
|
|
||||||
|
|
||||||
locationsCursor = myTracksProviderUtils.getLocationsCursor(trackId, 0, -1, false);
|
locationsCursor = myTracksProviderUtils.getLocationsCursor(trackId, 0, -1, false);
|
||||||
if (locationsCursor == null) {
|
if (locationsCursor == null) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.SendToGoogleUtils;
|
|||||||
import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.common.gdata.AndroidXmlParserFactory;
|
import com.google.android.common.gdata.AndroidXmlParserFactory;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -257,9 +258,7 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
|
|||||||
boolean uploadAllTrackPoints(Track track) {
|
boolean uploadAllTrackPoints(Track track) {
|
||||||
Cursor locationsCursor = null;
|
Cursor locationsCursor = null;
|
||||||
try {
|
try {
|
||||||
SharedPreferences prefs = context.getSharedPreferences(
|
boolean metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
boolean metricUnits = prefs.getBoolean(context.getString(R.string.metric_units_key), true);
|
|
||||||
|
|
||||||
locationsCursor = myTracksProviderUtils.getLocationsCursor(trackId, 0, -1, false);
|
locationsCursor = myTracksProviderUtils.getLocationsCursor(trackId, 0, -1, false);
|
||||||
if (locationsCursor == null) {
|
if (locationsCursor == null) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public class PreferenceManager implements OnSharedPreferenceChangeListener {
|
|||||||
private final String autoResumeTrackCurrentRetryKey;
|
private final String autoResumeTrackCurrentRetryKey;
|
||||||
private final String autoResumeTrackTimeoutKey;
|
private final String autoResumeTrackTimeoutKey;
|
||||||
private final String maxRecordingDistanceKey;
|
private final String maxRecordingDistanceKey;
|
||||||
private final String metricUnitsKey;
|
|
||||||
private final String minRecordingDistanceKey;
|
private final String minRecordingDistanceKey;
|
||||||
private final String minRecordingIntervalKey;
|
private final String minRecordingIntervalKey;
|
||||||
private final String minRequiredAccuracyKey;
|
private final String minRequiredAccuracyKey;
|
||||||
@@ -63,8 +62,6 @@ public class PreferenceManager implements OnSharedPreferenceChangeListener {
|
|||||||
service.getString(R.string.auto_resume_track_timeout_key);
|
service.getString(R.string.auto_resume_track_timeout_key);
|
||||||
maxRecordingDistanceKey =
|
maxRecordingDistanceKey =
|
||||||
service.getString(R.string.max_recording_distance_key);
|
service.getString(R.string.max_recording_distance_key);
|
||||||
metricUnitsKey =
|
|
||||||
service.getString(R.string.metric_units_key);
|
|
||||||
minRecordingDistanceKey =
|
minRecordingDistanceKey =
|
||||||
service.getString(R.string.min_recording_distance_key);
|
service.getString(R.string.min_recording_distance_key);
|
||||||
minRecordingIntervalKey =
|
minRecordingIntervalKey =
|
||||||
@@ -160,9 +157,8 @@ public class PreferenceManager implements OnSharedPreferenceChangeListener {
|
|||||||
service.setSplitFrequency(
|
service.setSplitFrequency(
|
||||||
sharedPreferences.getInt(splitFrequencyKey, 0));
|
sharedPreferences.getInt(splitFrequencyKey, 0));
|
||||||
}
|
}
|
||||||
if (key == null || key.equals(metricUnitsKey)) {
|
if (key == null || key.equals(PreferencesUtils.getMetricUnitsKey(service))) {
|
||||||
service.setMetricUnits(
|
service.setMetricUnits(PreferencesUtils.isMetricUnits(service));
|
||||||
sharedPreferences.getBoolean(metricUnitsKey, true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -486,11 +486,11 @@ public class TrackRecordingService extends Service {
|
|||||||
private void showNotification() {
|
private void showNotification() {
|
||||||
if (isRecording) {
|
if (isRecording) {
|
||||||
Notification notification = new Notification(
|
Notification notification = new Notification(
|
||||||
R.drawable.arrow_320, null /* tickerText */,
|
R.drawable.my_tracks_notification_icon, null, System.currentTimeMillis());
|
||||||
System.currentTimeMillis());
|
|
||||||
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
|
PendingIntent contentIntent = PendingIntent.getActivity(
|
||||||
|
this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
notification.setLatestEventInfo(this, getString(R.string.my_tracks_app_name),
|
notification.setLatestEventInfo(this, getString(R.string.my_tracks_app_name),
|
||||||
getString(R.string.track_record_notification), contentIntent);
|
getString(R.string.track_record_notification), contentIntent);
|
||||||
notification.flags += Notification.FLAG_NO_CLEAR;
|
notification.flags += Notification.FLAG_NO_CLEAR;
|
||||||
@@ -933,12 +933,12 @@ public class TrackRecordingService extends Service {
|
|||||||
"Unable to insert waypoint marker while not recording!");
|
"Unable to insert waypoint marker while not recording!");
|
||||||
}
|
}
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
request = WaypointCreationRequest.DEFAULT_MARKER;
|
request = WaypointCreationRequest.DEFAULT_WAYPOINT;
|
||||||
}
|
}
|
||||||
Waypoint wpt = new Waypoint();
|
Waypoint wpt = new Waypoint();
|
||||||
switch (request.getType()) {
|
switch (request.getType()) {
|
||||||
case MARKER:
|
case WAYPOINT:
|
||||||
buildMarker(wpt, request);
|
buildWaypointMarker(wpt, request);
|
||||||
break;
|
break;
|
||||||
case STATISTICS:
|
case STATISTICS:
|
||||||
buildStatisticsMarker(wpt, request);
|
buildStatisticsMarker(wpt, request);
|
||||||
@@ -963,18 +963,22 @@ public class TrackRecordingService extends Service {
|
|||||||
return Long.parseLong(uri.getLastPathSegment());
|
return Long.parseLong(uri.getLastPathSegment());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMarker(Waypoint wpt, WaypointCreationRequest request) {
|
private void buildWaypointMarker(Waypoint wpt, WaypointCreationRequest request) {
|
||||||
wpt.setType(Waypoint.TYPE_WAYPOINT);
|
wpt.setType(Waypoint.TYPE_WAYPOINT);
|
||||||
if (request.getIconUrl() == null) {
|
if (request.getIconUrl() == null) {
|
||||||
wpt.setIcon(getString(R.string.marker_waypoint_icon_url));
|
wpt.setIcon(getString(R.string.marker_waypoint_icon_url));
|
||||||
} else {
|
} else {
|
||||||
wpt.setIcon(request.getIconUrl());
|
wpt.setIcon(request.getIconUrl());
|
||||||
}
|
}
|
||||||
if (request.getName() == null) {
|
String name;
|
||||||
wpt.setName(getString(R.string.marker_edit_type_waypoint));
|
if (request.getName() != null) {
|
||||||
|
name = request.getName();
|
||||||
} else {
|
} else {
|
||||||
wpt.setName(request.getName());
|
int nextMarkerNumber = providerUtils.getNextMarkerNumber(recordingTrackId, false);
|
||||||
|
name = nextMarkerNumber == -1 ? getString(R.string.marker_type_waypoint)
|
||||||
|
: getString(R.string.marker_waypoint_name_format, nextMarkerNumber);
|
||||||
}
|
}
|
||||||
|
wpt.setName(name);
|
||||||
if (request.getCategory() != null) {
|
if (request.getCategory() != null) {
|
||||||
wpt.setCategory(request.getCategory());
|
wpt.setCategory(request.getCategory());
|
||||||
}
|
}
|
||||||
@@ -1003,8 +1007,15 @@ public class TrackRecordingService extends Service {
|
|||||||
|
|
||||||
// Set the rest of the waypoint data
|
// Set the rest of the waypoint data
|
||||||
waypoint.setType(Waypoint.TYPE_STATISTICS);
|
waypoint.setType(Waypoint.TYPE_STATISTICS);
|
||||||
waypoint.setName(request.getName() != null ? request.getName()
|
String name;
|
||||||
: getString(R.string.marker_edit_type_statistics));
|
if (request.getName() != null) {
|
||||||
|
name = request.getName();
|
||||||
|
} else {
|
||||||
|
int nextMarkerNumber = providerUtils.getNextMarkerNumber(recordingTrackId, true);
|
||||||
|
name = nextMarkerNumber == -1 ? getString(R.string.marker_type_statistics)
|
||||||
|
: getString(R.string.marker_statistics_name_format, nextMarkerNumber);
|
||||||
|
}
|
||||||
|
waypoint.setName(name);
|
||||||
waypoint.setStatistics(waypointStatsBuilder.getStatistics());
|
waypoint.setStatistics(waypointStatsBuilder.getStatistics());
|
||||||
waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint));
|
waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint));
|
||||||
waypoint.setIcon(getString(R.string.marker_statistics_icon_url));
|
waypoint.setIcon(getString(R.string.marker_statistics_icon_url));
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ import static com.google.android.apps.mytracks.Constants.TAG;
|
|||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.speech.tts.TextToSpeech;
|
import android.speech.tts.TextToSpeech;
|
||||||
import android.speech.tts.TextToSpeech.OnInitListener;
|
import android.speech.tts.TextToSpeech.OnInitListener;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -150,15 +150,8 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
|||||||
*/
|
*/
|
||||||
// @VisibleForTesting
|
// @VisibleForTesting
|
||||||
protected String getAnnouncement(TripStatistics stats) {
|
protected String getAnnouncement(TripStatistics stats) {
|
||||||
boolean metricUnits = true;
|
boolean metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
boolean reportSpeed = true;
|
boolean reportSpeed = PreferencesUtils.isReportSpeed(context);
|
||||||
SharedPreferences preferences = context.getSharedPreferences(
|
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
|
||||||
if (preferences != null) {
|
|
||||||
metricUnits = preferences.getBoolean(context.getString(R.string.metric_units_key), true);
|
|
||||||
reportSpeed = preferences.getBoolean(context.getString(R.string.report_speed_key), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
double d = stats.getTotalDistance() * UnitConversions.M_TO_KM;
|
double d = stats.getTotalDistance() * UnitConversions.M_TO_KM;
|
||||||
double s = stats.getAverageMovingSpeed() * UnitConversions.MS_TO_KMH;
|
double s = stats.getAverageMovingSpeed() * UnitConversions.MS_TO_KMH;
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
|
mode.finish();
|
||||||
return contextualActionModeCallback.onClick(item.getItemId(), position, id);
|
return contextualActionModeCallback.onClick(item.getItemId(), position, id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -100,10 +101,35 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureSearchWidget(Activity activity, MenuItem menuItem) {
|
public void configureSearchWidget(Activity activity, final MenuItem menuItem) {
|
||||||
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
|
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
|
||||||
SearchView searchView = (SearchView) menuItem.getActionView();
|
SearchView searchView = (SearchView) menuItem.getActionView();
|
||||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName()));
|
searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName()));
|
||||||
|
searchView.setQueryRefinementEnabled(true);
|
||||||
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextSubmit(String query) {
|
||||||
|
menuItem.collapseActionView();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onSuggestionSelect(int position) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSuggestionClick(int position) {
|
||||||
|
menuItem.collapseActionView();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,13 +16,11 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.util;
|
package com.google.android.apps.mytracks.util;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
|
||||||
import com.google.android.apps.mytracks.content.Track;
|
import com.google.android.apps.mytracks.content.Track;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
@@ -47,18 +45,11 @@ public class ChartURLGenerator {
|
|||||||
* @param track The track for this chart
|
* @param track The track for this chart
|
||||||
* @param context The current appplication context
|
* @param context The current appplication context
|
||||||
*/
|
*/
|
||||||
public static String getChartUrl(Vector<Double> distances,
|
public static String getChartUrl(
|
||||||
Vector<Double> elevations, Track track, Context context) {
|
Vector<Double> distances, Vector<Double> elevations, Track track, Context context) {
|
||||||
SharedPreferences preferences = context.getSharedPreferences(
|
boolean metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
return getChartUrl(
|
||||||
boolean metricUnits = true;
|
distances, elevations, track, context.getString(R.string.stats_elevation), metricUnits);
|
||||||
if (preferences != null) {
|
|
||||||
metricUnits = preferences.getBoolean(
|
|
||||||
context.getString(R.string.metric_units_key), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return getChartUrl(distances, elevations, track,
|
|
||||||
context.getString(R.string.stats_elevation), metricUnits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.util;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.SharedPreferences.Editor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utilities for checking units.
|
|
||||||
*
|
|
||||||
* @author Jimmy Shih
|
|
||||||
*/
|
|
||||||
public class CheckUnitsUtils {
|
|
||||||
|
|
||||||
private static final String CHECK_UNITS_PREFERENCE_FILE = "checkunits";
|
|
||||||
private static final String CHECK_UNITS_PREFERENCE_KEY = "checkunits.checked";
|
|
||||||
|
|
||||||
private CheckUnitsUtils() {}
|
|
||||||
|
|
||||||
public static boolean getCheckUnitsValue(Context context) {
|
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
|
||||||
CHECK_UNITS_PREFERENCE_FILE, Context.MODE_PRIVATE);
|
|
||||||
return sharedPreferences.getBoolean(CHECK_UNITS_PREFERENCE_KEY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setCheckUnitsValue(Context context) {
|
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
|
||||||
CHECK_UNITS_PREFERENCE_FILE, Context.MODE_PRIVATE);
|
|
||||||
Editor editor = sharedPreferences.edit().putBoolean(CHECK_UNITS_PREFERENCE_KEY, true);
|
|
||||||
ApiAdapterFactory.getApiAdapter().applyPreferenceChanges(editor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,9 +26,9 @@ import android.widget.TextView;
|
|||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public class ListItemUtil {
|
public class ListItemUtils {
|
||||||
|
|
||||||
private ListItemUtil() {}
|
private ListItemUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a list item.
|
* Sets a list item.
|
||||||
@@ -32,6 +32,34 @@ public class PreferencesUtils {
|
|||||||
|
|
||||||
private PreferencesUtils() {}
|
private PreferencesUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the metric units key.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static String getMetricUnitsKey(Context context) {
|
||||||
|
return getKey(context, R.string.metric_units_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the metric units value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static boolean isMetricUnits(Context context) {
|
||||||
|
return getBoolean(context, R.string.metric_units_key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the metric units value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public static void setMetricUnits(Context context, boolean value) {
|
||||||
|
setBoolean(context, R.string.metric_units_key, value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the recording track id key.
|
* Gets the recording track id key.
|
||||||
*
|
*
|
||||||
@@ -60,6 +88,34 @@ public class PreferencesUtils {
|
|||||||
setLong(context, R.string.recording_track_id_key, trackId);
|
setLong(context, R.string.recording_track_id_key, trackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the report speed key.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static String getReportSpeedKey(Context context) {
|
||||||
|
return getKey(context, R.string.report_speed_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the report speed value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static boolean isReportSpeed(Context context) {
|
||||||
|
return getBoolean(context, R.string.report_speed_key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the report speed value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public static void setReportSpeed(Context context, boolean value) {
|
||||||
|
setBoolean(context, R.string.report_speed_key, value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the selected track id key.
|
* Gets the selected track id key.
|
||||||
*
|
*
|
||||||
@@ -88,6 +144,42 @@ public class PreferencesUtils {
|
|||||||
setLong(context, R.string.selected_track_id_key, trackId);
|
setLong(context, R.string.selected_track_id_key, trackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the show check units dialog value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static boolean isShowCheckUnitsDialog(Context context) {
|
||||||
|
return getBoolean(context, R.string.show_check_units_dialog_key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the show check units dialog value to false.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static void setShowCheckUnitsDialog(Context context) {
|
||||||
|
setBoolean(context, R.string.show_check_units_dialog_key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the show welcomes dialog value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static boolean isShowWelcomeDialog(Context context) {
|
||||||
|
return getBoolean(context, R.string.show_welcome_dialog_key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the show welcome dialog value to false.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
|
public static void setShowWelcome(Context context) {
|
||||||
|
setBoolean(context, R.string.show_welcome_dialog_key, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a preference key
|
* Gets a preference key
|
||||||
*
|
*
|
||||||
@@ -98,6 +190,34 @@ public class PreferencesUtils {
|
|||||||
return context.getString(keyId);
|
return context.getString(keyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a boolean preference value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param keyId the key id
|
||||||
|
* @param defaultValue the default value
|
||||||
|
*/
|
||||||
|
public static boolean getBoolean(Context context, int keyId, boolean defaultValue) {
|
||||||
|
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
||||||
|
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||||
|
return sharedPreferences.getBoolean(getKey(context, keyId), defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a boolean preference value.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param keyId the key id
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public static void setBoolean(Context context, int keyId, boolean value) {
|
||||||
|
SharedPreferences sharedPreferences = context.getSharedPreferences(
|
||||||
|
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||||
|
Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putBoolean(getKey(context, keyId), value);
|
||||||
|
ApiAdapterFactory.getApiAdapter().applyPreferenceChanges(editor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a long preference value.
|
* Gets a long preference value.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.maps.mytracks.R;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,111 +34,158 @@ public class StatsUtils {
|
|||||||
private StatsUtils() {}
|
private StatsUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the speed labels.
|
* Sets the location values.
|
||||||
*
|
*
|
||||||
* @param activity the activity
|
* @param activity the activity
|
||||||
* @param reportSpeed true to report speed
|
* @param location the location
|
||||||
* @param includeLocationSpeed true to include the current location speed
|
* @param showAll true to show all the fields, false to show only the
|
||||||
|
* elevation field
|
||||||
*/
|
*/
|
||||||
public static void setSpeedLabels(
|
public static void setLocationValues(Activity activity, Location location, boolean showAll) {
|
||||||
Activity activity, boolean reportSpeed, boolean includeLocationSpeed) {
|
boolean metricUnits = PreferencesUtils.getBoolean(activity, R.string.metric_units_key, true);
|
||||||
StatsUtils.setSpeedLabel(activity, R.id.stats_max_speed_label, R.string.stats_max_speed,
|
boolean reportSpeed = PreferencesUtils.getBoolean(activity, R.string.report_speed_key, true);
|
||||||
R.string.stats_fastest_pace, reportSpeed);
|
|
||||||
StatsUtils.setSpeedLabel(activity, R.id.stats_average_speed_label, R.string.stats_average_speed,
|
// Set elevation
|
||||||
R.string.stats_average_pace, reportSpeed);
|
boolean showElevation = PreferencesUtils.getBoolean(
|
||||||
StatsUtils.setSpeedLabel(activity, R.id.stats_average_moving_speed_label,
|
activity, R.string.stats_show_elevation_key, false);
|
||||||
R.string.stats_average_moving_speed, R.string.stats_average_moving_pace, reportSpeed);
|
if (showElevation) {
|
||||||
if (includeLocationSpeed) {
|
double altitude = location == null ? Double.NaN : location.getAltitude();
|
||||||
StatsUtils.setSpeedLabel(
|
setElevationValue(activity, R.id.stats_elevation_value, altitude, metricUnits);
|
||||||
activity, R.id.stats_speed_label, R.string.stats_speed, R.string.stats_pace, reportSpeed);
|
}
|
||||||
|
|
||||||
|
if (!showAll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set speed/pace
|
||||||
|
setSpeedLabel(
|
||||||
|
activity, R.id.stats_speed_label, R.string.stats_speed, R.string.stats_pace, reportSpeed);
|
||||||
|
double speed = location == null ? Double.NaN : location.getSpeed();
|
||||||
|
setSpeedValue(activity, R.id.stats_speed_value, speed, metricUnits, reportSpeed);
|
||||||
|
|
||||||
|
// Set coordinate
|
||||||
|
boolean showCoordinate = PreferencesUtils.getBoolean(
|
||||||
|
activity, R.string.stats_show_coordinate_key, false);
|
||||||
|
View coordinateLabelTableRow = activity.findViewById(R.id.stats_coordinate_label_table_row);
|
||||||
|
View coordinateValueTableRow = activity.findViewById(R.id.stats_coordinate_value_table_row);
|
||||||
|
coordinateLabelTableRow.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
|
||||||
|
coordinateValueTableRow.setVisibility(showCoordinate ? View.VISIBLE : View.GONE);
|
||||||
|
if (showCoordinate) {
|
||||||
|
double latitude = location == null ? Double.NaN : location.getLatitude();
|
||||||
|
double longitude = location == null ? Double.NaN : location.getLongitude();
|
||||||
|
setCoordinateValue(activity, R.id.stats_latitude_value, latitude);
|
||||||
|
setCoordinateValue(activity, R.id.stats_longitude_value, longitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the trip statistics values.
|
|
||||||
*
|
|
||||||
* @param activity the activity
|
|
||||||
* @param tripStatistics the trip statistics
|
|
||||||
* @param metricUnits true to display in metric units
|
|
||||||
* @param reportSpeed true to report speed
|
|
||||||
*/
|
|
||||||
public static void setTripStatisticsValues(
|
|
||||||
Activity activity, TripStatistics tripStatistics, boolean metricUnits, boolean reportSpeed) {
|
|
||||||
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
|
||||||
double maxSpeed = tripStatistics == null ? Double.NaN : tripStatistics.getMaxSpeed();
|
|
||||||
long totalTime = tripStatistics == null ? -1L : tripStatistics.getTotalTime();
|
|
||||||
double averageSpeed = tripStatistics == null ? Double.NaN : tripStatistics.getAverageSpeed();
|
|
||||||
long movingTime = tripStatistics == null ? -1L : tripStatistics.getMovingTime();
|
|
||||||
double averageMovingSpeed = tripStatistics == null ? Double.NaN
|
|
||||||
: tripStatistics.getAverageMovingSpeed();
|
|
||||||
double elevationGain = tripStatistics == null ? Double.NaN
|
|
||||||
: tripStatistics.getTotalElevationGain();
|
|
||||||
double minElevation = tripStatistics == null ? Double.NaN : tripStatistics.getMinElevation();
|
|
||||||
double maxElevation = tripStatistics == null ? Double.NaN : tripStatistics.getMaxElevation();
|
|
||||||
double minGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMinGrade();
|
|
||||||
double maxGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMaxGrade();
|
|
||||||
|
|
||||||
StatsUtils.setDistanceValue(
|
|
||||||
activity, R.id.stats_total_distance_value, totalDistance, metricUnits);
|
|
||||||
StatsUtils.setSpeedValue(
|
|
||||||
activity, R.id.stats_max_speed_value, maxSpeed, metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setTimeValue(activity, R.id.stats_total_time_value, totalTime);
|
|
||||||
StatsUtils.setSpeedValue(
|
|
||||||
activity, R.id.stats_average_speed_value, averageSpeed, metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setTimeValue(activity, R.id.stats_moving_time_value, movingTime);
|
|
||||||
StatsUtils.setSpeedValue(activity, R.id.stats_average_moving_speed_value, averageMovingSpeed,
|
|
||||||
metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setAltitudeValue(
|
|
||||||
activity, R.id.stats_elevation_gain_value, elevationGain, metricUnits);
|
|
||||||
StatsUtils.setAltitudeValue(
|
|
||||||
activity, R.id.stats_min_elevation_value, minElevation, metricUnits);
|
|
||||||
StatsUtils.setAltitudeValue(
|
|
||||||
activity, R.id.stats_max_elevation_value, maxElevation, metricUnits);
|
|
||||||
StatsUtils.setGradeValue(activity, R.id.stats_min_grade_value, minGrade);
|
|
||||||
StatsUtils.setGradeValue(activity, R.id.stats_max_grade_value, maxGrade);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the location values.
|
|
||||||
*
|
|
||||||
* @param activity the activity
|
|
||||||
* @param location the location
|
|
||||||
* @param metricUnits true to display in metric units
|
|
||||||
* @param reportSpeed true to report speed
|
|
||||||
*/
|
|
||||||
public static void setLocationValues(
|
|
||||||
Activity activity, Location location, boolean metricUnits, boolean reportSpeed) {
|
|
||||||
double speed = location == null ? Double.NaN : location.getSpeed();
|
|
||||||
double altitude = location == null ? Double.NaN : location.getAltitude();
|
|
||||||
double latitude = location == null ? Double.NaN : location.getLatitude();
|
|
||||||
double longitude = location == null ? Double.NaN : location.getLongitude();
|
|
||||||
|
|
||||||
StatsUtils.setSpeedValue(activity, R.id.stats_speed_value, speed, metricUnits, reportSpeed);
|
|
||||||
StatsUtils.setAltitudeValue(activity, R.id.stats_elevation_value, altitude, metricUnits);
|
|
||||||
StatsUtils.setCoordinateValue(activity, R.id.stats_latitude_value, latitude);
|
|
||||||
StatsUtils.setCoordinateValue(activity, R.id.stats_longitude_value, longitude);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the location elevation value.
|
|
||||||
*
|
|
||||||
* @param activity the activity
|
|
||||||
* @param elevation the elevation in meters
|
|
||||||
* @param metricUnits true to display in metric units
|
|
||||||
*/
|
|
||||||
public static void setLocationElevationValue(
|
|
||||||
Activity activity, double elevation, boolean metricUnits) {
|
|
||||||
StatsUtils.setAltitudeValue(activity, R.id.stats_elevation_value, elevation, metricUnits);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the total time value.
|
* Sets the total time value.
|
||||||
*
|
*
|
||||||
* @param activity the activity
|
* @param activity the activity
|
||||||
* @param totalTime the total time
|
* @param totalTime the total time
|
||||||
*/
|
*/
|
||||||
public static void setTotalTimeValue(Activity activity, long totalTime) {
|
public static void setTotalTimeValue(Activity activity, long totalTime) {
|
||||||
StatsUtils.setTimeValue(activity, R.id.stats_total_time_value, totalTime);
|
setTimeValue(activity, R.id.stats_total_time_value, totalTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the trip statistics values.
|
||||||
|
*
|
||||||
|
* @param activity the activity
|
||||||
|
* @param tripStatistics the trip statistics
|
||||||
|
*/
|
||||||
|
public static void setTripStatisticsValues(Activity activity, TripStatistics tripStatistics) {
|
||||||
|
boolean metricUnits = PreferencesUtils.getBoolean(activity, R.string.metric_units_key, true);
|
||||||
|
boolean reportSpeed = PreferencesUtils.getBoolean(activity, R.string.report_speed_key, true);
|
||||||
|
boolean showTotalTime = PreferencesUtils.getBoolean(
|
||||||
|
activity, R.string.stats_show_total_time_key, true);
|
||||||
|
|
||||||
|
// Set total distance
|
||||||
|
double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
|
||||||
|
setDistanceValue(activity, R.id.stats_total_distance_value, totalDistance, metricUnits);
|
||||||
|
|
||||||
|
// Set total time/moving time
|
||||||
|
setTimeLabel(activity, R.id.stats_total_time_label, R.string.stats_total_time,
|
||||||
|
R.string.stats_moving_time, showTotalTime);
|
||||||
|
long totalTime;
|
||||||
|
if (tripStatistics == null) {
|
||||||
|
totalTime = -1L;
|
||||||
|
} else {
|
||||||
|
totalTime = showTotalTime ? tripStatistics.getTotalTime() : tripStatistics.getMovingTime();
|
||||||
|
}
|
||||||
|
setTimeValue(activity, R.id.stats_total_time_value, totalTime);
|
||||||
|
|
||||||
|
// Set average speed/moving average speed
|
||||||
|
if (showTotalTime) {
|
||||||
|
setSpeedLabel(activity, R.id.stats_average_speed_label, R.string.stats_average_speed,
|
||||||
|
R.string.stats_average_pace, reportSpeed);
|
||||||
|
} else {
|
||||||
|
setSpeedLabel(activity, R.id.stats_average_speed_label, R.string.stats_average_moving_speed,
|
||||||
|
R.string.stats_average_moving_pace, reportSpeed);
|
||||||
|
}
|
||||||
|
double averageSpeed;
|
||||||
|
if (tripStatistics == null) {
|
||||||
|
averageSpeed = Double.NaN;
|
||||||
|
} else {
|
||||||
|
averageSpeed = showTotalTime ? tripStatistics.getAverageSpeed()
|
||||||
|
: tripStatistics.getAverageMovingSpeed();
|
||||||
|
}
|
||||||
|
setSpeedValue(activity, R.id.stats_average_speed_value, averageSpeed, metricUnits, reportSpeed);
|
||||||
|
|
||||||
|
// Set max speed
|
||||||
|
setSpeedLabel(activity, R.id.stats_max_speed_label, R.string.stats_max_speed,
|
||||||
|
R.string.stats_fastest_pace, reportSpeed);
|
||||||
|
double maxSpeed = tripStatistics == null ? Double.NaN : tripStatistics.getMaxSpeed();
|
||||||
|
setSpeedValue(activity, R.id.stats_max_speed_value, maxSpeed, metricUnits, reportSpeed);
|
||||||
|
|
||||||
|
// Set elevation
|
||||||
|
boolean showElevation = PreferencesUtils.getBoolean(
|
||||||
|
activity, R.string.stats_show_elevation_key, false);
|
||||||
|
View elevationLabelTableRow1 = activity.findViewById(R.id.stats_elevation_label_table_row1);
|
||||||
|
View elevationValueTableRow1 = activity.findViewById(R.id.stats_elevation_value_table_row1);
|
||||||
|
View elevationLabelTableRow2 = activity.findViewById(R.id.stats_elevation_label_table_row2);
|
||||||
|
View elevationValueTableRow2 = activity.findViewById(R.id.stats_elevation_value_table_row2);
|
||||||
|
elevationLabelTableRow1.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
elevationValueTableRow1.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
elevationLabelTableRow2.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
elevationValueTableRow2.setVisibility(showElevation ? View.VISIBLE : View.GONE);
|
||||||
|
if (showElevation) {
|
||||||
|
double elevationGain = tripStatistics == null ? Double.NaN
|
||||||
|
: tripStatistics.getTotalElevationGain();
|
||||||
|
double minElevation = tripStatistics == null ? Double.NaN : tripStatistics.getMinElevation();
|
||||||
|
double maxElevation = tripStatistics == null ? Double.NaN : tripStatistics.getMaxElevation();
|
||||||
|
setElevationValue(activity, R.id.stats_elevation_gain_value, elevationGain, metricUnits);
|
||||||
|
setElevationValue(activity, R.id.stats_min_elevation_value, minElevation, metricUnits);
|
||||||
|
setElevationValue(activity, R.id.stats_max_elevation_value, maxElevation, metricUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set grade
|
||||||
|
boolean showGrade = PreferencesUtils.getBoolean(activity, R.string.stats_show_grade_key, false);
|
||||||
|
View gradeLabelTableRow = activity.findViewById(R.id.stats_grade_label_table_row);
|
||||||
|
View gradeValueTableRow = activity.findViewById(R.id.stats_grade_value_table_row);
|
||||||
|
gradeLabelTableRow.setVisibility(showGrade ? View.VISIBLE : View.GONE);
|
||||||
|
gradeValueTableRow.setVisibility(showGrade ? View.VISIBLE : View.GONE);
|
||||||
|
if (showGrade) {
|
||||||
|
double minGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMinGrade();
|
||||||
|
double maxGrade = tripStatistics == null ? Double.NaN : tripStatistics.getMaxGrade();
|
||||||
|
setGradeValue(activity, R.id.stats_min_grade_value, minGrade);
|
||||||
|
setGradeValue(activity, R.id.stats_max_grade_value, maxGrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a time label.
|
||||||
|
*
|
||||||
|
* @param activity the activity
|
||||||
|
* @param id the time label resource id
|
||||||
|
* @param totalTimeId the total time string id
|
||||||
|
* @param movingTimeId the moving time string id
|
||||||
|
* @param totalTime true to use total time
|
||||||
|
*/
|
||||||
|
private static void setTimeLabel(Activity activity, int id, int totalTimeId, int movingTimeId,
|
||||||
|
boolean totalTime) {
|
||||||
|
TextView textView = (TextView) activity.findViewById(id);
|
||||||
|
textView.setText(totalTime ? totalTimeId : movingTimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,25 +283,25 @@ public class StatsUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an altitude value.
|
* Sets an elevation value.
|
||||||
*
|
*
|
||||||
* @param activity the activity
|
* @param activity the activity
|
||||||
* @param id the altitude value resource id
|
* @param id the elevation value resource id
|
||||||
* @param altitude the altitude in meters
|
* @param elevation the elevation in meters
|
||||||
* @param metricUnits true to display in metric units
|
* @param metricUnits true to display in metric units
|
||||||
*/
|
*/
|
||||||
private static void setAltitudeValue(
|
private static void setElevationValue(
|
||||||
Activity activity, int id, double altitude, boolean metricUnits) {
|
Activity activity, int id, double elevation, boolean metricUnits) {
|
||||||
TextView textView = (TextView) activity.findViewById(id);
|
TextView textView = (TextView) activity.findViewById(id);
|
||||||
String value;
|
String value;
|
||||||
if (Double.isNaN(altitude) || Double.isInfinite(altitude)) {
|
if (Double.isNaN(elevation) || Double.isInfinite(elevation)) {
|
||||||
value = activity.getString(R.string.value_unknown);
|
value = activity.getString(R.string.value_unknown);
|
||||||
} else {
|
} else {
|
||||||
if (metricUnits) {
|
if (metricUnits) {
|
||||||
value = activity.getString(R.string.value_float_meter, altitude);
|
value = activity.getString(R.string.value_float_meter, elevation);
|
||||||
} else {
|
} else {
|
||||||
altitude *= UnitConversions.M_TO_FT;
|
elevation *= UnitConversions.M_TO_FT;
|
||||||
value = activity.getString(R.string.value_float_feet, altitude);
|
value = activity.getString(R.string.value_float_feet, elevation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textView.setText(value);
|
textView.setText(value);
|
||||||
|
|||||||
@@ -17,9 +17,11 @@
|
|||||||
package com.google.android.apps.mytracks.util;
|
package com.google.android.apps.mytracks.util;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.TrackEditActivity;
|
import com.google.android.apps.mytracks.TrackEditActivity;
|
||||||
|
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityManager.RunningServiceInfo;
|
import android.app.ActivityManager.RunningServiceInfo;
|
||||||
@@ -28,6 +30,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ public class TrackRecordingServiceConnectionUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes the track recording service connection.
|
* Resumes the track recording service connection.
|
||||||
*
|
*
|
||||||
* @param context the context
|
* @param context the context
|
||||||
* @param trackRecordingServiceConnection the track recording service
|
* @param trackRecordingServiceConnection the track recording service
|
||||||
* connection
|
* connection
|
||||||
@@ -134,4 +137,29 @@ public class TrackRecordingServiceConnectionUtils {
|
|||||||
PreferencesUtils.setRecordingTrackId(context, -1L);
|
PreferencesUtils.setRecordingTrackId(context, -1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a marker.
|
||||||
|
*/
|
||||||
|
public static void addMarker(Context context,
|
||||||
|
TrackRecordingServiceConnection trackRecordingServiceConnection,
|
||||||
|
WaypointCreationRequest waypointCreationRequest) {
|
||||||
|
ITrackRecordingService trackRecordingService = trackRecordingServiceConnection
|
||||||
|
.getServiceIfBound();
|
||||||
|
if (trackRecordingService == null) {
|
||||||
|
Log.d(TAG, "Unable to add marker, no track recording service");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (trackRecordingService.insertWaypoint(waypointCreationRequest) != -1L) {
|
||||||
|
Toast.makeText(context, R.string.marker_add_success, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Unable to add marker", e);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
Log.e(TAG, "Unable to add marker.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Toast.makeText(context, R.string.marker_add_error, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class TrackWidgetProvider
|
|||||||
private Context context;
|
private Context context;
|
||||||
private String unknown;
|
private String unknown;
|
||||||
private TrackObserver trackObserver;
|
private TrackObserver trackObserver;
|
||||||
private boolean isMetric;
|
private boolean metricUnits;
|
||||||
private boolean reportSpeed;
|
private boolean reportSpeed;
|
||||||
private long selectedTrackId;
|
private long selectedTrackId;
|
||||||
private SharedPreferences sharedPreferences;
|
private SharedPreferences sharedPreferences;
|
||||||
@@ -178,11 +178,11 @@ public class TrackWidgetProvider
|
|||||||
if (TRACK_STARTED_ACTION.equals(action)) {
|
if (TRACK_STARTED_ACTION.equals(action)) {
|
||||||
// If a new track is started by this appwidget or elsewhere,
|
// If a new track is started by this appwidget or elsewhere,
|
||||||
// toggle the button to active and have it disable the track if pressed.
|
// toggle the button to active and have it disable the track if pressed.
|
||||||
setButtonIntent(views, R.string.track_action_end, R.drawable.appwidget_button_enabled);
|
setButtonIntent(views, R.string.track_action_end, R.drawable.app_widget_button_enabled);
|
||||||
} else {
|
} else {
|
||||||
// If a track is stopped by this appwidget or elsewhere,
|
// If a track is stopped by this appwidget or elsewhere,
|
||||||
// toggle the button to inactive and have it start a new track if pressed.
|
// toggle the button to inactive and have it start a new track if pressed.
|
||||||
setButtonIntent(views, R.string.track_action_start, R.drawable.appwidget_button_disabled);
|
setButtonIntent(views, R.string.track_action_start, R.drawable.app_widget_button_disabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,10 +218,10 @@ public class TrackWidgetProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
TripStatistics stats = track.getStatistics();
|
TripStatistics stats = track.getStatistics();
|
||||||
String distance = StringUtils.formatDistance(context, stats.getTotalDistance(), isMetric);
|
String distance = StringUtils.formatDistance(context, stats.getTotalDistance(), metricUnits);
|
||||||
String time = StringUtils.formatElapsedTime(stats.getMovingTime());
|
String time = StringUtils.formatElapsedTime(stats.getMovingTime());
|
||||||
String speed = StringUtils.formatSpeed(
|
String speed = StringUtils.formatSpeed(
|
||||||
context, stats.getAverageMovingSpeed(), isMetric, reportSpeed);
|
context, stats.getAverageMovingSpeed(), metricUnits, reportSpeed);
|
||||||
|
|
||||||
views.setTextViewText(R.id.appwidget_distance_text, distance);
|
views.setTextViewText(R.id.appwidget_distance_text, distance);
|
||||||
views.setTextViewText(R.id.appwidget_time_text, time);
|
views.setTextViewText(R.id.appwidget_time_text, time);
|
||||||
@@ -230,14 +230,12 @@ public class TrackWidgetProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||||
String metricUnitsKey = context.getString(R.string.metric_units_key);
|
if (key == null || key.equals(PreferencesUtils.getMetricUnitsKey(context))) {
|
||||||
if (key == null || key.equals(metricUnitsKey)) {
|
metricUnits = PreferencesUtils.isMetricUnits(context);
|
||||||
isMetric = prefs.getBoolean(metricUnitsKey, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String reportSpeedKey = context.getString(R.string.report_speed_key);
|
if (key == null || key.equals(PreferencesUtils.getReportSpeedKey(context))) {
|
||||||
if (key == null || key.equals(reportSpeedKey)) {
|
reportSpeed = PreferencesUtils.isReportSpeed(context);
|
||||||
reportSpeed = prefs.getBoolean(reportSpeedKey, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == null || key.equals(PreferencesUtils.getSelectedTrackIdKey(context))) {
|
if (key == null || key.equals(PreferencesUtils.getSelectedTrackIdKey(context))) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ limitations under the License.
|
|||||||
android:targetSdkVersion="15" />
|
android:targetSdkVersion="15" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/arrow_icon"
|
android:icon="@drawable/my_tracks_icon"
|
||||||
android:label="@string/lib_name" >
|
android:label="@string/lib_name" >
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -129,6 +129,15 @@ public interface MyTracksProviderUtils {
|
|||||||
*/
|
*/
|
||||||
long getLastWaypointId(long trackId);
|
long getLastWaypointId(long trackId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next marker number.
|
||||||
|
*
|
||||||
|
* @param trackId the track id
|
||||||
|
* @param statistics true for statistics marker, false for waypoint marker
|
||||||
|
* @return the next number or -1 if unable to get the value
|
||||||
|
*/
|
||||||
|
int getNextMarkerNumber(long trackId, boolean statistics);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the last recorded track from the track provider.
|
* Finds the last recorded track from the track provider.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -794,6 +794,37 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNextMarkerNumber(long trackId, boolean statistics) {
|
||||||
|
if (trackId == -1L) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
String[] projection = { "_id" };
|
||||||
|
String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "=?";
|
||||||
|
String[] selectionArgs = new String[] { String.valueOf(trackId),
|
||||||
|
String.valueOf(statistics ? Waypoint.TYPE_STATISTICS : Waypoint.TYPE_WAYPOINT) };
|
||||||
|
Cursor cursor = null;
|
||||||
|
try {
|
||||||
|
cursor = contentResolver.query(
|
||||||
|
WaypointsColumns.CONTENT_URI, projection, selection, selectionArgs, null);
|
||||||
|
if (cursor != null) {
|
||||||
|
int count = cursor.getCount();
|
||||||
|
/*
|
||||||
|
* For statistics markers, the first marker is for the track statistics,
|
||||||
|
* thus just return the count as the next user visible number.
|
||||||
|
*/
|
||||||
|
return statistics ? count : count + 1;
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Log.w(TAG, "Caught unexpected exception.", e);
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Track getLastTrack() {
|
public Track getLastTrack() {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import android.os.Parcelable;
|
|||||||
public class WaypointCreationRequest implements Parcelable {
|
public class WaypointCreationRequest implements Parcelable {
|
||||||
|
|
||||||
public static enum WaypointType {
|
public static enum WaypointType {
|
||||||
MARKER,
|
WAYPOINT,
|
||||||
STATISTICS;
|
STATISTICS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ public class WaypointCreationRequest implements Parcelable {
|
|||||||
private String description;
|
private String description;
|
||||||
private String iconUrl;
|
private String iconUrl;
|
||||||
|
|
||||||
public final static WaypointCreationRequest DEFAULT_MARKER =
|
public final static WaypointCreationRequest DEFAULT_WAYPOINT =
|
||||||
new WaypointCreationRequest(WaypointType.MARKER);
|
new WaypointCreationRequest(WaypointType.WAYPOINT);
|
||||||
public final static WaypointCreationRequest DEFAULT_STATISTICS =
|
public final static WaypointCreationRequest DEFAULT_STATISTICS =
|
||||||
new WaypointCreationRequest(WaypointType.STATISTICS);
|
new WaypointCreationRequest(WaypointType.STATISTICS);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.android.apps.mytracks.content.TrackDataHub.ListenerDataType;
|
|||||||
import com.google.android.apps.mytracks.content.TrackDataListener.ProviderState;
|
import com.google.android.apps.mytracks.content.TrackDataListener.ProviderState;
|
||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceTest.MockContext;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceTest.MockContext;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
|
||||||
import com.google.android.testing.mocking.AndroidMock;
|
import com.google.android.testing.mocking.AndroidMock;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -798,12 +797,12 @@ public class TrackDataHubTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testDisplayPreferencesListen() throws Exception {
|
public void testDisplayPreferencesListen() throws Exception {
|
||||||
String metricUnitsKey = context.getString(R.string.metric_units_key);
|
String metricUnitsKey = PreferencesUtils.getMetricUnitsKey(context);
|
||||||
String speedKey = context.getString(R.string.report_speed_key);
|
String reportSpeedKey = PreferencesUtils.getReportSpeedKey(context);
|
||||||
|
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putBoolean(metricUnitsKey, true)
|
.putBoolean(metricUnitsKey, true)
|
||||||
.putBoolean(speedKey, true)
|
.putBoolean(reportSpeedKey, true)
|
||||||
.apply();
|
.apply();
|
||||||
|
|
||||||
Capture<OnSharedPreferenceChangeListener> listenerCapture =
|
Capture<OnSharedPreferenceChangeListener> listenerCapture =
|
||||||
@@ -829,10 +828,10 @@ public class TrackDataHubTest extends AndroidTestCase {
|
|||||||
replay();
|
replay();
|
||||||
|
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putBoolean(speedKey, false)
|
.putBoolean(reportSpeedKey, false)
|
||||||
.apply();
|
.apply();
|
||||||
OnSharedPreferenceChangeListener listener = listenerCapture.getValue();
|
OnSharedPreferenceChangeListener listener = listenerCapture.getValue();
|
||||||
listener.onSharedPreferenceChanged(prefs, speedKey);
|
listener.onSharedPreferenceChanged(prefs, reportSpeedKey);
|
||||||
|
|
||||||
AndroidMock.verify(dataSources, providerUtils, listener1, listener2);
|
AndroidMock.verify(dataSources, providerUtils, listener1, listener2);
|
||||||
AndroidMock.reset(dataSources, providerUtils, listener1, listener2);
|
AndroidMock.reset(dataSources, providerUtils, listener1, listener2);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import android.test.AndroidTestCase;
|
|||||||
public class WaypointCreationRequestTest extends AndroidTestCase {
|
public class WaypointCreationRequestTest extends AndroidTestCase {
|
||||||
|
|
||||||
public void testTypeParceling() {
|
public void testTypeParceling() {
|
||||||
WaypointCreationRequest original = WaypointCreationRequest.DEFAULT_MARKER;
|
WaypointCreationRequest original = WaypointCreationRequest.DEFAULT_WAYPOINT;
|
||||||
Parcel p = Parcel.obtain();
|
Parcel p = Parcel.obtain();
|
||||||
original.writeToParcel(p, 0);
|
original.writeToParcel(p, 0);
|
||||||
p.setDataPosition(0);
|
p.setDataPosition(0);
|
||||||
@@ -42,7 +42,7 @@ public class WaypointCreationRequestTest extends AndroidTestCase {
|
|||||||
|
|
||||||
public void testAllAttributesParceling() {
|
public void testAllAttributesParceling() {
|
||||||
WaypointCreationRequest original =
|
WaypointCreationRequest original =
|
||||||
new WaypointCreationRequest(WaypointType.MARKER, "name", "category", "description", "img.png");
|
new WaypointCreationRequest(WaypointType.WAYPOINT, "name", "category", "description", "img.png");
|
||||||
Parcel p = Parcel.obtain();
|
Parcel p = Parcel.obtain();
|
||||||
original.writeToParcel(p, 0);
|
original.writeToParcel(p, 0);
|
||||||
p.setDataPosition(0);
|
p.setDataPosition(0);
|
||||||
|
|||||||
@@ -31,9 +31,16 @@ public class CsvTrackWriterTest extends TrackFormatWriterTest {
|
|||||||
String expectedTrackHeader = getExpectedLine(
|
String expectedTrackHeader = getExpectedLine(
|
||||||
"Name", "Activity type", "Description");
|
"Name", "Activity type", "Description");
|
||||||
String expectedTrack = getExpectedLine(TRACK_NAME, TRACK_CATEGORY, TRACK_DESCRIPTION);
|
String expectedTrack = getExpectedLine(TRACK_NAME, TRACK_CATEGORY, TRACK_DESCRIPTION);
|
||||||
String expectedMarkerHeader = getExpectedLine("Marker name", "Marker type",
|
String expectedMarkerHeader = getExpectedLine("Name",
|
||||||
"Marker description", "Latitude (deg)", "Longitude (deg)", "Altitude (m)", "Bearing (deg)",
|
"Marker type",
|
||||||
"Accuracy (m)", "Speed (m/s)", "Time");
|
"Description",
|
||||||
|
"Latitude (deg)",
|
||||||
|
"Longitude (deg)",
|
||||||
|
"Altitude (m)",
|
||||||
|
"Bearing (deg)",
|
||||||
|
"Accuracy (m)",
|
||||||
|
"Speed (m/s)",
|
||||||
|
"Time");
|
||||||
String expectedMarker1 = getExpectedLine(WAYPOINT1_NAME, WAYPOINT1_CATEGORY,
|
String expectedMarker1 = getExpectedLine(WAYPOINT1_NAME, WAYPOINT1_CATEGORY,
|
||||||
WAYPOINT1_DESCRIPTION, "1.0", "-1.0", "10.0", "100.0", "1,000", "10,000",
|
WAYPOINT1_DESCRIPTION, "1.0", "-1.0", "10.0", "100.0", "1,000", "10,000",
|
||||||
"1970-01-01T00:01:40.000Z");
|
"1970-01-01T00:01:40.000Z");
|
||||||
|
|||||||
@@ -491,11 +491,9 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
|
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
|
||||||
assertEquals(2, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
|
assertEquals(2, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
|
||||||
|
|
||||||
Waypoint wpt = providerUtils.getWaypoint(1);
|
Waypoint wpt = providerUtils.getWaypoint(2);
|
||||||
assertEquals(getContext().getString(R.string.marker_statistics_icon_url),
|
assertEquals(getContext().getString(R.string.marker_statistics_icon_url), wpt.getIcon());
|
||||||
wpt.getIcon());
|
assertEquals(getContext().getString(R.string.marker_statistics_name_format, 1), wpt.getName());
|
||||||
assertEquals(getContext().getString(R.string.marker_edit_type_statistics),
|
|
||||||
wpt.getName());
|
|
||||||
assertEquals(Waypoint.TYPE_STATISTICS, wpt.getType());
|
assertEquals(Waypoint.TYPE_STATISTICS, wpt.getType());
|
||||||
assertEquals(123L, wpt.getTrackId());
|
assertEquals(123L, wpt.getTrackId());
|
||||||
assertEquals(0.0, wpt.getLength());
|
assertEquals(0.0, wpt.getLength());
|
||||||
@@ -512,7 +510,7 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
assertFalse(service.isRecording());
|
assertFalse(service.isRecording());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER);
|
service.insertWaypoint(WaypointCreationRequest.DEFAULT_WAYPOINT);
|
||||||
fail("Expecting IllegalStateException");
|
fail("Expecting IllegalStateException");
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
// Expected.
|
// Expected.
|
||||||
@@ -526,12 +524,11 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
ITrackRecordingService service = bindAndGetService(createStartIntent());
|
ITrackRecordingService service = bindAndGetService(createStartIntent());
|
||||||
assertTrue(service.isRecording());
|
assertTrue(service.isRecording());
|
||||||
|
|
||||||
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER));
|
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_WAYPOINT));
|
||||||
Waypoint wpt = providerUtils.getWaypoint(1);
|
Waypoint wpt = providerUtils.getWaypoint(1);
|
||||||
assertEquals(getContext().getString(R.string.marker_waypoint_icon_url),
|
assertEquals(getContext().getString(R.string.marker_waypoint_icon_url),
|
||||||
wpt.getIcon());
|
wpt.getIcon());
|
||||||
assertEquals(getContext().getString(R.string.marker_edit_type_waypoint),
|
assertEquals(getContext().getString(R.string.marker_waypoint_name_format, 1), wpt.getName());
|
||||||
wpt.getName());
|
|
||||||
assertEquals(Waypoint.TYPE_WAYPOINT, wpt.getType());
|
assertEquals(Waypoint.TYPE_WAYPOINT, wpt.getType());
|
||||||
assertEquals(123L, wpt.getTrackId());
|
assertEquals(123L, wpt.getTrackId());
|
||||||
assertEquals(0.0, wpt.getLength());
|
assertEquals(0.0, wpt.getLength());
|
||||||
@@ -727,7 +724,7 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
|||||||
if (i % 10 == 0) {
|
if (i % 10 == 0) {
|
||||||
service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
|
service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
|
||||||
} else if (i % 7 == 0) {
|
} else if (i % 7 == 0) {
|
||||||
service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER);
|
service.insertWaypoint(WaypointCreationRequest.DEFAULT_WAYPOINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||