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


Java DriveResource.MetadataResult方法代码示例

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


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

示例1: updateMetadata

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
public PendingResult<DriveResource.MetadataResult> updateMetadata(GoogleApiClient paramGoogleApiClient, final MetadataChangeSet paramMetadataChangeSet)
{
  // Byte code:
  //   0: aload_2
  //   1: ifnonnull +13 -> 14
  //   4: new 35	java/lang/IllegalArgumentException
  //   7: dup
  //   8: ldc 37
  //   10: invokespecial 40	java/lang/IllegalArgumentException:<init>	(Ljava/lang/String;)V
  //   13: athrow
  //   14: aload_1
  //   15: new 42	com/google/android/gms/drive/internal/m$2
  //   18: dup
  //   19: aload_0
  //   20: aload_2
  //   21: invokespecial 45	com/google/android/gms/drive/internal/m$2:<init>	(Lcom/google/android/gms/drive/internal/m;Lcom/google/android/gms/drive/MetadataChangeSet;)V
  //   24: 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;
  //   27: areturn
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:m.java

示例2: onResult

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
@Override
public void onResult(DriveResource.MetadataResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Problem while trying to fetch metadata");
        return;
    }
    Metadata metadata = result.getMetadata();
    showMessage("Metadata successfully fetched. Title: " + metadata.getTitle());
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:10,代码来源:SyncToDriveService.java

示例3: onResult

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
@Override
public void onResult(DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        Log.i(TAG, "Error creating the file");
        Toast.makeText(UploadFileActivity.this,
                "Error adding file to Drive", Toast.LENGTH_SHORT).show();
        return;
    }
    Log.i(TAG, "File added to Drive");
    Log.i(TAG, "Created a file with content: "
            + result.getDriveFile().getDriveId());
    Toast.makeText(UploadFileActivity.this,
            "File successfully added to Drive", Toast.LENGTH_SHORT).show();
    final PendingResult<DriveResource.MetadataResult> metadata
            = result.getDriveFile().getMetadata(googleApiClient);
    metadata.setResultCallback(new
                                       ResultCallback<DriveResource.MetadataResult>() {
                                           @Override
                                           public void onResult(DriveResource.MetadataResult metadataResult) {
                                               Metadata data = metadataResult.getMetadata();
                                               Log.i(TAG, "Title: " + data.getTitle());
                                               drive_id = data.getDriveId().encodeToString();
                                               Log.i(TAG, "DrivId: " + drive_id);
                                               driveID = data.getDriveId();
                                               Log.i(TAG, "Description: " + data.getDescription().toString());
                                               Log.i(TAG, "MimeType: " + data.getMimeType());
                                               Log.i(TAG, "File size: " + String.valueOf(data.getFileSize()));
                                           }
                                       });
}
 
开发者ID:JonathanImperato,项目名称:Service-Notes,代码行数:31,代码来源:UploadFileActivity.java

