forked from upstream-mirrors/OpenTracks
Cleanup code to enable sync to Google Drive
This commit is contained in:
@@ -2127,14 +2127,18 @@ limitations under the License.
|
|||||||
All files in the %1$s Google Drive ‘%2$s’ folder will be imported as new tracks. If
|
All files in the %1$s Google Drive ‘%2$s’ folder will be imported as new tracks. If
|
||||||
not desired, move the files to a different folder beforehand.
|
not desired, move the files to a different folder beforehand.
|
||||||
</string>
|
</string>
|
||||||
|
<string name="sync_drive_confirm_title"
|
||||||
|
translation_description="The dialog title to confirm sync to Google Drive.">
|
||||||
|
Sync with Google Drive?
|
||||||
|
</string>
|
||||||
<string name="sync_drive_enable_message"
|
<string name="sync_drive_enable_message"
|
||||||
translation_description="The dialog message to enable sync to Google Drive.">
|
translation_description="The dialog message to enable sync to Google Drive.">
|
||||||
Do you want to sync your tracks to Google Drive? This will allow you to view your tracks in
|
Do you want to sync your tracks to Google Drive? This will allow you to view your tracks in
|
||||||
Google Drive and view the tracks shared with you. All tracks synced to Google Drive will be
|
Google Drive and view the tracks shared with you. All tracks synced to Google Drive will be
|
||||||
private by default.
|
private by default.
|
||||||
</string>
|
</string>
|
||||||
<string name="sync_drive_title"
|
<string name="sync_drive_enable_title"
|
||||||
translation_description="The dialog title to sync to Google Drive.">
|
translation_description="The dialog title after the track is saved.">
|
||||||
Track Saved
|
Track Saved
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,8 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks;
|
package com.google.android.apps.mytracks;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment;
|
|
||||||
import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment.ChooseAccountCaller;
|
|
||||||
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment;
|
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment.ConfirmDeleteCaller;
|
import com.google.android.apps.mytracks.fragments.ConfirmDeleteDialogFragment.ConfirmDeleteCaller;
|
||||||
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment;
|
|
||||||
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment.ConfirmSyncCaller;
|
|
||||||
import com.google.android.apps.mytracks.fragments.ExportDialogFragment.ExportType;
|
import com.google.android.apps.mytracks.fragments.ExportDialogFragment.ExportType;
|
||||||
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
import com.google.android.apps.mytracks.fragments.InstallEarthDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.ShareTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.ShareTrackDialogFragment;
|
||||||
@@ -69,14 +65,15 @@ import java.io.IOException;
|
|||||||
* {@link SearchListActivity}:
|
* {@link SearchListActivity}:
|
||||||
* <p>
|
* <p>
|
||||||
* - share track <br>
|
* - share track <br>
|
||||||
* - delete track <br>
|
* - export track to Google services<br>
|
||||||
* - play track <br>
|
* - enable sync to Google Drive <br>
|
||||||
|
* - delete tracks <br>
|
||||||
|
* - play tracks
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActivity implements
|
public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActivity
|
||||||
ChooseAccountCaller, ConfirmSyncCaller, CheckPermissionCaller, ShareTrackCaller,
|
implements CheckPermissionCaller, ShareTrackCaller, ConfirmDeleteCaller {
|
||||||
ConfirmDeleteCaller {
|
|
||||||
|
|
||||||
private static final String TAG = AbstractMyTracksActivity.class.getSimpleName();
|
private static final String TAG = AbstractMyTracksActivity.class.getSimpleName();
|
||||||
private static final String SEND_REQUEST_KEY = "send_request_key";
|
private static final String SEND_REQUEST_KEY = "send_request_key";
|
||||||
@@ -170,7 +167,7 @@ public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActiv
|
|||||||
sendRequest.setDriveSharePublic(makePublic);
|
sendRequest.setDriveSharePublic(makePublic);
|
||||||
sendRequest.setDriveShareEmails(emails);
|
sendRequest.setDriveShareEmails(emails);
|
||||||
sendRequest.setAccount(account);
|
sendRequest.setAccount(account);
|
||||||
onConfirmSyncDone(true);
|
checkPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void exportTrackToGoogle(long trackId, ExportType exportType, Account account) {
|
protected void exportTrackToGoogle(long trackId, ExportType exportType, Account account) {
|
||||||
@@ -195,60 +192,47 @@ public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActiv
|
|||||||
}
|
}
|
||||||
AnalyticsUtils.sendPageViews(this, pageView);
|
AnalyticsUtils.sendPageViews(this, pageView);
|
||||||
sendRequest.setAccount(account);
|
sendRequest.setAccount(account);
|
||||||
onConfirmSyncDone(true);
|
checkPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a request to Google.
|
* Enables Google Drive sync.
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
*/
|
*/
|
||||||
protected void sendToGoogle(SendRequest request) {
|
protected void enableSync(Account account) {
|
||||||
sendRequest = request;
|
sendRequest = new SendRequest(-1L);
|
||||||
new ChooseAccountDialogFragment().show(
|
sendRequest.setSendDrive(true);
|
||||||
getSupportFragmentManager(), ChooseAccountDialogFragment.CHOOSE_ACCOUNT_DIALOG_TAG);
|
sendRequest.setDriveSync(true);
|
||||||
|
sendRequest.setAccount(account);
|
||||||
|
checkPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void onChooseAccountDone(String account) {
|
* Checks permissions to needed Google services.
|
||||||
String googleAccount = PreferencesUtils.getString(
|
*/
|
||||||
this, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
private void checkPermissions() {
|
||||||
if (googleAccount == null || googleAccount.equals(PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT)) {
|
// Check Drive permission
|
||||||
return;
|
boolean needDrivePermission = sendRequest.isSendDrive();
|
||||||
|
if (!needDrivePermission && sendRequest.isSendFusionTables()) {
|
||||||
|
needDrivePermission = PreferencesUtils.getBoolean(this,
|
||||||
|
R.string.export_google_fusion_tables_public_key,
|
||||||
|
PreferencesUtils.EXPORT_GOOGLE_FUSION_TABLES_PUBLIC_DEFAULT);
|
||||||
|
}
|
||||||
|
if (!needDrivePermission) {
|
||||||
|
needDrivePermission = sendRequest.isSendSpreadsheets();
|
||||||
}
|
}
|
||||||
sendRequest.setAccount(new Account(googleAccount, Constants.ACCOUNT_TYPE));
|
|
||||||
|
|
||||||
if (sendRequest.isSendDrive() && sendRequest.isDriveSync()
|
if (needDrivePermission) {
|
||||||
&& sendRequest.isDriveSyncConfirm()) {
|
startCheckPermission(SendToGoogleUtils.DRIVE_SCOPE);
|
||||||
new ConfirmSyncDialogFragment().show(
|
|
||||||
getSupportFragmentManager(), ConfirmSyncDialogFragment.CONFIRM_SYNC_DIALOG_TAG);
|
|
||||||
} else {
|
} else {
|
||||||
onConfirmSyncDone(true);
|
onDrivePermissionSuccess();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfirmSyncDone(boolean enable) {
|
|
||||||
if (enable) {
|
|
||||||
// Check Drive permission
|
|
||||||
boolean needDrivePermission = sendRequest.isSendDrive();
|
|
||||||
if (!needDrivePermission && sendRequest.isSendFusionTables()) {
|
|
||||||
needDrivePermission = PreferencesUtils.getBoolean(this,
|
|
||||||
R.string.export_google_fusion_tables_public_key,
|
|
||||||
PreferencesUtils.EXPORT_GOOGLE_FUSION_TABLES_PUBLIC_DEFAULT);
|
|
||||||
}
|
|
||||||
if (!needDrivePermission) {
|
|
||||||
needDrivePermission = sendRequest.isSendSpreadsheets();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needDrivePermission) {
|
|
||||||
startCheckPermission(SendToGoogleUtils.DRIVE_SCOPE);
|
|
||||||
} else {
|
|
||||||
onDrivePermissionSuccess();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts checking permission for a Google service.
|
||||||
|
*
|
||||||
|
* @param scope the service scope
|
||||||
|
*/
|
||||||
private void startCheckPermission(String scope) {
|
private void startCheckPermission(String scope) {
|
||||||
asyncTask = new CheckPermissionAsyncTask(this, sendRequest.getAccount().name, scope);
|
asyncTask = new CheckPermissionAsyncTask(this, sendRequest.getAccount().name, scope);
|
||||||
asyncTask.execute();
|
asyncTask.execute();
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ package com.google.android.apps.mytracks;
|
|||||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||||
import com.google.android.apps.mytracks.content.Track;
|
import com.google.android.apps.mytracks.content.Track;
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
import com.google.android.apps.mytracks.content.TracksColumns;
|
||||||
|
import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.ChooseAccountDialogFragment.ChooseAccountCaller;
|
||||||
|
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment;
|
||||||
|
import com.google.android.apps.mytracks.fragments.ConfirmSyncDialogFragment.ConfirmSyncCaller;
|
||||||
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
import com.google.android.apps.mytracks.fragments.EulaDialogFragment;
|
||||||
import com.google.android.apps.mytracks.fragments.EulaDialogFragment.EulaCaller;
|
import com.google.android.apps.mytracks.fragments.EulaDialogFragment.EulaCaller;
|
||||||
import com.google.android.apps.mytracks.fragments.FileTypeDialogFragment;
|
import com.google.android.apps.mytracks.fragments.FileTypeDialogFragment;
|
||||||
@@ -28,7 +32,6 @@ import com.google.android.apps.mytracks.fragments.PlayMultipleDialogFragment.Pla
|
|||||||
import com.google.android.apps.mytracks.io.file.TrackFileFormat;
|
import com.google.android.apps.mytracks.io.file.TrackFileFormat;
|
||||||
import com.google.android.apps.mytracks.io.file.exporter.SaveActivity;
|
import com.google.android.apps.mytracks.io.file.exporter.SaveActivity;
|
||||||
import com.google.android.apps.mytracks.io.file.importer.ImportActivity;
|
import com.google.android.apps.mytracks.io.file.importer.ImportActivity;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
|
||||||
import com.google.android.apps.mytracks.io.sync.SyncUtils;
|
import com.google.android.apps.mytracks.io.sync.SyncUtils;
|
||||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
||||||
import com.google.android.apps.mytracks.services.MyTracksLocationManager;
|
import com.google.android.apps.mytracks.services.MyTracksLocationManager;
|
||||||
@@ -51,6 +54,7 @@ import com.google.android.gms.common.GooglePlayServicesUtil;
|
|||||||
import com.google.android.maps.mytracks.BuildConfig;
|
import com.google.android.maps.mytracks.BuildConfig;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -90,7 +94,7 @@ import java.util.Locale;
|
|||||||
* @author Leif Hendrik Wilden
|
* @author Leif Hendrik Wilden
|
||||||
*/
|
*/
|
||||||
public class TrackListActivity extends AbstractSendToGoogleActivity
|
public class TrackListActivity extends AbstractSendToGoogleActivity
|
||||||
implements EulaCaller, FileTypeCaller, PlayMultipleCaller {
|
implements EulaCaller, FileTypeCaller, PlayMultipleCaller, ChooseAccountCaller, ConfirmSyncCaller {
|
||||||
|
|
||||||
private static final String TAG = TrackListActivity.class.getSimpleName();
|
private static final String TAG = TrackListActivity.class.getSimpleName();
|
||||||
private static final String[] PROJECTION = new String[] { TracksColumns._ID, TracksColumns.NAME,
|
private static final String[] PROJECTION = new String[] { TracksColumns._ID, TracksColumns.NAME,
|
||||||
@@ -539,13 +543,8 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
|||||||
if (driveSync) {
|
if (driveSync) {
|
||||||
SyncUtils.syncNow(this);
|
SyncUtils.syncNow(this);
|
||||||
} else {
|
} else {
|
||||||
PreferencesUtils.setString(
|
new ChooseAccountDialogFragment().show(
|
||||||
this, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
getSupportFragmentManager(), ChooseAccountDialogFragment.CHOOSE_ACCOUNT_DIALOG_TAG);
|
||||||
SendRequest sendRequest = new SendRequest(-1L);
|
|
||||||
sendRequest.setSendDrive(true);
|
|
||||||
sendRequest.setDriveSync(true);
|
|
||||||
sendRequest.setDriveSyncConfirm(true);
|
|
||||||
sendToGoogle(sendRequest);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_aggregated_statistics:
|
case R.id.track_list_aggregated_statistics:
|
||||||
@@ -795,4 +794,24 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
|||||||
public void onPlayMultipleDone(long[] trackIds) {
|
public void onPlayMultipleDone(long[] trackIds) {
|
||||||
playTracks(trackIds);
|
playTracks(trackIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChooseAccountDone(String account) {
|
||||||
|
PreferencesUtils.setString(this, R.string.google_account_key, account);
|
||||||
|
if (PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT.equals(account)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
new ConfirmSyncDialogFragment().show(
|
||||||
|
getSupportFragmentManager(), ConfirmSyncDialogFragment.CONFIRM_SYNC_DIALOG_TAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmSyncDone(boolean enable) {
|
||||||
|
if (enable) {
|
||||||
|
String googleAccount = PreferencesUtils.getString(
|
||||||
|
this, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
||||||
|
enableSync(new Account(googleAccount, Constants.ACCOUNT_TYPE));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-13
@@ -24,7 +24,6 @@ import android.app.AlertDialog;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,17 +61,6 @@ public class ConfirmSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (PreferencesUtils.getBoolean(
|
|
||||||
getActivity(), R.string.drive_sync_key, PreferencesUtils.DRIVE_SYNC_DEFAULT)) {
|
|
||||||
dismiss();
|
|
||||||
caller.onConfirmSyncDone(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Dialog createDialog() {
|
protected Dialog createDialog() {
|
||||||
FragmentActivity fragmentActivity = getActivity();
|
FragmentActivity fragmentActivity = getActivity();
|
||||||
@@ -91,7 +79,7 @@ public class ConfirmSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
caller.onConfirmSyncDone(true);
|
caller.onConfirmSyncDone(true);
|
||||||
}
|
}
|
||||||
}).setTitle(R.string.sync_drive_title).create();
|
}).setTitle(R.string.sync_drive_confirm_title).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFrament to enable sync to Google Drive.
|
* A DialogFrament to prompt user to sync to Google Drive after saving first track.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +72,7 @@ public class EnableSyncDialogFragment extends AbstractMyTracksDialogFragment {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
caller.onEnableSyncDone(true);
|
caller.onEnableSyncDone(true);
|
||||||
}
|
}
|
||||||
}).setTitle(R.string.sync_drive_title).create();
|
}).setTitle(R.string.sync_drive_enable_title).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public class SendRequest implements Parcelable {
|
|||||||
private boolean sendSpreadsheets = false;
|
private boolean sendSpreadsheets = false;
|
||||||
|
|
||||||
private boolean driveSync = false; // to enable Drive sync
|
private boolean driveSync = false; // to enable Drive sync
|
||||||
private boolean driveSyncConfirm = false;
|
|
||||||
private boolean driveSharePublic = false; // for driveShare, share as public
|
private boolean driveSharePublic = false; // for driveShare, share as public
|
||||||
private String driveShareEmails = null; // for driveShare, emails to share
|
private String driveShareEmails = null; // for driveShare, emails to share
|
||||||
|
|
||||||
@@ -102,14 +101,6 @@ public class SendRequest implements Parcelable {
|
|||||||
this.driveSync = driveSync;
|
this.driveSync = driveSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDriveSyncConfirm() {
|
|
||||||
return driveSyncConfirm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDriveSyncConfirm(boolean driveSyncConfirm) {
|
|
||||||
this.driveSyncConfirm = driveSyncConfirm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDriveSharePublic() {
|
public boolean isDriveSharePublic() {
|
||||||
return driveSharePublic;
|
return driveSharePublic;
|
||||||
}
|
}
|
||||||
@@ -181,7 +172,6 @@ public class SendRequest implements Parcelable {
|
|||||||
sendFusionTables = in.readByte() == 1;
|
sendFusionTables = in.readByte() == 1;
|
||||||
sendSpreadsheets = in.readByte() == 1;
|
sendSpreadsheets = in.readByte() == 1;
|
||||||
driveSync = in.readByte() == 1;
|
driveSync = in.readByte() == 1;
|
||||||
driveSyncConfirm = in.readByte() == 1;
|
|
||||||
driveSharePublic = in.readByte() == 1;
|
driveSharePublic = in.readByte() == 1;
|
||||||
driveShareEmails = in.readString();
|
driveShareEmails = in.readString();
|
||||||
account = in.readParcelable(null);
|
account = in.readParcelable(null);
|
||||||
@@ -205,7 +195,6 @@ public class SendRequest implements Parcelable {
|
|||||||
out.writeByte((byte) (sendFusionTables ? 1 : 0));
|
out.writeByte((byte) (sendFusionTables ? 1 : 0));
|
||||||
out.writeByte((byte) (sendSpreadsheets ? 1 : 0));
|
out.writeByte((byte) (sendSpreadsheets ? 1 : 0));
|
||||||
out.writeByte((byte) (driveSync ? 1 : 0));
|
out.writeByte((byte) (driveSync ? 1 : 0));
|
||||||
out.writeByte((byte) (driveSyncConfirm ? 1 : 0));
|
|
||||||
out.writeByte((byte) (driveSharePublic ? 1 : 0));
|
out.writeByte((byte) (driveSharePublic ? 1 : 0));
|
||||||
out.writeString(driveShareEmails);
|
out.writeString(driveShareEmails);
|
||||||
out.writeParcelable(account, 0);
|
out.writeParcelable(account, 0);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class SettingsActivity extends AbstractSettingsActivity implements CheckP
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case DIALOG_CONFIRM_DRIVE_SYNC_ON:
|
case DIALOG_CONFIRM_DRIVE_SYNC_ON:
|
||||||
dialog = DialogUtils.createConfirmationDialog(this, R.string.sync_drive_title,
|
dialog = DialogUtils.createConfirmationDialog(this, R.string.sync_drive_confirm_title,
|
||||||
getString(R.string.sync_drive_confirm_message), new DialogInterface.OnClickListener() {
|
getString(R.string.sync_drive_confirm_message), new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface d, int button) {
|
public void onClick(DialogInterface d, int button) {
|
||||||
|
|||||||
+1
-10
@@ -128,7 +128,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
parcel.writeByte((byte) 1);
|
parcel.writeByte((byte) 1);
|
||||||
parcel.writeByte((byte) 1);
|
parcel.writeByte((byte) 1);
|
||||||
parcel.writeByte((byte) 1);
|
parcel.writeByte((byte) 1);
|
||||||
parcel.writeByte((byte) 1);
|
|
||||||
parcel.writeString(DRIVE_SHARE_EMAILS);
|
parcel.writeString(DRIVE_SHARE_EMAILS);
|
||||||
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
|
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
|
||||||
parcel.writeParcelable(account, 0);
|
parcel.writeParcelable(account, 0);
|
||||||
@@ -145,7 +144,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
assertTrue(sendRequest.isSendFusionTables());
|
assertTrue(sendRequest.isSendFusionTables());
|
||||||
assertTrue(sendRequest.isSendSpreadsheets());
|
assertTrue(sendRequest.isSendSpreadsheets());
|
||||||
assertTrue(sendRequest.isDriveSync());
|
assertTrue(sendRequest.isDriveSync());
|
||||||
assertTrue(sendRequest.isDriveSyncConfirm());
|
|
||||||
assertTrue(sendRequest.isDriveSharePublic());
|
assertTrue(sendRequest.isDriveSharePublic());
|
||||||
assertEquals(DRIVE_SHARE_EMAILS, sendRequest.getDriveShareEmails());
|
assertEquals(DRIVE_SHARE_EMAILS, sendRequest.getDriveShareEmails());
|
||||||
assertEquals(account, sendRequest.getAccount());
|
assertEquals(account, sendRequest.getAccount());
|
||||||
@@ -169,7 +167,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
parcel.writeByte((byte) 0);
|
parcel.writeByte((byte) 0);
|
||||||
parcel.writeByte((byte) 0);
|
parcel.writeByte((byte) 0);
|
||||||
parcel.writeByte((byte) 0);
|
parcel.writeByte((byte) 0);
|
||||||
parcel.writeByte((byte) 0);
|
|
||||||
parcel.writeString(null);
|
parcel.writeString(null);
|
||||||
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
|
Account account = new Account(ACCOUNTNAME, ACCOUNTYPE);
|
||||||
parcel.writeParcelable(account, 0);
|
parcel.writeParcelable(account, 0);
|
||||||
@@ -186,8 +183,7 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
assertFalse(sendRequest.isSendFusionTables());
|
assertFalse(sendRequest.isSendFusionTables());
|
||||||
assertFalse(sendRequest.isSendSpreadsheets());
|
assertFalse(sendRequest.isSendSpreadsheets());
|
||||||
assertFalse(sendRequest.isDriveSync());
|
assertFalse(sendRequest.isDriveSync());
|
||||||
assertFalse(sendRequest.isDriveSyncConfirm());
|
assertFalse(sendRequest.isDriveSharePublic());
|
||||||
assertFalse(sendRequest.isDriveSharePublic());
|
|
||||||
assertNull(sendRequest.getDriveShareEmails());
|
assertNull(sendRequest.getDriveShareEmails());
|
||||||
assertEquals(account, sendRequest.getAccount());
|
assertEquals(account, sendRequest.getAccount());
|
||||||
assertFalse(sendRequest.isDriveSuccess());
|
assertFalse(sendRequest.isDriveSuccess());
|
||||||
@@ -212,7 +208,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
boolean sendFusionTables = parcel.readByte() == 1;
|
boolean sendFusionTables = parcel.readByte() == 1;
|
||||||
boolean sendSpreadsheets = parcel.readByte() == 1;
|
boolean sendSpreadsheets = parcel.readByte() == 1;
|
||||||
boolean driveSync = parcel.readByte() == 1;
|
boolean driveSync = parcel.readByte() == 1;
|
||||||
boolean driveSyncConfirm = parcel.readByte() == 1;
|
|
||||||
boolean driveSharePublic = parcel.readByte() == 1;
|
boolean driveSharePublic = parcel.readByte() == 1;
|
||||||
String dirveShareEmails = parcel.readString();
|
String dirveShareEmails = parcel.readString();
|
||||||
Parcelable account = parcel.readParcelable(null);
|
Parcelable account = parcel.readParcelable(null);
|
||||||
@@ -227,7 +222,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
assertFalse(sendFusionTables);
|
assertFalse(sendFusionTables);
|
||||||
assertFalse(sendSpreadsheets);
|
assertFalse(sendSpreadsheets);
|
||||||
assertFalse(driveSync);
|
assertFalse(driveSync);
|
||||||
assertFalse(driveSyncConfirm);
|
|
||||||
assertFalse(driveSharePublic);
|
assertFalse(driveSharePublic);
|
||||||
assertNull(dirveShareEmails);
|
assertNull(dirveShareEmails);
|
||||||
assertNull(account);
|
assertNull(account);
|
||||||
@@ -248,7 +242,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
sendRequest.setSendFusionTables(true);
|
sendRequest.setSendFusionTables(true);
|
||||||
sendRequest.setSendSpreadsheets(true);
|
sendRequest.setSendSpreadsheets(true);
|
||||||
sendRequest.setDriveSync(true);
|
sendRequest.setDriveSync(true);
|
||||||
sendRequest.setDriveSyncConfirm(true);
|
|
||||||
sendRequest.setDriveSharePublic(true);
|
sendRequest.setDriveSharePublic(true);
|
||||||
sendRequest.setDriveShareEmails(DRIVE_SHARE_EMAILS);
|
sendRequest.setDriveShareEmails(DRIVE_SHARE_EMAILS);
|
||||||
Account accountNew = new Account(ACCOUNTNAME + "2", ACCOUNTYPE + "2");
|
Account accountNew = new Account(ACCOUNTNAME + "2", ACCOUNTYPE + "2");
|
||||||
@@ -268,7 +261,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
boolean sendFusionTables = parcel.readByte() == 1;
|
boolean sendFusionTables = parcel.readByte() == 1;
|
||||||
boolean sendSpreadsheets = parcel.readByte() == 1;
|
boolean sendSpreadsheets = parcel.readByte() == 1;
|
||||||
boolean driveSync = parcel.readByte() == 1;
|
boolean driveSync = parcel.readByte() == 1;
|
||||||
boolean driveSyncConfirm = parcel.readByte() == 1;
|
|
||||||
boolean driveSharePublic = parcel.readByte() == 1;
|
boolean driveSharePublic = parcel.readByte() == 1;
|
||||||
String driveShareEmails = parcel.readString();
|
String driveShareEmails = parcel.readString();
|
||||||
Parcelable account = parcel.readParcelable(null);
|
Parcelable account = parcel.readParcelable(null);
|
||||||
@@ -283,7 +275,6 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
assertTrue(sendFusionTables);
|
assertTrue(sendFusionTables);
|
||||||
assertTrue(sendSpreadsheets);
|
assertTrue(sendSpreadsheets);
|
||||||
assertTrue(driveSync);
|
assertTrue(driveSync);
|
||||||
assertTrue(driveSyncConfirm);
|
|
||||||
assertTrue(driveSharePublic);
|
assertTrue(driveSharePublic);
|
||||||
assertEquals(DRIVE_SHARE_EMAILS, driveShareEmails);
|
assertEquals(DRIVE_SHARE_EMAILS, driveShareEmails);
|
||||||
assertEquals(accountNew, account);
|
assertEquals(accountNew, account);
|
||||||
|
|||||||
+1
-1
@@ -343,7 +343,7 @@ public class EndToEndTestUtils {
|
|||||||
if ((getButtonOnScreen(activityMytracks.getString(R.string.eula_accept), false, false) != null)) {
|
if ((getButtonOnScreen(activityMytracks.getString(R.string.eula_accept), false, false) != null)) {
|
||||||
getButtonOnScreen(activityMytracks.getString(R.string.eula_accept), true, true);
|
getButtonOnScreen(activityMytracks.getString(R.string.eula_accept), true, true);
|
||||||
}
|
}
|
||||||
if (SOLO.waitForText(activityMytracks.getString(R.string.sync_drive_title))) {
|
if (SOLO.waitForText(activityMytracks.getString(R.string.sync_drive_confirm_title))) {
|
||||||
// Click for Sync with Google Drive(Don't enable sync as default).
|
// Click for Sync with Google Drive(Don't enable sync as default).
|
||||||
getButtonOnScreen(activityMytracks.getString(R.string.generic_no), true, true);
|
getButtonOnScreen(activityMytracks.getString(R.string.generic_no), true, true);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
|
|||||||
Reference in New Issue
Block a user