當前位置: 首頁>>代碼示例>>Java>>正文


Java DriveFile.getDriveId方法代碼示例

本文整理匯總了Java中com.google.android.gms.drive.DriveFile.getDriveId方法的典型用法代碼示例。如果您正苦於以下問題:Java DriveFile.getDriveId方法的具體用法?Java DriveFile.getDriveId怎麽用?Java DriveFile.getDriveId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.drive.DriveFile的用法示例。


在下文中一共展示了DriveFile.getDriveId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sync_trashFile

import com.google.android.gms.drive.DriveFile; //導入方法依賴的package包/類
/**
 * Trashes a file.
 * 
 * @param driveFile	The Drive file
 * @param driveFileMetaData	The Drive file metadata, see {@link Metadata}
 * @returns Boolean. TRUE if file is trashed ok, otherwise FALSE.
 */
public boolean sync_trashFile(final DriveFile driveFile, final Metadata driveFileMetaData) throws TBDriveException {
	
	boolean res = false;
	
       //If a DriveResource is a folder it will only be trashable if all of its children
       //are also accessible to this app.
       if (driveFileMetaData.isTrashable()) {
         if (!driveFileMetaData.isTrashed()) {
       	  Status status = driveFile.trash(mGoogleApiClient).await();
       	  if (!status.isSuccess()) {
             	Log.e(TAG, "Problem trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " [" + status.getStatusMessage() + "].");
             	throw new TBDriveException("Problem trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " [" + status.getStatusMessage() + "].");
             }else{
           	  res = true;
             }
       	  
         } else {
       	  Log.e(TAG, "The file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " is already in trash.");
       	  throw new TBDriveException("The file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " is already in trash.");
         }
       } else {
       	Log.e(TAG, "Error trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + ", resource is not owned by the user or is in the AppFolder.");
       	throw new TBDriveException("Error trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + ", resource is not owned by the user or is in the AppFolder.");
       }
       
       return res;
}
 
開發者ID:javocsoft,項目名稱:javocsoft-toolbox,代碼行數:35,代碼來源:TBDrive.java

示例2: sync_untrashFile

import com.google.android.gms.drive.DriveFile; //導入方法依賴的package包/類
/**
 * Un-Trashes a file.
 * 
 * @param driveFile	The Drive file
 * @param driveFileMetaData	The Drive file metadata, see {@link Metadata}
 * @returns Boolean. TRUE if file is un-trashed ok, otherwise FALSE.
 */
public boolean sync_untrashFile(final DriveFile driveFile, final Metadata driveFileMetaData) 
		throws TBDriveException {
	
	boolean res = false;
	
       //If a DriveResource is a folder it will only be trashable if 
	//all of its children are also accessible to this app.
       if (driveFileMetaData.isTrashable()) {
       	if (driveFileMetaData.isTrashed()) {
       		Status status = driveFile.untrash(mGoogleApiClient).await();
       		if (!status.isSuccess()) {
               	Log.e(TAG, "Problem untrashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " [" + status.getStatusMessage() + "].");
               	throw new TBDriveException("Problem untrashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " [" + status.getStatusMessage() + "].");
       		} else {
               	res = true;
               }
       		
       	} else {
       		Log.e(TAG, "The file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " is not in the trash.");  
       		throw new TBDriveException("The file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + " is not in the trash.");
       	}
       } else {
       	Log.e(TAG, "Error trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + ", resource is not owned by the user or is in the AppFolder.");
       	throw new TBDriveException("Error trashing the file '" + driveFileMetaData.getTitle() + "' with DriveId: " + driveFile.getDriveId() + ", resource is not owned by the user or is in the AppFolder.");
       }
       
       return res;
}
 
開發者ID:javocsoft,項目名稱:javocsoft-toolbox,代碼行數:36,代碼來源:TBDrive.java


注:本文中的com.google.android.gms.drive.DriveFile.getDriveId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。