Change the the return value of SyncUtils.getMyTracksFolder(context, drive) from string to File object.

This commit is contained in:
youtaol
2013-02-18 19:50:21 +08:00
parent 3bf9e9343d
commit 9d6ba74a6d
5 changed files with 8 additions and 33 deletions
@@ -76,7 +76,7 @@ public class SendDriveAsyncTask extends AbstractSendAsyncTask {
return false;
}
Drive drive = SyncUtils.getDriveService(credential);
String folderId = SyncUtils.getMyTracksFolder(context, drive);
String folderId = SyncUtils.getMyTracksFolder(context, drive).getId();
if (folderId == null) {
return false;
}
@@ -113,7 +113,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter {
driveAccountName = account.name;
}
String folderId = SyncUtils.getMyTracksFolder(context, drive);
String folderId = SyncUtils.getMyTracksFolder(context, drive).getId();
if (folderId == null) {
return;
}
@@ -153,20 +153,20 @@ public class SyncUtils {
* @param context the context
* @param drive the drive
*/
public static String getMyTracksFolder(Context context, Drive drive) throws IOException {
public static File getMyTracksFolder(Context context, Drive drive) throws IOException {
String folderName = context.getString(R.string.my_tracks_app_name);
List list = drive.files()
.list().setQ(String.format(Locale.US, MY_TRACKS_FOLDER_QUERY, folderName));
FileList result = list.execute();
for (File file : result.getItems()) {
if (file.getSharedWithMeDate() == null) {
return file.getId();
return file;
}
}
File file = new File();
file.setTitle(folderName);
file.setMimeType(FOLDER_MIME_TYPE);
return drive.files().insert(file).execute().getId();
return drive.files().insert(file).execute();
}
/**