Rename to Google Spreadsheets.

This commit is contained in:
Jimmy Shih
2013-02-12 17:38:26 -08:00
parent c93b487483
commit 4f8e8adc23
30 changed files with 277 additions and 272 deletions
+1 -1
View File
@@ -204,7 +204,6 @@ limitations under the License.
<activity android:name="com.google.android.apps.mytracks.io.backup.BackupActivity" />
<activity android:name="com.google.android.apps.mytracks.io.backup.RestoreActivity" />
<activity android:name="com.google.android.apps.mytracks.io.backup.RestoreChooserActivity" />
<activity android:name="com.google.android.apps.mytracks.io.docs.SendDocsActivity" />
<activity android:name="com.google.android.apps.mytracks.io.drive.SendDriveActivity" />
<activity android:name="com.google.android.apps.mytracks.io.file.SaveActivity" />
<activity android:name="com.google.android.apps.mytracks.io.fusiontables.SendFusionTablesActivity" />
@@ -214,6 +213,7 @@ limitations under the License.
<activity android:name="com.google.android.apps.mytracks.io.maps.SendMapsActivity" />
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.AccountChooserActivity" />
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity" />
<activity android:name="com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity" />
<activity android:name="com.google.android.apps.mytracks.settings.BackupResetSettingsActivity" />
<activity android:name="com.google.android.apps.mytracks.settings.ChartSettingsActivity" />
<activity android:name="com.google.android.apps.mytracks.settings.GoogleSettingsActivity" />
Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -67,12 +67,12 @@ limitations under the License.
</TableRow>
<TableRow>
<ImageView
android:contentDescription="@string/send_google_docs"
android:src="@drawable/google_docs_icon"
android:contentDescription="@string/send_google_spreadsheets"
android:src="@drawable/google_spreadsheets_icon"
style="@style/ChooseUploadServiceImageView" />
<CheckBox
android:id="@+id/choose_upload_service_docs"
android:text="@string/send_google_docs"
android:id="@+id/choose_upload_service_spreadsheets"
android:text="@string/send_google_spreadsheets"
style="@style/ChooseUploadServiceCheckBox" />
</TableRow>
</TableLayout>
+5 -5
View File
@@ -105,15 +105,15 @@ limitations under the License.
style="@style/TextSmall" />
</LinearLayout>
</LinearLayout>
<!-- Google Docs result -->
<!-- Google Spreadsheets result -->
<LinearLayout
android:id="@+id/upload_result_docs_result"
android:id="@+id/upload_result_spreadsheets_result"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal" >
<ImageView
android:contentDescription="@string/generic_success_title"
android:id="@+id/upload_result_docs_result_icon"
android:id="@+id/upload_result_spreadsheets_result_icon"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -126,10 +126,10 @@ limitations under the License.
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:text="@string/send_google_docs"
android:text="@string/send_google_spreadsheets"
style="@style/TextMedium" />
<TextView
android:text="@string/send_google_docs_url"
android:text="@string/send_google_spreadsheets_url"
style="@style/TextSmall" />
</LinearLayout>
</LinearLayout>
+1 -1
View File
@@ -79,10 +79,10 @@ Google은 이용자에 대한 위치정보의 이용∙제공사실을 위치정
<string name="my_tracks_support_url">groups.google.com/a/googleproductforums.com/forum/#!categories/maps/mytracks</string>
<string name="my_tracks_web_url">www.google.com/mobile/mytracks</string>
<string name="permission_notification_value">com.google.android.apps.mytracks.MYTRACKS_NOTIFICATIONS</string>
<string name="send_google_docs_url">docs.google.com</string>
<string name="send_google_drive_url">drive.google.com</string>
<string name="send_google_fusion_tables_url">google.com/fusiontables</string>
<string name="send_google_maps_url">maps.google.com</string>
<string name="send_google_spreadsheets_url">drive.google.com</string>
<string name="sensor_type_value_ant">ANT</string>
<string name="sensor_type_value_none">NONE</string>
<string name="sensor_type_value_polar">POLAR</string>
+1 -1
View File
@@ -44,10 +44,10 @@ limitations under the License.
<string name="min_required_accuracy_key">minRequiredAccuracy</string>
<string name="pick_existing_map_key">pickExistingMap</string>
<string name="report_speed_key">reportSpeed</string>
<string name="send_to_docs_key">sendToDocs</string>
<string name="send_to_drive_key">sendToDrive</string>
<string name="send_to_fusion_tables_key">sendToFusionTables</string>
<string name="send_to_maps_key">sendToMaps</string>
<string name="send_to_spreadsheets_key">sendToSpreadsheets</string>
<string name="sensor_type_key">sensorType</string>
<string name="split_frequency_key">splitFrequency</string>
<string name="stats_show_coordinate_key">statsShowCoordinate</string>
+18 -18
View File
@@ -795,8 +795,8 @@ limitations under the License.
deletes the recorded tracks from the device memory. If you have saved tracks or backups on the
external storage, you must delete them separately. You can access the external storage using
any file manager app from the Play Store or using a USB cable to connect your device to your
computer. Tracks uploaded to Google Maps, Google Fusion Tables, and Google Docs must also be
deleted separately.
computer. Tracks uploaded to Google Maps, Google Fusion Tables, and Google Spreadsheets must
also be deleted separately.
</string>
<string name="help_delete_tracks_question"
translation_description="In the 'Help' page, the question on delete tracks.">
@@ -875,8 +875,8 @@ limitations under the License.
translation_description="In the 'Help' page, the answer on what is My Tracks.">
My Tracks allows you to record GPS tracks and visualize your walking, running, biking or any
other activity while watching live performance statistics. My Tracks makes it easy to archive
your training history with Google Maps, Google Fusion Tables, and Google Docs, and share your
activities with friends and the world.
your training history with Google Maps, Google Fusion Tables, and Google Spreadsheets, and share
your activities with friends and the world.
</string>
<string name="help_my_tracks_question"
translation_description="In the 'Help' page, the question on what is My Tracks.">
@@ -896,10 +896,10 @@ limitations under the License.
%1$s url. E.g., 'maps.google.com'.
%2$s url. E.g., 'google.com/fusiontables'.
%3$s url. E.g., 'docs.google.com'.">
You can send a track to Google Maps, Google Fusion Tables, and Google Docs. Tracks sent to
Google Maps are at %1$s, &#8220;My Places&#8221;. Tracks sent to Google Fusion Tables are at
%2$s. Tracks sent to Google Docs are at %3$s.
%3$s url. E.g., 'drive.google.com'.">
You can send a track to Google Maps, Google Fusion Tables, and Google Spreadsheets. Tracks sent
to Google Maps are at %1$s, &#8220;My Places&#8221;. Tracks sent to Google Fusion Tables are at
%2$s. Tracks sent to Google Spreadsheets are at %3$s.
</string>
<string name="help_send_track_question"
translation_description="In the 'Help' page, the question on sending a track.">
@@ -917,13 +917,13 @@ limitations under the License.
<string name="help_share_visibility_answer"
translation_description="In the 'Help' page, the answer on share visibility.">
By default, tracks sent to Google Maps are unlisted, tracks sent to Google Fusion Tables are
public, and tracks sent to Google Docs are private. For Google Maps, you can change the
private, and tracks sent to Google Spreadsheets are private. For Google Maps, you can change the
default between public and unlisted via Settings -> Google. After uploading tracks, you can
change their visibility in Google Maps, Google Fusion Tables, and Google Docs.
change their visibility in Google Maps, Google Fusion Tables, and Google Spreadsheets.
</string>
<string name="help_share_visibility_question"
translation_description="In the 'Help' page, the question on share visibility.">
Who can see the tracks I send to Google Maps, Google Fusion Tables, and Google Docs?
Who can see the tracks I send to Google Maps, Google Fusion Tables, and Google Spreadsheets?
</string>
<string name="help_split_marker_answer"
translation_description="In the 'Help' page, the answer on split markers.">
@@ -1437,11 +1437,6 @@ limitations under the License.
translation_description="When sending to Google, the dialog title to choose a Google account.">
Choose account
</string>
<string name="send_google_docs"
translation_description="When sending a track to Google, under the 'Send to...' dialog, the
checkbox option to send to Google Docs.">
Google Docs
</string>
<string name="send_google_drive"
translation_description="When sending a track to Google, under the 'Send to...' dialog, the
checkbox option to send to Google Drive.">
@@ -1509,7 +1504,7 @@ limitations under the License.
<string name="send_google_progress_message"
translation_description="When sending a track to a Google service, the progress message.
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Docs'.">
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Spreadsheets'.">
Sending to %1$s&#8230;
</string>
<string name="send_google_send_now"
@@ -1517,6 +1512,11 @@ limitations under the License.
button on the bottom to send the track to the selected Google services.">
Send now
</string>
<string name="send_google_spreadsheets"
translation_description="When sending a track to Google, under the 'Send to...' dialog, the
checkbox option to send to Google Spreadsheets.">
Google Spreadsheets
</string>
<string name="send_google_success_footer"
translation_description="When sending a track to Google, the additional comment on the bottom of
the result page.">
@@ -1525,7 +1525,7 @@ limitations under the License.
<string name="send_google_title"
translation_description="When sending a track to Google, the dialog title to choose the Google
services to send the track to. The user can choose Google Maps, Google Fusion Tables, and
Google Docs.">
Google Spreadsheets.">
Send to&#8230;
</string>
<string name="send_google_track_part_label"
@@ -43,7 +43,7 @@ public class HelpActivity extends AbstractMyTracksActivity {
TextView sendTrack = (TextView) findViewById(R.id.help_send_track_answer);
sendTrack.setText(StringUtils.getHtml(
this, R.string.help_send_track_answer, R.string.send_google_maps_url,
R.string.send_google_fusion_tables_url, R.string.send_google_docs_url));
R.string.send_google_fusion_tables_url, R.string.send_google_spreadsheets_url));
findViewById(R.id.help_ok).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
@@ -50,7 +50,8 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
private static final String KEY_SEND_REQUEST = "sendRequest";
private static final String KEY_HIDE_DRIVE = "hideDrive";
public static ChooseUploadServiceDialogFragment newInstance(SendRequest sendRequest, boolean hideDrive) {
public static ChooseUploadServiceDialogFragment newInstance(
SendRequest sendRequest, boolean hideDrive) {
Bundle bundle = new Bundle();
bundle.putParcelable(KEY_SEND_REQUEST, sendRequest);
bundle.putBoolean(KEY_HIDE_DRIVE, hideDrive);
@@ -63,11 +64,11 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
private FragmentActivity activity;
private SendRequest sendRequest;
private boolean hideDrive;
private CheckBox driveCheckBox;
private CheckBox mapsCheckBox;
private CheckBox fusionTablesCheckBox;
private CheckBox docsCheckBox;
private CheckBox spreadsheetsCheckBox;
private TableRow mapsOptionTableRow;
private RadioButton existingMapRadioButton;
@@ -77,7 +78,7 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
activity = getActivity();
sendRequest = getArguments().getParcelable(KEY_SEND_REQUEST);
hideDrive = getArguments().getBoolean(KEY_HIDE_DRIVE);
View view = activity.getLayoutInflater().inflate(R.layout.choose_upload_service, null);
view.findViewById(R.id.choose_upload_service_drive_options)
@@ -86,7 +87,7 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
driveCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_drive);
mapsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_maps);
fusionTablesCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_fusion_tables);
docsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_docs);
spreadsheetsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_spreadsheets);
driveCheckBox.setChecked(PreferencesUtils.getBoolean(
activity, R.string.send_to_drive_key, PreferencesUtils.SEND_TO_DRIVE_DEFAULT));
@@ -94,10 +95,11 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
activity, R.string.send_to_maps_key, PreferencesUtils.SEND_TO_MAPS_DEFAULT));
fusionTablesCheckBox.setChecked(PreferencesUtils.getBoolean(
activity, R.string.send_to_fusion_tables_key,
PreferencesUtils.SEND_TO_FUSION_TABLES_DEFAULT));
docsCheckBox.setChecked(PreferencesUtils.getBoolean(
activity, R.string.send_to_docs_key, PreferencesUtils.SEND_TO_DOCS_DEFAULT));
PreferencesUtils.SEND_TO_FUSION_TABLES_DEFAULT));
spreadsheetsCheckBox.setChecked(PreferencesUtils.getBoolean(
activity, R.string.send_to_spreadsheets_key,
PreferencesUtils.SEND_TO_SPREADSHEETS_DEFAULT));
mapsCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton button, boolean checked) {
@@ -124,16 +126,15 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
} else {
newMapRadioButton.setChecked(true);
}
// Update fusion table
boolean defaultTablePublic = PreferencesUtils.getBoolean(activity,
R.string.default_table_public_key,
PreferencesUtils.DEFAULT_TABLE_PUBLIC_DEFAULT);
boolean defaultTablePublic = PreferencesUtils.getBoolean(
activity, R.string.default_table_public_key, PreferencesUtils.DEFAULT_TABLE_PUBLIC_DEFAULT);
String text = getString(R.string.send_google_fusion_tables) + "\n"
+ getString(defaultTablePublic ? R.string.send_google_fusion_tables_public
: R.string.send_google_fusion_tables_private);
fusionTablesCheckBox.setText(text);
return new AlertDialog.Builder(activity).setNegativeButton(R.string.generic_cancel, null)
.setPositiveButton(R.string.send_google_send_now, new DialogInterface.OnClickListener() {
@Override
@@ -147,9 +148,9 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
PreferencesUtils.setBoolean(
activity, R.string.send_to_fusion_tables_key, fusionTablesCheckBox.isChecked());
PreferencesUtils.setBoolean(
activity, R.string.send_to_docs_key, docsCheckBox.isChecked());
if (sendDrive() || mapsCheckBox.isChecked()
|| fusionTablesCheckBox.isChecked() || docsCheckBox.isChecked()) {
activity, R.string.send_to_spreadsheets_key, spreadsheetsCheckBox.isChecked());
if (sendDrive() || mapsCheckBox.isChecked() || fusionTablesCheckBox.isChecked()
|| spreadsheetsCheckBox.isChecked()) {
startNextActivity();
} else {
Toast.makeText(activity, R.string.send_google_no_service_selected, Toast.LENGTH_LONG)
@@ -173,7 +174,7 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
sendRequest.setSendDrive(sendDrive());
sendRequest.setSendMaps(mapsCheckBox.isChecked());
sendRequest.setSendFusionTables(fusionTablesCheckBox.isChecked());
sendRequest.setSendDocs(docsCheckBox.isChecked());
sendRequest.setSendSpreadsheets(spreadsheetsCheckBox.isChecked());
sendRequest.setNewMap(!existingMapRadioButton.isChecked());
sendStats();
Intent intent = IntentUtils.newIntent(activity, AccountChooserActivity.class)
@@ -194,11 +195,11 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
if (sendRequest.isSendFusionTables()) {
AnalyticsUtils.sendPageViews(activity, "/send/fusion_tables");
}
if (sendRequest.isSendDocs()) {
AnalyticsUtils.sendPageViews(activity, "/send/docs");
if (sendRequest.isSendSpreadsheets()) {
AnalyticsUtils.sendPageViews(activity, "/send/spreadsheets");
}
}
/**
* True to send to Google Drive.
*/
@@ -16,7 +16,6 @@
package com.google.android.apps.mytracks.io.drive;
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.maps.ChooseMapActivity;
import com.google.android.apps.mytracks.io.maps.SendMapsActivity;
@@ -24,6 +23,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
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 com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.maps.mytracks.R;
@@ -65,8 +65,8 @@ public class SendDriveActivity extends AbstractSendActivity {
return sendRequest.isNewMap() ? SendMapsActivity.class : ChooseMapActivity.class;
} else if (sendRequest.isSendFusionTables()) {
return SendFusionTablesActivity.class;
} else if (sendRequest.isSendDocs()) {
return SendDocsActivity.class;
} else if (sendRequest.isSendSpreadsheets()) {
return SendSpreadsheetsActivity.class;
} else {
return UploadResultActivity.class;
}
@@ -16,11 +16,11 @@
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.AbstractSendActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
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 com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
@@ -59,8 +59,8 @@ public class SendFusionTablesActivity extends AbstractSendActivity {
if (isCancel) {
return UploadResultActivity.class;
} else {
if (request.isSendDocs()) {
return SendDocsActivity.class;
if (request.isSendSpreadsheets()) {
return SendSpreadsheetsActivity.class;
} else {
return UploadResultActivity.class;
}
@@ -15,12 +15,12 @@
*/
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.AbstractSendActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
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 com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
@@ -62,8 +62,8 @@ public class SendMapsActivity extends AbstractSendActivity {
} else {
if (request.isSendFusionTables()) {
return SendFusionTablesActivity.class;
} else if (request.isSendDocs()) {
return SendDocsActivity.class;
} else if (request.isSendSpreadsheets()) {
return SendSpreadsheetsActivity.class;
} else {
return UploadResultActivity.class;
}
@@ -17,12 +17,12 @@
package com.google.android.apps.mytracks.io.sendtogoogle;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.io.docs.SendDocsActivity;
import com.google.android.apps.mytracks.io.drive.SendDriveActivity;
import com.google.android.apps.mytracks.io.fusiontables.SendFusionTablesActivity;
import com.google.android.apps.mytracks.io.gdata.maps.MapsConstants;
import com.google.android.apps.mytracks.io.maps.ChooseMapActivity;
import com.google.android.apps.mytracks.io.maps.SendMapsActivity;
import com.google.android.apps.mytracks.io.spreadsheets.SendSpreadsheetsActivity;
import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R;
@@ -185,7 +185,7 @@ public class AccountChooserActivity extends Activity {
needDrivePermission = defaultTablePublic && sendRequest.isSendFusionTables();
}
if (!needDrivePermission) {
needDrivePermission = sendRequest.isSendDocs();
needDrivePermission = sendRequest.isSendSpreadsheets();
}
if (needDrivePermission) {
@@ -214,7 +214,7 @@ public class AccountChooserActivity extends Activity {
* Checks the Spreadsheet permission.
*/
private void checkSpreadsheetPermission() {
if (sendRequest.isSendDocs()) {
if (sendRequest.isSendSpreadsheets()) {
SendToGoogleUtils.checkPermissionByActivity(this, sendRequest.getAccount().name,
SendToGoogleUtils.SPREADSHEET_SCOPE,
SendToGoogleUtils.SPREADSHEET_PERMISSION_REQUEST_CODE, spreadsheetsCallback);
@@ -312,15 +312,17 @@ public class AccountChooserActivity extends Activity {
/**
* Starts the next activity. If
* <p>
* sendDrive -> {@link SendDriveActivity}
* <p>
* sendMaps and newMap -> {@link SendMapsActivity}
* <p>
* sendMaps and !newMap -> {@link ChooseMapActivity}
* <p>
* !sendMaps && sendFusionTables -> {@link SendFusionTablesActivity}
* <p>
* !sendMaps && !sendFusionTables && sendDocs -> {@link SendDocsActivity}
* !sendMaps && !sendFusionTables && sendSpreadsheets -> {@link SendSpreadsheetsActivity}
* <p>
* !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;
}
@@ -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<SendRequest>
@@ -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
@@ -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);
@@ -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);
@@ -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.
@@ -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;
@@ -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));
}
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
}
@@ -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:
* <ul>
* <li>Only send to Maps and Docs.</li>
* <li>Only send to Maps and Spreadsheets.</li>
* <li>Send to Maps successful.</li>
* <li>Send to Docs failed.</li>
* <li>Send to Spreadsheets failed.</li>
* </ul>
*/
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);
}
}
@@ -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));
}
}