示例4: getMetadata

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
public PendingResult<DriveResource.MetadataResult> getMetadata(GoogleApiClient paramGoogleApiClient)
{
  // Byte code:
  //   0: aload_1
  //   1: new 23	com/google/android/gms/drive/internal/m$1
  //   4: dup
  //   5: aload_0
  //   6: invokespecial 26	com/google/android/gms/drive/internal/m$1:<init>	(Lcom/google/android/gms/drive/internal/m;)V
  //   9: invokevirtual 31	com/google/android/gms/common/api/GoogleApiClient:a	(Lcom/google/android/gms/common/api/a$a;)Lcom/google/android/gms/common/api/a$a;
  //   12: areturn
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:12,代码来源:m.java

示例5: onActivityResult

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    switch (requestCode) {
        case RESOLVE_CONNECTION_REQUEST_CODE:
            if (resultCode == RESULT_OK) {
                mGoogleApiClient.connect();
            }
            break;
        case REQUEST_CODE_CREATOR:
            if (resultCode == RESULT_OK) {
                Toast.makeText(getApplicationContext(),"All Notes Backed Up",Toast.LENGTH_SHORT).show();
            }
            break;
        case REQUEST_CODE_OPENER:
            if (resultCode == RESULT_OK) {
                DriveId mCurrentDriveId = data.getParcelableExtra(OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);

                DriveFile file = Drive.DriveApi.getFile(mGoogleApiClient, mCurrentDriveId);

                final PendingResult<DriveResource.MetadataResult> metadataResult = file.getMetadata(mGoogleApiClient);

                final PendingResult<DriveApi.DriveContentsResult> contentsResult = file.open(mGoogleApiClient,
                        DriveFile.MODE_READ_ONLY | DriveFile.MODE_WRITE_ONLY, null);

                file.open(mGoogleApiClient, DriveFile.MODE_READ_ONLY, null)
                        .setResultCallback(new ResultCallback<DriveApi.DriveContentsResult>() {
                            @Override
                            public void onResult(DriveApi.DriveContentsResult result) {
                                if (!result.getStatus().isSuccess()) {
                                    Toast.makeText(getApplicationContext(),"Error While Restoring Notes",Toast.LENGTH_SHORT).show();
                                    return;
                                }
                                // DriveContents object contains pointers
                                // to the actual byte stream
                                DriveContents contents = result.getDriveContents();
                                BufferedReader reader = new BufferedReader(new InputStreamReader(contents.getInputStream()));
                                StringBuilder builder = new StringBuilder();
                                String line;
                                try {
                                    while ((line = reader.readLine()) != null) {
                                        builder.append(line);
                                    }
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                String contentsAsString = builder.toString();

                               // mDbHelper.createNotesFromJson(contentsAsString);

                                Toast.makeText(getApplicationContext(), "Notes Restored", Toast.LENGTH_SHORT).show();

                            }
                        });
            }
        default:
            super.onActivityResult(requestCode, resultCode, data);
            break;
    }

}
 
开发者ID:JonathanImperato,项目名称:Service-Notes,代码行数:61,代码来源:NotesBackupActivity.java

示例6: s

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
public DriveResource.MetadataResult s(Status paramStatus)
{
  return new m.c(paramStatus, null);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:m.java

示例7: b

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
public b(a.c<DriveResource.MetadataResult> paramc)
{
  this.jW = paramc;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:m.java

示例8: lookupDriveFile

import com.google.android.gms.drive.DriveResource; //导入方法依赖的package包/类
static public DriveFile lookupDriveFile(DriveId driveId, GoogleApiClient apiClient) {
    DriveFile result = null;

    // First, check if ID is valid
    if (driveId != null) {
        Log.d(TAG, "DriveID passed is not null, trying to get the corresponding file");
        try {
            result = Drive.DriveApi.getFile(apiClient, driveId);
            if (result != null)  {
                // check if metadata is ok. For example, if the file has been directly removed from
                // the server, the getFile can return a file that is actually not valid. Hopefully
                // the metadata will get the correct info
                try {
                    DriveResource.MetadataResult metadataResult = result.getMetadata(apiClient).await();
                    if (!metadataResult.getStatus().isSuccess()) {
                        result = null;
                    }
                } catch (Exception ex) {
                    result = null;
                }
            }
        } catch (Exception e) {
            Log.d(TAG, "Saved drive ID "+driveId+" seems to be invalid (message: " +
                    e.getMessage()+"). Ignoring it");
            result = null;
        }
    }

    if (result == null) {
        // search for a file with the expected name (and get the most recent one, if many)
        Log.d(TAG, "DriveID passed is null, looking up for a file named "+DRIVE_FILENAME);
        Metadata metaOfMostRecent = null;
        MetadataBuffer buffer = Drive.DriveApi.getAppFolder(apiClient)
                .listChildren(apiClient).await().getMetadataBuffer();
        Log.d(TAG, "Found "+buffer.getCount()+" files");
        for (Metadata metadata: buffer) {
            if (metaOfMostRecent != null) {
                Log.w(TAG, "Warning, found more than one file named "+DRIVE_FILENAME+
                        " in AppData folder. Using the most recently modified.");
            }
            if (metaOfMostRecent == null || metaOfMostRecent
                    .getModifiedDate().compareTo(metadata.getModifiedDate())<0) {
                metaOfMostRecent = metadata;
            }
        }
        if (metaOfMostRecent != null) {
            driveId = metaOfMostRecent.getDriveId();
            result = Drive.DriveApi.getFile(apiClient, driveId);
        }
        buffer.close();
    }

    return result;
}
 
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:55,代码来源:DriveHelper.java


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