本文整理汇总了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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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");
}
示例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();
}
}
示例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());
}
示例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: ");
}
示例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());
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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();
}
示例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);
}
});
}
示例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();
}