本文整理汇总了Java中com.google.android.gms.drive.DriveFolder.DriveFolderResult方法的典型用法代码示例。如果您正苦于以下问题:Java DriveFolder.DriveFolderResult方法的具体用法?Java DriveFolder.DriveFolderResult怎么用?Java DriveFolder.DriveFolderResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.drive.DriveFolder
的用法示例。
在下文中一共展示了DriveFolder.DriveFolderResult方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResult
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFolderResult result) {
if (!result.getStatus().isSuccess()) {
uploadFailed();
return;
}
triggerUpload(result.getDriveFolder());
}
示例2: createFolder
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public PendingResult<DriveFolder.DriveFolderResult> createFolder(GoogleApiClient paramGoogleApiClient, final MetadataChangeSet paramMetadataChangeSet)
{
// Byte code:
// 0: aload_2
// 1: ifnonnull +13 -> 14
// 4: new 14 java/lang/IllegalArgumentException
// 7: dup
// 8: ldc 16
// 10: invokespecial 19 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;)V
// 13: athrow
// 14: aload_2
// 15: invokevirtual 29 com/google/android/gms/drive/MetadataChangeSet:getMimeType ()Ljava/lang/String;
// 18: ifnull +25 -> 43
// 21: aload_2
// 22: invokevirtual 29 com/google/android/gms/drive/MetadataChangeSet:getMimeType ()Ljava/lang/String;
// 25: ldc 23
// 27: invokevirtual 35 java/lang/String:equals (Ljava/lang/Object;)Z
// 30: ifne +13 -> 43
// 33: new 14 java/lang/IllegalArgumentException
// 36: dup
// 37: ldc 52
// 39: invokespecial 19 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;)V
// 42: athrow
// 43: aload_1
// 44: new 54 com/google/android/gms/drive/internal/l$2
// 47: dup
// 48: aload_0
// 49: aload_2
// 50: invokespecial 57 com/google/android/gms/drive/internal/l$2:<init> (Lcom/google/android/gms/drive/internal/l;Lcom/google/android/gms/drive/MetadataChangeSet;)V
// 53: invokevirtual 48 com/google/android/gms/common/api/GoogleApiClient:b (Lcom/google/android/gms/common/api/a$a;)Lcom/google/android/gms/common/api/a$a;
// 56: areturn
}
示例3: createFolderIfNeeded
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
private DriveFolder createFolderIfNeeded(DriveFolder root) {
DriveApi.MetadataBufferResult folders = root.queryChildren(mClient, new Query.Builder()
.addFilter(Filters.eq(SearchableField.MIME_TYPE, DriveFolder.MIME_TYPE))
.addFilter(Filters.eq(SearchableField.TITLE, FOLDER_NAME))
.build()).await();
if (!folders.getStatus().isSuccess()) {
Log.d(TAG, "Failed to search metadata");
return null;
}
try {
if (folders.getMetadataBuffer().getCount() > 0) {
Log.d(TAG, "Using Existing Folder");
DriveId id = folders.getMetadataBuffer().get(0).getDriveId();
return Drive.DriveApi.getFolder(mClient, id);
} else {
Log.d(TAG, "Creating Folder");
DriveFolder.DriveFolderResult folderResult = root.createFolder(mClient,
new MetadataChangeSet.Builder()
.setTitle(FOLDER_NAME)
.build()
)
.await();
if (!folderResult.getStatus().isSuccess()) {
Log.e(TAG, "Failed to create folder.");
return null;
}
return folderResult.getDriveFolder();
}
} finally {
folders.getMetadataBuffer().release();
}
}
示例4: getAppFolder
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public static DriveFolder getAppFolder(GoogleApiClient mClient) {
DriveFolder PluginServiceDir = Drive.DriveApi.getRootFolder(mClient);
DriveId id = GDrive.findChild(mClient, "PowerControlApp_Backup", PluginServiceDir);
if (id == null) {
DriveFolder.DriveFolderResult result = GDrive.createAppDir(mClient, PluginServiceDir);
if (!result.getStatus().isSuccess()) {
// We failed, stop the task and return.
return null;
}
return result.getDriveFolder();
} else
return Drive.DriveApi.getFolder(mClient, id);
}
示例5: getOrCreateDriveFolder
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
* search on a particualr folder or root
*/
public static DriveId getOrCreateDriveFolder(GoogleApiClient mGoogleApiClient,DriveId baseFolderId, String targetFolder) throws ImportExportException {
DriveFolder baseFolder=null;
if (baseFolderId!=null) {
baseFolder=Drive.DriveApi.getFolder(mGoogleApiClient, baseFolderId);
//DriveResource.MetadataResult r = baseFolder.getMetadata(mGoogleApiClient).await();
}
if (baseFolder==null) {
baseFolder=Drive.DriveApi.getRootFolder(mGoogleApiClient);
}
DriveId folder = null;
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
Query query = new Query.Builder()
.addFilter(Filters.eq(SearchableField.TITLE, targetFolder))
.addFilter(Filters.eq(SearchableField.TRASHED, false))
.addFilter(Filters.eq(SearchableField.MIME_TYPE, "application/vnd.google-apps.folder"))
.build();
// fire the query
DriveApi.MetadataBufferResult rslt =baseFolder.queryChildren(mGoogleApiClient,query).await();
//DriveApi.MetadataBufferResult rslt = Drive.DriveApi.query(mGoogleApiClient, query).await();
if (rslt.getStatus().isSuccess()) {
MetadataBuffer mdb = null;
try {
mdb = rslt.getMetadataBuffer();
for (Metadata md : mdb) {
if (md == null || !md.isDataValid() || md.isTrashed()) continue;
// md.getTitle(), md.getDriveId(), ....
if (md.getTitle().equals(targetFolder)) {
folder = md.getDriveId();
}
}
} finally {
if (mdb != null) mdb.close();
}
}
//if not found create it
if (folder == null) {
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle(targetFolder).build();
DriveFolder.DriveFolderResult rslt2 = baseFolder.createFolder(mGoogleApiClient, changeSet).await();
folder = rslt2.getDriveFolder().getDriveId();
}
return folder;
} else {
throw new ImportExportException(R.string.gdocs_connection_failed);
}
}
示例6: b
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public b(a.c<DriveFolder.DriveFolderResult> paramc)
{
this.jW = paramc;
}
示例7: r
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public DriveFolder.DriveFolderResult r(Status paramStatus)
{
return new l.e(paramStatus, null);
}
示例8: createAppDir
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public static DriveFolder.DriveFolderResult createAppDir(GoogleApiClient mClient, DriveFolder baseFolder) {
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle("PowerControlApp_Backup").build();
return baseFolder.createFolder(mClient, changeSet).await();
}
示例9: doInBackground
import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
RuntimeDataController c = RuntimeDataController.getDataController();
// Enter dir
DriveFolder PluginServiceDir = GDrive.getAppFolder(mClient);
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle(Utils.getDeviceName() + " " + Utils.getDateTime(context)).build();
DriveFolder.DriveFolderResult result = PluginServiceDir.createFolder(mClient, changeSet).await(3, TimeUnit.SECONDS);
if (!result.getStatus().isSuccess()) {
// We failed, stop the task and return.
return false;
}
DriveFolder target = result.getDriveFolder();
boolean s;
s = createFile(c.sceneCollection.toJSON(), "scenes.json", target, "text/plain");
s &= createFile(c.groupCollection.toJSON(), "groups.json", target, "text/plain");
s &= createFile(c.deviceCollection.toJSON(), "devices.json", target, "text/plain");
// Create icons folder
changeSet = new MetadataChangeSet.Builder().setTitle("icons").build();
result = target.createFolder(mClient, changeSet).await(3, TimeUnit.SECONDS);
if (!result.getStatus().isSuccess()) {
// We failed, stop the task and return.
return false;
}
DriveFolder iconsFolder = result.getDriveFolder();
Icons.IconFile[] icons = Icons.getAllIcons(context);
for (Icons.IconFile f : icons) {
try {
// Open sub folder
String relativePath = f.type.name() + f.state.name();
DriveId subFolderID = GDrive.findChild(mClient, relativePath, iconsFolder);
DriveFolder subFolder;
if (subFolderID == null) { // not existing, create it
changeSet = new MetadataChangeSet.Builder().setTitle(relativePath).build();
result = iconsFolder.createFolder(mClient, changeSet).await(3, TimeUnit.SECONDS);
if (!result.getStatus().isSuccess()) {
// We failed, continue with the next file
Log.e(TAG, "Failed to create sub folder " + relativePath);
continue;
}
subFolder = result.getDriveFolder();
} else
subFolder = Drive.DriveApi.getFolder(mClient, subFolderID);
FileInputStream stream = new FileInputStream(f.file);
createFile(stream, f.file.getName(), subFolder, f.file.getName().endsWith("png") ? "image/png" : "image/jpeg");
} catch (FileNotFoundException ignored) {
}
}
return s;
}