Merge to head

This commit is contained in:
Rodrigo Damazio
2012-01-02 19:03:07 -02:00
parent 1bd6e53f04
commit c3912042e9
125 changed files with 1852 additions and 3675 deletions
+3 -3
View File
@@ -17,8 +17,8 @@ limitations under the License.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.maps.mytracks" package="com.google.android.maps.mytracks"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="34" android:versionCode="36"
android:versionName="1.1.11"> android:versionName="1.1.13">
<application android:icon="@drawable/arrow_icon" <application android:icon="@drawable/arrow_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"
@@ -84,7 +84,7 @@ limitations under the License.
android:value="com.google.android.apps.mytracks.SearchActivity" /> android:value="com.google.android.apps.mytracks.SearchActivity" />
</activity> </activity>
<activity android:name="com.google.android.apps.mytracks.TrackDetails" <activity android:name="com.google.android.apps.mytracks.TrackDetail"
android:label="@string/track_detail_title"> android:label="@string/track_detail_title">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.EDIT" />
+1 -1
View File
@@ -11,5 +11,5 @@
split.density=false split.density=false
proguard.config=proguard.cfg proguard.config=proguard.cfg
# Project target. # Project target.
target=Google Inc.:Google APIs:14 target=Google Inc.:Google APIs:15
android.library.reference.1=../MyTracksLib android.library.reference.1=../MyTracksLib
Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 275 B

