diff --git a/MyTracks/AndroidManifest.xml b/MyTracks/AndroidManifest.xml
index e25f170d3..3e983284b 100755
--- a/MyTracks/AndroidManifest.xml
+++ b/MyTracks/AndroidManifest.xml
@@ -170,9 +170,7 @@ limitations under the License.
-
+
-
+
@@ -231,8 +227,7 @@ limitations under the License.
+ android:name="com.google.android.apps.mytracks.widgets.TrackWidgetConfigActivity" >
diff --git a/MyTracks/res/drawable-hdpi/failure.png b/MyTracks/res/drawable-hdpi/failure.png
deleted file mode 100644
index fe2a5f8c4..000000000
Binary files a/MyTracks/res/drawable-hdpi/failure.png and /dev/null differ
diff --git a/MyTracks/res/drawable-hdpi/menu_map_layer.png b/MyTracks/res/drawable-hdpi/menu_map_layer.png
index 5a6b26019..091733a34 100644
Binary files a/MyTracks/res/drawable-hdpi/menu_map_layer.png and b/MyTracks/res/drawable-hdpi/menu_map_layer.png differ
diff --git a/MyTracks/res/drawable-hdpi/menu_split_frequency.png b/MyTracks/res/drawable-hdpi/menu_split_frequency.png
index 2d9aa3c5f..e6351a076 100644
Binary files a/MyTracks/res/drawable-hdpi/menu_split_frequency.png and b/MyTracks/res/drawable-hdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-hdpi/success.png b/MyTracks/res/drawable-hdpi/success.png
deleted file mode 100644
index a7b338b4d..000000000
Binary files a/MyTracks/res/drawable-hdpi/success.png and /dev/null differ
diff --git a/MyTracks/res/drawable-hdpi/track_paused.png b/MyTracks/res/drawable-hdpi/track_paused.png
index 835085555..62aa3831f 100644
Binary files a/MyTracks/res/drawable-hdpi/track_paused.png and b/MyTracks/res/drawable-hdpi/track_paused.png differ
diff --git a/MyTracks/res/drawable-hdpi/track_recording.png b/MyTracks/res/drawable-hdpi/track_recording.png
index 89710bdd7..9188c0c9e 100644
Binary files a/MyTracks/res/drawable-hdpi/track_recording.png and b/MyTracks/res/drawable-hdpi/track_recording.png differ
diff --git a/MyTracks/res/drawable-mdpi/failure.png b/MyTracks/res/drawable-mdpi/failure.png
deleted file mode 100644
index b90e3caa1..000000000
Binary files a/MyTracks/res/drawable-mdpi/failure.png and /dev/null differ
diff --git a/MyTracks/res/drawable-mdpi/menu_map_layer.png b/MyTracks/res/drawable-mdpi/menu_map_layer.png
index 611020d7e..0ae2f963a 100644
Binary files a/MyTracks/res/drawable-mdpi/menu_map_layer.png and b/MyTracks/res/drawable-mdpi/menu_map_layer.png differ
diff --git a/MyTracks/res/drawable-mdpi/menu_split_frequency.png b/MyTracks/res/drawable-mdpi/menu_split_frequency.png
index 8a91fbb56..939e0754c 100644
Binary files a/MyTracks/res/drawable-mdpi/menu_split_frequency.png and b/MyTracks/res/drawable-mdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-mdpi/success.png b/MyTracks/res/drawable-mdpi/success.png
deleted file mode 100644
index b498048dd..000000000
Binary files a/MyTracks/res/drawable-mdpi/success.png and /dev/null differ
diff --git a/MyTracks/res/drawable-mdpi/track_paused.png b/MyTracks/res/drawable-mdpi/track_paused.png
index 704866ec3..1c931e7c5 100644
Binary files a/MyTracks/res/drawable-mdpi/track_paused.png and b/MyTracks/res/drawable-mdpi/track_paused.png differ
diff --git a/MyTracks/res/drawable-mdpi/track_recording.png b/MyTracks/res/drawable-mdpi/track_recording.png
index 151a0ab1f..381189442 100644
Binary files a/MyTracks/res/drawable-mdpi/track_recording.png and b/MyTracks/res/drawable-mdpi/track_recording.png differ
diff --git a/MyTracks/res/drawable-xhdpi/menu_map_layer.png b/MyTracks/res/drawable-xhdpi/menu_map_layer.png
index fd70d7406..72a7259de 100644
Binary files a/MyTracks/res/drawable-xhdpi/menu_map_layer.png and b/MyTracks/res/drawable-xhdpi/menu_map_layer.png differ
diff --git a/MyTracks/res/drawable-xhdpi/menu_split_frequency.png b/MyTracks/res/drawable-xhdpi/menu_split_frequency.png
index 2d9aa3c5f..ad204e4f0 100644
Binary files a/MyTracks/res/drawable-xhdpi/menu_split_frequency.png and b/MyTracks/res/drawable-xhdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-xhdpi/track_paused.png b/MyTracks/res/drawable-xhdpi/track_paused.png
index 64a2a8442..4484ed1f5 100644
Binary files a/MyTracks/res/drawable-xhdpi/track_paused.png and b/MyTracks/res/drawable-xhdpi/track_paused.png differ
diff --git a/MyTracks/res/drawable-xhdpi/track_recording.png b/MyTracks/res/drawable-xhdpi/track_recording.png
index 3a0f0dbc2..3cff5ec76 100644
Binary files a/MyTracks/res/drawable-xhdpi/track_recording.png and b/MyTracks/res/drawable-xhdpi/track_recording.png differ
diff --git a/MyTracks/res/layout/list_item.xml b/MyTracks/res/layout/list_item.xml
index 853acfbee..f3522dda8 100644
--- a/MyTracks/res/layout/list_item.xml
+++ b/MyTracks/res/layout/list_item.xml
@@ -52,6 +52,7 @@ limitations under the License.
style="@style/ListItemDate" />
+
+ style="@style/TrackWidgetRecordStatus" />
+ style="@style/TrackWidgetRecordStatus" />
+ style="@style/TrackWidgetRecordStatus" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/MyTracks/res/values-v11/themes_mytracks.xml b/MyTracks/res/values-v11/themes_mytracks.xml
index 559ee35ac..29025d4ff 100644
--- a/MyTracks/res/values-v11/themes_mytracks.xml
+++ b/MyTracks/res/values-v11/themes_mytracks.xml
@@ -27,16 +27,4 @@ limitations under the License.
- @style/ActionBarStyle.MyTracks
- @drawable/action_mode_background_mytracks
-
\ No newline at end of file
diff --git a/MyTracks/res/values-v14/styles.xml b/MyTracks/res/values-v14/styles.xml
index 6234c2c6f..8ef59714c 100644
--- a/MyTracks/res/values-v14/styles.xml
+++ b/MyTracks/res/values-v14/styles.xml
@@ -37,24 +37,6 @@ limitations under the License.
- ?android:attr/textAppearanceListItemSmall
-
-
-
-
-
-
+
-
@@ -221,9 +224,7 @@ limitations under the License.
- 8dp
-
@@ -232,15 +233,11 @@ limitations under the License.
- center_vertical
-
-
@@ -353,6 +350,15 @@ limitations under the License.
- 30dp
- 30dp
+
+
-
\ No newline at end of file
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivity.java b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivity.java
index d35f665d7..3b5f10518 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivity.java
@@ -32,9 +32,6 @@ import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
/**
* A dialog to show the result of uploading to Google services.
@@ -79,89 +76,49 @@ public class UploadResultActivity extends FragmentActivity implements ChooseActi
if (id != DIALOG_RESULT_ID) {
return null;
}
- view = getLayoutInflater().inflate(R.layout.upload_result, null);
-
- LinearLayout driveResult = (LinearLayout) view.findViewById(R.id.upload_result_drive_result);
- LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
- LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(
- R.id.upload_result_fusion_tables_result);
- LinearLayout spreadsheetsResult = (LinearLayout) view.findViewById(
- R.id.upload_result_spreadsheets_result);
-
- ImageView driveResultIcon = (ImageView) view.findViewById(R.id.upload_result_drive_result_icon);
- ImageView mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
- ImageView fusionTablesResultIcon = (ImageView) view.findViewById(
- R.id.upload_result_fusion_tables_result_icon);
- ImageView spreadsheetsResultIcon = (ImageView) view.findViewById(
- R.id.upload_result_spreadsheets_result_icon);
-
- TextView successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer);
- TextView errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer);
-
- boolean hasError = false;
- if (!sendRequest.isSendDrive()) {
- driveResult.setVisibility(View.GONE);
+ int serviceName;
+ int serviceUrl;
+ boolean success;
+ if (sendRequest.isSendDrive()) {
+ serviceName = R.string.export_google_drive;
+ serviceUrl = R.string.export_google_drive_url;
+ success = sendRequest.isDriveSuccess();
+ } else if (sendRequest.isSendMaps()) {
+ serviceName = R.string.export_google_maps;
+ serviceUrl = R.string.export_google_maps_url;
+ success = sendRequest.isMapsSuccess();
+ } else if (sendRequest.isSendFusionTables()) {
+ serviceName = R.string.export_google_fusion_tables;
+ serviceUrl = R.string.export_google_fusion_tables_url;
+ success = sendRequest.isFusionTablesSuccess();
} else {
- if (!sendRequest.isDriveSuccess()) {
- driveResultIcon.setImageResource(R.drawable.failure);
- driveResultIcon.setContentDescription(getString(R.string.generic_error_title));
- hasError = true;
- }
- }
-
- if (!sendRequest.isSendMaps()) {
- mapsResult.setVisibility(View.GONE);
- } else {
- if (!sendRequest.isMapsSuccess()) {
- mapsResultIcon.setImageResource(R.drawable.failure);
- mapsResultIcon.setContentDescription(getString(R.string.generic_error_title));
- hasError = true;
- }
- }
-
- if (!sendRequest.isSendFusionTables()) {
- fusionTablesResult.setVisibility(View.GONE);
- } else {
- if (!sendRequest.isFusionTablesSuccess()) {
- fusionTablesResultIcon.setImageResource(R.drawable.failure);
- fusionTablesResultIcon.setContentDescription(getString(R.string.generic_error_title));
- hasError = true;
- }
- }
-
- if (!sendRequest.isSendSpreadsheets()) {
- spreadsheetsResult.setVisibility(View.GONE);
- } else {
- if (!sendRequest.isSpreadsheetsSuccess()) {
- spreadsheetsResultIcon.setImageResource(R.drawable.failure);
- spreadsheetsResultIcon.setContentDescription(getString(R.string.generic_error_title));
- hasError = true;
- }
- }
-
- if (hasError) {
- successFooter.setVisibility(View.GONE);
- } else {
- errorFooter.setVisibility(View.GONE);
+ serviceName = R.string.export_google_spreadsheets;
+ serviceUrl = R.string.export_google_spreadsheets_url;
+ success = sendRequest.isSpreadsheetsSuccess();
}
+ String message = getString(
+ success ? R.string.export_google_success : R.string.export_google_error,
+ getString(serviceName), getString(serviceUrl));
AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
- .setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info)
+ .setIcon(success ? android.R.drawable.ic_dialog_info : android.R.drawable.ic_dialog_alert)
+ .setMessage(message)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
- }).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
+ })
+ .setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
- }).setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title)
- .setView(view);
+ })
+ .setTitle(success ? R.string.generic_success_title : R.string.generic_error_title);
// Add a Share URL button if shareUrl exists
- if (!hasError && shareUrl != null) {
+ if (success && shareUrl != null) {
builder.setNegativeButton(
R.string.share_track_share_url, new DialogInterface.OnClickListener() {
@Override
diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/ListItemUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/ListItemUtils.java
index dc44a7d74..667119d30 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/util/ListItemUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/util/ListItemUtils.java
@@ -50,6 +50,7 @@ public class ListItemUtils {
* @param totalDistance the total distance value
* @param startTime the start time value
* @param description the description value
+ * @param sharedOwner if shared with me track, the owner, else null
*/
public static void setListItem(Context context, View view, boolean isRecording, boolean isPaused,
int iconId, int iconContentDescriptionId, String name, String category, String totalTime,
@@ -69,22 +70,25 @@ public class ListItemUtils {
nameTextView.setText(name);
TextView timeDistanceTextView = (TextView) view.findViewById(R.id.list_item_time_distance);
- int color = isRecording ? context.getResources()
- .getColor(isPaused ? android.R.color.white : R.color.recording_text)
- : 0;
+ if (isRecording) {
+ timeDistanceTextView.setTextColor(context.getResources()
+ .getColor(isPaused ? android.R.color.white : R.color.recording_text));
+ } else {
+ // Need to match the style set in list_item.xml
+ timeDistanceTextView.setTextAppearance(context, R.style.TextSmall);
+ }
setTextView(timeDistanceTextView,
- getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance),
- color);
+ getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance));
String[] startTimeDisplay = getStartTime(isRecording, context, startTime);
TextView dateTextView = (TextView) view.findViewById(R.id.list_item_date);
- setTextView(dateTextView, startTimeDisplay[0], 0);
+ setTextView(dateTextView, startTimeDisplay[0]);
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
- setTextView(timeTextView, startTimeDisplay[1], 0);
+ setTextView(timeTextView, startTimeDisplay[1]);
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
- setTextView(descriptionTextView, getDescription(isRecording, category, description), 0);
+ setTextView(descriptionTextView, getDescription(isRecording, category, description));
}
/**
@@ -190,15 +194,12 @@ public class ListItemUtils {
* @param textView the text view
* @param value the value for the text view
*/
- private static void setTextView(TextView textView, String value, int color) {
+ private static void setTextView(TextView textView, String value) {
if (value == null || value.length() == 0) {
textView.setVisibility(View.GONE);
} else {
textView.setVisibility(View.VISIBLE);
textView.setText(value);
- if (color != 0) {
- textView.setTextColor(color);
- }
}
}
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivityTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivityTest.java
deleted file mode 100644
index 32d20b21b..000000000
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivityTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.android.apps.mytracks.io.sendtogoogle;
-
-import com.google.android.maps.mytracks.R;
-
-import android.content.Intent;
-import android.test.ActivityInstrumentationTestCase2;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-/**
- * Tests the {@link UploadResultActivity}.
- *
- * @author Youtao Liu
- */
-public class UploadResultActivityTest extends
- ActivityInstrumentationTestCase2 {
-
- private UploadResultActivity uploadResultActivity;
- private TextView errorFooter;
- private TextView successFooter;
- private LinearLayout mapsResult;
- private LinearLayout fusionTablesResult;
- private LinearLayout spreadsheetsResult;
- private ImageView mapsResultIcon;
- private ImageView fusionTablesResultIcon;
- private ImageView spreadsheetsResultIcon;
-
- private String successTitle;
- private String errorTitle;
-
- /**
- * This method is necessary for ActivityInstrumentationTestCase2.
- */
- public UploadResultActivityTest() {
- super(UploadResultActivity.class);
- }
-
- /**
- * Checks the display of dialog when send to all and all sends are successful.
- */
- public void testAllSuccess() {
- initialActivity(true, true, true, true, true, true);
- createDialogAndGetViews();
- assertEquals(View.VISIBLE, successFooter.getVisibility());
- assertEquals(View.GONE, errorFooter.getVisibility());
-
- assertEquals(View.VISIBLE, mapsResult.getVisibility());
- assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
-
- assertEquals(successTitle, mapsResultIcon.getContentDescription());
- assertEquals(successTitle, fusionTablesResultIcon.getContentDescription());
- assertEquals(successTitle, spreadsheetsResultIcon.getContentDescription());
- }
-
- /**
- * Checks the display of dialog when send to all and all sends are failed.
- */
- public void testAllFailed() {
- // Send all kinds but all failed.
- initialActivity(true, true, true, false, false, false);
- createDialogAndGetViews();
- assertEquals(View.GONE, successFooter.getVisibility());
- assertEquals(View.VISIBLE, errorFooter.getVisibility());
-
- assertEquals(View.VISIBLE, mapsResult.getVisibility());
- assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
-
- assertEquals(errorTitle, mapsResultIcon.getContentDescription());
- assertEquals(errorTitle, fusionTablesResultIcon.getContentDescription());
- assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
- }
-
- /**
- * Checks the display of dialog when match following items:
- *
- * - Only send to Maps and Spreadsheets.
- * - Send to Maps successful.
- * - Send to Spreadsheets failed.
- *
- */
- public void testPartialSuccess() {
- initialActivity(true, false, true, true, false, false);
- createDialogAndGetViews();
- assertEquals(View.VISIBLE, errorFooter.getVisibility());
-
- assertEquals(View.VISIBLE, mapsResult.getVisibility());
- assertEquals(View.GONE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
-
- assertEquals(successTitle, mapsResultIcon.getContentDescription());
- assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
- }
-
- /**
- * Initials a {@link SendRequest} and then initials a activity to be tested.
- *
- * @param isSendMaps
- * @param isSendFusionTables
- * @param isSendSpreadsheets
- * @param isMapsSuccess
- * @param isFusionTablesSuccess
- * @param isSpreadsheetSuccess
- */
- private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendSpreadsheets,
- boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isSpreadsheetSuccess) {
- Intent intent = new Intent();
- SendRequest sendRequest = new SendRequest(1L);
- sendRequest.setSendMaps(isSendMaps);
- sendRequest.setSendFusionTables(isSendFusionTables);
- sendRequest.setSendSpreadsheets(isSendSpreadsheets);
- sendRequest.setMapsSuccess(isMapsSuccess);
- sendRequest.setFusionTablesSuccess(isFusionTablesSuccess);
- sendRequest.setSpreadsheetsSuccess(isSpreadsheetSuccess);
- intent.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
- setActivityIntent(intent);
- uploadResultActivity = this.getActivity();
- successTitle = uploadResultActivity.getString(R.string.generic_success_title);
- errorTitle = uploadResultActivity.getString(R.string.generic_error_title);
- }
-
- /**
- * Creates result dialog and gets views in the dialog.
- */
- private void createDialogAndGetViews() {
- uploadResultActivity.onCreateDialog(UploadResultActivity.DIALOG_RESULT_ID);
- View view = uploadResultActivity.view;
- errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer);
- successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer);
-
- mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
- fusionTablesResult = (LinearLayout) view.findViewById(R.id.upload_result_fusion_tables_result);
- spreadsheetsResult = (LinearLayout) view.findViewById(R.id.upload_result_spreadsheets_result);
-
- mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
- fusionTablesResultIcon = (ImageView) view
- .findViewById(R.id.upload_result_fusion_tables_result_icon);
- spreadsheetsResultIcon = (ImageView) view.findViewById(R.id.upload_result_spreadsheets_result_icon);
- }
-}