Use a dialog for the welcome page. Thus the startup sequence

consists of three dialogs.
Rename to HelpActivity.
Fix activity button styles.
Reuse EulaDialogFragment when invoked from the AboutDialogFragment.
Only hide the title bar on the TrackDetailPage.
This commit is contained in:
Jimmy Shih
2012-04-07 15:52:28 -07:00
parent 54bfe5d4b4
commit adfa66505e
23 changed files with 679 additions and 562 deletions
+3 -4
View File
@@ -148,6 +148,9 @@ limitations under the License.
android:label="@string/menu_aggregated_statistics"
android:name="com.google.android.apps.mytracks.AggregatedStatsActivity" />
<activity android:name="com.google.android.apps.mytracks.ExportActivity"/>
<activity
android:label="@string/menu_help"
android:name="com.google.android.apps.mytracks.HelpActivity" />
<activity
android:label="@string/my_tracks_importer"
android:name="com.google.android.apps.mytracks.ImportActivity"
@@ -229,10 +232,6 @@ limitations under the License.
android:name="android.app.default_searchable"
android:value="com.google.android.apps.mytracks.SearchActivity" />
</activity>
<activity
android:exported="false"
android:label="@string/welcome_title"
android:name="com.google.android.apps.mytracks.WelcomeActivity" />
<activity android:name="com.google.android.apps.mytracks.io.backup.BackupActivity"/>
<activity android:name="com.google.android.apps.mytracks.io.backup.RestoreActivity"/>
<activity android:name="com.google.android.apps.mytracks.io.backup.RestoreChooserActivity"/>
+26
View File
@@ -0,0 +1,26 @@
<?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" >
<Button
android:id="@+id/help_about"
android:text="@string/help_about"
style="@style/BottomButton" />
<Button
android:id="@+id/help_ok"
android:text="@string/generic_ok"
style="@style/BottomButton" />
</merge>
+30
View File
@@ -0,0 +1,30 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical" >
<ScrollView
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent" >
<include layout="@layout/welcome" />
</ScrollView>
<LinearLayout style="@style/BottomBar" >
<include layout="@layout/help_buttons" />
</LinearLayout>
</LinearLayout>
+26
View File
@@ -0,0 +1,26 @@
<?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" >
<Button
android:id="@+id/help_ok"
android:text="@string/generic_ok"
style="@style/BottomButton" />
<Button
android:id="@+id/help_about"
android:text="@string/help_about"
style="@style/BottomButton" />
</merge>
+114
View File
@@ -0,0 +1,114 @@
<?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>
@@ -486,16 +486,14 @@ limitations under the License.
</TableLayout>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button android:id="@+id/waypointdetails_save"
android:layout_gravity="left"
<LinearLayout style="@style/BottomBar" >
<Button
android:id="@+id/waypointdetails_save"
android:text="@string/generic_save"
style="@style/Button"/>
<Button android:id="@+id/waypointdetails_cancel"
android:layout_gravity="right"
style="@style/BottomButton" />
<Button
android:id="@+id/waypointdetails_cancel"
android:text="@string/generic_cancel"
style="@style/Button"/>
<LinearLayout style="@style/ButtonSpacer"/>
style="@style/BottomButton" />
</LinearLayout>
</LinearLayout>
@@ -35,21 +35,18 @@ limitations under the License.
android:text="@string/marker_list_pick_one"
android:layout_weight="1"/>
</LinearLayout>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button android:id="@+id/waypointslist_btn_insert_statistics"
android:layout_gravity="left"
<LinearLayout style="@style/BottomBar" >
<Button
android:id="@+id/waypointslist_btn_insert_statistics"
android:text="@string/marker_list_insert_statistics"
style="@style/Button"/>
<Button android:id="@+id/waypointslist_btn_insert_waypoint"
android:layout_gravity="right"
style="@style/BottomButton" />
<Button
android:id="@+id/waypointslist_btn_insert_waypoint"
android:text="@string/marker_list_insert_waypoint"
style="@style/Button"/>
<LinearLayout style="@style/ButtonSpacer"/>
style="@style/BottomButton" />
</LinearLayout>
</LinearLayout>
+3 -9
View File
@@ -92,20 +92,14 @@ limitations under the License.
/>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<LinearLayout style="@style/BottomBar" >
<Button
android:id="@+id/track_edit_save"
android:layout_gravity="left"
android:text="@string/generic_save"
style="@style/Button"
/>
style="@style/BottomButton" />
<Button
android:id="@+id/track_edit_cancel"
android:layout_gravity="right"
android:text="@string/generic_cancel"
style="@style/Button"
/>
<LinearLayout style="@style/ButtonSpacer"/>
style="@style/BottomButton" />
</LinearLayout>
</LinearLayout>
+4 -138
View File
@@ -14,142 +14,8 @@ 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<ScrollView
android:background="@color/white"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<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/welcome_my_tracks_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_my_tracks_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_app_navigation_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_app_navigation_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_add_graph_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_add_graph_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_gps_fix_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_gps_fix_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_send_google_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_send_google_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_share_friends_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_share_friends_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_waypoint_marker_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_waypoint_marker_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_statistics_marker_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_statistics_marker_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_data_connection_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_data_connection_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_battery_life_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_battery_life_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_share_file_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_share_file_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_location_precision_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_location_precision_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_elevation_precision_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_elevation_precision_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_edit_accuracy_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_edit_accuracy_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_split_track_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_split_track_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_delete_all_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_delete_all_answer"
style="@style/WelcomeTextView"/>
<TextView
android:text="@string/welcome_maps_sharing_question"
style="@style/WelcomeTextView.Question"/>
<TextView
android:text="@string/welcome_maps_sharing_answer"
style="@style/WelcomeTextView"/>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button
android:id="@+id/welcome_ok"
android:layout_gravity="left"
android:text="@string/generic_ok"
style="@style/Button"/>
<Button
android:id="@+id/welcome_about"
android:layout_gravity="right"
android:text="@string/welcome_about"
style="@style/Button"/>
<LinearLayout style="@style/ButtonSpacer"/>
</LinearLayout>
</LinearLayout>
android:layout_width="fill_parent" >
<include layout="@layout/help_content"/>
</ScrollView>
+152 -199
View File
@@ -700,6 +700,155 @@ limitations under the License.
Waiting for a better GPS fix. Make sure the sky is visible.
</string>
<!-- Help page -->
<string name="help_about"
translation_description="In the 'Help' page, the button on the bottom to open the 'About My
Tracks' dialog.">
About My Tracks
</string>
<string name="help_battery_life_answer"
translation_description="In the 'Help' page, the answer on battery life.">
The GPS receiver draws a relatively high amount of power, so a fully charged battery typically
survives less than 5 hours. Battery life depends on many factors, including signal strength,
battery freshness, and tasks running in parallel. Switching off some or all of the phone\'s
radios will lengthen battery life. Putting the phone into Airplane mode will yield the best
results.
</string>
<string name="help_battery_life_question"
translation_description="In the 'Help' page, the question on battery life.">
How long does the battery last when recording tracks?
</string>
<string name="help_data_connection_answer"
translation_description="In the 'Help' page, the answer on data connection.">
Cell signal or data connection is not required to record GPS tracks. However, if there is no
data connection, you will not be able to see a map. Instead, you will see a grey screen or a
partial map. Tracks, represented as simple lines, can still be recorded even if there is no data
connection.
</string>
<string name="help_data_connection_question"
translation_description="In the 'Help' page, the question on data connection.">
Do I need cell signal and data connection to use My Tracks?
</string>
<string name="help_delete_tracks_answer"
translation_description="In the 'Help' page, the answer on delete tracks.">
From the track list, select \"Delete all\" when not recording. This permanently deletes the
recorded tracks from memory. If you have saved tracks or backups on the SD card, you must delete
them separately. Tracks uploaded to Google Maps, Google Fusion Tables, and Google Doc must also
be deleted separately.
</string>
<string name="help_delete_tracks_question"
translation_description="In the 'Help' page, the question on delete tracks.">
How do I delete all the tracks from the phone?
</string>
<string name="help_edit_tracks_answer"
translation_description="In the 'Help' page, the answer on edit tracks.">
Currently, you can\'t with My Tracks. But you can upload your tracks to Google or save them to
the SD card to modify them there.
</string>
<string name="help_edit_tracks_question"
translation_description="In the 'Help' page, the question on edit tracks.">
How can I edit or correct tracks for accuracy?
</string>
<string name="help_elevation_precision_answer"
translation_description="In the 'Help' page, the help content answer on elevation
precision.">
GPS receivers measure elevations much less precisely than latitude and longitude. Elevations
can sometimes be off by a few hundred feet, though relative changes are tracked more precisely.
To get a good elevation measurement, make sure that you have a strong GPS signal and wait a few
minutes for the elevation to settle to a stable value.
</string>
<string name="help_elevation_precision_question"
translation_description="In the 'Help' page, the question on elevation precision.">
How precise is the elevation measurement?
</string>
<string name="help_gps_fix_answer"
translation_description="In the 'Help' page, the answer on the GPS fix message.">
For My Tracks to work, your phone needs to be in line-of-sight contact with the GPS satellites.
If the line-of-sight is obstructed by trees, buildings or canyon walls, you may not get an
accurate fix. If you see the message, wait a minute or two. If your device does not achieve a
fix, move to an area clear of obstructions and try again.
</string>
<string name="help_gps_fix_question"
translation_description="In the 'Help' page, the question on the GPS fix message.">
Why does the application sometimes display \"Waiting for a better GPS fix.\"?
</string>
<string name="help_location_precision_answer"
translation_description="In the 'Help' page, the answer on location precision.">
Under optimal conditions, the location error can be +/- 20 feet (6 meters). However, precision
depends on the quality of the GPS signal. The blue circle around the orange location arrow
indicates estimated precision. (You may need to zoom in or out to see the circle.) You can
change the GPS precision at Settings -> Recording -> GPS accuracy.
</string>
<string name="help_location_precision_question"
translation_description="In the 'Help' page, the question on location precision.">
How precise are the recorded tracks?
</string>
<string name="help_my_tracks_answer"
translation_description="In the 'Help' page, the answer on what is My Tracks.">
My Tracks allows you to record GPS tracks and visualize your hiking, running, biking or any
other activity while watching live performance statistics. My Tracks makes it easy to archive
your training history with Google Maps, Google Fusion Tables, and Google Docs, and share your
activities with friends and the world.
</string>
<string name="help_my_tracks_question"
translation_description="In the 'Help' page, the question on what is My Tracks.">
What is My Tracks?
</string>
<string name="help_saved_files_answer"
translation_description="In the 'Help' page, the answer on saved files.">
You can use Google Earth or similar applications to visualize and edit GPS tracks.
</string>
<string name="help_saved_files_question"
translation_description="In the 'Help' page, the question on saved files.">
What can I do with tracks after saving them to the SD card or sharing such files with friends?
</string>
<string name="help_share_friends_answer"
translation_description="In the 'Help' page, the answer on sharing with friends.">
You can share a track as a link to Google Map or Google Fusion Table (you will be prompted to
upload the track first) or as a GPX, KML, CSV, or TCX file in an e-mail attachment.
</string>
<string name="help_share_friends_question"
translation_description="In the 'Help' page, the question on sharing with friends.">
How do I share tracks with friends and the rest of the world?
</string>
<string name="help_share_visibility_answer"
translation_description="In the 'Help' page, the answer on share visibility.">
By default, tracks sent to Google Maps and Google Fusion Tables are public. You can change the
visibility of your tracks in Google Maps and Google Fusion. For Google Maps, you can change the
default from public to unlisted in Settings -> Sharing.
</string>
<string name="help_share_visibility_question"
translation_description="In the 'Help' page, the question on share visibility.">
Who can see the tracks I send to Google Maps and Google Fusion Tables?
</string>
<string name="help_split_track_answer"
translation_description="In the 'Help' page, the answer on splitting long tracks.">
Tracks on Google Maps and Google Fusion Tables are limited to certain sizes.
</string>
<string name="help_split_track_question"
translation_description="In the 'Help' page, the question on splitting long tracks.">
Why do very long tracks split into multiple segments upon sending them to Google Maps and
Google Fusion Tables?
</string>
<string name="help_statistics_marker_answer"
translation_description="In the 'Help' page, the answer on statistics markers.">
Statistics markers are used to segment a track to calculate statistics for each segment. For
example, let\'s say you are recording a bike ride up a hill, you can insert a statistics marker
at the bottom of the hill and another at the top.
</string>
<string name="help_statistics_marker_question"
translation_description="In the 'Help' page, the question on statistics markers.">
What are statistics markers?
</string>
<string name="help_waypoint_marker_answer"
translation_description="In the 'Help' page, the answer on waypoint markers.">
Waypoint markers are used to annotate a location.
</string>
<string name="help_waypoint_marker_question"
translation_description="In the 'Help' page, the question on waypoint markers.">
What are waypoint markers?
</string>
<!-- Import -->
<string name="import_error"
translation_description="When importing all the tracks, a toast message indicating import error
@@ -2792,205 +2941,9 @@ limitations under the License.
waypoint
</string>
<!-- Welcome Page -->
<string name="welcome_about"
translation_description="In the 'Welcome' page, the button on the bottom to open the 'About My
Tracks' dialog.">
About My Tracks
</string>
<string name="welcome_add_graph_answer"
translation_description="In the 'Welcome' page, the help content answer on adding graphs to the
graphs view.">
In the graphs view, Menu -> Chart settings.
</string>
<string name="welcome_add_graph_question"
translation_description="In the 'Welcome' page, the help content question on adding graphs to
the graphs view.">
How do I add more graphs?
</string>
<string name="welcome_app_navigation_answer"
translation_description="In the 'Welcome' page, the help content answer on app navigation.">
Touch the map. Left and right arrows will appear. Tap on these arrows to cycle between the map,
statistics, and graphs view.
</string>
<string name="welcome_app_navigation_question"
translation_description="In the 'Welcome' page, the help content question on app navigation.">
How do I see the map, statistics, and graphs view?
</string>
<string name="welcome_battery_life_answer"
translation_description="In the 'Welcome' page, the help content answer on battery life.">
The GPS receiver draws a relatively high amount of power, so a fully charged battery typically
survives less than 5 hours. Battery life depends on many factors, including signal strength,
battery freshness, and tasks running in parallel. Switching off some or all of the phone\'s
radios will lengthen battery life. Putting the phone into Airplane mode will yield the best
results.
</string>
<string name="welcome_battery_life_question"
translation_description="In the 'Welcome' page, the help content question on battery life.">
How long does the battery last when recording tracks?
</string>
<string name="welcome_data_connection_answer"
translation_description="In the 'Welcome' page, the help content answer on data connection.">
Cell signal or data connection is not required to record GPS tracks. However, if there is no
data connection, you will not be able to see a map. Instead, you will see a grey screen or a
partial map. Tracks, represented as simple lines, can still be recorded even if there is no data
connection.
</string>
<string name="welcome_data_connection_question"
translation_description="In the 'Welcome' page, the help content question on data connection.">
Do I need cell signal and data connection to use My Tracks?
</string>
<string name="welcome_delete_all_answer"
translation_description="In the 'Welcome' page, the help content answer on deleting all
tracks.">
Menu -> Tracks -> Delete all. This permanently deletes the recorded tracks from memory. If you
have saved tracks to the SD card, you must delete them separately. Tracks uploaded to Google
Maps, Google Fusion Tables, and Google Docs must also be deleted separately.
</string>
<string name="welcome_delete_all_question"
translation_description="In the 'Welcome' page, the help content question on deleting all
tracks.">
How do I delete all the tracks from the phone?
</string>
<string name="welcome_edit_accuracy_answer"
translation_description="In the 'Welcome' page, the help content answer on editing points.">
Once you upload tracks to Google Maps, Google Fusion Tables, or Google Docs, you can move,
delete or insert individual track points as desired.
</string>
<string name="welcome_edit_accuracy_question"
translation_description="In the 'Welcome' page, the help content question on editing points.">
How can I edit or correct tracks for accuracy?
</string>
<string name="welcome_elevation_precision_answer"
translation_description="In the 'Welcome' page, the help content answer on elevation
precision.">
GPS receivers measure elevations much less precisely than latitude and longitude. Elevations
can sometimes be off by a few hundred feet, though relative changes are tracked more precisely.
To get a good elevation measurement, make sure that you have a strong GPS signal and wait a few
minutes for the elevation to settle to a stable value.
</string>
<string name="welcome_elevation_precision_question"
translation_description="In the 'Welcome' page, the help content question on elevation
precision.">
How precise is the elevation measurement?
</string>
<string name="welcome_gps_fix_answer"
translation_description="In the 'Welcome' page, the help content answer on the GPS fix
message.">
For My Tracks to work, your phone needs to be in line-of-sight contact with the GPS satellites.
If the line-of-sight is obstructed by trees, buildings or canyon walls, you may not get an
accurate fix. If you see the message, wait a minute or two. If your device does not achieve a
fix, move to an area clear of obstructions and try again.
</string>
<string name="welcome_gps_fix_question"
translation_description="In the 'Welcome' page, the help content question on the GPS fix
message.">
Why does the application sometimes display \"Waiting for a better GPS fix. Make sure the sky is
visible.\"?
</string>
<string name="welcome_location_precision_answer"
translation_description="In the 'Welcome' page, the help content answer on location precision.">
Under optimal conditions, the location error can be +/- 20 feet (6 meters). However, precision
depends on the quality of the GPS signal. The blue circle around the orange location arrow
indicates estimated precision. (You may need to zoom in or out to see the circle.) You can
change the GPS precision at Settings -> Recording -> GPS accuracy. If the precision is too low,
at the top of the screen, you will see the message \"Waiting for a better GPS fix.\".
</string>
<string name="welcome_location_precision_question"
translation_description="In the 'Welcome' page, the help content question on location
precision.">
How precise are the recorded tracks?
</string>
<string name="welcome_maps_sharing_answer"
translation_description="In the 'Welcome' page, the help content answer on Google Maps
visibility.">
By default, new maps are public. To change the default to unlisted, uncheck Settings -> Sharing
-> Make new maps public. You can change the visibility of all your maps at My places in Google
Maps.
</string>
<string name="welcome_maps_sharing_question"
translation_description="In the 'Welcome' page, the help content question on Google Maps
visibility.">
Who can see the maps I send to Google Maps?
</string>
<string name="welcome_my_tracks_answer"
translation_description="In the 'Welcome' page, the help content answer on what is My Tracks.">
My Tracks allows you to record GPS tracks and visualize your hiking, running, biking or any
other activity while watching live performance statistics. My Tracks makes it easy to archive
your training history with Google Maps, Google Fusion Tables, and Google Docs, and share your
activities with friends and the world.
</string>
<string name="welcome_my_tracks_question"
translation_description="In the 'Welcome' page, the help content question on what is My
Tracks.">
What is My Tracks?
</string>
<string name="welcome_send_google_answer"
translation_description="In the 'Welcome' page, the help content answer on sending a track to
Google.">
Tap the Options button located at the bottom right corner of the map view and select \"Send to
Google...\".
</string>
<string name="welcome_send_google_question"
translation_description="In the 'Welcome' page, the help content question on sending a track to
Google.">
How do I send my tracks to Google Maps, Google Fusion Tables, and Google Docs?
</string>
<string name="welcome_share_file_answer"
translation_description="In the 'Welcome' page, the help content answer on sharing a file.">
You can use Google Earth or similar applications to visualize and edit GPS tracks.
</string>
<string name="welcome_share_file_question"
translation_description="In the 'Welcome' page, the help content question on sharing a file.">
What can I do with tracks after saving them to the SD card or sharing such files with friends?
</string>
<string name="welcome_share_friends_answer"
translation_description="In the 'Welcome' page, the help content answer on sharing a track with
friends.">
Tap the Options button located at the bottom right corner of the map view and select \"Share
with friends...\". You can share the track as a link to Google Map or Google Fusion Table
(you will be prompted to upload the track first) or as a GPX, KML, CSV, or TCX file in an e-mail
attachment.
</string>
<string name="welcome_share_friends_question"
translation_description="In the 'Welcome' page, the help content question on sharing a track
with friends.">
How do I share tracks with friends and the rest of the world?
</string>
<string name="welcome_split_track_answer"
translation_description="In the 'Welcome' page, the help content answer on splitting long
tracks.">
Tracks on Google Maps and Google Fusion Tables are limited to certain sizes.
</string>
<string name="welcome_split_track_question"
translation_description="In the 'Welcome' page, the help content question on splitting long
tracks.">
Why do very long tracks split into multiple segments upon sending them to Google Maps and
Google Fusion Tables?
</string>
<string name="welcome_statistics_marker_answer"
translation_description="In the 'Welcome' page, the help content answer on statistics markers.">
Statistics markers are used to segment a track to calculate statistics for each segment. For
example, let\'s say you are recording a bike ride up a hill, you can insert a statistics marker
at the bottom of the hill and another at the top by pressing Menu -> Markers -> Insert
statistics.
</string>
<string name="welcome_statistics_marker_question"
translation_description="In the 'Welcome' page, the help content question on statistics
markers.">
What are statistics markers?
</string>
<!-- Welcome -->
<string name="welcome_title"
translation_description="In the 'Welcome' page, the title of the page.">
My Tracks Welcome
</string>
<string name="welcome_waypoint_marker_answer"
translation_description="In the 'Welcome' page, the help content answer on waypoint markers.">
Waypoint markers are used to annotate a location. For example, if you are recording a track and
you are close to an interesting place, press Menu -> Markers -> Insert waypoint.
</string>
<string name="welcome_waypoint_marker_question"
translation_description="In the 'Welcome' page, the help content question on waypoint markers.">
What are waypoint markers?
translation_description="The title of the welcome dialog.">
Welcome to My Tracks
</string>
</resources>
+17 -34
View File
@@ -17,34 +17,18 @@ limitations under the License.
<resources>
<style name="ThemeSelector" parent="android:Theme" />
<!-- Button -->
<style name="Button">
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_width">0dp</item>
<item name="android:maxLines">2</item>
<item name="android:textSize">14sp</item>
</style>
<!-- Button layout -->
<style name="ButtonLayout">
<item name="android:background">@drawable/list_bar</item>
<!-- Bottom Bar -->
<style name="BottomBar" parent="@android:style/DeviceDefault.ButtonBar">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:measureWithLargestChild">true</item>
<item name="android:orientation">horizontal</item>
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingRight">2dp</item>
<item name="android:paddingTop">4dp</item>
</style>
<!-- Button spacer -->
<style name="ButtonSpacer">
<!-- Bottom Button -->
<style name="BottomButton" parent="@android:style/Widget.DeviceDefault.Button.Borderless">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">0.25</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_width">0dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:visibility">gone</item>
</style>
<style name="SensorStateLabel">
@@ -126,27 +110,26 @@ limitations under the License.
</style>
<!-- The TextView showing the stats in the track list item -->
<style name="TrackListItemStatsTextView" parents="@android:style/TextAppearance.DeviceDefault.Small">
<style name="TrackListItemStatsTextView" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">@color/green</item>
</style>
<!-- Welcome page TextView -->
<style name="WelcomeTextView">
<!-- The welcome activity answer TextView -->
<style name="WelcomeAnswerTextView" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:paddingLeft">10sp</item>
<item name="android:paddingRight">10sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">16sp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:paddingBottom">8dp</item>
</style>
<!-- Welcome page TextView question -->
<style name="WelcomeTextView.Question">
<item name="android:paddingTop">10sp</item>
<!-- The welcome activity question TextView -->
<style name="WelcomeQuestionTextView" parent="@android:style/TextAppearance.DeviceDefault.Medium">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:paddingTop">8dp</item>
</style>
<!-- Widget TextView -->
@@ -0,0 +1,67 @@
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.fragments.AboutDialogFragment;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.maps.mytracks.R;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.support.v4.app.FragmentActivity;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
/**
* An activity that displays the help page.
*
* @author Sandor Dornbush
*/
public class HelpActivity extends FragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
setContentView(R.layout.help);
findViewById(R.id.help_ok).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
findViewById(R.id.help_about).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
new AboutDialogFragment().show(
getSupportFragmentManager(), AboutDialogFragment.ABOUT_DIALOG_TAG);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() != android.R.id.home) {
return false;
}
startActivity(new Intent(this, TrackListActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
return true;
}
}
@@ -137,6 +137,7 @@ public class TrackDetailActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
ApiAdapterFactory.getApiAdapter().hideTitle(this);
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
setContentView(R.layout.track_detail);
@@ -429,7 +430,7 @@ public class TrackDetailActivity extends FragmentActivity {
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.track_detail_help:
startActivity(new Intent(this, WelcomeActivity.class));
startActivity(new Intent(this, HelpActivity.class));
return true;
default:
return false;
@@ -17,7 +17,6 @@
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.TracksColumns;
import com.google.android.apps.mytracks.fragments.CheckUnitsDialogFragment;
import com.google.android.apps.mytracks.fragments.DeleteAllDialogFragment;
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
import com.google.android.apps.mytracks.io.file.TrackWriterFactory.TrackFileFormat;
@@ -25,7 +24,6 @@ import com.google.android.apps.mytracks.services.ITrackRecordingService;
import com.google.android.apps.mytracks.services.ServiceUtils;
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.apps.mytracks.util.CheckUnitsUtils;
import com.google.android.apps.mytracks.util.EulaUtils;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.maps.mytracks.R;
@@ -39,9 +37,7 @@ import android.os.Bundle;
import android.os.Parcelable;
import android.speech.tts.TextToSpeech;
import android.support.v4.app.Fragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
@@ -65,11 +61,6 @@ import android.widget.Toast;
public class TrackListActivity extends FragmentActivity {
private static final String TAG = TrackListActivity.class.getSimpleName();
private static final String CHECK_UNITS_DIALOG_TAG = "checkUnitsDialog";
private static final String DELETE_ALL_DIALOG_TAG = "deleteAllDialog";
private static final String EULA_DIALOG_TAG = "eulaDialog";
public static final int WELCOME_ACTIVITY_REQUEST_CODE = 0;
private static final String[] PROJECTION = new String[] {
TracksColumns._ID,
@@ -237,9 +228,11 @@ public class TrackListActivity extends FragmentActivity {
});
if (!EulaUtils.getEulaValue(this)) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(EULA_DIALOG_TAG);
Fragment fragment = getSupportFragmentManager()
.findFragmentByTag(EulaDialogFragment.EULA_DIALOG_TAG);
if (fragment == null) {
new EulaDialogFragment().show(getSupportFragmentManager(), EULA_DIALOG_TAG);
EulaDialogFragment.newInstance(false).show(
getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
}
}
}
@@ -256,24 +249,6 @@ public class TrackListActivity extends FragmentActivity {
trackRecordingServiceConnection.unbind();
}
@Override
public void onActivityResult(int requestCode, int resultCode, final Intent results) {
if (requestCode == WELCOME_ACTIVITY_REQUEST_CODE) {
if (!CheckUnitsUtils.getCheckUnitsValue(this)) {
/*
* See bug http://code.google.com/p/android/issues/detail?id=23761.
* Cannot use
* CheckUnitsDialogFragment().show(getSupportFragmentManager(),
* CHECK_UNITS_DIALOG_TAG). Need to use commitAllowingStateLoss with the
* support package.
*/
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(new CheckUnitsDialogFragment(), CHECK_UNITS_DIALOG_TAG);
fragmentTransaction.commitAllowingStateLoss();
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.track_list, menu);
@@ -364,7 +339,8 @@ public class TrackListActivity extends FragmentActivity {
ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX));
return true;
case R.id.track_list_delete_all:
new DeleteAllDialogFragment().show(getSupportFragmentManager(), DELETE_ALL_DIALOG_TAG);
new DeleteAllDialogFragment().show(
getSupportFragmentManager(), DeleteAllDialogFragment.DELETE_ALL_DIALOG_TAG);
return true;
case R.id.track_list_aggregated_statistics:
startActivity(new Intent(this, AggregatedStatsActivity.class));
@@ -373,7 +349,7 @@ public class TrackListActivity extends FragmentActivity {
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.track_list_help:
startActivity(new Intent(this, WelcomeActivity.class));
startActivity(new Intent(this, HelpActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
@@ -1,87 +0,0 @@
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.util.EulaUtils;
import com.google.android.apps.mytracks.util.SystemUtils;
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.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
/**
* An activity that displays a welcome screen.
*
* @author Sandor Dornbush
*/
public class WelcomeActivity extends Activity {
private static final int DIALOG_ABOUT_ID = 0;
private static final int DIALOG_EULA_ID = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
findViewById(R.id.welcome_ok).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
findViewById(R.id.welcome_about).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_ABOUT_ID);
}
});
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_ABOUT_ID:
View view = getLayoutInflater().inflate(R.layout.about, null);
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
aboutVersion.setText(SystemUtils.getMyTracksVersion(this));
return new AlertDialog.Builder(this)
.setCancelable(true)
.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showDialog(DIALOG_EULA_ID);
}
})
.setPositiveButton(R.string.generic_ok, null)
.setTitle(R.string.my_tracks_app_name)
.setView(view)
.create();
case DIALOG_EULA_ID:
return new AlertDialog.Builder(this)
.setCancelable(true)
.setMessage(EulaUtils.getEulaMessage(this))
.setPositiveButton(R.string.generic_ok, null)
.setTitle(R.string.eula_title)
.create();
default:
return null;
}
}
}
@@ -0,0 +1,58 @@
/*
* 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.SystemUtils;
import com.google.android.maps.mytracks.R;
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.TextView;
/**
* A DialogFragment to show information about My Tracks.
*
* @author Jimmy Shih
*/
public class AboutDialogFragment extends DialogFragment {
public static final String ABOUT_DIALOG_TAG = "aboutDialog";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.about, null);
TextView aboutVersion = (TextView) view.findViewById(R.id.about_version);
aboutVersion.setText(SystemUtils.getMyTracksVersion(getActivity()));
return new AlertDialog.Builder(getActivity())
.setCancelable(true)
.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EulaDialogFragment.newInstance(true).show(
getActivity().getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG);
}
})
.setPositiveButton(R.string.generic_ok, null)
.setTitle(R.string.help_about)
.setView(view)
.create();
}
}
@@ -30,20 +30,27 @@ import android.os.Bundle;
import android.support.v4.app.DialogFragment;
/**
* Check Units DialogFragment.
* A DialogFragment to check preferred units.
*
* @author Jimmy Shih
*/
public class CheckUnitsDialogFragment extends DialogFragment {
public static final String CHECK_UNITS_DIALOG_TAG = "checkUnitsDialog";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()).setCancelable(true)
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() {
@Override
public void onClick(DialogInterface dialog, int which) {
CheckUnitsUtils.setCheckUnitsValue(getActivity());
@@ -26,10 +26,14 @@ import android.os.Bundle;
import android.support.v4.app.DialogFragment;
/**
* Delete All DialogFragment.
* A DialogFragment to delete all tracks.
*
* @author Jimmy Shih
*/
public class DeleteAllDialogFragment extends DialogFragment {
public static final String DELETE_ALL_DIALOG_TAG = "deleteAllDialog";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return DialogUtils.createConfirmationDialog(getActivity(),
@@ -16,49 +16,71 @@
package com.google.android.apps.mytracks.fragments;
import com.google.android.apps.mytracks.TrackListActivity;
import com.google.android.apps.mytracks.WelcomeActivity;
import com.google.android.apps.mytracks.util.EulaUtils;
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;
/**
* Eula DialogFragment.
* A DialogFragment to show EULA.
*
* @author Jimmy Shih
*/
public class EulaDialogFragment extends DialogFragment {
public static final String EULA_DIALOG_TAG = "eulaDialog";
private static final String KEY_HAS_ACCEPTED = "hasAccepted";
/**
* Creates a new instance of {@link EulaDialogFragment}.
*
* @param hasAccepted true if the user has accepted the eula.
*/
public static EulaDialogFragment newInstance(boolean hasAccepted) {
Bundle bundle = new Bundle();
bundle.putBoolean(KEY_HAS_ACCEPTED, hasAccepted);
EulaDialogFragment eulaDialogFragment = new EulaDialogFragment();
eulaDialogFragment.setArguments(bundle);
return eulaDialogFragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
boolean hasAccepted = getArguments().getBoolean(KEY_HAS_ACCEPTED);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setCancelable(true)
.setMessage(EulaUtils.getEulaMessage(getActivity()))
.setNegativeButton(R.string.eula_decline, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getActivity().finish();
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
getActivity().finish();
}
})
.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EulaUtils.setEulaValue(getActivity());
getActivity().startActivityForResult(
new Intent(getActivity(), WelcomeActivity.class), TrackListActivity.WELCOME_ACTIVITY_REQUEST_CODE);
}
})
.setTitle(R.string.eula_title)
.create();
.setTitle(R.string.eula_title);
if (hasAccepted) {
builder.setPositiveButton(R.string.generic_ok, null);
} else {
builder.setNegativeButton(R.string.eula_decline, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getActivity().finish();
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
getActivity().finish();
}
})
.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EulaUtils.setEulaValue(getActivity());
new WelcomeDialogFragment().show(
getActivity().getSupportFragmentManager(), WelcomeDialogFragment.WELCOME_DIALOG_TAG);
}
});
}
return builder.create();
}
}
@@ -0,0 +1,63 @@
/*
* 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.maps.mytracks.R;
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;
/**
* A DialogFrament to show the welcome info.
*
* @author Jimmy Shih
*/
public class WelcomeDialogFragment extends DialogFragment {
public static final String WELCOME_DIALOG_TAG = "welcomeDialog";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.welcome, null);
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() {
@Override
public void onClick(DialogInterface dialog, int which) {
checkUnits();
}
})
.setTitle(R.string.welcome_title)
.setView(view)
.create();
}
private void checkUnits() {
new CheckUnitsDialogFragment().show(
getActivity().getSupportFragmentManager(), CheckUnitsDialogFragment.CHECK_UNITS_DIALOG_TAG);
}
}
@@ -32,13 +32,18 @@ import android.widget.SearchView;
@TargetApi(11)
public class Api11Adapter extends Api10Adapter {
@Override
public void hideTitle(Activity activity) {
// Do nothing
}
@Override
public void configureActionBarHomeAsUp(Activity activity) {
ActionBar actionBar = activity.getActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public void configureSearchWidget(Activity activity, MenuItem menuItem) {
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
@@ -104,17 +104,20 @@ public class Api7Adapter implements ApiAdapter {
}
@Override
public void configureActionBarHomeAsUp(Activity activity) {
// Action bar not available, just hide the title and let actions be shown
// via the regular menu.
public void hideTitle(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
@Override
public void configureActionBarHomeAsUp(Activity activity) {
// Do nothing
}
@Override
public void configureSearchWidget(Activity activity, MenuItem menuItem) {
// Do nothing
// Do nothing
}
@Override
public boolean handleSearchMenuSelection(Activity activity) {
activity.onSearchRequested();
@@ -100,14 +100,26 @@ public interface ApiAdapter {
* @param bluetoothDevice
*/
public BluetoothSocket getBluetoothSocket(BluetoothDevice bluetoothDevice) throws IOException;
/**
* Hides the title. If the platform supports the action bar, do nothing.
* Ideally, with the action bar, we would like to collapse the navigation tabs
* into the action bar. However, collapsing is not supported by the
* compatibility library.
* <p>
* Due to changes in API level 11.
*
* @param activity the activity
*/
public void hideTitle(Activity activity);
/**
* Configures the action bar with the Home button as an Up button. If the
* system doesn't support action bar, hide the title bar.
* platform doesn't support the action bar, do nothing.
* <p>
* Due to changes in API level 11.
*
* @param activity the current activity
* @param activity the activity
*/
public void configureActionBarHomeAsUp(Activity activity);