Merge from main repo

This commit is contained in:
Josh Kasten
2011-09-19 17:38:32 -05:00
3 changed files with 36 additions and 16 deletions
+13 -15
View File
@@ -127,26 +127,24 @@ limitations under the License.
</TableLayout> </TableLayout>
</ScrollView> </ScrollView>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_bar" android:background="@drawable/list_bar"
android:padding="3dip"> android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:paddingLeft="2dip"
android:paddingRight="2dip"
android:paddingTop="4dip">
<!-- left spacer -->
<LinearLayout style="@style/DialogButtonSpacer"/>
<Button android:id="@+id/sendtogoogle_cancel" <Button android:id="@+id/sendtogoogle_cancel"
android:layout_width="wrap_content" android:layout_gravity="left"
android:layout_height="48dip"
android:layout_gravity="right"
android:text="@string/cancel" android:text="@string/cancel"
android:textSize="14dip"/> style="@style/DialogButton"/>
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button android:id="@+id/sendtogoogle_send_now" <Button android:id="@+id/sendtogoogle_send_now"
android:layout_width="wrap_content"
android:layout_height="48dip"
android:layout_gravity="right" android:layout_gravity="right"
android:text="@string/sendtogoogle_send_now" android:text="@string/sendtogoogle_send_now"
android:textSize="14dip"/> style="@style/DialogButton"/>
<!-- right spacer -->
<LinearLayout style="@style/DialogButtonSpacer"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
+18
View File
@@ -85,4 +85,22 @@ limitations under the License.
<style name="WidgetText.Register"> <style name="WidgetText.Register">
<item name="android:width">160px</item> <item name="android:width">160px</item>
</style> </style>
<!-- The style for the buttons on the bottom of a dialog. -->
<style name="DialogButton">
<item name="android:layout_height">48dip</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_width">0dip</item>
<item name="android:maxLines">2</item>
<item name="android:textSize">14dip</item>
</style>
<!-- The style for the spacer on the left and right of the dialog buttons. -->
<style name="DialogButtonSpacer">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">0.25</item>
<item name="android:layout_width">0dip</item>
<item name="android:orientation">horizontal</item>
<item name="android:visibility">gone</item>
</style>
</resources> </resources>
@@ -153,6 +153,9 @@ public class TrackRecordingService extends Service {
@Override @Override
public void onLocationChanged(final Location location) { public void onLocationChanged(final Location location) {
if (executorService.isShutdown() || executorService.isTerminated()) {
return;
}
executorService.submit( executorService.submit(
new Runnable() { new Runnable() {
@Override @Override
@@ -342,7 +345,6 @@ public class TrackRecordingService extends Service {
timer.purge(); timer.purge();
unregisterLocationListener(); unregisterLocationListener();
shutdownTaskExecutors(); shutdownTaskExecutors();
executorService.shutdown();
if (sensorManager != null) { if (sensorManager != null) {
sensorManager.shutdown(); sensorManager.shutdown();
sensorManager = null; sensorManager = null;
@@ -358,6 +360,8 @@ public class TrackRecordingService extends Service {
// This should be the last operation. // This should be the last operation.
releaseWakeLock(); releaseWakeLock();
// Shutdown the executor service last to avoid sending events to a dead executor.
executorService.shutdown();
super.onDestroy(); super.onDestroy();
} }