+82 -77
View File
@@ -17,86 +17,91 @@ limitations under the License.
<ScrollView <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content"> android:layout_width="fill_parent">
<TableLayout <LinearLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:paddingBottom="2dp" android:orientation="vertical"
android:stretchColumns="1"> android:padding="10dp">
<TableRow style="@style/AboutTableRow">
<ImageView <!-- Title -->
android:layout_column="0" <TableLayout
android:scaleType="center" android:layout_height="wrap_content"
android:src="@drawable/arrow_icon"/> android:layout_width="fill_parent"
<LinearLayout android:padding="2dp"
android:layout_column="1" android:shrinkColumns="0"
android:layout_height="wrap_content" android:stretchColumns="1">
android:layout_width="wrap_content" <TableRow>
android:orientation="vertical"> <ImageView
<TextView android:layout_column="0"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@string/my_tracks_app_name" android:scaleType="center"
android:textSize="30sp" /> android:src="@drawable/arrow_icon"/>
<TextView <LinearLayout
android:layout_column="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@string/about_copyright_notice" android:orientation="vertical">
android:textSize="15sp" /> <TextView
</LinearLayout> android:layout_height="wrap_content"
</TableRow> android:layout_width="wrap_content"
<TableRow style="@style/AboutTableRow"> android:text="@string/my_tracks_app_name"
<TextView android:textSize="30sp"/>
android:text="@string/about_team" <TextView
style="@style/AboutTextView.Column0"/> android:layout_height="wrap_content"
<LinearLayout android:layout_width="wrap_content"
android:layout_column="1" android:text="@string/about_copyright_notice"
android:layout_height="wrap_content" android:textSize="15sp"/>
android:layout_width="wrap_content" </LinearLayout>
android:orientation="vertical"> </TableRow>
<TextView </TableLayout>
android:text="@string/about_bart"
style="@style/AboutTextView"/> <!-- Team -->
<TextView <TextView
android:text="@string/about_dylan" android:text="@string/about_team"
style="@style/AboutTextView"/> style="@style/AboutLabel"/>
<TextView <TextView
android:text="@string/about_jimmy" android:text="@string/about_bart"
style="@style/AboutTextView"/> style="@style/AboutItem"/>
<TextView <TextView
android:text="@string/about_leif" android:text="@string/about_dylan"
style="@style/AboutTextView"/> style="@style/AboutItem"/>
<TextView <TextView
android:text="@string/about_rodrigo" android:text="@string/about_jimmy"
style="@style/AboutTextView"/> style="@style/AboutItem"/>
<TextView <TextView
android:text="@string/about_sandor" android:text="@string/about_leif"
style="@style/AboutTextView"/> style="@style/AboutItem"/>
</LinearLayout> <TextView
</TableRow> android:text="@string/about_rodrigo"
<TableRow style="@style/AboutTableRow"> style="@style/AboutItem"/>
<TextView <TextView
android:text="@string/about_version" android:text="@string/about_sandor"
style="@style/AboutTextView.Column0"/> style="@style/AboutItem"/>
<TextView
android:id="@+id/about_version" <!-- Version -->
style="@style/AboutTextView"/> <TextView
</TableRow> android:text="@string/about_version"
<TableRow style="@style/AboutTableRow"> style="@style/AboutLabel"/>
<TextView <TextView
android:text="@string/about_support" android:id="@+id/about_version"
style="@style/AboutTextView.Column0"/> style="@style/AboutItem"/>
<TextView
android:text="@string/my_tracks_web_url" <!-- Support -->
style="@style/AboutTextView.Url"/> <TextView
</TableRow> android:text="@string/about_support"
<TableRow style="@style/AboutTableRow"> style="@style/AboutLabel"/>
<TextView <TextView
android:text="@string/about_privacy" android:text="@string/my_tracks_web_url"
style="@style/AboutTextView.Column0"/> style="@style/AboutUrl"/>
<TextView
android:text="@string/my_tracks_privacy_url" <!-- Privacy -->
style="@style/AboutTextView.Url"/> <TextView
</TableRow> android:text="@string/about_privacy"
</TableLayout> style="@style/AboutLabel"/>
<TextView
android:text="@string/my_tracks_privacy_url"
style="@style/AboutUrl"/>
</LinearLayout>
</ScrollView> </ScrollView>
+76 -106
View File
@@ -17,120 +17,90 @@ 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:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:minWidth="300dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <TableLayout
android:background="@drawable/list_bar"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent"> android:layout_width="fill_parent"
<TextView android:shrinkColumns="0"
android:layout_height="wrap_content" android:stretchColumns="0">
android:layout_marginLeft="10dp" <TableRow>
android:layout_width="fill_parent" <TextView
android:text="@string/menu_chart_view_chart_settings" android:background="@drawable/list_bar"
android:textColor="#fff" android:layout_height="wrap_content"
android:textSize="20sp"/> android:layout_width="fill_parent"
</LinearLayout> android:paddingLeft="10dp"
android:text="@string/menu_chart_view_chart_settings"
android:textColor="@color/white"
android:textSize="20sp"/>
</TableRow>
</TableLayout>
<ScrollView <ScrollView
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="fill_parent"> android:layout_width="fill_parent">
<TableLayout <LinearLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:stretchColumns="1"> android:orientation="vertical"
<TableRow> android:padding="10dp">
<LinearLayout
android:layout_height="wrap_content" <!-- X axis -->
android:layout_marginLeft="10dp" <LinearLayout style="@style/ChartSettingsAxisLayout">
android:layout_width="fill_parent" <ImageView
android:orientation="vertical"> android:src="@drawable/x_axis"
<LinearLayout style="@style/ChartSettingsAxisImage"/>
android:layout_height="wrap_content" <TextView
android:layout_width="fill_parent" android:text="@string/chart_settings_x_axis"
android:orientation="horizontal"> style="@style/ChartSettingsAxisText"/>
<ImageView </LinearLayout>
android:layout_height="wrap_content"
android:layout_width="wrap_content" <RadioGroup
android:src="@drawable/x_axis"/> android:id="@+id/chart_settings_x"
<TextView android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_width="fill_parent">
android:layout_width="fill_parent" <RadioButton
android:text="@string/chart_settings_x_axis" android:id="@+id/chart_settings_by_distance"
android:textSize="20sp"/> android:text="@string/chart_settings_by_distance"
</LinearLayout> style="@style/ChartSettingsRadioButton"/>
<RadioGroup <RadioButton
android:id="@+id/chart_settings_x" android:id="@+id/chart_settings_by_time"
android:layout_height="wrap_content" android:text="@string/chart_settings_by_time"
android:layout_width="fill_parent"> style="@style/ChartSettingsRadioButton"/>
<RadioButton </RadioGroup>
android:id="@+id/chart_settings_by_distance"
android:layout_height="wrap_content" <!-- Y axis -->
android:layout_width="fill_parent" <LinearLayout
android:text="@string/chart_settings_by_distance"/> android:paddingTop="10dp"
<RadioButton style="@style/ChartSettingsAxisLayout">
android:id="@+id/chart_settings_by_time" <ImageView
android:layout_height="wrap_content" android:src="@drawable/y_axis"
android:layout_width="fill_parent" style="@style/ChartSettingsAxisImage"/>
android:text="@string/chart_settings_by_time"/> <TextView
</RadioGroup> android:text="@string/chart_settings_y_axis"
</LinearLayout> style="@style/ChartSettingsAxisText"/>
</TableRow> </LinearLayout>
<TableRow>
<LinearLayout <CheckBox
android:layout_height="wrap_content" android:id="@+id/chart_settings_elevation"
android:layout_marginLeft="10dp" android:text="@string/stat_elevation"
android:layout_width="fill_parent" style="@style/ChartSettingsCheckbox"/>
android:orientation="vertical"> <CheckBox
<LinearLayout android:id="@+id/chart_settings_speed"
android:layout_height="wrap_content" android:text="@string/stat_speed"
android:layout_width="fill_parent" style="@style/ChartSettingsCheckbox"/>
android:orientation="horizontal"> <CheckBox
<ImageView android:id="@+id/chart_settings_power"
android:layout_height="wrap_content" android:text="@string/sensor_state_power"
android:layout_width="wrap_content" style="@style/ChartSettingsCheckbox"/>
android:src="@drawable/y_axis"/> <CheckBox
<TextView android:id="@+id/chart_settings_cadence"
android:layout_height="wrap_content" android:text="@string/sensor_state_cadence"
android:layout_width="fill_parent" style="@style/ChartSettingsCheckbox"/>
android:text="@string/chart_settings_y_axis" <CheckBox
android:textSize="20sp" /> android:id="@+id/chart_settings_heart_rate"
</LinearLayout> android:text="@string/sensor_state_heart_rate"
<CheckBox style="@style/ChartSettingsCheckbox"/>
android:id="@+id/chart_settings_elevation" </LinearLayout>
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/stat_elevation"/>
<CheckBox
android:id="@+id/chart_settings_speed"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/stat_speed"/>
<CheckBox
android:id="@+id/chart_settings_power"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_power"/>
<CheckBox
android:id="@+id/chart_settings_cadence"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_cadence"/>
<CheckBox
android:id="@+id/chart_settings_heart_rate"
android:checked="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/sensor_state_heart_rate"/>
</LinearLayout>
</TableRow>
</TableLayout>
</ScrollView> </ScrollView>
<LinearLayout style="@style/ButtonLayout"> <LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/> <LinearLayout style="@style/ButtonSpacer"/>
-83
View File
@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2010 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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="10dip"
android:background="#c000">
<TextView android:text="@string/track_detail_track_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView android:id="@+id/trackdetails_icon"
android:src="@drawable/track"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="4dip"
android:paddingRight="4dip"/>
<EditText android:id="@+id/trackdetails_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:autoText="true"
android:capitalize="words"
android:selectAllOnFocus="true"
android:hint="@string/track_detail_track_name"
android:imeOptions="actionNext"/>
</LinearLayout>
<TextView android:text="@string/track_detail_activity_type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<AutoCompleteTextView android:id="@+id/trackdetails_category"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/track_detail_activity_type_hint"
android:imeOptions="actionNext"/>
<TextView android:text="@string/track_detail_track_description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText android:id="@+id/trackdetails_description"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:singleLine="false"
android:autoText="true"
android:capitalize="sentences"
android:selectAllOnFocus="true"
android:maxLines="50"
android:gravity="top"
android:layout_weight="1"
android:hint="@string/track_detail_track_description"
android:imeOptions="actionDone"/>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button android:id="@+id/trackdetails_save"
android:layout_gravity="left"
android:text="@string/generic_save"
style="@style/Button"/>
<Button android:id="@+id/trackdetails_cancel"
android:layout_gravity="right"
android:text="@string/generic_cancel"
style="@style/Button"/>
<LinearLayout style="@style/ButtonSpacer"/>
</LinearLayout>
</LinearLayout>
@@ -100,7 +100,7 @@ limitations under the License.
</TableRow> </TableRow>
<!-- Google Docs --> <!-- Google Docs -->
<TableRow> <TableRow android:id="@+id/send_google_docs_table_row">
<ImageView <ImageView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
+51 -123
View File
@@ -14,139 +14,67 @@ 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.
--> -->
<RelativeLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_height="fill_parent"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_width="fill_parent"> android:orientation="vertical">
<ScrollView <ScrollView
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent"> android:layout_width="fill_parent">
<LinearLayout <LinearLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent"> android:layout_width="fill_parent"
android:orientation="vertical">
<TableLayout <!-- Sensor state -->
android:layout_height="wrap_content" <TextView
android:stretchColumns="1,4" android:text="@string/menu_sensor_state"
android:layout_width="fill_parent"> style="@style/SensorStateLabel"/>
<TextView
android:id="@+id/sensor_state"
style="@style/SensorStateValue"/>
<!-- Layout the sensor state on one line. --> <!-- Last sensor time -->
<TableRow> <TextView
<TextView android:text="@string/sensor_state_last_sensor_time"
android:layout_span="5" style="@style/SensorStateLabel"/>
android:text="@string/menu_sensor_state" /> <TextView
</TableRow> android:id="@+id/sensor_state_last_sensor_time"
<TableRow style="@style/SensorStateValue"/>
android:background="@color/stat_label_background">
<TextView
android:id="@+id/sensor_state_register"
android:layout_column="1"
android:layout_span="5"
style="@style/StatsRegister" />
</TableRow>
<!-- Layout the sensor data age on one line. --> <!-- Power -->
<TableRow> <TextView
<TextView android:text="@string/sensor_state_power"
android:layout_span="5" style="@style/SensorStateLabel"/>
android:text="@string/sensor_state_last_sensor_time" /> <TextView
</TableRow> android:id="@+id/sensor_state_power"
<TableRow style="@style/SensorStateValue"/>
android:background="@color/stat_label_background">
<TextView
android:id="@+id/sensor_data_time_register"
android:layout_column="1"
android:layout_span="5"
style="@style/StatsRegister" />
</TableRow>
<!-- Power meter --> <!-- Cadence -->
<TableRow <TextView
android:padding="1dip"> android:text="@string/sensor_state_cadence"
<TextView style="@style/SensorStateLabel"/>
android:layout_column="1" <TextView
android:layout_span="3" android:id="@+id/sensor_state_cadence"
android:text="@string/sensor_state_power" /> style="@style/SensorStateValue"/>
</TableRow>
<TableRow
android:background="@color/stat_label_background">
<TextView
style="@style/StatsRegister.Big"
android:id="@+id/power_state_register"
android:layout_column="1"
android:layout_span="4" />
<TextView
style="@style/StatsUnitSolo" />
android:layout_column="5"
android:text="@string/watts" />
</TableRow>
<!-- Cadence --> <!-- Heart rate -->
<TableRow <TextView
android:padding="1dip"> android:text="@string/sensor_state_heart_rate"
<TextView style="@style/SensorStateLabel"/>
android:layout_column="1" <TextView
android:layout_span="3" android:id="@+id/sensor_state_heart_rate"
android:text="@string/sensor_state_cadence" /> style="@style/SensorStateValue"/>
</TableRow>
<TableRow
android:background="@color/stat_label_background">
<TextView
style="@style/StatsRegister.Big"
android:id="@+id/cadence_state_register"
android:layout_column="4" />
<TextView
style="@style/StatsUnitSolo" />
android:layout_column="2"
android:text="@string/revolutions_per_minute" />
</TableRow>
<!-- Heart Rate --> <!-- Battery level -->
<TableRow <TextView
android:padding="1dip"> android:text="@string/sensor_state_battery"
<TextView style="@style/SensorStateLabel"/>
android:layout_column="1" <TextView
android:layout_span="3" android:id="@+id/sensor_state_battery"
android:text="@string/sensor_state_heart_rate" /> style="@style/SensorStateValue"/>
</TableRow>
<TableRow
android:background="@color/stat_label_background">
<TextView
style="@style/StatsRegister.Big"
android:id="@+id/heart_rate_register"
android:layout_column="1"
android:layout_span="4" />
<TextView
style="@style/StatsUnitSolo"
android:layout_column="5"
android:text="@string/unit_beat_per_minute" />
</TableRow>
<!-- Battery Level -->
<TableRow
android:padding="1dip">
<TextView
android:layout_column="1"
android:layout_span="3"
android:text="@string/sensor_state_battery" />
</TableRow>
<TableRow
android:background="@color/stat_label_background">
<TextView
style="@style/StatsRegister.Big"
android:id="@+id/battery_level_register"
android:layout_column="1"
android:layout_span="4" />
<TextView
style="@style/StatsUnitSolo"
android:layout_column="5"
android:text="@string/unit_percent" />
</TableRow>
</TableLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</RelativeLayout> </LinearLayout>
+112
View File
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2010 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:background="@color/black"
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"
android:padding="4dp"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_track_name"
/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:src="@drawable/track"
/>
<EditText
android:autoText="true"
android:capitalize="words"
android:hint="@string/track_detail_track_name"
android:id="@+id/track_detail_track_name"
android:imeOptions="actionNext"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:selectAllOnFocus="true"
android:singleLine="true"
/>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_activity_type"
/>
<AutoCompleteTextView
android:id="@+id/track_detail_activity_type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/track_detail_activity_type_hint"
android:imeOptions="actionNext"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_track_description"
/>
<EditText
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/track_detail_track_description"
android:id="@+id/track_detail_track_description"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:maxLines="50"
android:selectAllOnFocus="true"
android:singleLine="false"
/>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button
android:id="@+id/track_detail_save"
android:layout_gravity="left"
android:text="@string/generic_save"
style="@style/Button"
/>
<Button
android:id="@+id/track_detail_cancel"
android:layout_gravity="right"
android:text="@string/generic_cancel"
style="@style/Button"
/>
<LinearLayout style="@style/ButtonSpacer"/>
</LinearLayout>
</LinearLayout>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2010 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.
-->
<resources>
<string name="about_license">Licencia</string>
<string name="about_privacy">Privacidad:</string>
<string name="about_support">Soporte:</string>
<string name="about_version">Versión:</string>
<string name="generic_save">Guardar</string>
<string name="menu_markers">Señales</string>
<string name="sd_card_error_read_file">No es posible leer del fichero.</string>
<string name="sd_card_success_read_file">Lectura de tarjeta SD terminada.</string>
<string name="sd_card_success_write_file">Grabación a tarjeta SD terminada.</string>
<string name="send_google_choose_account_title">Elegir cuenta</string>
<string name="send_google_no_account_message">No se ha encontrado la cuenta a la que subir los recorridos.</string>
<string name="send_google_no_account_title">No se ha encontrado la cuenta</string>
<string name="settings_display_speed">Mostrar velocidad</string>
<string name="settings_recording_voice_not_available">No está disponible en su versión de Android</string>
<string name="settings_sensor_type_ant">ANT+ Sensores</string>
<string name="settings_sensor_type_none">Ninguna</string>
<string name="settings_sensor_type_srm">SRM ANT+ Puente</string>
</resources>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -22,6 +22,9 @@ limitations under the License.
<string name="about_leif">Leif Wilden</string> <string name="about_leif">Leif Wilden</string>
<string name="about_rodrigo">Rodrigo Damazio</string> <string name="about_rodrigo">Rodrigo Damazio</string>
<string name="about_sandor">Sandor Dornbush</string> <string name="about_sandor">Sandor Dornbush</string>
<string name="color_mode_dynamic_percentage_default">25</string>
<string name="color_mode_fixed_medium_default">15</string>
<string name="color_mode_fixed_slow_default">9</string>
<string name="display_track_color_value_dynamic">DYNAMIC</string> <string name="display_track_color_value_dynamic">DYNAMIC</string>
<string name="display_track_color_value_fixed">FIXED</string> <string name="display_track_color_value_fixed">FIXED</string>
<string name="display_track_color_value_none">NONE</string> <string name="display_track_color_value_none">NONE</string>
@@ -49,6 +52,5 @@ limitations under the License.
<string name="track_action_end">com.google.android.apps.mytracks.END_CURRENT_TRACK</string> <string name="track_action_end">com.google.android.apps.mytracks.END_CURRENT_TRACK</string>
<string name="track_action_save">android.intent.action.SAVE</string> <string name="track_action_save">android.intent.action.SAVE</string>
<string name="track_action_start">com.google.android.apps.mytracks.START_NEW_TRACK</string> <string name="track_action_start">com.google.android.apps.mytracks.START_NEW_TRACK</string>
<string name="unit_percent">%</string>
<string name="value_unknown">-</string> <string name="value_unknown">-</string>
</resources> </resources>
File diff suppressed because it is too large Load Diff
+71 -18
View File
@@ -15,36 +15,36 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<resources> <resources>
<!-- About page label -->
<!-- About dialog TableRow --> <style name="AboutLabel">
<style name="AboutTableRow">
<item name="android:paddingBottom">2dp</item>
</style>
<!-- About dialog TextView -->
<style name="AboutTextView">
<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">fill_parent</item>
<item name="android:paddingBottom">2dp</item>
<item name="android:textSize">20sp</item> <item name="android:textSize">20sp</item>
</style> </style>
<!-- About dialog TextView column 0 --> <!-- About page item -->
<style name="AboutTextView.Column0"> <style name="AboutItem">
<item name="android:gravity">right</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_column">0</item> <item name="android:layout_width">fill_parent</item>
<item name="android:paddingLeft">10dp</item> <item name="android:paddingBottom">2dp</item>
<item name="android:paddingRight">10dp</item> <item name="android:paddingLeft">20dp</item>
<item name="android:textSize">18sp</item>
</style> </style>
<!-- About dialog TextView Url --> <!-- About page url -->
<style name="AboutTextView.Url"> <style name="AboutUrl">
<item name="android:autoLink">web</item> <item name="android:autoLink">web</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:paddingBottom">2dp</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:textSize">18sp</item> <item name="android:textSize">18sp</item>
</style> </style>
<!-- Button --> <!-- Button -->
<style name="Button"> <style name="Button">
<item name="android:layout_height">48dip</item> <item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">1</item> <item name="android:layout_weight">1</item>
<item name="android:layout_width">0dip</item> <item name="android:layout_width">0dip</item>
<item name="android:maxLines">2</item> <item name="android:maxLines">2</item>
@@ -71,6 +71,59 @@ limitations under the License.
<item name="android:visibility">gone</item> <item name="android:visibility">gone</item>
</style> </style>
<!-- Chart settings axis image -->
<style name="ChartSettingsAxisImage">
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- Chart settings axis layout -->
<style name="ChartSettingsAxisLayout">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:orientation">horizontal</item>
</style>
<!-- Chart settings axis text -->
<style name="ChartSettingsAxisText">
<item name="android:gravity">bottom</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:textSize">20sp</item>
</style>
<!-- Chart settings checkbox -->
<style name="ChartSettingsCheckbox">
<item name="android:checked">true</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- Chart settings radio button -->
<style name="ChartSettingsRadioButton">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<style name="SensorStateLabel">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item>
</style>
<style name="SensorStateValue">
<item name="android:background">@color/stat_label_background</item>
<item name="android:gravity">right</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:textColor">@color/stat_label_text</item>
<item name="android:textSize">40sp</item>
</style>
<!-- The style for a view which divides the numerator and denominator of the units on the statistics activity. --> <!-- The style for a view which divides the numerator and denominator of the units on the statistics activity. -->
<style name="StatsDivider" parent="@android:Widget.TextView"> <style name="StatsDivider" parent="@android:Widget.TextView">
<item name="android:background">@color/black</item> <item name="android:background">@color/black</item>
+6 -6
View File
@@ -45,7 +45,7 @@ limitations under the License.
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_key" <EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_key"
android:title="@string/settings_display_track_color_fixed_slow" android:title="@string/settings_display_track_color_fixed_slow"
android:summary="@string/settings_display_track_color_fixed_slow_summary" android:summary="@string/settings_display_track_color_fixed_slow_summary"
android:defaultValue="9" android:defaultValue="@string/color_mode_fixed_slow_default"
android:inputType="number" android:inputType="number"
android:maxLength="3"> android:maxLength="3">
</EditTextPreference> </EditTextPreference>
@@ -53,7 +53,7 @@ limitations under the License.
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_display_key" <EditTextPreference android:key="@string/track_color_mode_fixed_speed_slow_display_key"
android:title="@string/settings_display_track_color_fixed_slow" android:title="@string/settings_display_track_color_fixed_slow"
android:summary="@string/settings_display_track_color_fixed_slow_summary" android:summary="@string/settings_display_track_color_fixed_slow_summary"
android:defaultValue="9" android:defaultValue="@string/color_mode_fixed_slow_default"
android:inputType="number" android:inputType="number"
android:maxLength="3"> android:maxLength="3">
</EditTextPreference> </EditTextPreference>
@@ -61,7 +61,7 @@ limitations under the License.
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_key" <EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_key"
android:title="@string/settings_display_track_color_fixed_medium" android:title="@string/settings_display_track_color_fixed_medium"
android:summary="@string/settings_display_track_color_fixed_medium_summary" android:summary="@string/settings_display_track_color_fixed_medium_summary"
android:defaultValue="15" android:defaultValue="@string/color_mode_fixed_medium_default"
android:inputType="number" android:inputType="number"
android:maxLength="3"> android:maxLength="3">
</EditTextPreference> </EditTextPreference>
@@ -69,7 +69,7 @@ limitations under the License.
<EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_display_key" <EditTextPreference android:key="@string/track_color_mode_fixed_speed_medium_display_key"
android:title="@string/settings_display_track_color_fixed_medium" android:title="@string/settings_display_track_color_fixed_medium"
android:summary="@string/settings_display_track_color_fixed_medium_summary" android:summary="@string/settings_display_track_color_fixed_medium_summary"
android:defaultValue="15" android:defaultValue="@string/color_mode_fixed_medium_default"
android:inputType="number" android:inputType="number"
android:maxLength="3"> android:maxLength="3">
</EditTextPreference> </EditTextPreference>
@@ -79,7 +79,7 @@ limitations under the License.
<EditTextPreference android:key="@string/track_color_mode_dynamic_speed_variation_key" <EditTextPreference android:key="@string/track_color_mode_dynamic_speed_variation_key"
android:title="@string/settings_display_track_color_dynamic_medium" android:title="@string/settings_display_track_color_dynamic_medium"
android:summary="@string/settings_display_track_color_dynamic_medium_summary" android:summary="@string/settings_display_track_color_dynamic_medium_summary"
android:defaultValue="25" android:defaultValue="@string/color_mode_dynamic_percentage_default"
android:inputType="number" android:inputType="number"
android:maxLength="2"> android:maxLength="2">
</EditTextPreference> </EditTextPreference>
@@ -167,7 +167,7 @@ limitations under the License.
<ListPreference android:key="@string/bluetooth_sensor_key" <ListPreference android:key="@string/bluetooth_sensor_key"
android:title="@string/settings_sensor_bluetooth_sensor" android:title="@string/settings_sensor_bluetooth_sensor"
android:summary="@string/settings_sensor_bluetooth_sensor_summary" android:summary="@string/settings_sensor_bluetooth_sensor_summary"
android:defaultValue="any" /> android:defaultValue="" />
<Preference android:key="@string/bluetooth_pairing_key" <Preference android:key="@string/bluetooth_pairing_key"
android:title="@string/settings_sensor_bluetooth_pairing" android:title="@string/settings_sensor_bluetooth_pairing"
@@ -77,8 +77,8 @@ public class ChartActivity extends Activity implements TrackDataListener {
private double trackMaxSpeed; private double trackMaxSpeed;
// Modes of operation // Modes of operation
private boolean metricUnits; private boolean metricUnits = true;
private boolean reportSpeed; private boolean reportSpeed = true;
/* /*
* UI elements: * UI elements:
@@ -240,6 +240,7 @@ public class ChartActivity extends Activity implements TrackDataListener {
private void prepareSettingsDialog(ChartSettingsDialog settingsDialog) { private void prepareSettingsDialog(ChartSettingsDialog settingsDialog) {
settingsDialog.setMode(chartView.getMode()); settingsDialog.setMode(chartView.getMode());
settingsDialog.setDisplaySpeed(reportSpeed);
for (int i = 0; i < ChartView.NUM_SERIES; i++) { for (int i = 0; i < ChartView.NUM_SERIES; i++) {
settingsDialog.setSeriesEnabled(i, chartView.isChartValueSeriesEnabled(i)); settingsDialog.setSeriesEnabled(i, chartView.isChartValueSeriesEnabled(i));
} }
@@ -452,26 +453,33 @@ public class ChartActivity extends Activity implements TrackDataListener {
@Override @Override
public boolean onUnitsChanged(boolean metric) { public boolean onUnitsChanged(boolean metric) {
boolean changed = metric != this.metricUnits; if (metricUnits == metric) {
if (!changed) return false; return false;
}
this.metricUnits = metric; metricUnits = metric;
chartView.setMetricUnits(metricUnits);
chartView.setMetricUnits(metric); runOnUiThread(new Runnable() {
@Override
return true; // Reload data public void run() {
chartView.requestLayout();
}
});
return true;
} }
@SuppressWarnings("hiding")
@Override @Override
public boolean onReportSpeedChanged(boolean reportSpeed) { public boolean onReportSpeedChanged(boolean speed) {
boolean changed = reportSpeed != this.reportSpeed; if (reportSpeed == speed) {
if (!changed) return false; return false;
}
this.reportSpeed = reportSpeed; reportSpeed = speed;
chartView.setReportSpeed(speed, this);
chartView.setReportSpeed(reportSpeed, this); runOnUiThread(new Runnable() {
@Override
return true; // Reload data public void run() {
chartView.requestLayout();
}
});
return true;
} }
} }
@@ -90,6 +90,15 @@ public class ChartSettingsDialog extends Dialog {
: R.id.chart_settings_by_time); : R.id.chart_settings_by_time);
} }
/**
* Sets whether to display speed or pace.
*
* @param displaySpeed true to display speed
*/
public void setDisplaySpeed(boolean displaySpeed) {
series[ChartView.SPEED_SERIES].setText(displaySpeed ? R.string.stat_speed : R.string.stat_pace);
}
public void setSeriesEnabled(int seriesIdx, boolean enabled) { public void setSeriesEnabled(int seriesIdx, boolean enabled) {
series[seriesIdx].setChecked(enabled); series[seriesIdx].setChecked(enabled);
} }
@@ -91,7 +91,7 @@ public class ChartView extends View {
*/ */
private int bottomBorder; private int bottomBorder;
private static final int RIGHT_BORDER = 17; private static final int RIGHT_BORDER = 40;
/** Space to leave for drawing the unit labels */ /** Space to leave for drawing the unit labels */
private static final int UNIT_BORDER = 15; private static final int UNIT_BORDER = 15;
@@ -116,7 +116,7 @@ public class ImportAllTracks {
Log.i(Constants.TAG, "ImportAllTracks: Releasing wake lock."); Log.i(Constants.TAG, "ImportAllTracks: Releasing wake lock.");
} }
activity.runOnUiThread(new Thread() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showDoneDialog(); showDoneDialog();
@@ -219,7 +219,7 @@ public class ImportAllTracks {
* Attempts to import a GPX file. Returns true on success, issues error * Attempts to import a GPX file. Returns true on success, issues error
* notifications and returns false on failure. * notifications and returns false on failure.
*/ */
private boolean importFile(File gpxFile, MyTracksProviderUtils providerUtils) { private boolean importFile(final File gpxFile, MyTracksProviderUtils providerUtils) {
Log.i(Constants.TAG, "ImportAllTracks: importing: " + gpxFile.getName()); Log.i(Constants.TAG, "ImportAllTracks: importing: " + gpxFile.getName());
try { try {
importedTrackIds = GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils); importedTrackIds = GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils);
@@ -234,8 +234,13 @@ public class ImportAllTracks {
} catch (IOException e) { } catch (IOException e) {
Log.w(Constants.TAG, "Error reading file: " + gpxFile.getAbsolutePath(), e); Log.w(Constants.TAG, "Error reading file: " + gpxFile.getAbsolutePath(), e);
} }
Toast.makeText(activity, activity.getString(R.string.import_error, gpxFile.getName()), activity.runOnUiThread(new Runnable() {
Toast.LENGTH_LONG).show(); @Override
public void run() {
Toast.makeText(activity, activity.getString(R.string.import_error, gpxFile.getName()),
Toast.LENGTH_LONG).show();
}
});
return false; return false;
} }
@@ -420,9 +420,8 @@ public class MapActivity extends com.google.android.maps.MapActivity
Constants.getActionFromMenuId(item.getItemId())); Constants.getActionFromMenuId(item.getItemId()));
return true; return true;
case Constants.MENU_EDIT: { case Constants.MENU_EDIT: {
Intent intent = new Intent(this, TrackDetails.class); Intent intent = new Intent(this, TrackDetail.class);
// TODO: Pass in a content URI intent.putExtra(TrackDetail.TRACK_ID, dataHub.getSelectedTrackId());
intent.putExtra("trackid", dataHub.getSelectedTrackId());
startActivity(intent); startActivity(intent);
return true; return true;
} }
@@ -269,7 +269,7 @@ public class MyTracks extends TabActivity implements OnTouchListener {
case DIALOG_EULA_ID: case DIALOG_EULA_ID:
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.eula_title); builder.setTitle(R.string.eula_title);
builder.setMessage(R.string.eula_message); builder.setMessage(EulaUtil.getEulaMessage(this));
builder.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
@@ -477,9 +477,9 @@ public class MyTracks extends TabActivity implements OnTouchListener {
serviceConnection.stop(); serviceConnection.stop();
if (currentTrackId > 0) { if (currentTrackId > 0) {
Intent intent = new Intent(MyTracks.this, TrackDetails.class); Intent intent = new Intent(MyTracks.this, TrackDetail.class);
intent.putExtra("trackid", currentTrackId); intent.putExtra(TrackDetail.TRACK_ID, currentTrackId);
intent.putExtra("hasCancelButton", false); intent.putExtra(TrackDetail.SHOW_CANCEL, false);
startActivity(intent); startActivity(intent);
} }
} }
@@ -80,7 +80,7 @@ public class SensorStateActivity extends Activity {
/** /**
* A temporary sensor manager, when none is available. * A temporary sensor manager, when none is available.
*/ */
SensorManager tempSensorManager = null; private SensorManager tempSensorManager = null;
/** /**
* A state flag set to true when the activity is active/visible, * A state flag set to true when the activity is active/visible,
@@ -91,7 +91,7 @@ public class SensorStateActivity extends Activity {
* it could cause the {@link #tempSensorManager} to be recreated, after it * it could cause the {@link #tempSensorManager} to be recreated, after it
* is destroyed at the pause event. * is destroyed at the pause event.
*/ */
boolean isVisible = false; private boolean isVisible = false;
public SensorStateActivity() { public SensorStateActivity() {
utils = new StatsUtilities(this); utils = new StatsUtilities(this);
@@ -139,7 +139,7 @@ public class SensorStateActivity extends Activity {
super.onDestroy(); super.onDestroy();
} }
protected void updateState() { private void updateState() {
Log.d(TAG, "Updating SensorStateActivity"); Log.d(TAG, "Updating SensorStateActivity");
ITrackRecordingService service = serviceConnection.getServiceIfBound(); ITrackRecordingService service = serviceConnection.getServiceIfBound();
@@ -162,8 +162,7 @@ public class SensorStateActivity extends Activity {
} }
} }
private void updateFromTempSensorManager() private void updateFromTempSensorManager() {
{
// Use variables to hold the sensor state and data set. // Use variables to hold the sensor state and data set.
Sensor.SensorState currentState = null; Sensor.SensorState currentState = null;
Sensor.SensorDataSet currentDataSet = null; Sensor.SensorDataSet currentDataSet = null;
@@ -186,8 +185,7 @@ public class SensorStateActivity extends Activity {
updateSensorStateAndData(currentState, currentDataSet); updateSensorStateAndData(currentState, currentDataSet);
} }
private void updateFromSysSensorManager() private void updateFromSysSensorManager() {
{
// Use variables to hold the sensor state and data set. // Use variables to hold the sensor state and data set.
Sensor.SensorState currentState = null; Sensor.SensorState currentState = null;
Sensor.SensorDataSet currentDataSet = null; Sensor.SensorDataSet currentDataSet = null;
@@ -228,91 +226,115 @@ public class SensorStateActivity extends Activity {
/** /**
* Stops the temporary sensor manager, if one exists. * Stops the temporary sensor manager, if one exists.
*/ */
private void stopTempSensorManager() private void stopTempSensorManager() {
{
if (tempSensorManager != null) { if (tempSensorManager != null) {
tempSensorManager.shutdown(); tempSensorManager.shutdown();
tempSensorManager = null; tempSensorManager = null;
} }
} }
private void updateSensorStateAndData(Sensor.SensorState state, Sensor.SensorDataSet dataSet) private void updateSensorStateAndData(Sensor.SensorState state, Sensor.SensorDataSet dataSet) {
{
updateSensorState(state == null ? Sensor.SensorState.NONE : state); updateSensorState(state == null ? Sensor.SensorState.NONE : state);
updateSensorData(dataSet); updateSensorData(dataSet);
} }
private void updateSensorState(Sensor.SensorState state) { private void updateSensorState(Sensor.SensorState state) {
TextView sensorTime = ((TextView) findViewById(R.id.sensor_state)).setText(SensorUtils.getStateAsString(state, this));
((TextView) findViewById(R.id.sensor_state_register));
sensorTime.setText(SensorUtils.getStateAsString(state, this));
} }
protected void updateSensorData(Sensor.SensorDataSet sds) { private void updateSensorData(Sensor.SensorDataSet sds) {
if (sds == null) { if (sds == null) {
utils.setUnknown(R.id.sensor_data_time_register); utils.setUnknown(R.id.sensor_state_last_sensor_time);
utils.setUnknown(R.id.cadence_state_register); utils.setUnknown(R.id.sensor_state_power);
utils.setUnknown(R.id.power_state_register); utils.setUnknown(R.id.sensor_state_cadence);
utils.setUnknown(R.id.heart_rate_register); utils.setUnknown(R.id.sensor_state_battery);
utils.setUnknown(R.id.battery_level_register); } else {
return; ((TextView) findViewById(R.id.sensor_state_last_sensor_time)).setText(getLastSensorTime(sds));
((TextView) findViewById(R.id.sensor_state_power)).setText(getPower(sds));
((TextView) findViewById(R.id.sensor_state_cadence)).setText(getCadence(sds));
((TextView) findViewById(R.id.sensor_state_heart_rate)).setText(getHeartRate(sds));
((TextView) findViewById(R.id.sensor_state_battery)).setText(getBattery(sds));
} }
}
TextView sensorTime = /**
((TextView) findViewById(R.id.sensor_data_time_register)); * Gets the last sensor time.
sensorTime.setText( *
TIMESTAMP_FORMAT.format(new Date(sds.getCreationTime()))); * @param sds sensor data set
*/
private String getLastSensorTime(Sensor.SensorDataSet sds) {
return TIMESTAMP_FORMAT.format(new Date(sds.getCreationTime()));
}
/**
* Gets the power.
*
* @param sds sensor data set
*/
private String getPower(Sensor.SensorDataSet sds) {
String value;
if (sds.hasPower() && sds.getPower().hasValue() if (sds.hasPower() && sds.getPower().hasValue()
&& sds.getPower().getState() == Sensor.SensorState.SENDING) { && sds.getPower().getState() == Sensor.SensorState.SENDING) {
utils.setText(R.id.power_state_register, String format = getString(R.string.sensor_state_power_value);
Integer.toString(sds.getPower().getValue())); value = String.format(format, sds.getPower().getValue());
} else { } else {
utils.setText(R.id.power_state_register, value = SensorUtils.getStateAsString(
SensorUtils.getStateAsString( sds.hasPower() ? sds.getPower().getState() : Sensor.SensorState.NONE, this);
sds.hasPower()
? sds.getPower().getState()
: Sensor.SensorState.NONE,
this));
} }
return value;
}
/**
* Gets the cadence.
*
* @param sds sensor data set
*/
private String getCadence(Sensor.SensorDataSet sds) {
String value;
if (sds.hasCadence() && sds.getCadence().hasValue() if (sds.hasCadence() && sds.getCadence().hasValue()
&& sds.getCadence().getState() == Sensor.SensorState.SENDING) { && sds.getCadence().getState() == Sensor.SensorState.SENDING) {
utils.setText(R.id.cadence_state_register, String format = getString(R.string.sensor_state_cadence_value);
Integer.toString(sds.getCadence().getValue())); value = String.format(format, sds.getCadence().getValue());
} else { } else {
utils.setText(R.id.cadence_state_register, value = SensorUtils.getStateAsString(
SensorUtils.getStateAsString( sds.hasCadence() ? sds.getCadence().getState() : Sensor.SensorState.NONE, this);
sds.hasCadence()
? sds.getCadence().getState()
: Sensor.SensorState.NONE,
this));
} }
return value;
}
/**
* Gets the heart rate.
*
* @param sds sensor data set
*/
private String getHeartRate(Sensor.SensorDataSet sds) {
String value;
if (sds.hasHeartRate() && sds.getHeartRate().hasValue() if (sds.hasHeartRate() && sds.getHeartRate().hasValue()
&& sds.getHeartRate().getState() == Sensor.SensorState.SENDING) { && sds.getHeartRate().getState() == Sensor.SensorState.SENDING) {
utils.setText(R.id.heart_rate_register, String format = getString(R.string.sensor_state_heart_rate_value);
Integer.toString(sds.getHeartRate().getValue())); value = String.format(format, sds.getHeartRate().getValue());
} else { } else {
utils.setText(R.id.heart_rate_register, value = SensorUtils.getStateAsString(
SensorUtils.getStateAsString( sds.hasHeartRate() ? sds.getHeartRate().getState() : Sensor.SensorState.NONE, this);
sds.hasHeartRate()
? sds.getHeartRate().getState()
: Sensor.SensorState.NONE,
this));
} }
return value;
}
/**
* Gets the battery.
*
* @param sds sensor data set
*/
private String getBattery(Sensor.SensorDataSet sds) {
String value;
if (sds.hasBatteryLevel() && sds.getBatteryLevel().hasValue() if (sds.hasBatteryLevel() && sds.getBatteryLevel().hasValue()
&& sds.getBatteryLevel().getState() == Sensor.SensorState.SENDING) { && sds.getBatteryLevel().getState() == Sensor.SensorState.SENDING) {
utils.setText(R.id.battery_level_register, String format = getString(R.string.sensor_state_battery_value);
Integer.toString(sds.getBatteryLevel().getValue())); value = String.format(format, sds.getBatteryLevel().getValue());
} else { } else {
utils.setText(R.id.battery_level_register, value = SensorUtils.getStateAsString(
SensorUtils.getStateAsString( sds.hasBatteryLevel() ? sds.getBatteryLevel().getState() : Sensor.SensorState.NONE, this);
sds.hasBatteryLevel()
? sds.getBatteryLevel().getState()
: Sensor.SensorState.NONE,
this));
} }
return value;
} }
} }

Some files were not shown because too many files have changed in this diff Show More