merge heads

This commit is contained in:
Jimmy Shih
2011-11-18 13:51:39 -08:00
5 changed files with 42 additions and 27 deletions
+2 -2
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="33" android:versionCode="34"
android:versionName="1.1.10"> android:versionName="1.1.11">
<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"
+8 -8
View File
@@ -1047,18 +1047,18 @@ limitations under the License.
</string> </string>
<string name="settings_display_track_color_dynamic_medium" <string name="settings_display_track_color_dynamic_medium"
translation_description="In the Display settings, under the 'Dynamic thresholds' configurations, translation_description="In the Display settings, under the 'Dynamic thresholds' configurations,
the option for configuring the medium speed percentage. It is the percentage from the average the option for configuring the percentage from the average speed to be considered as the
speed to be considered as the medium speed. The track color mode will use different colors to medium speed. The track color mode will use different colors to color a track depending on
color a track depending on whether the speed is above, in, or below the medium speed range."> whether the speed is above, in, or below the medium speed range.">
Medium speed percentage Medium percentage
</string> </string>
<string name="settings_display_track_color_dynamic_medium_summary" <string name="settings_display_track_color_dynamic_medium_summary"
translation_description="In the Display settings, under the 'Dynamic thresholds' configurations, translation_description="In the Display settings, under the 'Dynamic thresholds' configurations,
the summary for the 'Medium speed percentage' option explaining that it sets a percentage from the summary for the 'Medium percentage' option explaining that it sets the percentage from
the average speed to be considered as the medium speed color. The track color mode will use the average speed to be considered as the medium speed. The track color mode will use
different colors to color a track depending on whether the speed is above, in, or below the different colors to color a track depending on whether the speed is above, in, or below the
medium speed range."> medium speed range.">
Percentage from the average speed for the medium speed color. Percentage from the average speed for the medium speed range.
</string> </string>
<string name="settings_display_track_color_fixed" <string name="settings_display_track_color_fixed"
translation_description="In the Display settings, for the 'Track color mode' dropdown, the translation_description="In the Display settings, for the 'Track color mode' dropdown, the
@@ -1099,7 +1099,7 @@ limitations under the License.
<string name="settings_display_track_color_summary" <string name="settings_display_track_color_summary"
translation_description="In the Display settings, the summary for the 'Track color mode' translation_description="In the Display settings, the summary for the 'Track color mode'
dropdown explaining that it configures how colors are used to color a track based on speed."> dropdown explaining that it configures how colors are used to color a track based on speed.">
The way to color a track based on speed. The way to color a track based on slow, medium, and high speed.
</string> </string>
<string name="settings_not_while_recording" <string name="settings_not_while_recording"
translation_description="In the Settings page, the summary for an option that is not available translation_description="In the Settings page, the summary for an option that is not available
@@ -365,7 +365,7 @@ public class MapActivity extends com.google.android.maps.MapActivity
String saveFileFormat = getString(R.string.track_list_save_file); String saveFileFormat = getString(R.string.track_list_save_file);
String shareFileFormat = getString(R.string.track_list_share_file); String shareFileFormat = getString(R.string.track_list_share_file);
String fileTypes[] = getResources().getStringArray(R.array.file_types); String fileTypes[] = getResources().getStringArray(R.array.file_types);
menu.add(0, Constants.MENU_SEND_TO_GOOGLE, 0, menu.add(0, Constants.MENU_SEND_TO_GOOGLE, 0,
R.string.track_list_send_google); R.string.track_list_send_google);
SubMenu share = menu.addSubMenu(0, Constants.MENU_SHARE, 0, SubMenu share = menu.addSubMenu(0, Constants.MENU_SHARE, 0,
@@ -469,6 +469,9 @@ public class MapActivity extends com.google.android.maps.MapActivity
if (mapView.getZoomLevel() < 18) { if (mapView.getZoomLevel() < 18) {
mapView.getController().setZoom(18); mapView.getController().setZoom(18);
} }
if (currentLocation != null) {
showCurrentLocation();
}
return true; return true;
} }
case Constants.MENU_TOGGLE_LAYERS: { case Constants.MENU_TOGGLE_LAYERS: {
@@ -25,8 +25,8 @@ public class AntMessage {
/** Build a short value from its constituent bytes */ /** Build a short value from its constituent bytes */
protected static short decodeShort(byte b0, byte b1) { protected static short decodeShort(byte b0, byte b1) {
short value = b0; int value = b0 & 0xFF;
value |= ((short) b1) << 8; value |= (b1 & 0xFF) << 8;
return value; return (short)value;
} }
} }
@@ -92,7 +92,7 @@ public abstract class AntSensorManager extends SensorManager {
String antAction = intent.getAction(); String antAction = intent.getAction();
Log.i(TAG, "enter data onReceive" + antAction); Log.i(TAG, "enter data onReceive" + antAction);
if (antAction.equals(AntInterfaceIntent.ANT_RX_MESSAGE_ACTION)) { if (antAction != null && antAction.equals(AntInterfaceIntent.ANT_RX_MESSAGE_ACTION)) {
byte[] antMessage = intent.getByteArrayExtra(AntInterfaceIntent.ANT_MESSAGE); byte[] antMessage = intent.getByteArrayExtra(AntInterfaceIntent.ANT_MESSAGE);
if (DEBUGGING) { if (DEBUGGING) {
Log.d(TAG, "Received RX message " + messageToString(antMessage)); Log.d(TAG, "Received RX message " + messageToString(antMessage));
@@ -185,22 +185,24 @@ public abstract class AntSensorManager extends SensorManager {
* Cleans up the ANT+ receiver interface, by releasing the interface * Cleans up the ANT+ receiver interface, by releasing the interface
* and destroying it. * and destroying it.
*/ */
private void cleanAntInterface() private void cleanAntInterface() {
{
Log.i(TAG, "Destroying AntSensorManager"); Log.i(TAG, "Destroying AntSensorManager");
if (antReceiver == null) {
Log.e(TAG, "no ANT receiver");
return;
}
if (antReceiver != null) { try {
try { antReceiver.releaseInterface();
antReceiver.releaseInterface();
} catch (AntServiceNotConnectedException e) {
Log.i(TAG, "ANT service not connected", e);
} catch (AntInterfaceException e) {
Log.e(TAG, "failed to release ANT interface", e);
}
antReceiver.destroy(); antReceiver.destroy();
antReceiver = null; antReceiver = null;
} catch (AntServiceNotConnectedException e) {
Log.i(TAG, "ANT service not connected", e);
} catch (AntInterfaceException e) {
Log.e(TAG, "failed to release ANT interface", e);
} catch (RuntimeException e) {
Log.e(TAG, "run-time exception when cleaning the ANT interface", e);
} }
} }
@@ -212,6 +214,11 @@ public abstract class AntSensorManager extends SensorManager {
private synchronized void serviceConnected() { private synchronized void serviceConnected() {
Log.d(TAG, "ANT service connected"); Log.d(TAG, "ANT service connected");
if (antReceiver == null) {
Log.e(TAG, "no ANT receiver");
return;
}
try { try {
if (!antReceiver.claimInterface()) { if (!antReceiver.claimInterface()) {
Log.e(TAG, "failed to claim ANT interface"); Log.e(TAG, "failed to claim ANT interface");
@@ -299,6 +306,11 @@ public abstract class AntSensorManager extends SensorManager {
short deviceNumber, byte deviceType, byte txType, short channelPeriod, short deviceNumber, byte deviceType, byte txType, short channelPeriod,
byte radioFreq, byte proxSearch) { byte radioFreq, byte proxSearch) {
if (antReceiver == null) {
Log.e(TAG, "no ANT receiver");
return false;
}
try { try {
// Assign as slave channel on selected network (0 = public, 1 = ANT+, 2 = // Assign as slave channel on selected network (0 = public, 1 = ANT+, 2 =
// ANTFS) // ANTFS)