diff --git a/MyTracks/res/drawable-hdpi/menu_split_frequency.png b/MyTracks/res/drawable-hdpi/menu_split_frequency.png
new file mode 100644
index 000000000..bdf97e2a5
Binary files /dev/null and b/MyTracks/res/drawable-hdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-hdpi/menu_voice_frequency.png b/MyTracks/res/drawable-hdpi/menu_voice_frequency.png
new file mode 100644
index 000000000..7b69ea56b
Binary files /dev/null and b/MyTracks/res/drawable-hdpi/menu_voice_frequency.png differ
diff --git a/MyTracks/res/drawable-mdpi/menu_split_frequency.png b/MyTracks/res/drawable-mdpi/menu_split_frequency.png
new file mode 100644
index 000000000..2bd0c919e
Binary files /dev/null and b/MyTracks/res/drawable-mdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-mdpi/menu_voice_frequency.png b/MyTracks/res/drawable-mdpi/menu_voice_frequency.png
new file mode 100644
index 000000000..f8dd8469c
Binary files /dev/null and b/MyTracks/res/drawable-mdpi/menu_voice_frequency.png differ
diff --git a/MyTracks/res/drawable-xhdpi/menu_split_frequency.png b/MyTracks/res/drawable-xhdpi/menu_split_frequency.png
new file mode 100644
index 000000000..982df112d
Binary files /dev/null and b/MyTracks/res/drawable-xhdpi/menu_split_frequency.png differ
diff --git a/MyTracks/res/drawable-xhdpi/menu_voice_frequency.png b/MyTracks/res/drawable-xhdpi/menu_voice_frequency.png
new file mode 100644
index 000000000..dfd2b33c7
Binary files /dev/null and b/MyTracks/res/drawable-xhdpi/menu_voice_frequency.png differ
diff --git a/MyTracks/res/layout/choose_activity_list_item.xml b/MyTracks/res/layout/choose_activity_list_item.xml
new file mode 100644
index 000000000..86bff7de9
--- /dev/null
+++ b/MyTracks/res/layout/choose_activity_list_item.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/help.xml b/MyTracks/res/layout/help.xml
index d34e5020d..4324c9a41 100644
--- a/MyTracks/res/layout/help.xml
+++ b/MyTracks/res/layout/help.xml
@@ -91,16 +91,16 @@ limitations under the License.
android:text="@string/help_saved_files_answer"
style="@style/HelpAnswer" />
-
+
\ No newline at end of file
diff --git a/MyTracks/res/layout/upload_service_chooser.xml b/MyTracks/res/layout/upload_service_chooser.xml
index 189ed9921..d97cf5de8 100644
--- a/MyTracks/res/layout/upload_service_chooser.xml
+++ b/MyTracks/res/layout/upload_service_chooser.xml
@@ -21,7 +21,7 @@ limitations under the License.
android:layout_width="fill_parent"
android:padding="8dp"
android:stretchColumns="1" >
-
+
-
+
-
+
-
+
+
-
\ No newline at end of file
diff --git a/MyTracks/res/values/arrays_do_not_translate.xml b/MyTracks/res/values/arrays_do_not_translate.xml
index fb5aeb571..4ca399897 100644
--- a/MyTracks/res/values/arrays_do_not_translate.xml
+++ b/MyTracks/res/values/arrays_do_not_translate.xml
@@ -96,6 +96,22 @@ limitations under the License.
- CSV
- TCX
+
+ - 0
+ - 1
+ - 2
+ - 5
+ - 10
+ - 15
+ - 30
+ - 60
+ - -1
+ - -5
+ - -10
+ - -25
+ - -50
+ - -100
+
- 50
- 100
@@ -142,22 +158,6 @@ limitations under the License.
- 2000
- 5000
-
- - 0
- - 1
- - 2
- - 5
- - 10
- - 15
- - 30
- - 60
- - -1
- - -5
- - -10
- - -25
- - -50
- - -100
-
- @string/settings_sensor_type_none
- @string/settings_sensor_type_ant
diff --git a/MyTracks/res/values/keys.xml b/MyTracks/res/values/keys.xml
index 3e46e54e0..64e356e48 100644
--- a/MyTracks/res/values/keys.xml
+++ b/MyTracks/res/values/keys.xml
@@ -39,7 +39,6 @@ limitations under the License.
minRecordingInterval
minRequiredAccuracy
pickExistingMap
- preferredAccount
recordingTrackId
reportSpeed
selectedTrackId
@@ -47,7 +46,7 @@ limitations under the License.
sendToFusionTables
sendToMaps
sensorType
- shareUrlOnly
+ sharingAccount
showCheckUnitsDialog
showWelcomeDialog
splitFrequency
diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml
index 312f6acfd..b6f072971 100644
--- a/MyTracks/res/values/strings.xml
+++ b/MyTracks/res/values/strings.xml
@@ -377,8 +377,8 @@ limitations under the License.
Use My Tracks while you run, bike, hike, or do anything else outdoors, and it will use the GPS
sensor in your phone to record the path you took. It will also gather useful statistics such as
time, speed, distance, and elevation. You can review all of this data live, or you can save it
- for use later. While you\'re out, you can mark relevant waypoints, and can ask to hear automatic
- voice announcements about your progress.\n
+ for use later. While you\'re out, you can insert markers, have split markers inserted
+ automatically, and can ask to hear periodic voice announcements of your progress.\n
\n
My Tracks can record data from external sensors:\n
- Zephyr Technology Consumer HxM Bluetooth heart rate monitor\n
@@ -654,7 +654,7 @@ limitations under the License.
translation_description="The title on an alert dialog indicating success.">
Success
-
+
How precise are the recorded tracks?
+
+ Markers are used to annotate a location.
+
+
+ What are markers?
+
My Tracks allows you to record GPS tracks and visualize your hiking, running, biking or any
@@ -793,6 +801,15 @@ limitations under the License.
translation_description="In the 'Help' page, the question on share visibility.">
Who can see the tracks I send to Google Maps and Google Fusion Tables?
+
+ The split markers are used to segment a track to calculate statistics for each segment. Split
+ markers are inserted by setting the split frequency in the menu.
+
+
+ What are split markers?
+
Tracks on Google Maps and Google Fusion Tables are limited to certain sizes.
@@ -802,26 +819,14 @@ limitations under the License.
Why do very long tracks split into multiple segments upon sending them to Google Maps and
Google Fusion Tables?
-
- Statistics markers are used to segment a track to calculate statistics for each segment. For
- example, let\'s say you are recording a bike ride up a hill, you can insert a statistics marker
- at the bottom of the hill and another at the top.
-
-
- What are statistics markers?
-
-
- Waypoint markers are used to annotate a location.
-
-
- What are waypoint markers?
-
+
+ Application
+
Marker
@@ -952,34 +957,34 @@ limitations under the License.
%1$s marker name. E.g., 'Marker 1'.">
Name: %1$s
-
+
Description: %1$s
-
+
Marker type: %1$s
-
+
- Since last Statistics marker:
-
+ indicating that the data below are since the last split marker.">
+ Since last split marker:
+
+ examples.">
Marker type (e.g. building, pothole...)
Marker type
-
+
You don\'t have any markers.
-
- Statistics %1$d
-
Marker %1$d
-
+
+ Split %1$d
+
+
@@ -1098,32 +1102,24 @@ limitations under the License.
translation_description="In the menu, to share a track.">
Share
-
- %1$s file
-
-
- Fusion Table URL
-
-
- Map URL
-
+ translation_description="In the menu, to show a track or a marker on the map.">
Show on map
+
+ Split frequency
+
Stop recording
+
+ Voice frequency
+
Save finished.
-
+
Sending to %1$s...
-
- Share track URL
-
@@ -1500,13 +1491,13 @@ limitations under the License.
translation_description="In the 'Chart' settings, the option to display the x axis by
distance.">
By distance
-
+
By time
X axis
@@ -1573,7 +1564,7 @@ limitations under the License.
track recording.">
Not available while recording a track.
-
+
Smallest time interval between two recordings of your position.
-
- Marker
-
-
- Time/distance after which a new marker will be inserted.
-
Default track name
-
- Voice
-
-
- Time/distance between two voice announcements.
-
-
Revert all your settings to the default values.
-
+
Unpair SRM ANT+ bridge
-
+
Sharing
+
+ Switch account
+
+
+ Switch account used when sending a track to Google.
+
Make new maps created in Google Maps public.
-
- Share only URL
-
-
- Include descriptive text when sharing a URL with friends.
-
-
- Remove any descriptive text when sharing a URL with friends.
+
+
+ Time/distance between two split markers
@@ -1986,7 +1946,7 @@ limitations under the License.
Time measurement
Imperial (mi, ft)
@@ -1994,13 +1954,19 @@ limitations under the License.
translation_description="In the 'Stats' settings, the option to use metric units, with
examples.">
Metric (km, m)
-
+
Preferred units
+
+
+ Time/distance between two voice announcements
+
+
@@ -2009,8 +1975,13 @@ limitations under the License.
- Share track using:
+ the user to select an application.">
+ Select an application
+
+
+ Share track URL
@@ -2124,11 +2095,11 @@ limitations under the License.
Stats
-
+
Recording...
-
+
@@ -2361,10 +2332,10 @@ limitations under the License.
- %1$d %%
-
+ %1$d %%
+
%1$s \u00B0
-
+
Use My Tracks while you run, bike, hike, or do anything outdoor to record your path. While
- recording, you can visualize your track and watch live statistics. You can also add
- markers, have markers inserted periodically, or hear automatic voice announcements of
- your progress. For recorded tracks, you can play them on Google Earth, share with friends, or
- upload to Google Maps, Google Fusion Tables, or Google Docs.
+ recording, you can visualize your track and watch live statistics. You can also add markers,
+ have split markers inserted periodically, or hear periodic announcements of your progress.
+ For recorded tracks, you can play them on Google Earth, share with friends, or upload to Google
+ Maps, Google Fusion Tables, or Google Docs.
diff --git a/MyTracks/res/xml/recording_settings.xml b/MyTracks/res/xml/recording_settings.xml
index b79455ec4..fe3f5cff3 100644
--- a/MyTracks/res/xml/recording_settings.xml
+++ b/MyTracks/res/xml/recording_settings.xml
@@ -16,18 +16,6 @@ limitations under the License.
-->
-
-
+
-
displayInfos = getDisplayInfos();
+
+ ArrayAdapter arrayAdapter = new ArrayAdapter(getActivity(),
+ R.layout.choose_activity_list_item, R.id.choose_activity_list_item_text1, displayInfos) {
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view;
+ if (convertView == null) {
+ view = getActivity()
+ .getLayoutInflater().inflate(R.layout.choose_activity_list_item, parent, false);
+ } else {
+ view = convertView;
+ }
+ DisplayInfo displayInfo = getItem(position);
+ TextView text1 = (TextView) view.findViewById(R.id.choose_activity_list_item_text1);
+ TextView text2 = (TextView) view.findViewById(R.id.choose_activity_list_item_text2);
+ ImageView icon = (ImageView) view.findViewById(R.id.choose_activity_list_item_icon);
+ text1.setText(displayInfo.primaryLabel);
+ if (displayInfo.secondaryLabel != null) {
+ text2.setVisibility(View.VISIBLE);
+ text2.setText(displayInfo.secondaryLabel);
+ } else {
+ text2.setVisibility(View.GONE);
+ }
+ icon.setImageDrawable(displayInfo.icon);
+ return view;
+ }
+ };
+ return new AlertDialog.Builder(getActivity())
+ .setSingleChoiceItems(arrayAdapter, 0, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ AlertDialog alertDialog = (AlertDialog) dialog;
+ DisplayInfo displayInfo = (DisplayInfo) alertDialog.getListView()
+ .getItemAtPosition(which);
+ ActivityInfo activityInfo = displayInfo.resolveInfo.activityInfo;
+ String packageName = activityInfo.applicationInfo.packageName;
+ String className = activityInfo.name;
+
+ String trackUrl = getArguments().getString(KEY_TRACK_URL);
+ if (trackUrl == null) {
+ SendRequest sendRequest = new SendRequest(getArguments().getLong(KEY_TRACK_ID));
+ sendRequest.setSendMaps(true);
+ sendRequest.setNewMap(true);
+ sendRequest.setSharingAppPackageName(packageName);
+ sendRequest.setSharingAppClassName(className);
+ Intent intent = IntentUtils.newIntent(getActivity(), AccountChooserActivity.class)
+ .putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
+ startActivity(intent);
+ dismiss();
+ } else {
+ Intent intent = IntentUtils.newShareUrlIntent(
+ getActivity(), trackUrl, packageName, className);
+ startActivity(intent);
+ getActivity().finish();
+ }
+ }
+ })
+ .setTitle(R.string.share_track_picker_title)
+ .create();
+ }
+
+ /**
+ * Gets the display info.
+ */
+ private List getDisplayInfos() {
+ List displayInfos = new ArrayList();
+ Intent intent = ShareCompat.IntentBuilder.from(getActivity())
+ .setType(IntentUtils.TEXT_PLAIN_TYPE).getIntent();
+ List resolveInfos = packageManager.queryIntentActivities(
+ intent, PackageManager.MATCH_DEFAULT_ONLY);
+ if (resolveInfos != null && resolveInfos.size() > 0) {
+ int size = resolveInfos.size();
+ ResolveInfo firstResolveInfo = resolveInfos.get(0);
+ for (int i = 1; i < size; i++) {
+ ResolveInfo resolveInfo = resolveInfos.get(i);
+ if (firstResolveInfo.priority != resolveInfo.priority
+ || firstResolveInfo.isDefault != resolveInfo.isDefault) {
+ while (i < size) {
+ resolveInfos.remove(i);
+ size--;
+ }
+ }
+ }
+ if (size > 1) {
+ ResolveInfo.DisplayNameComparator displayNameComparator = new ResolveInfo.DisplayNameComparator(
+ packageManager);
+ Collections.sort(resolveInfos, displayNameComparator);
+ }
+
+ firstResolveInfo = resolveInfos.get(0);
+ int start = 0;
+ CharSequence firstLabel = firstResolveInfo.loadLabel(packageManager);
+ for (int i = 1; i < size; i++) {
+ if (firstLabel == null) {
+ firstLabel = firstResolveInfo.activityInfo.packageName;
+ }
+ ResolveInfo resolveInfo = resolveInfos.get(i);
+ CharSequence label = resolveInfo.loadLabel(packageManager);
+ if (label == null) {
+ label = resolveInfo.activityInfo.packageName;
+ }
+ if (label.equals(firstLabel)) {
+ continue;
+ }
+ processGroup(resolveInfos, displayInfos, start, i - 1);
+ firstResolveInfo = resolveInfo;
+ firstLabel = label;
+ start = i;
+ }
+ // Process last group
+ processGroup(resolveInfos, displayInfos, start, size - 1);
+ }
+ return displayInfos;
+ }
+
+ /**
+ * Contains display info.
+ *
+ * @author Jimmy Shih
+ */
+ private final class DisplayInfo {
+ private ResolveInfo resolveInfo;
+ private CharSequence primaryLabel;
+ private CharSequence secondaryLabel;
+ private Drawable icon;
+
+ public DisplayInfo(ResolveInfo resolveInfo, CharSequence primaryLabel,
+ CharSequence secondaryLabel, Drawable icon) {
+ this.resolveInfo = resolveInfo;
+ this.primaryLabel = primaryLabel;
+ this.secondaryLabel = secondaryLabel;
+ this.icon = icon;
+ }
+ }
+
+ /**
+ * Processes a group of items with the same label.
+ *
+ * @param resolveInfos list of resolve infos
+ * @param displayInfos list of display infos
+ * @param start start index
+ * @param end end index
+ */
+ private void processGroup(
+ List resolveInfos, List displayInfos, int start, int end) {
+ ResolveInfo startResolveInfo = resolveInfos.get(start);
+ CharSequence primaryLabel = startResolveInfo.loadLabel(packageManager);
+ Drawable icon = startResolveInfo.loadIcon(packageManager);
+
+ int num = end - start + 1;
+ if (num == 1) {
+ // Only one, set the secondary label to null
+ displayInfos.add(new DisplayInfo(startResolveInfo, primaryLabel, null, icon));
+ } else {
+ // Decide package name or application name for the secondary label
+ boolean usePackageName = false;
+ CharSequence appName = startResolveInfo.activityInfo.applicationInfo.loadLabel(
+ packageManager);
+ if (appName == null) {
+ usePackageName = true;
+ } else {
+ // Use HashSet to track duplicates
+ HashSet duplicates = new HashSet();
+ duplicates.add(appName);
+ for (int i = start + 1; i <= end; i++) {
+ ResolveInfo resolveInfo = resolveInfos.get(i);
+ CharSequence name = resolveInfo.activityInfo.applicationInfo.loadLabel(packageManager);
+ if ((name == null) || (duplicates.contains(name))) {
+ usePackageName = true;
+ break;
+ } else {
+ duplicates.add(name);
+ }
+ }
+ // Clear HashSet for later use
+ duplicates.clear();
+ }
+ for (int i = start; i <= end; i++) {
+ ResolveInfo resolveInfo = resolveInfos.get(i);
+ CharSequence secondaryLabel = usePackageName ? resolveInfo.activityInfo.packageName
+ : resolveInfo.activityInfo.applicationInfo.loadLabel(packageManager);
+ displayInfos.add(new DisplayInfo(resolveInfo, primaryLabel, secondaryLabel, icon));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MyTracks/src/com/google/android/apps/mytracks/fragments/FrequencyDialogFragment.java b/MyTracks/src/com/google/android/apps/mytracks/fragments/FrequencyDialogFragment.java
new file mode 100644
index 000000000..ea8cdf099
--- /dev/null
+++ b/MyTracks/src/com/google/android/apps/mytracks/fragments/FrequencyDialogFragment.java
@@ -0,0 +1,118 @@
+/*
+ * 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.fragments;
+
+import com.google.android.apps.mytracks.util.PreferencesUtils;
+import com.google.android.maps.mytracks.R;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
+
+/**
+ * A DialogFragment to configure frequency.
+ *
+ * @author Jimmy Shih
+ */
+public class FrequencyDialogFragment extends DialogFragment {
+
+ public static final String FREQUENCY_DIALOG_TAG = "frequencyDialog";
+
+ private static final String KEY_PREFERENCE_ID = "preferenceId";
+ private static final String KEY_DEFAULT_VALUE = "defaultValue";
+ private static final String KEY_TITLE_ID = "titleId";
+
+ public static FrequencyDialogFragment newInstance(
+ int preferenceId, int defaultValue, int titleId) {
+ Bundle bundle = new Bundle();
+ bundle.putInt(KEY_PREFERENCE_ID, preferenceId);
+ bundle.putInt(KEY_DEFAULT_VALUE, defaultValue);
+ bundle.putInt(KEY_TITLE_ID, titleId);
+
+ FrequencyDialogFragment frequencyDialogFragment = new FrequencyDialogFragment();
+ frequencyDialogFragment.setArguments(bundle);
+ return frequencyDialogFragment;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final int preferenceId = getArguments().getInt(KEY_PREFERENCE_ID);
+ int defaultValue = getArguments().getInt(KEY_DEFAULT_VALUE);
+ int titleId = getArguments().getInt(KEY_TITLE_ID);
+ int frequencyValue = PreferencesUtils.getInt(getActivity(), preferenceId, defaultValue);
+
+ return new AlertDialog.Builder(getActivity())
+ .setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ int listIndex = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
+ PreferencesUtils.setInt(getActivity(), preferenceId, getFrequencyValue(listIndex));
+ }
+ })
+ .setSingleChoiceItems(getFrequencyDisplayOptions(), getListIndex(frequencyValue), null)
+ .setTitle(titleId)
+ .create();
+ }
+
+ /**
+ * Gets the frequency display options.
+ */
+ private String[] getFrequencyDisplayOptions() {
+ boolean metricUnits = PreferencesUtils.getBoolean(
+ getActivity(), R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
+ String[] values = getResources().getStringArray(R.array.frequency_values);
+ String[] options = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ int value = Integer.parseInt(values[i]);
+ if (value == PreferencesUtils.FREQUENCY_OFF) {
+ options[i] = getString(R.string.value_off);
+ } else if (value < 0) {
+ options[i] = getString(metricUnits ? R.string.value_integer_kilometer
+ : R.string.value_integer_mile, Math.abs(value));
+ } else {
+ options[i] = getString(R.string.value_integer_minute, value);
+ }
+ }
+ return options;
+ }
+
+ /**
+ * Gets the list index for a frequency value. Returns 0 if the value is not on
+ * the list.
+ */
+ private int getListIndex(int frequencyValue) {
+ String[] values = getResources().getStringArray(R.array.frequency_values);
+ for (int i = 0; i < values.length; i++) {
+ if (frequencyValue == Integer.parseInt(values[i])) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Gets the frequency value from a list index.
+ *
+ * @param listIndex the list index
+ */
+ private int getFrequencyValue(int listIndex) {
+ String[] values = getResources().getStringArray(R.array.frequency_values);
+ return Integer.parseInt(values[listIndex]);
+ }
+}
\ No newline at end of file
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/AbstractSendAsyncTask.java b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/AbstractSendAsyncTask.java
index 710d21c6d..11dab9c5c 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/AbstractSendAsyncTask.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/AbstractSendAsyncTask.java
@@ -80,9 +80,6 @@ public abstract class AbstractSendAsyncTask extends AsyncTask 1 ) {
- showDialog(DIALOG_CHOOSER_ID);
- }
+ showDialog(DIALOG_CHOOSER_ID);
}
@Override
@@ -162,20 +157,15 @@ public class AccountChooserActivity extends Activity {
})
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- Account account = accounts[selectedAccountIndex];
+ int position = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
+ Account account = accounts[position];
PreferencesUtils.setString(
- AccountChooserActivity.this, R.string.preferred_account_key, account.name);
+ AccountChooserActivity.this, R.string.sharing_account_key, account.name);
sendRequest.setAccount(account);
getPermission(MapsConstants.SERVICE_NAME, sendRequest.isSendMaps(), mapsCallback);
}
})
- .setSingleChoiceItems(
- choices, selectedAccountIndex, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- selectedAccountIndex = which;
- }
- })
+ .setSingleChoiceItems(choices, 0, null)
.setTitle(R.string.send_google_choose_account_title)
.create();
}
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 a5be3b24d..4dd2d0ed0 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
@@ -31,9 +31,8 @@ public class SendRequest implements Parcelable {
public static final String SEND_REQUEST_KEY = "sendRequest";
private long trackId = -1L;
- private boolean showMaps = false;
- private boolean showFusionTables = false;
- private boolean showDocs = false;
+ private String sharingAppPackageName = null;
+ private String sharingAppClassName = null;
private boolean sendMaps = false;
private boolean sendFusionTables = false;
private boolean sendDocs = false;
@@ -48,15 +47,9 @@ public class SendRequest implements Parcelable {
* Creates a new send request.
*
* @param trackId the track id
- * @param showMaps true to show the Google Maps option
- * @param showFusionTables true to show the Google Fusion Tables option
- * @param showDocs true to show the Google Docs option
*/
- public SendRequest(long trackId, boolean showMaps, boolean showFusionTables, boolean showDocs) {
+ public SendRequest(long trackId) {
this.trackId = trackId;
- this.showMaps = showMaps;
- this.showFusionTables = showFusionTables;
- this.showDocs = showDocs;
}
/**
@@ -67,31 +60,35 @@ public class SendRequest implements Parcelable {
}
/**
- * True if showing the send to Google Maps option.
+ * Gets the sharing app package name.
*/
- public boolean isShowMaps() {
- return showMaps;
+ public String getSharingAppPackageName() {
+ return sharingAppPackageName;
}
/**
- * True if showing the send to Google Fusion Tables option.
+ * Sets the sharing app package name.
+ *
+ * @param sharingAppPackageName the sharing app package name
*/
- public boolean isShowFusionTables() {
- return showFusionTables;
+ public void setSharingAppPackageName(String sharingAppPackageName) {
+ this.sharingAppPackageName = sharingAppPackageName;
}
/**
- * True if showing the send to Google Docs option.
+ * Gets the sharing app class name.
*/
- public boolean isShowDocs() {
- return showDocs;
+ public String getSharingAppClassName() {
+ return sharingAppClassName;
}
/**
- * True if showing all the send options.
+ * Sets the sharing app class name.
+ *
+ * @param sharingAppClassName the sharing app class name
*/
- public boolean isShowAll() {
- return showMaps && showFusionTables && showDocs;
+ public void setSharingAppClassName(String sharingAppClassName) {
+ this.sharingAppClassName = sharingAppClassName;
}
/**
@@ -245,9 +242,8 @@ public class SendRequest implements Parcelable {
private SendRequest(Parcel in) {
trackId = in.readLong();
- showMaps = in.readByte() == 1;
- showFusionTables = in.readByte() == 1;
- showDocs = in.readByte() == 1;
+ sharingAppPackageName = in.readString();
+ sharingAppClassName = in.readString();
sendMaps = in.readByte() == 1;
sendFusionTables = in.readByte() == 1;
sendDocs = in.readByte() == 1;
@@ -267,9 +263,8 @@ public class SendRequest implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeLong(trackId);
- out.writeByte((byte) (showMaps ? 1 : 0));
- out.writeByte((byte) (showFusionTables ? 1 : 0));
- out.writeByte((byte) (showDocs ? 1 : 0));
+ out.writeString(sharingAppPackageName);
+ out.writeString(sharingAppClassName);
out.writeByte((byte) (sendMaps ? 1 : 0));
out.writeByte((byte) (sendFusionTables ? 1 : 0));
out.writeByte((byte) (sendDocs ? 1 : 0));
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 bb523282b..2a31b235d 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
@@ -17,18 +17,19 @@ package com.google.android.apps.mytracks.io.sendtogoogle;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Track;
+import com.google.android.apps.mytracks.fragments.ChooseActivityDialogFragment;
import com.google.android.apps.mytracks.io.fusiontables.SendFusionTablesUtils;
import com.google.android.apps.mytracks.io.maps.SendMapsUtils;
-import com.google.android.apps.mytracks.util.PreferencesUtils;
+import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
-import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -36,33 +37,40 @@ import android.widget.TextView;
/**
* A dialog to show the result of uploading to Google services.
- *
+ *
* @author Jimmy Shih
*/
-public class UploadResultActivity extends Activity {
+public class UploadResultActivity extends FragmentActivity {
- private static final String TEXT_PLAIN_TYPE = "text/plain";
private static final int DIALOG_RESULT_ID = 0;
private SendRequest sendRequest;
private Track track;
private String shareUrl;
private Dialog resultDialog;
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sendRequest = getIntent().getParcelableExtra(SendRequest.SEND_REQUEST_KEY);
track = null;
shareUrl = null;
-
+
if (sendRequest.isSendMaps() && sendRequest.isMapsSuccess()) {
shareUrl = SendMapsUtils.getMapUrl(getTrack());
+ if (sendRequest.getSharingAppPackageName() != null) {
+ Intent intent = IntentUtils.newShareUrlIntent(this, shareUrl,
+ sendRequest.getSharingAppPackageName(), sendRequest.getSharingAppClassName());
+ startActivity(intent);
+ finish();
+ return;
+ }
}
if (shareUrl == null && sendRequest.isSendFusionTables()
&& sendRequest.isFusionTablesSuccess()) {
shareUrl = SendFusionTablesUtils.getMapUrl(getTrack());
}
+ showDialog(DIALOG_RESULT_ID);
}
private Track getTrack() {
@@ -72,17 +80,11 @@ public class UploadResultActivity extends Activity {
return track;
}
- @Override
- protected void onResume() {
- super.onResume();
- showDialog(DIALOG_RESULT_ID);
- }
-
@Override
protected Dialog onCreateDialog(int id) {
if (id != DIALOG_RESULT_ID) {
return null;
- }
+ }
View view = getLayoutInflater().inflate(R.layout.upload_result, null);
LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
@@ -139,31 +141,29 @@ public class UploadResultActivity extends Activity {
.setCancelable(true)
.setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
+ @Override
public void onCancel(DialogInterface dialog) {
finish();
}
})
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
- @Override
+ @Override
public void onClick(DialogInterface dialog, int which) {
- if (!sendRequest.isShowAll() && shareUrl != null) {
- startShareUrlActivity(shareUrl);
- }
finish();
}
})
.setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title)
.setView(view);
- // Add a Share URL button if showing all the options and a shareUrl exists
- if (sendRequest.isShowAll() && shareUrl != null) {
+ // Add a Share URL button if shareUrl exists
+ if (shareUrl != null) {
builder.setNegativeButton(
- R.string.send_google_result_share_url, new DialogInterface.OnClickListener() {
- @Override
+ R.string.share_track_share_url, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialog, int which) {
- startShareUrlActivity(shareUrl);
- finish();
+ ChooseActivityDialogFragment.newInstance(sendRequest.getTrackId(), shareUrl).show(
+ getSupportFragmentManager(),
+ ChooseActivityDialogFragment.CHOOSE_ACTIVITY_DIALOG_TAG);
}
});
}
@@ -171,22 +171,6 @@ public class UploadResultActivity extends Activity {
return resultDialog;
}
- /**
- * Starts an activity to share the url.
- *
- * @param url the url
- */
- private void startShareUrlActivity(String url) {
- boolean shareUrlOnly = PreferencesUtils.getBoolean(
- this, R.string.share_url_only_key, PreferencesUtils.SHARE_URL_ONLY_DEFAULT);
- Intent intent = new Intent(Intent.ACTION_SEND)
- .setType(TEXT_PLAIN_TYPE)
- .putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_track_subject))
- .putExtra(Intent.EXTRA_TEXT,
- shareUrlOnly ? url : getString(R.string.share_track_url_body_format, url));
- startActivity(Intent.createChooser(intent, getString(R.string.share_track_picker_title)));
- }
-
@VisibleForTesting
Dialog getDialog() {
return resultDialog;
diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivity.java b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivity.java
index 80d4455db..d5ec6e443 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivity.java
@@ -49,10 +49,6 @@ public class UploadServiceChooserActivity extends Activity {
private SendRequest sendRequest;
private AlertDialog alertDialog;
- private TableRow mapsTableRow;
- private TableRow fusionTablesTableRow;
- private TableRow docsTableRow;
-
private CheckBox mapsCheckBox;
private CheckBox fusionTablesCheckBox;
private CheckBox docsCheckBox;
@@ -80,10 +76,6 @@ public class UploadServiceChooserActivity extends Activity {
}
View view = getLayoutInflater().inflate(R.layout.upload_service_chooser, null);
- mapsTableRow = (TableRow) view.findViewById(R.id.send_google_maps_row);
- fusionTablesTableRow = (TableRow) view.findViewById(R.id.send_google_fusion_tables_row);
- docsTableRow = (TableRow) view.findViewById(R.id.send_google_docs_row);
-
mapsCheckBox = (CheckBox) view.findViewById(R.id.send_google_maps);
fusionTablesCheckBox = (CheckBox) view.findViewById(R.id.send_google_fusion_tables);
docsCheckBox = (CheckBox) view.findViewById(R.id.send_google_docs);
@@ -105,9 +97,6 @@ public class UploadServiceChooserActivity extends Activity {
// Setup initial state
initState();
- // Update state based on sendRequest
- updateStateBySendRequest();
-
// Update state based on current selection
updateStateBySelection();
@@ -163,24 +152,6 @@ public class UploadServiceChooserActivity extends Activity {
this, R.string.send_to_docs_key, PreferencesUtils.SEND_TO_DOCS_DEFAULT));
}
- /**
- * Updates the UI state based on sendRequest.
- */
- private void updateStateBySendRequest() {
- if (!sendRequest.isShowAll()) {
- if (sendRequest.isShowMaps()) {
- mapsCheckBox.setChecked(true);
- } else if (sendRequest.isShowFusionTables()) {
- fusionTablesCheckBox.setChecked(true);
- } else if (sendRequest.isShowDocs()) {
- docsCheckBox.setChecked(true);
- }
- }
- mapsTableRow.setVisibility(sendRequest.isShowMaps() ? View.VISIBLE : View.GONE);
- fusionTablesTableRow.setVisibility(sendRequest.isShowFusionTables() ? View.VISIBLE : View.GONE);
- docsTableRow.setVisibility(sendRequest.isShowDocs() ? View.VISIBLE : View.GONE);
- }
-
/**
* Updates the UI state based on the current selection.
*/
@@ -195,32 +166,30 @@ public class UploadServiceChooserActivity extends Activity {
void saveState() {
PreferencesUtils.setBoolean(
this, R.string.pick_existing_map_key, existingMapRadioButton.isChecked());
- if (sendRequest.isShowAll()) {
- PreferencesUtils.setBoolean(this, R.string.send_to_maps_key, sendMaps());
- PreferencesUtils.setBoolean(this, R.string.send_to_fusion_tables_key, sendFusionTables());
- PreferencesUtils.setBoolean(this, R.string.send_to_docs_key, sendDocs());
- }
+ PreferencesUtils.setBoolean(this, R.string.send_to_maps_key, sendMaps());
+ PreferencesUtils.setBoolean(this, R.string.send_to_fusion_tables_key, sendFusionTables());
+ PreferencesUtils.setBoolean(this, R.string.send_to_docs_key, sendDocs());
}
/**
* Returns true to send to Google Maps.
*/
private boolean sendMaps() {
- return sendRequest.isShowMaps() && mapsCheckBox.isChecked();
+ return mapsCheckBox.isChecked();
}
/**
* Returns true to send to Google Fusion Tables.
*/
private boolean sendFusionTables() {
- return sendRequest.isShowFusionTables() && fusionTablesCheckBox.isChecked();
+ return fusionTablesCheckBox.isChecked();
}
/**
* Returns true to send to Google Docs.
*/
private boolean sendDocs() {
- return sendRequest.isShowDocs() && docsCheckBox.isChecked();
+ return docsCheckBox.isChecked();
}
/**
diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java
index 61f34e52b..d8b99c703 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java
@@ -997,7 +997,7 @@ public class TrackRecordingService extends Service {
} else {
int nextMarkerNumber = providerUtils.getNextMarkerNumber(recordingTrackId, true);
name = nextMarkerNumber == -1 ? getString(R.string.marker_type_statistics)
- : getString(R.string.marker_statistics_name_format, nextMarkerNumber);
+ : getString(R.string.marker_split_name_format, nextMarkerNumber);
}
waypoint.setName(name);
waypoint.setStatistics(waypointStatsBuilder.getStatistics());
diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/tasks/PeriodicTaskExecutor.java b/MyTracks/src/com/google/android/apps/mytracks/services/tasks/PeriodicTaskExecutor.java
index 4f108732d..228ca27c8 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/services/tasks/PeriodicTaskExecutor.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/services/tasks/PeriodicTaskExecutor.java
@@ -35,7 +35,7 @@ public class PeriodicTaskExecutor {
* A value greater than zero is a frequency in time.
* A value less than zero is considered a frequency in distance.
*/
- private int taskFrequency = PreferencesUtils.PERIODIC_TASK_OFF;
+ private int taskFrequency = PreferencesUtils.FREQUENCY_OFF;
/**
* The next distance when the task should execute.
@@ -75,7 +75,7 @@ public class PeriodicTaskExecutor {
timerExecutor = null;
}
}
- if (taskFrequency == PreferencesUtils.PERIODIC_TASK_OFF) {
+ if (taskFrequency == PreferencesUtils.FREQUENCY_OFF) {
return;
}
diff --git a/MyTracks/src/com/google/android/apps/mytracks/settings/AbstractSettingsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/settings/AbstractSettingsActivity.java
index 12f315107..78b5af181 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/settings/AbstractSettingsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/settings/AbstractSettingsActivity.java
@@ -36,13 +36,13 @@ public class AbstractSettingsActivity extends PreferenceActivity {
private BackupPreferencesListener backupPreferencesListener;
+ @SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
- @SuppressWarnings("deprecation")
PreferenceManager preferenceManager = getPreferenceManager();
preferenceManager.setSharedPreferencesName(Constants.SETTINGS_NAME);
preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE);
@@ -63,10 +63,10 @@ public class AbstractSettingsActivity extends PreferenceActivity {
return true;
}
+ @SuppressWarnings("deprecation")
@Override
protected void onDestroy() {
super.onDestroy();
- @SuppressWarnings("deprecation")
PreferenceManager preferenceManager = getPreferenceManager();
preferenceManager.getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(backupPreferencesListener);
diff --git a/MyTracks/src/com/google/android/apps/mytracks/settings/RecordingSettingsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/settings/RecordingSettingsActivity.java
index ccbea807b..656a3c0dd 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/settings/RecordingSettingsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/settings/RecordingSettingsActivity.java
@@ -39,14 +39,6 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
boolean metricUnits = PreferencesUtils.getBoolean(
this, R.string.metric_units_key, PreferencesUtils.METRIC_UNITS_DEFAULT);
- ListPreference announcementFrequencyListPreference = (ListPreference) findPreference(
- getString(R.string.announcement_frequency_key));
- announcementFrequencyListPreference.setEntries(getPeriodicTaskDisplayOptions(metricUnits));
-
- ListPreference splitFrequencyListPreference = (ListPreference) findPreference(
- getString(R.string.split_frequency_key));
- splitFrequencyListPreference.setEntries(getPeriodicTaskDisplayOptions(metricUnits));
-
ListPreference minRecordingIntervalListPreference = (ListPreference) findPreference(
getString(R.string.min_recording_interval_key));
minRecordingIntervalListPreference.setEntries(getMinRecordingIntervalDisplayOptions());
@@ -70,28 +62,6 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity {
autoResumeTrackTimeoutListPreference.setEntries(getAutoResumeTrackTimeoutDisplayOptions());
}
- /**
- * Gets the periodic task display options.
- *
- * @param metricUnits true to display metric units
- */
- private String[] getPeriodicTaskDisplayOptions(boolean metricUnits) {
- String[] values = getResources().getStringArray(R.array.periodic_task_values);
- String[] options = new String[values.length];
- for (int i = 0; i < values.length; i++) {
- int value = Integer.parseInt(values[i]);
- if (value == PreferencesUtils.PERIODIC_TASK_OFF) {
- options[i] = getString(R.string.value_off);
- } else if (value < 0) {
- options[i] = getString(metricUnits ? R.string.value_integer_kilometer
- : R.string.value_integer_mile, Math.abs(value));
- } else {
- options[i] = getString(R.string.value_integer_minute, value);
- }
- }
- return options;
- }
-
/**
* Gets the min recording interval display options.
*/
diff --git a/MyTracks/src/com/google/android/apps/mytracks/settings/SensorSettingsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/settings/SensorSettingsActivity.java
index 88f9b14e7..303de6ea9 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/settings/SensorSettingsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/settings/SensorSettingsActivity.java
@@ -120,8 +120,8 @@ public class SensorSettingsActivity extends AbstractSettingsActivity {
/**
* Updates the bluetooth sensor list preference.
*/
+ @SuppressWarnings("deprecation")
private void updateBluetoothSensorListPreference() {
- @SuppressWarnings("deprecation")
ListPreference bluetoothSensorListPreference = (ListPreference) findPreference(
getString(R.string.bluetooth_sensor_key));
List entries = new ArrayList();
diff --git a/MyTracks/src/com/google/android/apps/mytracks/settings/SharingSettingsActivity.java b/MyTracks/src/com/google/android/apps/mytracks/settings/SharingSettingsActivity.java
index a322ce262..eb16dead6 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/settings/SharingSettingsActivity.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/settings/SharingSettingsActivity.java
@@ -16,16 +16,23 @@
package com.google.android.apps.mytracks.settings;
+import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.util.DialogUtils;
import com.google.android.maps.mytracks.R;
+import android.accounts.Account;
+import android.accounts.AccountManager;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* An activity for accessing the sharing settings.
*
@@ -56,6 +63,21 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
}
}
});
+
+ ListPreference sharingAccountListPreference = (ListPreference) findPreference(
+ getString(R.string.sharing_account_key));
+ List entries = new ArrayList();
+ Account[] accounts = AccountManager.get(this).getAccountsByType(Constants.ACCOUNT_TYPE);
+ for (Account account : accounts) {
+ entries.add(account.name);
+ }
+
+ sharingAccountListPreference.setEntries(entries.toArray(new CharSequence[entries.size()]));
+ sharingAccountListPreference.setEntryValues(entries.toArray(
+ new CharSequence[entries.size()]));
+ if (entries.size() == 1) {
+ sharingAccountListPreference.setValueIndex(0);
+ }
}
@Override
diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/IntentUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/IntentUtils.java
index e38b55cff..fc303efe5 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/util/IntentUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/util/IntentUtils.java
@@ -16,6 +16,9 @@
package com.google.android.apps.mytracks.util;
+import com.google.android.maps.mytracks.R;
+
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -26,6 +29,9 @@ import android.content.Intent;
*/
public class IntentUtils {
+ public static final String TEXT_PLAIN_TYPE = "text/plain";
+ private static final String TWITTER_PACKAGE_NAME = "com.twitter.android";
+
private IntentUtils() {}
/**
@@ -39,4 +45,23 @@ public class IntentUtils {
return new Intent(context, cls).addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
}
+
+ /**
+ * Creates an intent to share a url with a sharing app.
+ *
+ * @param context the context
+ * @param url the url
+ * @param packageName the sharing app package name
+ * @param className the sharing app class name
+ */
+ public static final Intent newShareUrlIntent(
+ Context context, String url, String packageName, String className) {
+ return new Intent(Intent.ACTION_SEND)
+ .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP)
+ .putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.share_track_subject))
+ .putExtra(Intent.EXTRA_TEXT, TWITTER_PACKAGE_NAME.equals(packageName)
+ ? url : context.getString(R.string.share_track_url_body_format, url))
+ .setComponent(new ComponentName(packageName, className))
+ .setType(TEXT_PLAIN_TYPE);
+ }
}
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 1c64c04b3..6ee57feca 100644
--- a/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java
+++ b/MyTracks/src/com/google/android/apps/mytracks/util/PreferencesUtils.java
@@ -52,6 +52,7 @@ public class PreferencesUtils {
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = true;
+ public static final int FREQUENCY_OFF = 0;
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
public static final boolean METRIC_UNITS_DEFAULT = true;
public static final int MIN_RECORDING_DISTANCE_DEFAULT = 5;
@@ -64,16 +65,14 @@ public class PreferencesUtils {
public static final int MIN_REQUIRED_ACCURACY_EXCELLENT = 10;
public static final int MIN_REQUIRED_ACCURACY_POOR = 5000;
- public static final int PERIODIC_TASK_OFF = 0;
public static final boolean PICK_EXISTING_MAP_DEFAULT = false;
- public static final String PREFERRED_ACCOUNT_DEFAULT = "";
public static final long RECORDING_TRACK_ID_DEFAULT = -1L;
public static final boolean REPORT_SPEED_DEFAULT = true;
public static final long SELECTED_TRACK_ID_DEFAULT = -1L;
public static final boolean SEND_TO_DOCS_DEFAULT = true;
public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = true;
public static final boolean SEND_TO_MAPS_DEFAULT = true;
- public static final boolean SHARE_URL_ONLY_DEFAULT = false;
+ public static final String SHARING_ACCOUNT_DEFAULT = "";
public static final boolean SHOW_CHECK_UNITS_DIALOG_DEFAULT = true;
public static final boolean SHOW_WELCOME_DIALOG_DEFAULT = true;
public static final int SPLIT_FREQUENCY_DEFAULT = 0;
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 09b095a5f..800053ba8 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
@@ -34,7 +34,7 @@ public class SendFusionTablesActivityTest extends AndroidTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- sendRequest = new SendRequest(1L, true, false, true);
+ sendRequest = new SendRequest(1L);
sendFusionTablesActivity = new SendFusionTablesActivity();
}
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 d2646609a..97f2c0982 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
@@ -35,7 +35,7 @@ public class SendMapsActivityTest extends AndroidTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- sendRequest = new SendRequest(1L, true, false, true);
+ sendRequest = new SendRequest(1L);
sendMapsActivity = new SendMapsActivity();
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java
index 65f4fd92c..904114791 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java
@@ -86,7 +86,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase {
prepareAndUploadPointsCounter = 0;
sendMapsActivityMock = AndroidMock.createMock(SendMapsActivity.class);
myTracksProviderUtilsMock = AndroidMock.createMock(MyTracksProviderUtils.class);
- sendRequest = new SendRequest(TRACK_ID, false, true, false);
+ sendRequest = new SendRequest(TRACK_ID);
AndroidMock.expect(sendMapsActivityMock.getApplicationContext()).andReturn(getContext());
}
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 0ad6bfa1b..f9ff8ab5d 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
@@ -35,7 +35,7 @@ public class SendRequestTest extends AndroidTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- sendRequest = new SendRequest(1, true, true, true);
+ sendRequest = new SendRequest(1);
}
/**
@@ -46,44 +46,6 @@ public class SendRequestTest extends AndroidTestCase {
assertEquals(1, sendRequest.getTrackId());
}
- /**
- * Tests the method {@link SendRequest#isShowMaps()}. The value should be set
- * to true when it is initialed in setup method.
- */
- public void testIsShowMaps() {
- assertEquals(true, sendRequest.isShowMaps());
- }
-
- /**
- * Tests the method {@link SendRequest#isShowFusionTables()}. The value should
- * be set to true when it is initialed in setup method.
- */
- public void testIsShowFusionTables() {
- assertEquals(true, sendRequest.isShowFusionTables());
- }
-
- /**
- * Tests the method {@link SendRequest#isShowDocs()}. The value should be set
- * to true when it is initialed in setup method.
- */
- public void testIsShowDocs() {
- assertEquals(true, sendRequest.isShowDocs());
- }
-
- public void testIsShowAll() {
- assertEquals(true, sendRequest.isShowAll());
- sendRequest = new SendRequest(1, false, true, true);
- assertEquals(false, sendRequest.isShowAll());
- sendRequest = new SendRequest(1, true, false, true);
- assertEquals(false, sendRequest.isShowAll());
- sendRequest = new SendRequest(1, true, true, false);
- assertEquals(false, sendRequest.isShowAll());
- sendRequest = new SendRequest(1, false, true, false);
- assertEquals(false, sendRequest.isShowAll());
- sendRequest = new SendRequest(1, false, false, false);
- assertEquals(false, sendRequest.isShowAll());
- }
-
public void testIsSendMaps() {
assertEquals(false, sendRequest.isSendMaps());
sendRequest.setSendMaps(true);
@@ -174,120 +136,114 @@ public class SendRequestTest extends AndroidTestCase {
* Tests SendRequest.CREATOR.createFromParcel when all values are true.
*/
public void testCreateFromParcel_true() {
- Parcel sourceParcel = Parcel.obtain();
- sourceParcel.setDataPosition(0);
- sourceParcel.writeLong(2);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
+ Parcel parcel = Parcel.obtain();
+ parcel.setDataPosition(0);
+ parcel.writeLong(2);
+ parcel.writeString("");
+ parcel.writeString("");
+ parcel.writeByte((byte) 1);
+ parcel.writeByte((byte) 1);
+ parcel.writeByte((byte) 1);
+ parcel.writeByte((byte) 1);
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
- sourceParcel.writeParcelable(account, 0);
- sourceParcel.writeString(MAPID);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.writeByte((byte) 1);
- sourceParcel.setDataPosition(0);
- sendRequest = SendRequest.CREATOR.createFromParcel(sourceParcel);
+ parcel.writeParcelable(account, 0);
+ parcel.writeString(MAPID);
+ parcel.writeByte((byte) 1);
+ parcel.writeByte((byte) 1);
+ parcel.writeByte((byte) 1);
+ parcel.setDataPosition(0);
+ sendRequest = SendRequest.CREATOR.createFromParcel(parcel);
assertEquals(2, sendRequest.getTrackId());
- assertEquals(true, sendRequest.isShowMaps());
- assertEquals(true, sendRequest.isShowFusionTables());
- assertEquals(true, sendRequest.isShowDocs());
- assertEquals(true, sendRequest.isSendMaps());
- assertEquals(true, sendRequest.isSendFusionTables());
- assertEquals(true, sendRequest.isSendDocs());
- assertEquals(true, sendRequest.isNewMap());
+ assertEquals("", sendRequest.getSharingAppPackageName());
+ assertEquals("", sendRequest.getSharingAppClassName());
+ assertTrue(sendRequest.isSendMaps());
+ assertTrue(sendRequest.isSendFusionTables());
+ assertTrue(sendRequest.isSendDocs());
+ assertTrue(sendRequest.isNewMap());
assertEquals(account, sendRequest.getAccount());
assertEquals(MAPID, sendRequest.getMapId());
- assertEquals(true, sendRequest.isMapsSuccess());
- assertEquals(true, sendRequest.isFusionTablesSuccess());
- assertEquals(true, sendRequest.isDocsSuccess());
+ assertTrue(sendRequest.isMapsSuccess());
+ assertTrue(sendRequest.isFusionTablesSuccess());
+ assertTrue(sendRequest.isDocsSuccess());
}
/**
* Tests SendRequest.CREATOR.createFromParcel when all values are false.
*/
public void testCreateFromParcel_false() {
- Parcel sourceParcel = Parcel.obtain();
- sourceParcel.setDataPosition(0);
- sourceParcel.writeLong(4);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
+ Parcel parcel = Parcel.obtain();
+ parcel.setDataPosition(0);
+ parcel.writeLong(4);
+ parcel.writeString(null);
+ parcel.writeString(null);
+ parcel.writeByte((byte) 0);
+ parcel.writeByte((byte) 0);
+ parcel.writeByte((byte) 0);
+ parcel.writeByte((byte) 0);
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
- sourceParcel.writeParcelable(account, 0);
- sourceParcel.writeString(MAPID);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.writeByte((byte) 0);
- sourceParcel.setDataPosition(0);
- sendRequest = SendRequest.CREATOR.createFromParcel(sourceParcel);
+ parcel.writeParcelable(account, 0);
+ parcel.writeString(MAPID);
+ parcel.writeByte((byte) 0);
+ parcel.writeByte((byte) 0);
+ parcel.writeByte((byte) 0);
+ parcel.setDataPosition(0);
+ sendRequest = SendRequest.CREATOR.createFromParcel(parcel);
assertEquals(4, sendRequest.getTrackId());
- assertEquals(false, sendRequest.isShowMaps());
- assertEquals(false, sendRequest.isShowFusionTables());
- assertEquals(false, sendRequest.isShowDocs());
- assertEquals(false, sendRequest.isSendMaps());
- assertEquals(false, sendRequest.isSendFusionTables());
- assertEquals(false, sendRequest.isSendDocs());
- assertEquals(false, sendRequest.isNewMap());
+ assertNull(sendRequest.getSharingAppPackageName());
+ assertNull(sendRequest.getSharingAppClassName());
+ assertFalse(sendRequest.isSendMaps());
+ assertFalse(sendRequest.isSendFusionTables());
+ assertFalse(sendRequest.isSendDocs());
+ assertFalse(sendRequest.isNewMap());
assertEquals(account, sendRequest.getAccount());
assertEquals(MAPID, sendRequest.getMapId());
- assertEquals(false, sendRequest.isMapsSuccess());
- assertEquals(false, sendRequest.isFusionTablesSuccess());
- assertEquals(false, sendRequest.isDocsSuccess());
+ assertFalse(sendRequest.isMapsSuccess());
+ assertFalse(sendRequest.isFusionTablesSuccess());
+ assertFalse(sendRequest.isDocsSuccess());
}
/**
- * Tests {@link SendRequest#writeToParcel(Parcel, int)} when all input values
- * are true or affirmative.
+ * Tests {@link SendRequest#writeToParcel(Parcel, int)} with default values.
*/
- public void testWriteToParcel_allTrue() {
- sendRequest = new SendRequest(1, false, false, false);
- Parcel parcelWrite1st = Parcel.obtain();
- parcelWrite1st.setDataPosition(0);
- sendRequest.writeToParcel(parcelWrite1st, 1);
- parcelWrite1st.setDataPosition(0);
- long trackId = parcelWrite1st.readLong();
- boolean showMaps = parcelWrite1st.readByte() == 1;
- boolean showFusionTables = parcelWrite1st.readByte() == 1;
- boolean showDocs = parcelWrite1st.readByte() == 1;
- boolean sendMaps = parcelWrite1st.readByte() == 1;
- boolean sendFusionTables = parcelWrite1st.readByte() == 1;
- boolean sendDocs = parcelWrite1st.readByte() == 1;
- boolean newMap = parcelWrite1st.readByte() == 1;
- Parcelable account = parcelWrite1st.readParcelable(null);
- String mapId = parcelWrite1st.readString();
- boolean mapsSuccess = parcelWrite1st.readByte() == 1;
- boolean fusionTablesSuccess = parcelWrite1st.readByte() == 1;
- boolean docsSuccess = parcelWrite1st.readByte() == 1;
+ public void testWriteToParcel_default() {
+ sendRequest = new SendRequest(1);
+ Parcel parcel = Parcel.obtain();
+ parcel.setDataPosition(0);
+ sendRequest.writeToParcel(parcel, 1);
+ parcel.setDataPosition(0);
+ long trackId = parcel.readLong();
+ String sharingAppPackageName = parcel.readString();
+ String sharingAppClassName = parcel.readString();
+ boolean sendMaps = parcel.readByte() == 1;
+ boolean sendFusionTables = parcel.readByte() == 1;
+ boolean sendDocs = parcel.readByte() == 1;
+ boolean newMap = parcel.readByte() == 1;
+ Parcelable account = parcel.readParcelable(null);
+ String mapId = parcel.readString();
+ boolean mapsSuccess = parcel.readByte() == 1;
+ boolean fusionTablesSuccess = parcel.readByte() == 1;
+ boolean docsSuccess = parcel.readByte() == 1;
assertEquals(1, trackId);
- assertEquals(false, showMaps);
- assertEquals(false, showFusionTables);
- assertEquals(false, showDocs);
- assertEquals(false, sendMaps);
- assertEquals(false, sendFusionTables);
- assertEquals(false, sendDocs);
- assertEquals(false, newMap);
- assertEquals(null, account);
- assertEquals(null, mapId);
- assertEquals(false, mapsSuccess);
- assertEquals(false, fusionTablesSuccess);
- assertEquals(false, docsSuccess);
+ assertNull(sharingAppPackageName);
+ assertNull(sharingAppClassName);
+ assertFalse(sendMaps);
+ assertFalse(sendFusionTables);
+ assertFalse(sendDocs);
+ assertFalse(newMap);
+ assertNull(account);
+ assertNull(mapId);
+ assertFalse(mapsSuccess);
+ assertFalse(fusionTablesSuccess);
+ assertFalse(docsSuccess);
}
/**
- * Tests {@link SendRequest#writeToParcel(Parcel, int)} when all input values
- * are false or negative.
+ * Tests {@link SendRequest#writeToParcel(Parcel, int)}.
*/
- public void testWriteToParcel_allFalse() {
- sendRequest = new SendRequest(4, true, true, true);
+ public void testWriteToParcel() {
+ sendRequest = new SendRequest(4);
+ sendRequest.setSharingAppPackageName("package");
+ sendRequest.setSharingAppClassName("class");
sendRequest.setSendMaps(true);
sendRequest.setSendFusionTables(true);
sendRequest.setSendDocs(true);
@@ -298,36 +254,33 @@ public class SendRequestTest extends AndroidTestCase {
sendRequest.setMapsSuccess(true);
sendRequest.setFusionTablesSuccess(true);
sendRequest.setDocsSuccess(true);
- Parcel parcelWrite2nd = Parcel.obtain();
- parcelWrite2nd.setDataPosition(0);
- sendRequest.writeToParcel(parcelWrite2nd, 1);
- parcelWrite2nd.setDataPosition(0);
- long trackId = parcelWrite2nd.readLong();
- boolean showMaps = parcelWrite2nd.readByte() == 1;
- boolean showFusionTables = parcelWrite2nd.readByte() == 1;
- boolean showDocs = parcelWrite2nd.readByte() == 1;
- boolean sendMaps = parcelWrite2nd.readByte() == 1;
- boolean sendFusionTables = parcelWrite2nd.readByte() == 1;
- boolean sendDocs = parcelWrite2nd.readByte() == 1;
- boolean newMap = parcelWrite2nd.readByte() == 1;
- Parcelable account = parcelWrite2nd.readParcelable(null);
- String mapId = parcelWrite2nd.readString();
- boolean mapsSuccess = parcelWrite2nd.readByte() == 1;
- boolean fusionTablesSuccess = parcelWrite2nd.readByte() == 1;
- boolean docsSuccess = parcelWrite2nd.readByte() == 1;
+ Parcel parcel = Parcel.obtain();
+ parcel.setDataPosition(0);
+ sendRequest.writeToParcel(parcel, 1);
+ parcel.setDataPosition(0);
+ long trackId = parcel.readLong();
+ String sharingAppPackageName = parcel.readString();
+ String sharingAppClassName = parcel.readString();
+ boolean sendMaps = parcel.readByte() == 1;
+ boolean sendFusionTables = parcel.readByte() == 1;
+ boolean sendDocs = parcel.readByte() == 1;
+ boolean newMap = parcel.readByte() == 1;
+ Parcelable account = parcel.readParcelable(null);
+ String mapId = parcel.readString();
+ boolean mapsSuccess = parcel.readByte() == 1;
+ boolean fusionTablesSuccess = parcel.readByte() == 1;
+ boolean docsSuccess = parcel.readByte() == 1;
assertEquals(4, trackId);
- assertEquals(true, showMaps);
- assertEquals(true, showFusionTables);
- assertEquals(true, showDocs);
- assertEquals(true, sendMaps);
- assertEquals(true, sendFusionTables);
- assertEquals(true, sendDocs);
- assertEquals(true, newMap);
+ assertEquals("package", sharingAppPackageName);
+ assertEquals("class", sharingAppClassName);
+ assertTrue(sendMaps);
+ assertTrue(sendFusionTables);
+ assertTrue(sendDocs);
+ assertTrue(newMap);
assertEquals(accountNew, account);
assertEquals(MAPID, mapId);
- assertEquals(true, mapsSuccess);
- assertEquals(true, fusionTablesSuccess);
- assertEquals(true, docsSuccess);
+ assertTrue(mapsSuccess);
+ assertTrue(fusionTablesSuccess);
+ assertTrue(docsSuccess);
}
-
}
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 b363ad9c5..f56de3b42 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
@@ -97,7 +97,7 @@ public class UploadResultActivityTest
private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendDocs,
boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isDocsSuccess) {
Intent intent = new Intent();
- SendRequest sendRequest = new SendRequest(1L, true, true, true);
+ SendRequest sendRequest = new SendRequest(1L);
sendRequest.setSendMaps(isSendMaps);
sendRequest.setSendFusionTables(isSendFusionTables);
sendRequest.setSendDocs(isSendDocs);
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivityTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivityTest.java
index ff72cfb5b..e1caf2cf3 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivityTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/UploadServiceChooserActivityTest.java
@@ -50,7 +50,7 @@ public class UploadServiceChooserActivityTest extends
*/
public void testOnCreateDialog_displayAll() {
// Initials activity to display all send items.
- initialActivity(true, true, true);
+ initialActivity();
instrumentation.waitForIdleSync();
assertTrue(getMapsCheckBox().isShown());
assertTrue(getFusionTablesCheckBox().isShown());
@@ -79,46 +79,13 @@ public class UploadServiceChooserActivityTest extends
assertFalse(getExistingMapRadioButton().isShown());
}
- /**
- * Tests the logic to display only the "Send to Google Maps" option.
- */
- public void testOnCreateDialog_displayOne() {
- // Initials activity to display all send items.
- initialActivity(true, false, false);
- instrumentation.waitForIdleSync();
- assertTrue(getMapsCheckBox().isShown());
-
- // Clicks to enable this items.
- uploadServiceChooserActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (!getMapsCheckBox().isChecked()) {
- getMapsCheckBox().performClick();
- }
- }
- });
- instrumentation.waitForIdleSync();
- assertTrue(getMapsCheckBox().isShown());
- assertTrue(getNewMapRadioButton().isShown());
- assertTrue(getExistingMapRadioButton().isShown());
- }
-
- /**
- * Tests the logic to display no option.
- */
- public void testOnCreateDialog_displayNone() {
- initialActivity(false, false, false);
- assertFalse(getMapsCheckBox().isShown());
- assertFalse(getFusionTablesCheckBox().isShown());
- assertFalse(getDocsCheckBox().isShown());
- }
-
/**
* Tests the logic to initial state of check box to unchecked. This test cover
* code in method {@link UploadServiceChooserActivity#onCreateDialog(int)},
* {@link UploadServiceChooserActivity#initState()}.
*/
public void testOnCreateDialog_initStateUnchecked() {
- initialActivity(true, true, true);
+ initialActivity();
// Initial all values to false in SharedPreferences.
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.send_to_maps_key, false);
PreferencesUtils.setBoolean(
@@ -141,7 +108,7 @@ public class UploadServiceChooserActivityTest extends
* {@link UploadServiceChooserActivity#initState()}.
*/
public void testOnCreateDialog_initStateChecked() {
- initialActivity(true, true, true);
+ initialActivity();
// Initial all values to true in SharedPreferences.
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.pick_existing_map_key, true);
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.send_to_maps_key, true);
@@ -168,7 +135,7 @@ public class UploadServiceChooserActivityTest extends
* {@link UploadServiceChooserActivity#saveState()},
*/
public void testOnCreateDialog_saveState() {
- initialActivity(true, true, true);
+ initialActivity();
// Initial all values to true in SharedPreferences.
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.send_to_maps_key, true);
PreferencesUtils.setBoolean(
@@ -197,7 +164,7 @@ public class UploadServiceChooserActivityTest extends
* {@link UploadServiceChooserActivity#startNextActivity()}.
*/
public void testOnCreateDialog_startNextActivity() {
- initialActivity(true, true, true);
+ initialActivity();
// Initial all values to true or false in SharedPreferences.
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.send_to_maps_key, true);
PreferencesUtils.setBoolean(uploadServiceChooserActivity, R.string.send_to_docs_key, true);
@@ -224,10 +191,9 @@ public class UploadServiceChooserActivityTest extends
* @param showFusionTables
* @param showDocs
*/
- private void initialActivity(boolean showMaps, boolean showFusionTables, boolean showDocs) {
+ private void initialActivity() {
Intent intent = new Intent();
- intent.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(1L, showMaps, showFusionTables,
- showDocs));
+ intent.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(1L));
setActivityIntent(intent);
uploadServiceChooserActivity = this.getActivity();
}
diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java
index 7208605d2..a795b3b04 100644
--- a/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java
+++ b/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java
@@ -502,7 +502,7 @@ public class TrackRecordingServiceTest extends ServiceTestCase