From c0ec72f66a1957ce03033ba8ccb2260fe2b6d922 Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Tue, 5 Feb 2013 13:06:10 -0800 Subject: [PATCH] For "Shared with me" tracks, do not allow sending to Google Drive, do not allow sharing with Google Drive. For Drive tracks, exclude shared tracks. --- MyTracks/res/layout/choose_upload_service.xml | 2 +- .../apps/mytracks/TrackDetailActivity.java | 11 +++-- .../ChooseUploadServiceDialogFragment.java | 24 ++++++++-- .../mytracks/io/sendtogoogle/SendRequest.java | 48 +++++++++---------- .../apps/mytracks/io/sync/SyncUtils.java | 7 ++- 5 files changed, 56 insertions(+), 36 deletions(-) diff --git a/MyTracks/res/layout/choose_upload_service.xml b/MyTracks/res/layout/choose_upload_service.xml index 8dd4d494f..1af9231f3 100644 --- a/MyTracks/res/layout/choose_upload_service.xml +++ b/MyTracks/res/layout/choose_upload_service.xml @@ -21,7 +21,7 @@ limitations under the License. android:layout_width="match_parent" android:padding="8dp" android:stretchColumns="1" > - + CREATOR = new Parcelable.Creator< - SendRequest>() { - public SendRequest createFromParcel(Parcel in) { - return new SendRequest(in); - } + public static final Parcelable.Creator + CREATOR = new Parcelable.Creator() { + public SendRequest createFromParcel(Parcel in) { + return new SendRequest(in); + } - public SendRequest[] newArray(int size) { - return new SendRequest[size]; - } - }; + public SendRequest[] newArray(int size) { + return new SendRequest[size]; + } + }; } diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/sync/SyncUtils.java b/MyTracks/src/com/google/android/apps/mytracks/io/sync/SyncUtils.java index 8bbc2198f..48197c972 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/sync/SyncUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/sync/SyncUtils.java @@ -85,7 +85,7 @@ public class SyncUtils { // Get My Tracks folder KML files public static final String MY_TRACKS_FOLDER_FILES_QUERY = "'%s' in parents and mimeType = '" - + KML_MIME_TYPE + "' and trashed = false"; + + KML_MIME_TYPE + "' and trashed = false and not sharedWithMe"; // Get shared with me KML files public static final String SHARED_WITH_ME_FILES_QUERY = "sharedWithMe and mimeType = '" @@ -98,7 +98,7 @@ public class SyncUtils { @VisibleForTesting public static final String MY_TRACKS_FOLDER_QUERY = "'root' in parents and title = '%s' and mimeType = '" + FOLDER_MIME_TYPE - + "' and trashed = false"; + + "' and trashed = false and not sharedWithMe"; private static final String TAG = SyncUtils.class.getSimpleName(); private static final String SYNC_AUTHORITY = "com.google.android.maps.mytracks"; @@ -310,6 +310,9 @@ public class SyncUtils { if (!SyncUtils.KML_MIME_TYPE.equals(driveFile.getMimeType())) { return false; } + if (driveFile.getSharedWithMeDate() != null) { + return false; + } for (ParentReference parentReference : driveFile.getParents()) { String id = parentReference.getId(); if (id != null && id.equals(folderId)) {