• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MetadataResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: b

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


示例17: doInBackgroundConnected

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
@Override
protected Metadata doInBackgroundConnected(Void... arg0) {

    // First we start by creating a new contents, and blocking on the
    // result by calling await().
    ContentsResult contentsResult =
            Drive.DriveApi.newContents(getGoogleApiClient()).await();
    if (!contentsResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }

    // Read the contents and open its output stream for writing, then
    // write a short message.
    Contents originalContents = contentsResult.getContents();
    OutputStream os = originalContents.getOutputStream();
    try {
        os.write("Hello world!\n".getBytes());
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }

    // Create the metadata for the new file including title and MIME
    // type.
    MetadataChangeSet originalMetadata = new MetadataChangeSet.Builder()
            .setTitle("AsyncTaskFile.txt")
            .setMimeType("text/plain").build();

    // Create the file in the root folder, again calling await() to
    // block until the request finishes.
    DriveFolder rootFolder = Drive.DriveApi.getRootFolder(getGoogleApiClient());
    DriveFileResult fileResult = rootFolder.createFile(
            getGoogleApiClient(), originalMetadata, originalContents).await();
    if (!fileResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }

    // Finally, fetch the metadata for the newly created file, again
    // calling await to block until the request finishes.
    MetadataResult metadataResult = fileResult.getDriveFile()
            .getMetadata(getGoogleApiClient())
            .await();
    if (!metadataResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }
    // We succeeded, return the newly created metadata.
    return metadataResult.getMetadata();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:52,代码来源:SyncRequestsActivity.java


示例18: getMetadata

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
public Metadata getMetadata(DriveFile mDriveFile) {
	MetadataResult mMetadataResult = mDriveFile.getMetadata(mGoogleApiClient).await();
	if (!mMetadataResult.getStatus().isSuccess()) return null;
	return mMetadataResult.getMetadata();		
}
 
开发者ID:kanpol,项目名称:omni-note,代码行数:6,代码来源:DriveHelper.java


示例19: pinFile

import com.google.android.gms.drive.DriveResource.MetadataResult; //导入依赖的package包/类
private void pinFile(final DriveFile file){
    MetadataChangeSet changeSet;
    MetadataResult metadataResult;


    Log.i(TAG, "set file and pinned");

    changeSet = new MetadataChangeSet.Builder()
            .setPinned(true)
            .build();

    metadataResult = file.updateMetadata(mGoogleApiClient, changeSet).await();

    checkStatus(metadataResult);
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:16,代码来源:GDriveCloudProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Attribute类代码示例发布时间:2022-05-22
下一篇:
Java KeyStoreKeyManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap