Remove confirmation dialog when sharing via Google Drive.

This commit is contained in:
Jimmy Shih
2013-06-21 17:58:15 -07:00
parent abd8f59a07
commit 85eba36d4c
10 changed files with 22 additions and 47 deletions
+5 -4
View File
@@ -20,10 +20,7 @@ limitations under the License.
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="16dp" android:padding="8dp">
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp" >
<CheckBox <CheckBox
android:id="@+id/share_track_public" android:id="@+id/share_track_public"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@@ -46,5 +43,9 @@ limitations under the License.
android:singleLine="false" android:singleLine="false"
android:visibility="gone" > android:visibility="gone" >
</MultiAutoCompleteTextView> </MultiAutoCompleteTextView>
<TextView
android:text="@string/share_track_footer"
android:layout_marginTop="16dp"
style="@style/TextSmall" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
-1
View File
@@ -61,7 +61,6 @@ limitations under the License.
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string> <string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
<string name="bluetooth_sensor_key">bluetoothSensor</string> <string name="bluetooth_sensor_key">bluetoothSensor</string>
<string name="confirm_play_earth_key">confirmPlayEarth</string> <string name="confirm_play_earth_key">confirmPlayEarth</string>
<string name="confirm_share_drive_key">confirmShareDrive</string>
<string name="drive_deleted_list_key">driveDeletedList</string> <string name="drive_deleted_list_key">driveDeletedList</string>
<string name="drive_largest_change_id_key">driveLargestChangeId</string> <string name="drive_largest_change_id_key">driveLargestChangeId</string>
<string name="drive_sync_key">driveSync</string> <string name="drive_sync_key">driveSync</string>
+6 -7
View File
@@ -1528,7 +1528,7 @@ limitations under the License.
translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now' translation_description="In the 'Backup and reset' settings, after pressing the 'Restore now'
option, the message in the alert dialog informing the user that there is no backup to restore option, the message in the alert dialog informing the user that there is no backup to restore
from. from.
%1$s the directory. E.g., '/MyTracks/backups'."> %1$s the directory. E.g., '/MyTracks/backups'.">
No backups found in %1$s. No backups found in %1$s.
</string> </string>
@@ -2024,15 +2024,14 @@ limitations under the License.
</string> </string>
<!-- Share Track --> <!-- Share Track -->
<string name="share_track_confirm_message"
translation_description="The confirmation message when sharing a track via Google Drive with
friends.">
This will upload your track to Google Drive so you can share the file with friends.
</string>
<string name="share_track_emails_hint" <string name="share_track_emails_hint"
translation_description="The hint for the auto complete text box for entering email addresses."> translation_description="The hint for the auto complete text box for entering email addresses.">
Email addresses Email addresses
</string> </string>
<string name="share_track_footer"
translation_description="The dialog footer when sharing a track via Google Drive.">
This will updload your track to Google Drive.
</string>
<string name="share_track_invite" <string name="share_track_invite"
translation_description="The checkbox to invite people to view a track."> translation_description="The checkbox to invite people to view a track.">
Invite people to view Invite people to view
@@ -2093,7 +2092,7 @@ limitations under the License.
</string> </string>
<string name="share_track_title" <string name="share_track_title"
translation_description="The dialog title to share a track."> translation_description="The dialog title to share a track.">
Share track Share track via Google Drive
</string> </string>
<!-- Stats --> <!-- Stats -->
@@ -335,34 +335,26 @@ public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActiv
* *
* @param trackId the track id * @param trackId the track id
*/ */
protected void confirmShare(long trackId) { protected void shareTrack(long trackId) {
ConfirmDialogFragment.newInstance(R.string.confirm_share_drive_key, AnalyticsUtils.sendPageViews(this, "/action/share_drive");
PreferencesUtils.CONFIRM_SHARE_DRIVE_DEFAULT, SendRequest newRequest;
getString(R.string.share_track_confirm_message), new long[] { trackId }) newRequest = new SendRequest(trackId);
.show(getSupportFragmentManager(), ConfirmDialogFragment.CONFIRM_DIALOG_TAG); newRequest.setSendDrive(true);
newRequest.setDriveShare(true);
sendToGoogle(newRequest);
} }
@Override @Override
public void onConfirmDone(int confirmId, long[] trackIds) { public void onConfirmDone(int confirmId, long[] trackIds) {
Intent intent;
SendRequest newRequest;
switch (confirmId) { switch (confirmId) {
case R.string.confirm_play_earth_key: case R.string.confirm_play_earth_key:
AnalyticsUtils.sendPageViews(this, "/action/play"); AnalyticsUtils.sendPageViews(this, "/action/play");
intent = IntentUtils.newIntent(this, SaveActivity.class) Intent intent = IntentUtils.newIntent(this, SaveActivity.class)
.putExtra(SaveActivity.EXTRA_TRACK_IDS, trackIds) .putExtra(SaveActivity.EXTRA_TRACK_IDS, trackIds)
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML) .putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML)
.putExtra(SaveActivity.EXTRA_PLAY_TRACK, true); .putExtra(SaveActivity.EXTRA_PLAY_TRACK, true);
startActivity(intent); startActivity(intent);
break; break;
case R.string.confirm_share_drive_key:
AnalyticsUtils.sendPageViews(this, "/action/share_drive");
newRequest = new SendRequest(trackIds[0]);
newRequest.setSendDrive(true);
newRequest.setDriveShare(true);
sendToGoogle(newRequest);
break;
default: default:
} }
} }
@@ -347,7 +347,7 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
confirmPlay(new long[] {trackId}); confirmPlay(new long[] {trackId});
return true; return true;
case R.id.list_context_menu_share: case R.id.list_context_menu_share:
confirmShare(trackId); shareTrack(trackId);
return true; return true;
case R.id.list_context_menu_show_on_map: case R.id.list_context_menu_show_on_map:
intent = IntentUtils.newIntent(this, TrackDetailActivity.class) intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
@@ -340,7 +340,7 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
confirmPlay(new long[] {trackId}); confirmPlay(new long[] {trackId});
return true; return true;
case R.id.track_detail_share: case R.id.track_detail_share:
confirmShare(trackId); shareTrack(trackId);
return true; return true;
case R.id.track_detail_markers: case R.id.track_detail_markers:
intent = IntentUtils.newIntent(this, MarkerListActivity.class) intent = IntentUtils.newIntent(this, MarkerListActivity.class)
@@ -770,7 +770,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
confirmPlay(trackIds); confirmPlay(trackIds);
return true; return true;
case R.id.list_context_menu_share: case R.id.list_context_menu_share:
confirmShare(trackIds[0]); shareTrack(trackIds[0]);
return true; return true;
case R.id.list_context_menu_edit: case R.id.list_context_menu_edit:
Intent intent = IntentUtils.newIntent(this, TrackEditActivity.class) Intent intent = IntentUtils.newIntent(this, TrackEditActivity.class)
@@ -52,7 +52,6 @@ public class PreferenceBackupHelper {
doNotBackup.add(context.getString(R.string.auto_resume_track_current_retry_key)); doNotBackup.add(context.getString(R.string.auto_resume_track_current_retry_key));
doNotBackup.add(context.getString(R.string.bluetooth_sensor_key)); doNotBackup.add(context.getString(R.string.bluetooth_sensor_key));
doNotBackup.add(context.getString(R.string.confirm_play_earth_key)); doNotBackup.add(context.getString(R.string.confirm_play_earth_key));
doNotBackup.add(context.getString(R.string.confirm_share_drive_key));
doNotBackup.add(context.getString(R.string.drive_deleted_list_key)); doNotBackup.add(context.getString(R.string.drive_deleted_list_key));
doNotBackup.add(context.getString(R.string.drive_largest_change_id_key)); doNotBackup.add(context.getString(R.string.drive_largest_change_id_key));
doNotBackup.add(context.getString(R.string.drive_sync_key)); doNotBackup.add(context.getString(R.string.drive_sync_key));
@@ -58,7 +58,6 @@ public class PreferencesUtils {
public static final boolean CHART_SHOW_SPEED_DEFAULT = true; public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
public static final boolean CONFIRM_PLAY_EARTH_DEFAULT = true; public static final boolean CONFIRM_PLAY_EARTH_DEFAULT = true;
public static final boolean CONFIRM_SHARE_DRIVE_DEFAULT = true;
public static final String DEFAULT_ACTIVITY_DEFAULT = ""; public static final String DEFAULT_ACTIVITY_DEFAULT = "";
@@ -49,20 +49,6 @@ public class ShareTest extends ActivityInstrumentationTestCase2<TrackListActivit
EndToEndTestUtils.setupForAllTest(instrumentation, activityMyTracks); EndToEndTestUtils.setupForAllTest(instrumentation, activityMyTracks);
} }
/**
* Tests quitting the share.
*/
public void testQuitShare() {
EndToEndTestUtils.resetAllSettings(activityMyTracks, false);
EndToEndTestUtils.createTrackIfEmpty(0, false);
// Click share, check message and cancel the share.
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_share), true);
assertTrue(EndToEndTestUtils.SOLO.waitForText(activityMyTracks
.getString(R.string.share_track_confirm_message)));
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.generic_no));
}
/** /**
* Tests the share one track. * Tests the share one track.
*/ */