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


Java MetadataResult类代码示例

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


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

示例1: updateMetadata

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的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.MetadataResult; //导入依赖的package包/类
@Override
public void onResult(MetadataResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Problem while trying to retrieve the file metadata");
        return;
    }
    if (result.getMetadata().isPinnable()) {
        showMessage("File is not pinnable");
        return;
    }
    if (result.getMetadata().isPinned()) {
        showMessage("File is already pinned");
        return;
    }
    DriveFile file = Drive.DriveApi.getFile(getGoogleApiClient(), mFileId);
    MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
            .setPinned(true)
            .build();
    file.updateMetadata(getGoogleApiClient(), changeSet)
            .setResultCallback(pinningCallback);
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:22,代码来源:PinFileActivity.java

示例3: sync_pinFile

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Pinning a file causes the latest version of that file's contents and metadata 
 * to be downloaded to the local device whenever a new version is available. 
 * Once a file is pinned by one application it is locally available to all 
 * applications that have permissions to that file.<br><br>
 * 
 * <b>Note</b><br>
 * Because pinned files are downloaded to the device whenever a new version is 
 * available, pinning files can significantly increase a user's mobile data and 
 * device storage usage. You should avoid pinning files without a user's consent 
 * and inform them of the extra storage and bandwidth requirements of pinning files. 
 * These requirements increase for larger and frequently updated files.
 * 
 * @param driveFile The Drive file to PIN.
 * @param pin
 * @return	TRUE if is done successfully otherwise FALSE.
 */
