当前位置: 首页>>代码示例>>Java>>正文


Java DriveFolder.DriveFileResult方法代码示例

本文整理汇总了Java中com.google.android.gms.drive.DriveFolder.DriveFileResult方法的典型用法代码示例。如果您正苦于以下问题:Java DriveFolder.DriveFileResult方法的具体用法?Java DriveFolder.DriveFileResult怎么用?Java DriveFolder.DriveFileResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.drive.DriveFolder的用法示例。


在下文中一共展示了DriveFolder.DriveFileResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEmptyDriveFile

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * Create an empty file with the given {@code fileName} and {@code mimeType}.
 *
 * @return {@link DriveId} of the specific file.
 */
private DriveId createEmptyDriveFile(String fileName, String mimeType) {
    DriveApi.DriveContentsResult result =
            Drive.DriveApi.newDriveContents(mGoogleApiClient).await();

    MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
            .setTitle(fileName)
            .setMimeType(mimeType)
            .setStarred(true)
            .build();

    // Create a new file with the given changeSet in the AppData folder.
    DriveFolder.DriveFileResult driveFileResult = Drive.DriveApi.getAppFolder(mGoogleApiClient)
            .createFile(mGoogleApiClient, changeSet, result.getDriveContents())
            .await();
    return driveFileResult.getDriveFile().getDriveId();
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:22,代码来源:DriveHelper.java

示例2: commitToNewFile

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * Creates a new file and adds the {@link DriveContents} passed to this method.
 * @return Returns a boolean stating the success of this operation
 */
private boolean commitToNewFile(DriveContents driveContents) {
    DebugLog.logMethod();
    MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
            .setTitle("CouponsTrackerData.txt")
            .setMimeType("text/plain")
            .build();

    DriveFolder.DriveFileResult driveFileResult = Drive.DriveApi
            .getAppFolder(getGoogleApiClient())
            .createFile(getGoogleApiClient(), changeSet, driveContents)
            .await();
    DebugLog.logMessage("DriveFileResult: statusCode - " + driveFileResult.getStatus().getStatusCode()
            + ", statusMessage: " + driveFileResult.getStatus().getStatusMessage());
    return driveFileResult.getStatus().isSuccess();
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:20,代码来源:ExportToDriveService.java

示例3: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    progress.setProgress(progress.getCurrentProgress() + 1);
    if (!result.getStatus().isSuccess()) {
        errors += 1;
        return;
    }

    if (progress.getCurrentProgress() == progress.getMaxProgress()) {

        new AlertDialogWrapper.Builder(SettingsBackup.this)
                .setTitle(R.string.backup_success)
                .setPositiveButton(R.string.btn_close, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                }).show();
    }
}
 
开发者ID:ccrama,项目名称:Slide,代码行数:21,代码来源:SettingsBackup.java

示例4: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
        public void onResult(DriveFolder.DriveFileResult result) {
            mConnectionRequested = false; // for testing
            if (!result.getStatus().isSuccess()) {
                showMessage("Error while trying to create the file");
                return;
            }
            DriveId driveId = result.getDriveFile().getDriveId();
            showMessage("Created file: " + driveId);
            if (LDebug.ON) Log.d(LOG_TAG, "XXX Created file: " + driveId);
            DriveFile file = driveId.asDriveFile();
            file.addChangeSubscription(getGoogleApiClient());

            if (LDebug.ON) Log.d(LOG_TAG, "XXX resource ID file: "
                    + result.getDriveFile().getDriveId().getResourceId()); // returns null

//            result.getDriveFile().getMetadata().isCanceled();
        }
 
开发者ID:rickshory,项目名称:VegNabAS,代码行数:19,代码来源:MainVNActivity.java

示例5: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Error while trying to create the file");
        return;
    }
    String sDriveID = result.getDriveFile().getDriveId().encodeToString();
    showMessage("Local Save to Google Drive");
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:10,代码来源:SyncToDriveService.java

示例6: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        uploadFailed();
        return;
    }
    currentUpload++;
    if (currentUpload == fileNames.size()) {
        uploadSucceeded();
    } else {
        triggerNextUpload();
    }
}
 
开发者ID:apuder,项目名称:ActivityMonitor,代码行数:14,代码来源:DriveUploader.java

示例7: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        Log.d(TAG, "Error while trying to create the file");
        return;
    }
    Log.d(TAG, "Created a file with content: " + result.getDriveFile().getDriveId());
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:9,代码来源:TestActivity.java

示例8: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Error while trying to create the file " + result.getStatus());
        return;
    }


    DriveFile file = result.getDriveFile();
    new EditContentsAsyncTask(SettingsActivity.this).execute(file);

    //showMessage("Created a file in App Folder: ");

}
 
开发者ID:webianks,项目名称:HatkeMessenger,代码行数:15,代码来源:SettingsActivity.java

示例9: onFileCreatedResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * {@link DriveFioResultsCallback} called when the DriveFile with the queried name is finished
 * being created. If the result was not a success, logs that. Regardless, attempts to move
 * forward with whatever request required that the DriveFile be created be attempting to load
 * a reference to the DriveFile
 *
 * @param result the DriveFileResult indicating the exit status of the DriveFile creation
 *               operation
 */
@Override
public void onFileCreatedResult(DriveFolder.DriveFileResult result) {
    if (debug) {
        Log.d("DriveLayer", "File created");
    }

    if (!result.getStatus().isSuccess()) {
        Log.e("DriveLayer", "Error creating file");
    }

    new DriveFio(this).loadDriveFile(mDriveClient, result.getDriveFile(), callback.openModeWriteable());
}
 
开发者ID:akilawickey,项目名称:pinPotha,代码行数:22,代码来源:DriveLayer.java

示例10: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * Results handler for the asynchronous work methods in this class. Triages the Result and then
 * passes it up to the appropriate callback based on the type.
 *
 * @param result the returned result.
 */
@Override
public void onResult(Result result) {
    if (result instanceof DriveApi.DriveContentsResult) {
        callback.onFioResult((DriveApi.DriveContentsResult) result);
    }

    if (result instanceof DriveFolder.DriveFileResult) {
        callback.onFileCreatedResult((DriveFolder.DriveFileResult) result);
    }
}
 
开发者ID:akilawickey,项目名称:pinPotha,代码行数:17,代码来源:DriveFio.java

示例11: onFileCreatedResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * {@link DriveFioResultsCallback} called when the DriveFile with the queried name is finished
 * being created. If the result was not a success, logs that. Regardless, attempts to move
 * forward with whatever request required that the DriveFile be created be attempting to load
 * a reference to the DriveFile
 * @param result the DriveFileResult indicating the exit status of the DriveFile creation
 *               operation
 */
@Override
public void onFileCreatedResult(DriveFolder.DriveFileResult result) {
    if (debug) {
        Log.d("DriveLayer", "File created");
    }

    if (!result.getStatus().isSuccess()) {
        Log.e("DriveLayer", "Error creating file");
    }

    new DriveFio(this).loadDriveFile(mDriveClient, result.getDriveFile(), callback.openModeWriteable());
}
 
开发者ID:akilawickey,项目名称:pinPotha,代码行数:21,代码来源:DriveLayer.java

示例12: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
/**
 * Results handler for the asynchronous work methods in this class. Triages the Result and then
 * passes it up to the appropriate callback based on the type.
 * @param result the returned result.
 */
@Override
public void onResult(Result result) {
    if (result instanceof DriveApi.DriveContentsResult) {
        callback.onFioResult((DriveApi.DriveContentsResult) result);
    }

    if (result instanceof DriveFolder.DriveFileResult) {
        callback.onFileCreatedResult((DriveFolder.DriveFileResult) result);
    }
}
 
开发者ID:akilawickey,项目名称:pinPotha,代码行数:16,代码来源:DriveFio.java

示例13: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        dialog.dismiss();
        return;
    }
    Toast.makeText(MainActivity.this, getResources().getString(R.string.BackupoK), Toast.LENGTH_SHORT).show();
}
 
开发者ID:rulogarcillan,项目名称:PainLog,代码行数:9,代码来源:MainActivity.java

示例14: createFile

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
public PendingResult<DriveFolder.DriveFileResult> createFile(GoogleApiClient paramGoogleApiClient, final MetadataChangeSet paramMetadataChangeSet, final Contents paramContents)
{
  if (paramMetadataChangeSet == null)
    throw new IllegalArgumentException("MetatadataChangeSet must be provided.");
  if (paramContents == null)
    throw new IllegalArgumentException("Contents must be provided.");
  if ("application/vnd.google-apps.folder".equals(paramMetadataChangeSet.getMimeType()))
    throw new IllegalArgumentException("May not create folders (mimetype: application/vnd.google-apps.folder) using this method. Use DriveFolder.createFolder() instead.");
  return paramGoogleApiClient.b(new i()
  {
    protected void a(j paramAnonymousj)
    {
      try
      {
        paramContents.close();
        paramAnonymousj.cN().a(new CreateFileRequest(l.this.getDriveId(), paramMetadataChangeSet.cM(), paramContents), new l.a(this));
        return;
      }
      catch (RemoteException localRemoteException)
      {
        a(new l.d(new Status(8, localRemoteException.getLocalizedMessage(), null), null));
      }
    }

    public DriveFolder.DriveFileResult q(Status paramAnonymousStatus)
    {
      return new l.d(paramAnonymousStatus, null);
    }
  });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:31,代码来源:l.java

示例15: onResult

import com.google.android.gms.drive.DriveFolder; //导入方法依赖的package包/类
@Override
public void onResult(@NonNull DriveFolder.DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        Log.w(LOG_TAG, "Error while trying to create the file");
        return;
    }
    mDriveId = result.getDriveFile().getDriveId();
}
 
开发者ID:zhuqianqian,项目名称:Passbook,代码行数:9,代码来源:DriveSyncService.java


注:本文中的com.google.android.gms.drive.DriveFolder.DriveFileResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。