Add an interstitial when sharing a track with friends.

This commit is contained in:
Jimmy Shih
2012-06-12 12:44:07 -07:00
parent 19c50a8e16
commit 82bf454c79
14 changed files with 250 additions and 28 deletions
+1
View File
@@ -204,6 +204,7 @@ limitations under the License.
android:name="com.google.android.apps.mytracks.io.maps.ChooseMapActivity" />
<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.ConfirmSharingActivity" />
<activity android:name="com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity" />
<activity android:name="com.google.android.apps.mytracks.settings.BackupSettingsActivity" />
<activity android:name="com.google.android.apps.mytracks.settings.ChartSettingsActivity" />
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent" >
<CheckBox
android:id="@+id/confirm_sharing"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_width="fill_parent"
android:text="@string/generic_do_not_show_again"
style="@style/TextMedium" />
</LinearLayout>
+12
View File
@@ -72,6 +72,18 @@ limitations under the License.
<TextView
android:text="@string/help_share_friends_answer"
style="@style/HelpAnswer" />
<TextView
android:text="@string/help_maps_public_unlisted_question"
style="@style/HelpQuestion" />
<TextView
android:id="@+id/help_maps_public_unlisted_answer"
style="@style/HelpAnswer" />
<TextView
android:text="@string/help_google_services_question"
style="@style/HelpQuestion" />
<TextView
android:id="@+id/help_google_services_answer"
style="@style/HelpAnswer" />
<TextView
android:text="@string/help_share_visibility_question"
style="@style/HelpQuestion" />
+1
View File
@@ -16,6 +16,7 @@ limitations under the License.
-->
<resources>
<!-- DO NOT TRANSLATE ANY STRINGS IN THIS FILE. -->
<string name="maps_public_unlisted_url">support.google.com/maps/bin/answer.py?answer=62845</string>
<string name="marker_statistics_icon_url">http://maps.google.com/mapfiles/ms/micons/ylw-pushpin.png</string>
<string name="marker_waypoint_icon_url">http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png</string>
<string name="my_tracks_privacy_url">www.google.com/policies/privacy/</string>
+1
View File
@@ -46,6 +46,7 @@ limitations under the License.
<string name="send_to_maps_key">sendToMaps</string>
<string name="sensor_type_key">sensorType</string>
<string name="show_check_units_dialog_key">showCheckUnitsDialog</string>
<string name="show_confirm_sharing_dialog_key">showConfrimSharingDialog</string>
<string name="show_welcome_dialog_key">showWelcomeDialog</string>
<string name="split_frequency_key">splitFrequency</string>
<string name="stats_show_coordinate_key">statsShowCoordinate</string>
+54 -12
View File
@@ -615,6 +615,11 @@ limitations under the License.
%1$s description. E.g., 'At the top'.">
Description: %1$s
</string>
<string name="generic_do_not_show_again"
translation_description="When showing a confirmation message, the message in the footer checkbox
to not show the message again.">
Do no show this again.
</string>
<string name="generic_error_title"
translation_description="The title on an alert dialog indicating error.">
Error
@@ -696,8 +701,9 @@ limitations under the License.
translation_description="In the 'Help' page, the answer on delete tracks.">
From the track list, select \"Delete all\" when not recording. This permanently deletes the
recorded tracks from memory. If you have saved tracks or backups on the SD card, you must delete
them separately. Tracks uploaded to Google Maps, Google Fusion Tables, and Google Doc must also
be deleted separately.
them separately. You can access the SD card using any file manager app from the Play Store or
using a USB cable to connect your phone to your computer. Tracks uploaded to Google Maps,
Google Fusion Tables, and Google Docs must also be deleted separately.
</string>
<string name="help_delete_tracks_question"
translation_description="In the 'Help' page, the question on delete tracks.">
@@ -724,6 +730,19 @@ limitations under the License.
translation_description="In the 'Help' page, the question on elevation precision.">
How precise is the elevation measurement?
</string>
<string name="help_google_services_answer"
translation_description="In the 'Help' page, the answer on locations of google services.
%1$s url. E.g., 'maps.google.com'.
%2$s url. E.g., 'google.com/fusiontables'.
%3$s url. E.g., 'docs.google.com'.">
For Google Maps, go to %1$s and click on \"My Places\". For Google Fusion Tables, go to %2$s.
For Google Docs, go to %3$s.
</string>
<string name="help_google_services_question"
translation_description="In the 'Help' page, the question on locations of google services.">
Where are the tracks after sending to Google?
</string>
<string name="help_gps_signal_answer"
translation_description="In the 'Help' page, the answer on the GPS signal message.">
For My Tracks to work, your phone needs to be in line-of-sight contact with the GPS satellites.
@@ -739,13 +758,23 @@ limitations under the License.
translation_description="In the 'Help' page, the answer on location precision.">
Under optimal conditions, the location error can be +/- 20 feet (6 meters). However, precision
depends on the quality of the GPS signal. The blue circle around the orange location arrow
indicates estimated precision. (You may need to zoom in or out to see the circle.) You can
indicates estimated precision. (You may need to zoom in or zoom out to see the circle.) You can
change the GPS precision at Settings -> Recording -> GPS accuracy.
</string>
<string name="help_location_precision_question"
translation_description="In the 'Help' page, the question on location precision.">
How precise are the recorded tracks?
</string>
<string name="help_maps_public_unlisted_answer"
translation_description="In the 'Help' page, the answer on public versus unlisted maps.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=62845'.">
See %1$s.
</string>
<string name="help_maps_public_unlisted_question"
translation_description="In the 'Help' page, the question on public versus unlsited maps.">
What is the difference between public and unlisted when sending a track to Google Maps?
</string>
<string name="help_marker_answer"
translation_description="In the 'Help' page, the answer on markers.">
Markers are used to annotate a location.
@@ -783,9 +812,10 @@ limitations under the License.
</string>
<string name="help_share_visibility_answer"
translation_description="In the 'Help' page, the answer on share visibility.">
By default, tracks sent to Google Maps and Google Fusion Tables are public, while tracks sent to
Google Docs are private. You can change the visibility of your tracks in Google Maps, Google
Fusion, and Google Docs.
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
default between public and unlisted via Settings -> Sharing. After uploading tracks, you can
change their visibility in Google Maps, Google Fusion Tables, and Google Docs.
</string>
<string name="help_share_visibility_question"
translation_description="In the 'Help' page, the question on share visibility.">
@@ -793,8 +823,8 @@ limitations under the License.
</string>
<string name="help_split_marker_answer"
translation_description="In the 'Help' page, the answer on split markers.">
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.
Split markers are used to segment a track to calculate statistics for each segment. Split
markers are inserted by setting the split frequency from the menu.
</string>
<string name="help_split_marker_question"
translation_description="In the 'Help' page, the question on split markers.">
@@ -1838,8 +1868,10 @@ limitations under the License.
<string name="settings_sharing_map_public_summary"
translation_description="In the 'Sharing' settings, the summary for the 'Make new maps public'
option explaining that new maps created in Google Maps will be public, as opposed to unlisted.
See http://support.google.com/maps/bin/answer.py?answer=62845 for public versus unlisted.">
New maps created in Google Maps will be public.
See http://support.google.com/maps/bin/answer.py?answer=62845 for public versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=62845'.">
New maps created in Google Maps will be public. See %1$s for more info.
</string>
<string name="settings_sharing_map_unlisted"
translation_description="In the 'Sharing' settings, the title of the option to make new maps
@@ -1852,8 +1884,10 @@ limitations under the License.
<string name="settings_sharing_map_unlisted_summary"
translation_description="In the 'Sharing' settings, the summary for the 'Make new maps unlisted'
option explaining that new maps created in Google Maps will be unlisted, as opposed to public.
See http://support.google.com/maps/bin/answer.py?answer=62845 for public versus unlisted.">
New maps created in Google Maps will be unlisted.
See http://support.google.com/maps/bin/answer.py?answer=62845 for public versus unlisted.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=62845'.">
New maps created in Google Maps will be unlisted. See %1$s for more info.
</string>
<!-- Settings Show -->
@@ -1917,6 +1951,14 @@ limitations under the License.
</string>
<!-- Share Track -->
<string name="share_track_confirm_message"
translation_description="The confirmation message when sharing a track with friends.
%1$s url. E.g., 'support.google.com/maps/bin/answer.py?answer=62845'.">
This will upload your track to Google Maps so that you can share the map url with friends. The
map will be either public or unlisted depending on your setting at Settings -> Sharing. For more
info on public versus unlisted, see %1$s.
</string>
<string name="share_track_picker_title"
translation_description="When sharing a track with friends, the title on the picker to ask
the user to select an application.">
+1
View File
@@ -71,6 +71,7 @@ limitations under the License.
</style>
<!-- The style for the help answer -->
<style name="HelpAnswer" parent="@style/TextSmall">
<item name="android:autoLink">web</item>
<item name="android:paddingBottom">8dp</item>
</style>
<!-- The style for help question -->
+1 -3
View File
@@ -18,9 +18,7 @@ limitations under the License.
android:title="@string/settings_sharing" >
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/default_map_public_key"
android:summaryOff="@string/settings_sharing_map_unlisted_summary"
android:summaryOn="@string/settings_sharing_map_public_summary" />
android:key="@string/default_map_public_key" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/allow_access_key"
@@ -22,6 +22,7 @@ import com.google.android.maps.mytracks.R;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
/**
* An activity that displays the help page.
@@ -35,6 +36,16 @@ public class HelpActivity extends AbstractMyTracksActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
TextView mapsPublicUnlisted = (TextView) findViewById(R.id.help_maps_public_unlisted_answer);
mapsPublicUnlisted.setText(getString(
R.string.help_maps_public_unlisted_answer, getString(R.string.maps_public_unlisted_url)));
TextView googleServices = (TextView) findViewById(R.id.help_google_services_answer);
googleServices.setText(getString(R.string.help_google_services_answer,
getString(R.string.send_google_maps_url),
getString(R.string.send_google_fusion_tables_url),
getString(R.string.send_google_docs_url)));
findViewById(R.id.help_ok).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
@@ -16,8 +16,8 @@
package com.google.android.apps.mytracks.fragments;
import com.google.android.apps.mytracks.io.sendtogoogle.AccountChooserActivity;
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
import com.google.android.apps.mytracks.io.sendtogoogle.ConfirmSharingActivity;
import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.maps.mytracks.R;
@@ -117,7 +117,7 @@ public class ChooseActivityDialogFragment extends DialogFragment {
sendRequest.setNewMap(true);
sendRequest.setSharingAppPackageName(packageName);
sendRequest.setSharingAppClassName(className);
Intent intent = IntentUtils.newIntent(getActivity(), AccountChooserActivity.class)
Intent intent = IntentUtils.newIntent(getActivity(), ConfirmSharingActivity.class)
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
startActivity(intent);
dismiss();
@@ -0,0 +1,100 @@
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.sendtogoogle;
import com.google.android.apps.mytracks.util.DialogUtils;
import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
/**
* An interstitial to confirm sharing with friends.
*
* @author Jimmy Shih
*/
public class ConfirmSharingActivity extends Activity {
private static final int DIALOG_ID = 0;
private SendRequest sendRequest;
private CheckBox checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sendRequest = getIntent().getParcelableExtra(SendRequest.SEND_REQUEST_KEY);
if (PreferencesUtils.getBoolean(this, R.string.show_confirm_sharing_dialog_key,
PreferencesUtils.SHOW_CONFIRM_SHARING_DIALOG_DEFAULT)) {
showDialog(DIALOG_ID);
} else {
startNextActivity();
}
}
@Override
protected Dialog onCreateDialog(int id) {
if (id != DIALOG_ID) {
return null;
}
View view = getLayoutInflater().inflate(R.layout.confirm_sharing, null);
checkBox = (CheckBox) view.findViewById(R.id.confirm_sharing);
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int button) {
PreferencesUtils.setBoolean(ConfirmSharingActivity.this,
R.string.show_confirm_sharing_dialog_key, !checkBox.isChecked());
startNextActivity();
}
};
DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int button) {
finish();
}
};
String message = getString(
R.string.share_track_confirm_message, getString(R.string.maps_public_unlisted_url));
Dialog dialog = DialogUtils.createConfirmationDialog(
this, message, view, okListener, cancelListener);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
finish();
}
});
return dialog;
}
/**
* Starts the next activity for sharing with friends and finishes this
* activity.
*/
private void startNextActivity() {
Intent intent = IntentUtils.newIntent(this, AccountChooserActivity.class)
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
startActivity(intent);
finish();
}
}
@@ -35,7 +35,7 @@ import android.preference.Preference.OnPreferenceChangeListener;
public class SharingSettingsActivity extends AbstractSettingsActivity {
private static final int DIALOG_CONFIRM_ALLOW_ACCESS_ID = 0;
private CheckBoxPreference defaultMapPublicCheckBoxPreference;
private CheckBoxPreference allowAccessCheckBoxPreference;
@@ -47,6 +47,12 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
defaultMapPublicCheckBoxPreference = (CheckBoxPreference) findPreference(
getString(R.string.default_map_public_key));
defaultMapPublicCheckBoxPreference.setSummaryOn(getString(
R.string.settings_sharing_map_public_summary,
getString(R.string.maps_public_unlisted_url)));
defaultMapPublicCheckBoxPreference.setSummaryOff(getString(
R.string.settings_sharing_map_unlisted_summary,
getString(R.string.maps_public_unlisted_url)));
boolean defaultMapPublic = PreferencesUtils.getBoolean(
this, R.string.default_map_public_key, PreferencesUtils.DEFAULT_MAP_PUBLIC_DEFAULT);
updateDefaultMapPublicTitle(defaultMapPublic);
@@ -82,7 +88,7 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
return DialogUtils.createConfirmationDialog(this,
R.string.settings_sharing_allow_access_confirm_message,
new DialogInterface.OnClickListener() {
@Override
@Override
public void onClick(DialogInterface dialog, int button) {
allowAccessCheckBoxPreference.setChecked(true);
}
@@ -23,6 +23,7 @@ import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
/**
* Utilities for creating dialogs.
@@ -37,19 +38,37 @@ public class DialogUtils {
* Creates a confirmation dialog.
*
* @param context the context
* @param messageId the confirmation message id
* @param onClickListener the listener to invoke when the user clicks OK
* @param messageId the message id
* @param okListener the listener when OK is clicked
*/
public static Dialog createConfirmationDialog(
Context context, int messageId, DialogInterface.OnClickListener onClickListener) {
return new AlertDialog.Builder(context)
Context context, int messageId, DialogInterface.OnClickListener okListener) {
return createConfirmationDialog(context, context.getString(messageId), null, okListener, null);
}
/**
* Creates a confirmation dialog.
*
* @param context the context
* @param message the message
* @param view the view
* @param okListener the listener when OK is clicked
* @param cancelListener the listener when cancel is clicked
*/
public static Dialog createConfirmationDialog(
Context context, String message, View view, DialogInterface.OnClickListener okListener,
DialogInterface.OnClickListener cancelListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setCancelable(true)
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage(context.getString(messageId))
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, onClickListener)
.setTitle(R.string.generic_confirm_title)
.create();
.setMessage(message)
.setNegativeButton(android.R.string.cancel, cancelListener)
.setPositiveButton(android.R.string.ok, okListener)
.setTitle(R.string.generic_confirm_title);
if (view != null) {
builder.setView(view);
}
return builder.create();
}
/**
@@ -74,6 +74,7 @@ public class PreferencesUtils {
public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = true;
public static final boolean SEND_TO_MAPS_DEFAULT = true;
public static final boolean SHOW_CHECK_UNITS_DIALOG_DEFAULT = true;
public static final boolean SHOW_CONFIRM_SHARING_DIALOG_DEFAULT = true;
public static final boolean SHOW_WELCOME_DIALOG_DEFAULT = true;
public static final int SPLIT_FREQUENCY_DEFAULT = 0;