public boolean sync_pinFile(final DriveFile driveFile, boolean pin) throws TBDriveException {
	
	boolean res = false;
	
   	//DriveFile file = Drive.DriveApi.getFile(getGoogleApiClient(), mFileId);
       MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
               .setPinned(pin)
               .build();
       MetadataResult result = driveFile.updateMetadata(getGoogleApiClient(), changeSet).await();
       
       if (!result.getStatus().isSuccess()) {
           Log.e(TAG, "Problem while trying to pin the file. '" + result.getStatus().getStatusMessage() + "'");
           throw new TBDriveException("Problem while trying to pin the file. '" + result.getStatus().getStatusMessage() + "'");            
       }
       
       Log.e(TAG, "File successfully pinned to the device.");
       res = true;
       
       return res;
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:38,代码来源:TBDrive.java

示例4: getMetadata

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的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: onResult

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
@Override
public void onResult(MetadataResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Problem while trying to update metadata");
        return;
    }
    showMessage("Metadata successfully updated");
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:9,代码来源:EditMetadataActivity.java

示例6: onResult

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
@Override
public void onResult(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:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:10,代码来源:RetrieveMetadataActivity.java

示例7: doInBackground

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Opens contents for the given file, executes the editing tasks, saves the
 * metadata and content changes.
 */
@Override
protected com.google.android.gms.common.api.Status doInBackground(DriveId... params) {
  DriveFile file = Drive.DriveApi.getFile(mClient, params[0]);
  PendingResult<ContentsResult> openContentsResult =
      file.openContents(mClient, DriveFile.MODE_WRITE_ONLY, null);
  openContentsResult.await();
  if (!openContentsResult.await().getStatus().isSuccess()) {
    return openContentsResult.await().getStatus();
  }

  Changes changes = edit(openContentsResult.await().getContents());
  PendingResult<MetadataResult> metadataResult = null;
  PendingResult<com.google.android.gms.common.api.Status>
          closeContentsResult = null;

  if (changes.getMetadataChangeSet() != null) {
    metadataResult = file.updateMetadata(mClient, changes.getMetadataChangeSet());
    metadataResult.await();
    if (!metadataResult.await().getStatus().isSuccess()) {
      return metadataResult.await().getStatus();
    }
  }

  if (changes.getContents() != null) {
    closeContentsResult = file.commitAndCloseContents(mClient, changes.getContents());
    closeContentsResult.await();
  }
  return closeContentsResult.await().getStatus();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:34,代码来源:EditDriveFileAsyncTask.java

示例8: get

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Retrieves the currently selected Drive file's meta data and contents.
 */
private void get() {
    Log.d(TAG, "Retrieving...");
    DriveFile file = Drive.DriveApi.getFile(mGoogleApiClient, mCurrentDriveId);
    final PendingResult<MetadataResult>
            metadataResult = file.getMetadata(mGoogleApiClient);
    final PendingResult<ContentsResult>
            contentsResult = file.openContents(mGoogleApiClient,
            DriveFile.MODE_READ_ONLY | DriveFile.MODE_WRITE_ONLY, null);
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:13,代码来源:HomeActivity.java

示例9: doInBackground

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Opens contents for the given file, executes the editing tasks, saves the
 * metadata and content changes.
 */
@Override
protected com.google.android.gms.common.api.Status doInBackground(DriveId... params) {
    DriveFile file = Drive.DriveApi.getFile(mClient, params[0]);
    PendingResult<ContentsResult> openContentsResult =
            file.openContents(mClient, DriveFile.MODE_WRITE_ONLY, null);
    if (!openContentsResult.await().getStatus().isSuccess()) {
        return openContentsResult.await().getStatus();
    }

    Changes changes = edit(openContentsResult.await().getContents());
    PendingResult<MetadataResult> metadataResult = null;
    PendingResult<com.google.android.gms.common.api.Status>
            closeContentsResult = null;

    if (changes.getMetadataChangeSet() != null) {
        metadataResult = file.updateMetadata(mClient, changes.getMetadataChangeSet());
        if (!metadataResult.await().getStatus().isSuccess()) {
            return metadataResult.await().getStatus();
        }
    }

    if (changes.getContents() != null) {
        closeContentsResult = file.commitAndCloseContents(mClient, changes.getContents());
        closeContentsResult.await();
    }
    return closeContentsResult.await().getStatus();
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:32,代码来源:EditDriveFileAsyncTask.java

示例10: async_getDriveFileMetadata

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
  * Gets a Drive file metadata information.
  * 
  * @param driveFile	The Drive file
  * @param callback See {@link TBDriveGetMetadataOpCallback}
  */
 public void async_getDriveFileMetadata(DriveFile driveFile, final TBDriveGetMetadataOpCallback callback) {
 	
 	final ResultCallback<MetadataResult> fileGetMetadataCallback = new
          ResultCallback<MetadataResult>() {
      
@Override
      public void onResult(MetadataResult result) {
          if (!result.getStatus().isSuccess()) {
          	Log.e(TAG, "Problem getting drive file metadata: '" + result.getStatus().getStatusMessage() + "'");
              if(callback!=null) {
 					callback.setErrorCode(ERROR_FILE_GET_METADATA);
 					callback.setErrorMessage(ERROR_FILE_GET_METADATA_STRING);
 					callback.setErrorDetails(result.getStatus().getStatusMessage());
 					callback.run();
 				}
              return;
          }
          
          if(callback!=null) {
          	callback.setDriveFileMetaData(result.getMetadata());
          	callback.run();
	}
      }
  };
 	
 	driveFile.getMetadata(getGoogleApiClient())
 		.setResultCallback(fileGetMetadataCallback);
 }
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:35,代码来源:TBDrive.java

示例11: sync_getDriveFileMetadata

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Gets a Drive file metadata information.
 * 
 * @param driveFile
 * @return	The file metadata, see {@link MetadataResult}
 */
public MetadataResult sync_getDriveFileMetadata(DriveFile driveFile) throws TBDriveException {
	
	MetadataResult result = driveFile.getMetadata(getGoogleApiClient()).await();    	
	if (!result.getStatus().isSuccess()) {
    	Log.e(TAG, "Problem getting drive file metadata: '" + result.getStatus().getStatusMessage() + "'");
    	throw new TBDriveException("Problem getting drive file metadata: '" + result.getStatus().getStatusMessage() + "'");
    }
 
 return result;
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:17,代码来源:TBDrive.java

示例12: async_pinFile

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
/**
 * Pinning a file causes the latest version of that file's contents and metadata 
 * to be downloaded to the local device whenever a new version is available. 
 * Once a file is pinned by one application it is locally available to all 
 * applications that have permissions to that file.<br><br>
 * 
 * <b>Note</b><br>
 * Because pinned files are downloaded to the device whenever a new version is 
 * available, pinning files can significantly increase a user's mobile data and 
 * device storage usage. You should avoid pinning files without a user's consent 
 * and inform them of the extra storage and bandwidth requirements of pinning files. 
 * These requirements increase for larger and frequently updated files.
 * 
 * @param driveFile	The Drive file to PIN.
 * @param callback
 */
public void async_pinFile(final DriveFile driveFile, boolean pin, final TBDrivePinFileCallback callback) {
	
	/**
   	 * Handles the pinning request's response.
   	 */
   	final ResultCallback<MetadataResult> pinningCallback = new ResultCallback<MetadataResult>() {
   	    @Override
   	    public void onResult(MetadataResult result) {
   	        if (!result.getStatus().isSuccess()) {
   	            Log.e(TAG, "Problem while trying to pin the file. '" + result.getStatus().getStatusMessage() + "'");
   	            if(callback!=null) {
   					callback.setErrorCode(ERROR_FILE_PIN);
   					callback.setErrorMessage(ERROR_FILE_PIN_STRING);
   					callback.setErrorDetails(result.getStatus().getStatusMessage());
   					callback.run();
   				}
   	            return;
   	        }
   	        
   	        Log.e(TAG, "File successfully pinned to the device.");
   	        if(callback!=null) {
       			callback.setDriveFile(driveFile);
       			callback.setDriveFileMetaData(result.getMetadata());
       			callback.setStatus(result.getStatus());
       			callback.run();
       		}
   	    }
   	};
   	
   	
   	//DriveFile file = Drive.DriveApi.getFile(getGoogleApiClient(), mFileId);
       MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
               .setPinned(pin)
               .build();
       driveFile.updateMetadata(getGoogleApiClient(), changeSet)
               .setResultCallback(pinningCallback);
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:54,代码来源:TBDrive.java

示例13: uploadFile

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
@Override
public int uploadFile(File tempFile) {
    DriveFile driveFile;
    MetadataResult metadataResult;
    Metadata metadata;
    DriveContents driveContents = null;
    DriveContentsResult driveContentsResult;
    OutputStream outputStream;
    ExecutionOptions executionOptions;
    int complentionStatus;

    Log.i(TAG, "start upload of DB file temp:" + tempFile.getName());

    try {
        driveFile = mDriveId.asDriveFile();

        // Get metadata
        metadataResult = driveFile.getMetadata(mGoogleApiClient).await();
        checkStatus(metadataResult);

        metadata = metadataResult.getMetadata();

        Log.i(TAG, "try to upload of DB file:" + metadata.getOriginalFilename());

        if (!metadata.isPinned()) {
            pinFile(driveFile);
        }

        // Writing file
        driveContentsResult = mDriveContent.reopenForWrite(mGoogleApiClient).await();
        checkStatus(driveContentsResult);

        driveContents = driveContentsResult.getDriveContents();

        outputStream  = driveContents.getOutputStream();

        // Copio il file
        FileUtils.copyFile(tempFile, outputStream);
        Log.i(TAG, "try to commit file copy done");

        // Commit del file
        executionOptions = new ExecutionOptions.Builder()
                .setNotifyOnCompletion(true)
                .setConflictStrategy(ExecutionOptions.CONFLICT_STRATEGY_KEEP_REMOTE)
                .build();

        driveContents.commit(mGoogleApiClient, null, executionOptions);

        Log.i(TAG, "file committed - wait for complention");

        // Wait for complention
        complentionStatus = mGDriveCompletionRecevier.waitCompletion();

        Log.i(TAG, "received complention status:" + complentionStatus);

        if (complentionStatus == CompletionEvent.STATUS_CONFLICT) {
            return UPLOAD_CONFLICT;
        } else if (complentionStatus == CompletionEvent.STATUS_FAILURE) {
            throw new SyncException(SyncStatus.Code.ERROR_UPLOAD_CLOUD, "Error writing file to GDrive (FAILURE of commit)");
        }

        return UPLOAD_OK;
    } catch (IOException e) {
        if (driveContents != null) {
            driveContents.discard(mGoogleApiClient);
        }
        throw new SyncException(SyncStatus.Code.ERROR_UPLOAD_CLOUD, "Error writing file to GDrive message:" + e.getMessage());
    }
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:70,代码来源:GDriveCloudProvider.java

示例14: downloadFile

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
@Override
public InputStream downloadFile() {
    DriveFile driveFile;
    MetadataResult metadataResult;
    Metadata metadata;
    DriveContentsResult driveContentsResult;
    InputStream inputStream = null;

    Log.i(TAG, "start download of DB file");

    try {
        mDriveContent = null;
        driveFile = mDriveId.asDriveFile();

        // Get metadata
        metadataResult = driveFile.getMetadata(mGoogleApiClient).await();
        checkStatus(metadataResult);

        // Writing file
        driveContentsResult = driveFile.open(mGoogleApiClient, DriveFile.MODE_READ_ONLY, null).await();
        checkStatus(driveContentsResult);

        metadata = metadataResult.getMetadata();

        Log.i(TAG, "downloaded DB file:" + metadata.getOriginalFilename() + " modified on: " + metadata.getModifiedDate() + " size:" + metadata.getFileSize() + " bytes");

        mDriveContent = driveContentsResult.getDriveContents();

        inputStream  = mDriveContent.getInputStream();

        if (metadata.getFileSize() < 3) {
            inputStream.close();
            return null;
        }

        return inputStream;
    } catch (Exception e) {
        if (mDriveContent != null) {
            mDriveContent.discard(mGoogleApiClient);
        }
        throw new SyncException(SyncStatus.Code.ERROR_DOWNLOAD_CLOUD, "Error reading file from GDrive message:" + e.getMessage());
    }
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:44,代码来源:GDriveCloudProvider.java

示例15: s

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


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