+ * sendDrive -> {@link SendDriveActivity}
+ *
* sendMaps and newMap -> {@link SendMapsActivity}
*
* sendMaps and !newMap -> {@link ChooseMapActivity}
*
* !sendMaps && sendFusionTables -> {@link SendFusionTablesActivity}
*
- * !sendMaps && !sendFusionTables && sendDocs -> {@link SendDocsActivity}
+ * !sendMaps && !sendFusionTables && sendSpreadsheets -> {@link SendSpreadsheetsActivity}
*
- * !sendMaps && !sendFusionTables && !sendDocs -> {@link UploadResultActivity}
+ * !sendMaps && !sendFusionTables && !sendSpreadsheets -> {@link UploadResultActivity}
*/
private void startNextActivity() {
Class> next;
@@ -330,8 +332,8 @@ public class AccountChooserActivity extends Activity {
next = sendRequest.isNewMap() ? SendMapsActivity.class : ChooseMapActivity.class;
} else if (sendRequest.isSendFusionTables()) {
next = SendFusionTablesActivity.class;
- } else if (sendRequest.isSendDocs()) {
- next = SendDocsActivity.class;
+ } else if (sendRequest.isSendSpreadsheets()) {
+ next = SendSpreadsheetsActivity.class;
} else {
next = UploadResultActivity.class;
}
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequest.java b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequest.java
index 99a6df270..f9f05be0b 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequest.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequest.java
@@ -22,7 +22,7 @@ import android.os.Parcelable;
/**
* Send request states for sending a track to Google Maps, Google Fusion Tables,
- * and Google Docs.
+ * and Google Spreadsheets.
*
* @author Jimmy Shih
*/
@@ -37,13 +37,13 @@ public class SendRequest implements Parcelable {
private boolean sendDrive = false;
private boolean sendMaps = false;
private boolean sendFusionTables = false;
- private boolean sendDocs = false;
+ private boolean sendSpreadsheets = false;
private boolean newMap = false;
private Account account = null;
private String mapId = null;
private boolean driveSuccess = false;
private boolean mapsSuccess = false;
- private boolean docsSuccess = false;
+ private boolean spreadsheetsSuccess = false;
private boolean fusionTablesSuccess = false;
/**
@@ -162,20 +162,20 @@ public class SendRequest implements Parcelable {
}
/**
- * True if the user has selected the send to Google Docs option.
+ * True if the user has selected the send to Google Spreadsheets option.
*/
- public boolean isSendDocs() {
- return sendDocs;
+ public boolean isSendSpreadsheets() {
+ return sendSpreadsheets;
}
/**
- * Sets the send to Google Docs option.
+ * Sets the send to Google Spreadsheets option.
*
- * @param sendDocs true if the user has selected the send to Google Docs
- * option
+ * @param sendSpreadsheets true if the user has selected the send to Google
+ * Spreadsheets option
*/
- public void setSendDocs(boolean sendDocs) {
- this.sendDocs = sendDocs;
+ public void setSendSpreadsheets(boolean sendSpreadsheets) {
+ this.sendSpreadsheets = sendSpreadsheets;
}
/**
@@ -277,19 +277,20 @@ public class SendRequest implements Parcelable {
}
/**
- * True if sending to Google Docs is success.
+ * True if sending to Google Spreadsheets is success.
*/
- public boolean isDocsSuccess() {
- return docsSuccess;
+ public boolean isSpreadsheetsSuccess() {
+ return spreadsheetsSuccess;
}
/**
- * Sets the Google Docs result.
+ * Sets the Google Spreadsheets result.
*
- * @param docsSuccess true if sending to Google Docs is success
+ * @param spreadsheetsSuccess true if sending to Google Spreadsheets is
+ * success
*/
- public void setDocsSuccess(boolean docsSuccess) {
- this.docsSuccess = docsSuccess;
+ public void setSpreadsheetSuccess(boolean spreadsheetsSuccess) {
+ this.spreadsheetsSuccess = spreadsheetsSuccess;
}
private SendRequest(Parcel in) {
@@ -300,14 +301,14 @@ public class SendRequest implements Parcelable {
sendDrive = in.readByte() == 1;
sendMaps = in.readByte() == 1;
sendFusionTables = in.readByte() == 1;
- sendDocs = in.readByte() == 1;
+ sendSpreadsheets = in.readByte() == 1;
newMap = in.readByte() == 1;
account = in.readParcelable(null);
mapId = in.readString();
driveSuccess = in.readByte() == 1;
mapsSuccess = in.readByte() == 1;
fusionTablesSuccess = in.readByte() == 1;
- docsSuccess = in.readByte() == 1;
+ spreadsheetsSuccess = in.readByte() == 1;
}
@Override
@@ -324,14 +325,14 @@ public class SendRequest implements Parcelable {
out.writeByte((byte) (sendDrive ? 1 : 0));
out.writeByte((byte) (sendMaps ? 1 : 0));
out.writeByte((byte) (sendFusionTables ? 1 : 0));
- out.writeByte((byte) (sendDocs ? 1 : 0));
+ out.writeByte((byte) (sendSpreadsheets ? 1 : 0));
out.writeByte((byte) (newMap ? 1 : 0));
out.writeParcelable(account, 0);
out.writeString(mapId);
out.writeByte((byte) (driveSuccess ? 1 : 0));
out.writeByte((byte) (mapsSuccess ? 1 : 0));
out.writeByte((byte) (fusionTablesSuccess ? 1 : 0));
- out.writeByte((byte) (docsSuccess ? 1 : 0));
+ out.writeByte((byte) (spreadsheetsSuccess ? 1 : 0));
}
public static final Parcelable.Creator
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 4bd3498a5..4efe8b8f1 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
@@ -67,7 +67,7 @@ public class UploadResultActivity extends FragmentActivity {
finish();
return;
}
-
+
if (sendRequest.isSendMaps() && sendRequest.isMapsSuccess()) {
shareUrl = SendMapsUtils.getMapUrl(track);
if (sendRequest.getSharingAppPackageName() != null) {
@@ -80,9 +80,8 @@ public class UploadResultActivity extends FragmentActivity {
}
if (shareUrl == null && sendRequest.isSendFusionTables()
&& sendRequest.isFusionTablesSuccess()) {
- boolean defaultTablePublic = PreferencesUtils.getBoolean(this,
- R.string.default_table_public_key,
- PreferencesUtils.DEFAULT_TABLE_PUBLIC_DEFAULT);
+ boolean defaultTablePublic = PreferencesUtils.getBoolean(
+ this, R.string.default_table_public_key, PreferencesUtils.DEFAULT_TABLE_PUBLIC_DEFAULT);
if (defaultTablePublic) {
shareUrl = SendFusionTablesUtils.getMapUrl(track);
}
@@ -101,13 +100,15 @@ public class UploadResultActivity extends FragmentActivity {
LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(
R.id.upload_result_fusion_tables_result);
- LinearLayout docsResult = (LinearLayout) view.findViewById(R.id.upload_result_docs_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 docsResultIcon = (ImageView) view.findViewById(R.id.upload_result_docs_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);
@@ -122,7 +123,7 @@ public class UploadResultActivity extends FragmentActivity {
hasError = true;
}
}
-
+
if (!sendRequest.isSendMaps()) {
mapsResult.setVisibility(View.GONE);
} else {
@@ -143,12 +144,12 @@ public class UploadResultActivity extends FragmentActivity {
}
}
- if (!sendRequest.isSendDocs()) {
- docsResult.setVisibility(View.GONE);
+ if (!sendRequest.isSendSpreadsheets()) {
+ spreadsheetsResult.setVisibility(View.GONE);
} else {
- if (!sendRequest.isDocsSuccess()) {
- docsResultIcon.setImageResource(R.drawable.failure);
- docsResultIcon.setContentDescription(getString(R.string.generic_error_title));
+ if (!sendRequest.isSpreadsheetsSuccess()) {
+ spreadsheetsResultIcon.setImageResource(R.drawable.failure);
+ spreadsheetsResultIcon.setContentDescription(getString(R.string.generic_error_title));
hasError = true;
}
}
@@ -159,22 +160,19 @@ public class UploadResultActivity extends FragmentActivity {
errorFooter.setVisibility(View.GONE);
}
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setCancelable(true)
+ AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
.setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info)
.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)
+ }).setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title)
.setView(view);
// Add a Share URL button if shareUrl exists
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsActivity.java
similarity index 79%
rename from MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsActivity.java
rename to MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsActivity.java
index 688a185b1..c8e88ea4e 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsActivity.java
@@ -13,7 +13,8 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.android.apps.mytracks.io.docs;
+
+package com.google.android.apps.mytracks.io.spreadsheets;
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
@@ -25,25 +26,25 @@ import com.google.android.maps.mytracks.R;
import android.content.Intent;
/**
- * An activity to send a track to Google Docs.
+ * An activity to send a track to Google Spreadsheet.
*
* @author Jimmy Shih
*/
-public class SendDocsActivity extends AbstractSendActivity {
+public class SendSpreadsheetsActivity extends AbstractSendActivity {
@Override
protected AbstractSendAsyncTask createAsyncTask() {
- return new SendDocsAsyncTask(this, sendRequest.getTrackId(), sendRequest.getAccount());
+ return new SendSpreadsheetsAsyncTask(this, sendRequest.getTrackId(), sendRequest.getAccount());
}
@Override
protected String getServiceName() {
- return getString(R.string.send_google_docs);
+ return getString(R.string.send_google_spreadsheets);
}
@Override
protected void startNextActivity(boolean success, boolean isCancel) {
- sendRequest.setDocsSuccess(success);
+ sendRequest.setSpreadsheetSuccess(success);
Intent intent = IntentUtils.newIntent(this, UploadResultActivity.class)
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
startActivity(intent);
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsAsyncTask.java b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsAsyncTask.java
similarity index 90%
rename from MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsAsyncTask.java
rename to MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsAsyncTask.java
index 625ca8123..000a60b8d 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsAsyncTask.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsAsyncTask.java
@@ -14,7 +14,7 @@
* the License.
*/
-package com.google.android.apps.mytracks.io.docs;
+package com.google.android.apps.mytracks.io.spreadsheets;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Track;
@@ -55,13 +55,13 @@ import java.util.List;
import java.util.Locale;
/**
- * AsyncTask to send a track to Google Docs.
+ * AsyncTask to send a track to Google Spreadsheet.
*
* @author Jimmy Shih
*/
-public class SendDocsAsyncTask extends AbstractSendAsyncTask {
+public class SendSpreadsheetsAsyncTask extends AbstractSendAsyncTask {
- private static final String TAG = SendDocsAsyncTask.class.getSimpleName();
+ private static final String TAG = SendSpreadsheetsAsyncTask.class.getSimpleName();
private static final String
GOOGLE_SPREADSHEET_MIME_TYPE = "application/vnd.google-apps.spreadsheet";
private static final String
@@ -82,7 +82,7 @@ public class SendDocsAsyncTask extends AbstractSendAsyncTask {
private final Context context;
private final MyTracksProviderUtils myTracksProviderUtils;
- public SendDocsAsyncTask(SendDocsActivity activity, long trackId, Account account) {
+ public SendSpreadsheetsAsyncTask(SendSpreadsheetsActivity activity, long trackId, Account account) {
super(activity);
this.trackId = trackId;
this.account = account;
@@ -262,21 +262,21 @@ public class SendDocsAsyncTask extends AbstractSendAsyncTask {
row.getCustomElements().setValueLocal(
"movingtime", StringUtils.formatElapsedTimeWithHour(tripStatistics.getMovingTime()));
row.getCustomElements().setValueLocal(
- "distance", SendDocsUtils.getDistance(tripStatistics.getTotalDistance(), metricUnits));
+ "distance", SendSpreadsheetsUtils.getDistance(tripStatistics.getTotalDistance(), metricUnits));
row.getCustomElements().setValueLocal("distanceunit", distanceUnit);
row.getCustomElements().setValueLocal(
- "averagespeed", SendDocsUtils.getSpeed(tripStatistics.getAverageSpeed(), metricUnits));
+ "averagespeed", SendSpreadsheetsUtils.getSpeed(tripStatistics.getAverageSpeed(), metricUnits));
row.getCustomElements().setValueLocal("averagemovingspeed",
- SendDocsUtils.getSpeed(tripStatistics.getAverageMovingSpeed(), metricUnits));
+ SendSpreadsheetsUtils.getSpeed(tripStatistics.getAverageMovingSpeed(), metricUnits));
row.getCustomElements().setValueLocal(
- "maxspeed", SendDocsUtils.getSpeed(tripStatistics.getMaxSpeed(), metricUnits));
+ "maxspeed", SendSpreadsheetsUtils.getSpeed(tripStatistics.getMaxSpeed(), metricUnits));
row.getCustomElements().setValueLocal("speedunit", speedUnit);
row.getCustomElements().setValueLocal("elevationgain",
- SendDocsUtils.getElevation(tripStatistics.getTotalElevationGain(), metricUnits));
+ SendSpreadsheetsUtils.getElevation(tripStatistics.getTotalElevationGain(), metricUnits));
row.getCustomElements().setValueLocal(
- "minelevation", SendDocsUtils.getElevation(tripStatistics.getMinElevation(), metricUnits));
+ "minelevation", SendSpreadsheetsUtils.getElevation(tripStatistics.getMinElevation(), metricUnits));
row.getCustomElements().setValueLocal(
- "maxelevation", SendDocsUtils.getElevation(tripStatistics.getMaxElevation(), metricUnits));
+ "maxelevation", SendSpreadsheetsUtils.getElevation(tripStatistics.getMaxElevation(), metricUnits));
row.getCustomElements().setValueLocal("elevationunit", elevationUnit);
String map = SendMapsUtils.getMapUrl(track);
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsUtils.java b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtils.java
similarity index 90%
rename from MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsUtils.java
rename to MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtils.java
index f4144d828..ce95b460d 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/docs/SendDocsUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtils.java
@@ -14,7 +14,7 @@
* the License.
*/
-package com.google.android.apps.mytracks.io.docs;
+package com.google.android.apps.mytracks.io.spreadsheets;
import com.google.android.apps.mytracks.util.UnitConversions;
@@ -22,13 +22,13 @@ import java.text.NumberFormat;
import java.util.Locale;
/**
- * Utilities for sending a track to Google Docs.
+ * Utilities for sending a track to Google Spreadsheet.
*
* @author Jimmy Shih
*/
-public class SendDocsUtils {
+public class SendSpreadsheetsUtils {
- // Google Docs can only parse numbers in the English locale.
+ // Google Spreadsheet can only parse numbers in the English locale.
private static final NumberFormat NUMBER_FORMAT = NumberFormat.getNumberInstance(Locale.ENGLISH);
private static final NumberFormat INTEGER_FORMAT = NumberFormat.getIntegerInstance(
Locale.ENGLISH);
@@ -38,7 +38,7 @@ public class SendDocsUtils {
NUMBER_FORMAT.setMinimumFractionDigits(2);
}
- private SendDocsUtils() {}
+ private SendSpreadsheetsUtils() {}
/**
* Gets the distance. Performs unit conversion and formatting.
diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java
index 5a5a093dd..c84acec70 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java
@@ -86,9 +86,9 @@ public class PreferencesUtils {
public static final long SELECTED_TRACK_ID_DEFAULT = -1L;
public static final boolean SEND_TO_DRIVE_DEFAULT = false;
- public static final boolean SEND_TO_DOCS_DEFAULT = false;
public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = false;
public static final boolean SEND_TO_MAPS_DEFAULT = false;
+ public static final boolean SEND_TO_SPREADSHEETS_DEFAULT = false;
public static final String SENSOR_TYPE_DEFAULT = "NONE";
public static final int SPLIT_FREQUENCY_DEFAULT = 0;
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/docs/SendDocsUtilsTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/docs/SendDocsUtilsTest.java
deleted file mode 100644
index ad44624d5..000000000
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/docs/SendDocsUtilsTest.java
+++ /dev/null
@@ -1,72 +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.docs;
-
-import android.test.AndroidTestCase;
-
-/**
- * Tests {@link SendDocsUtils}.
- *
- * @author Jimmy Shih
- */
-public class SendDocsUtilsTest extends AndroidTestCase {
-
- /**
- * Tests {@link SendDocsUtils#getDistance(double, boolean)} with metric units.
- */
- public void testGetDistance_metric() {
- assertEquals("1.22", SendDocsUtils.getDistance(1222.3, true));
- }
-
- /**
- * Tests {@link SendDocsUtils#getDistance(double, boolean)} with imperial
- * units.
- */
- public void testGetDistance_imperial() {
- assertEquals("0.76", SendDocsUtils.getDistance(1222.3, false));
- }
-
- /**
- * Tests {@link SendDocsUtils#getSpeed(double, boolean)} with metric units.
- */
- public void testGetSpeed_metric() {
- assertEquals("15.55", SendDocsUtils.getSpeed(4.32, true));
- }
-
- /**
- * Tests {@link SendDocsUtils#getSpeed(double, boolean)} with imperial units.
- */
- public void testGetSpeed_imperial() {
- assertEquals("9.66", SendDocsUtils.getSpeed(4.32, false));
- }
-
- /**
- * Tests {@link SendDocsUtils#getElevation(double, boolean)} with metric
- * units.
- */
- public void testGetElevation_metric() {
- assertEquals("3", SendDocsUtils.getElevation(3.456, true));
- }
-
- /**
- * Tests {@link SendDocsUtils#getElevation(double, boolean)} with imperial
- * units.
- */
- public void testGetElevation_imperial() {
- assertEquals("11", SendDocsUtils.getElevation(3.456, false));
- }
-}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesActivityTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesActivityTest.java
index 800053ba8..9e2db29d6 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesActivityTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesActivityTest.java
@@ -15,9 +15,9 @@
*/
package com.google.android.apps.mytracks.io.fusiontables;
-import com.google.android.apps.mytracks.io.docs.SendDocsActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
+import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity;
import android.test.AndroidTestCase;
@@ -41,10 +41,10 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendFusionTablesActivity#getNextClass(SendRequest, boolean)}. Sets
- * the flags of "sendDocs" and "cancel" to false and false.
+ * the flags of "sendSpreadsheets" and "cancel" to false and false.
*/
- public void testGetNextClass_notCancelNotSendDocs() {
- sendRequest.setSendDocs(false);
+ public void testGetNextClass_notCancelNotSendSpreadsheets() {
+ sendRequest.setSendSpreadsheets(false);
Class> next = sendFusionTablesActivity.getNextClass(sendRequest, false);
assertEquals(UploadResultActivity.class, next);
}
@@ -52,21 +52,21 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendFusionTablesActivity#getNextClass(SendRequest, boolean)}. Sets
- * the flags of "sendDocs" and "cancel" to true and false.
+ * the flags of "sendSpreadsheets" and "cancel" to true and false.
*/
- public void testGetNextClass_notCancelSendDocs() {
- sendRequest.setSendDocs(true);
+ public void testGetNextClass_notCancelSendSpreadsheets() {
+ sendRequest.setSendSpreadsheets(true);
Class> next = sendFusionTablesActivity.getNextClass(sendRequest, false);
- assertEquals(SendDocsActivity.class, next);
+ assertEquals(SendSpreadsheetsActivity.class, next);
}
/**
* Tests the method
* {@link SendFusionTablesActivity#getNextClass(SendRequest,boolean)}. Sets
- * the flags of "sendDocs" and "cancel" to true and true.
+ * the flags of "sendSpreadsheets" and "cancel" to true and true.
*/
- public void testGetNextClass_cancelSendDocs() {
- sendRequest.setSendDocs(true);
+ public void testGetNextClass_cancelSendSpreadsheets() {
+ sendRequest.setSendSpreadsheets(true);
Class> next = sendFusionTablesActivity.getNextClass(sendRequest, true);
assertEquals(UploadResultActivity.class, next);
}
@@ -74,10 +74,10 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendFusionTablesActivity#getNextClass(SendRequest,boolean)}. Sets
- * the flags of "sendDocs" and "cancel" to false and true.
+ * the flags of "sendSpreadsheets" and "cancel" to false and true.
*/
- public void testGetNextClass_cancelNotSendDocs() {
- sendRequest.setSendDocs(false);
+ public void testGetNextClass_cancelNotSendSpreadsheets() {
+ sendRequest.setSendSpreadsheets(false);
Class> next = sendFusionTablesActivity.getNextClass(sendRequest, true);
assertEquals(UploadResultActivity.class, next);
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsActivityTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsActivityTest.java
index 97f2c0982..d9af47112 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsActivityTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsActivityTest.java
@@ -15,10 +15,10 @@
*/
package com.google.android.apps.mytracks.io.maps;
-import com.google.android.apps.mytracks.io.docs.SendDocsActivity;
import com.google.android.apps.mytracks.io.fusiontables.SendFusionTablesActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
+import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity;
import android.test.AndroidTestCase;
@@ -42,11 +42,11 @@ public class SendMapsActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
- * of "sendFusionTables","sendDocs" and "cancel" to true, true and false.
+ * of "sendFusionTables","sendSpreadsheets" and "cancel" to true, true and false.
*/
public void testGetNextClass_notCancelSendFusionTables() {
sendRequest.setSendFusionTables(true);
- sendRequest.setSendDocs(true);
+ sendRequest.setSendSpreadsheets(true);
Class> next = sendMapsActivity.getNextClass(sendRequest, false);
assertEquals(SendFusionTablesActivity.class, next);
}
@@ -54,23 +54,23 @@ public class SendMapsActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
- * of "sendFusionTables","sendDocs" and "cancel" to false, true and false.
+ * of "sendFusionTables","sendSpreadsheets" and "cancel" to false, true and false.
*/
- public void testGetNextClass_notCancelSendDocs() {
+ public void testGetNextClass_notCancelSendSpreadsheets() {
sendRequest.setSendFusionTables(false);
- sendRequest.setSendDocs(true);
+ sendRequest.setSendSpreadsheets(true);
Class> next = sendMapsActivity.getNextClass(sendRequest, false);
- assertEquals(SendDocsActivity.class, next);
+ assertEquals(SendSpreadsheetsActivity.class, next);
}
/**
* Tests the method
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
- * of "sendFusionTables","sendDocs" and "cancel" to false, false and false.
+ * of "sendFusionTables","sendSpreadsheets" and "cancel" to false, false and false.
*/
public void testGetNextClass_notCancelNotSend() {
sendRequest.setSendFusionTables(false);
- sendRequest.setSendDocs(false);
+ sendRequest.setSendSpreadsheets(false);
Class> next = sendMapsActivity.getNextClass(sendRequest, false);
assertEquals(UploadResultActivity.class, next);
}
@@ -78,11 +78,11 @@ public class SendMapsActivityTest extends AndroidTestCase {
/**
* Tests the method
* {@link SendMapsActivity#getNextClass(SendRequest, boolean)}. Sets the flags
- * of "sendFusionTables","sendDocs" and "cancel" to true, true and true.
+ * of "sendFusionTables","sendSpreadsheets" and "cancel" to true, true and true.
*/
- public void testGetNextClass_cancelSendDocs() {
+ public void testGetNextClass_cancelSendSpreadsheets() {
sendRequest.setSendFusionTables(true);
- sendRequest.setSendDocs(true);
+ sendRequest.setSendSpreadsheets(true);
Class> next = sendMapsActivity.getNextClass(sendRequest, true);
assertEquals(UploadResultActivity.class, next);
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequestTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequestTest.java
index 00ba4d282..d16846d6c 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequestTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/SendRequestTest.java
@@ -59,13 +59,13 @@ public class SendRequestTest extends AndroidTestCase {
}
/**
- * Tests the method {@link SendRequest#isSendDocs()}. The value should be set
+ * Tests the method {@link SendRequest#isSendSpreadsheets()}. The value should be set
* to false which is its default value when it is initialed in setup method.
*/
- public void testIsSendDocs() {
- assertEquals(false, sendRequest.isSendDocs());
- sendRequest.setSendDocs(true);
- assertEquals(true, sendRequest.isSendDocs());
+ public void testIsSendSpreadsheets() {
+ assertEquals(false, sendRequest.isSendSpreadsheets());
+ sendRequest.setSendSpreadsheets(true);
+ assertEquals(true, sendRequest.isSendSpreadsheets());
}
/**
@@ -122,14 +122,14 @@ public class SendRequestTest extends AndroidTestCase {
}
/**
- * Tests the method {@link SendRequest#isDocsSuccess()}. The value should be
+ * Tests the method {@link SendRequest#isSpreadsheetsSuccess()}. The value should be
* set to false which is its default value when it is initialed in setup
* method.
*/
- public void testIsDocsSuccess() {
- assertEquals(false, sendRequest.isDocsSuccess());
- sendRequest.setDocsSuccess(true);
- assertEquals(true, sendRequest.isDocsSuccess());
+ public void testIsSpreadsheetsSuccess() {
+ assertEquals(false, sendRequest.isSpreadsheetsSuccess());
+ sendRequest.setSpreadsheetSuccess(true);
+ assertEquals(true, sendRequest.isSpreadsheetsSuccess());
}
/**
@@ -163,14 +163,14 @@ public class SendRequestTest extends AndroidTestCase {
assertTrue(sendRequest.isSendDrive());
assertTrue(sendRequest.isSendMaps());
assertTrue(sendRequest.isSendFusionTables());
- assertTrue(sendRequest.isSendDocs());
+ assertTrue(sendRequest.isSendSpreadsheets());
assertTrue(sendRequest.isNewMap());
assertEquals(account, sendRequest.getAccount());
assertEquals(MAPID, sendRequest.getMapId());
assertTrue(sendRequest.isDriveSuccess());
assertTrue(sendRequest.isMapsSuccess());
assertTrue(sendRequest.isFusionTablesSuccess());
- assertTrue(sendRequest.isDocsSuccess());
+ assertTrue(sendRequest.isSpreadsheetsSuccess());
}
/**
@@ -204,14 +204,14 @@ public class SendRequestTest extends AndroidTestCase {
assertFalse(sendRequest.isSendDrive());
assertFalse(sendRequest.isSendMaps());
assertFalse(sendRequest.isSendFusionTables());
- assertFalse(sendRequest.isSendDocs());
+ assertFalse(sendRequest.isSendSpreadsheets());
assertFalse(sendRequest.isNewMap());
assertEquals(account, sendRequest.getAccount());
assertEquals(MAPID, sendRequest.getMapId());
assertFalse(sendRequest.isDriveSuccess());
assertFalse(sendRequest.isMapsSuccess());
assertFalse(sendRequest.isFusionTablesSuccess());
- assertFalse(sendRequest.isDocsSuccess());
+ assertFalse(sendRequest.isSpreadsheetsSuccess());
}
/**
@@ -230,14 +230,14 @@ public class SendRequestTest extends AndroidTestCase {
boolean sendDrive = parcel.readByte() == 1;
boolean sendMaps = parcel.readByte() == 1;
boolean sendFusionTables = parcel.readByte() == 1;
- boolean sendDocs = parcel.readByte() == 1;
+ boolean sendSpreadsheets = parcel.readByte() == 1;
boolean newMap = parcel.readByte() == 1;
Parcelable account = parcel.readParcelable(null);
String mapId = parcel.readString();
boolean driveSuccess = parcel.readByte() == 1;
boolean mapsSuccess = parcel.readByte() == 1;
boolean fusionTablesSuccess = parcel.readByte() == 1;
- boolean docsSuccess = parcel.readByte() == 1;
+ boolean spreadsheetsSuccess = parcel.readByte() == 1;
assertEquals(1, trackId);
assertNull(sharingAppPackageName);
assertNull(sharingAppClassName);
@@ -245,14 +245,14 @@ public class SendRequestTest extends AndroidTestCase {
assertFalse(sendDrive);
assertFalse(sendMaps);
assertFalse(sendFusionTables);
- assertFalse(sendDocs);
+ assertFalse(sendSpreadsheets);
assertFalse(newMap);
assertNull(account);
assertNull(mapId);
assertFalse(driveSuccess);
assertFalse(mapsSuccess);
assertFalse(fusionTablesSuccess);
- assertFalse(docsSuccess);
+ assertFalse(spreadsheetsSuccess);
}
/**
@@ -266,7 +266,7 @@ public class SendRequestTest extends AndroidTestCase {
sendRequest.setSendDrive(true);
sendRequest.setSendMaps(true);
sendRequest.setSendFusionTables(true);
- sendRequest.setSendDocs(true);
+ sendRequest.setSendSpreadsheets(true);
sendRequest.setNewMap(true);
Account accountNew = new Account(ACCOUNTNAME + "2", ACCOUNTYPE + "2");
sendRequest.setAccount(accountNew);
@@ -274,7 +274,7 @@ public class SendRequestTest extends AndroidTestCase {
sendRequest.setMapsSuccess(true);
sendRequest.setDriveSuccess(true);
sendRequest.setFusionTablesSuccess(true);
- sendRequest.setDocsSuccess(true);
+ sendRequest.setSpreadsheetSuccess(true);
Parcel parcel = Parcel.obtain();
parcel.setDataPosition(0);
sendRequest.writeToParcel(parcel, 1);
@@ -286,14 +286,14 @@ public class SendRequestTest extends AndroidTestCase {
boolean sendDrive = parcel.readByte() == 1;
boolean sendMaps = parcel.readByte() == 1;
boolean sendFusionTables = parcel.readByte() == 1;
- boolean sendDocs = parcel.readByte() == 1;
+ boolean sendSpreadsheets = parcel.readByte() == 1;
boolean newMap = parcel.readByte() == 1;
Parcelable account = parcel.readParcelable(null);
String mapId = parcel.readString();
boolean driveSuccess = parcel.readByte() == 1;
boolean mapsSuccess = parcel.readByte() == 1;
boolean fusionTablesSuccess = parcel.readByte() == 1;
- boolean docsSuccess = parcel.readByte() == 1;
+ boolean spreadsheetsSuccess = parcel.readByte() == 1;
assertEquals(4, trackId);
assertEquals("package", sharingAppPackageName);
assertEquals("class", sharingAppClassName);
@@ -301,13 +301,13 @@ public class SendRequestTest extends AndroidTestCase {
assertTrue(sendDrive);
assertTrue(sendMaps);
assertTrue(sendFusionTables);
- assertTrue(sendDocs);
+ assertTrue(sendSpreadsheets);
assertTrue(newMap);
assertEquals(accountNew, account);
assertEquals(MAPID, mapId);
assertTrue(driveSuccess);
assertTrue(mapsSuccess);
assertTrue(fusionTablesSuccess);
- assertTrue(docsSuccess);
+ assertTrue(spreadsheetsSuccess);
}
}
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
index 7ea9fb3d9..858b9fbd5 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivityTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadResultActivityTest.java
@@ -38,10 +38,10 @@ public class UploadResultActivityTest extends
private TextView successFooter;
private LinearLayout mapsResult;
private LinearLayout fusionTablesResult;
- private LinearLayout docsResult;
+ private LinearLayout spreadsheetsResult;
private ImageView mapsResultIcon;
private ImageView fusionTablesResultIcon;
- private ImageView docsResultIcon;
+ private ImageView spreadsheetsResultIcon;
private String successTitle;
private String errorTitle;
@@ -64,11 +64,11 @@ public class UploadResultActivityTest extends
assertEquals(View.VISIBLE, mapsResult.getVisibility());
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, docsResult.getVisibility());
+ assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
assertEquals(successTitle, mapsResultIcon.getContentDescription());
assertEquals(successTitle, fusionTablesResultIcon.getContentDescription());
- assertEquals(successTitle, docsResultIcon.getContentDescription());
+ assertEquals(successTitle, spreadsheetsResultIcon.getContentDescription());
}
/**
@@ -83,19 +83,19 @@ public class UploadResultActivityTest extends
assertEquals(View.VISIBLE, mapsResult.getVisibility());
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, docsResult.getVisibility());
+ assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
assertEquals(errorTitle, mapsResultIcon.getContentDescription());
assertEquals(errorTitle, fusionTablesResultIcon.getContentDescription());
- assertEquals(errorTitle, docsResultIcon.getContentDescription());
+ assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
}
/**
* Checks the display of dialog when match following items:
*
- * - Only send to Maps and Docs.
+ * - Only send to Maps and Spreadsheets.
* - Send to Maps successful.
- * - Send to Docs failed.
+ * - Send to Spreadsheets failed.
*
*/
public void testPartialSuccess() {
@@ -105,10 +105,10 @@ public class UploadResultActivityTest extends
assertEquals(View.VISIBLE, mapsResult.getVisibility());
assertEquals(View.GONE, fusionTablesResult.getVisibility());
- assertEquals(View.VISIBLE, docsResult.getVisibility());
+ assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
assertEquals(successTitle, mapsResultIcon.getContentDescription());
- assertEquals(errorTitle, docsResultIcon.getContentDescription());
+ assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
}
/**
@@ -116,21 +116,21 @@ public class UploadResultActivityTest extends
*
* @param isSendMaps
* @param isSendFusionTables
- * @param isSendDocs
+ * @param isSendSpreadsheets
* @param isMapsSuccess
* @param isFusionTablesSuccess
- * @param isDocsSuccess
+ * @param isSpreadsheetSuccess
*/
- private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendDocs,
- boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isDocsSuccess) {
+ 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.setSendDocs(isSendDocs);
+ sendRequest.setSendSpreadsheets(isSendSpreadsheets);
sendRequest.setMapsSuccess(isMapsSuccess);
sendRequest.setFusionTablesSuccess(isFusionTablesSuccess);
- sendRequest.setDocsSuccess(isDocsSuccess);
+ sendRequest.setSpreadsheetSuccess(isSpreadsheetSuccess);
intent.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
setActivityIntent(intent);
uploadResultActivity = this.getActivity();
@@ -149,11 +149,11 @@ public class UploadResultActivityTest extends
mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
fusionTablesResult = (LinearLayout) view.findViewById(R.id.upload_result_fusion_tables_result);
- docsResult = (LinearLayout) view.findViewById(R.id.upload_result_docs_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);
- docsResultIcon = (ImageView) view.findViewById(R.id.upload_result_docs_result_icon);
+ spreadsheetsResultIcon = (ImageView) view.findViewById(R.id.upload_result_spreadsheets_result_icon);
}
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtilsTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtilsTest.java
new file mode 100644
index 000000000..d830d1ba1
--- /dev/null
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/spreadsheets/SendSpreadsheetsUtilsTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.spreadsheets;
+
+import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsUtils;
+
+import android.test.AndroidTestCase;
+
+/**
+ * Tests {@link SendSpreadsheetsUtils}.
+ *
+ * @author Jimmy Shih
+ */
+public class SendSpreadsheetsUtilsTest extends AndroidTestCase {
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getDistance(double, boolean)} with metric units.
+ */
+ public void testGetDistance_metric() {
+ assertEquals("1.22", SendSpreadsheetsUtils.getDistance(1222.3, true));
+ }
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getDistance(double, boolean)} with imperial
+ * units.
+ */
+ public void testGetDistance_imperial() {
+ assertEquals("0.76", SendSpreadsheetsUtils.getDistance(1222.3, false));
+ }
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getSpeed(double, boolean)} with metric units.
+ */
+ public void testGetSpeed_metric() {
+ assertEquals("15.55", SendSpreadsheetsUtils.getSpeed(4.32, true));
+ }
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getSpeed(double, boolean)} with imperial units.
+ */
+ public void testGetSpeed_imperial() {
+ assertEquals("9.66", SendSpreadsheetsUtils.getSpeed(4.32, false));
+ }
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getElevation(double, boolean)} with metric
+ * units.
+ */
+ public void testGetElevation_metric() {
+ assertEquals("3", SendSpreadsheetsUtils.getElevation(3.456, true));
+ }
+
+ /**
+ * Tests {@link SendSpreadsheetsUtils#getElevation(double, boolean)} with imperial
+ * units.
+ */
+ public void testGetElevation_imperial() {
+ assertEquals("11", SendSpreadsheetsUtils.getElevation(3.456, false));
+ }
+}