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


Java File.getTitle方法代碼示例

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


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

示例1: convertToFileEntry

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
private FileEntry convertToFileEntry(File file, String path) {
	FileEntry e = new FileEntry();
	e.canRead = e.canWrite = true; 
	e.isDirectory = FOLDER_MIME_TYPE.equals(file.getMimeType());
	e.lastModifiedTime = file.getModifiedDate().getValue();
	e.path = path; 
	try
	{
		e.sizeInBytes = file.getFileSize();			
	}
	catch (NullPointerException ex)
	{
		e.sizeInBytes = 0;
	}
	e.displayName = file.getTitle();
	return e;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:18,代碼來源:GoogleDriveFileStorage.java

示例2: verify

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
private void verify() throws IOException {
	
	if (mAccountLocalPath.equals(""))
		return;
	
	String[] parts = mAccountLocalPath.split("/");
	
	AccountData accountData = mAccountData.get(mAccount);
	if (accountData == null)
	{
		throw new IllegalStateException("Looks like account "+mAccount+" was not properly initialized!");
	}
	
	//if initialization failed, try to repeat: 
	finishInitialization(accountData, mAccount);
	
	String part = parts[parts.length-1];
	logDebug("parsing part " + part);
	int indexOfSeparator = part.lastIndexOf(NAME_ID_SEP);
	if (indexOfSeparator < 0)
		throw new FileNotFoundException("invalid path " + mAccountLocalPath);
	String id = part.substring(indexOfSeparator+NAME_ID_SEP.length());
	String name = decode(part.substring(0, indexOfSeparator));
	logDebug("   name=" + name);
	
	File fl;
	try {
		fl = getDriveService(getAccount()).files().get(getGDriveId()).execute();
	} catch (Exception e) {
		e.printStackTrace();
		throw new FileNotFoundException("error getting file with for "+ this.getFullPath());
	}
	
	String displayName = fl.getTitle();
	
	if (displayName.equals(name) == false)
		throw new FileNotFoundException("Name of "+id+" changed from "+name+" to "+displayName +" in  "+ mAccountLocalPath+" in GDrive account " + mAccount);
	
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:40,代碼來源:GoogleDriveFileStorage.java

示例3: getRemoteEntries

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
@Override
public  List<RemoteDataInfo> getRemoteEntries() throws SyncFailedException {
    LogUtil.log(getClass().getSimpleName(), "Files in Narrate Drive AppFolder:");
    List<RemoteDataInfo> dataObjects = new ArrayList<>();

    try {
        List<File> contents = getContents();
        if (contents != null) {

            Iterator<File> iter = contents.iterator();
            File f;
            while (iter.hasNext()) {
                f = iter.next();
                LogUtil.log(getClass().getSimpleName(), f.getTitle());
                if (!f.getTitle().equals("photos")) {
                    RemoteDataInfo info = new RemoteDataInfo();
                    info.name = f.getTitle();
                    info.isDirectory = f.getMimeType().equals(FOLDER_MIME);
                    info.isDeleted = f.getLabels().getTrashed();
                    info.modifiedDate = f.getModifiedDate().getValue();
                    info.revision = String.valueOf(f.getVersion());
                    dataObjects.add(info);
                }
            }

            return dataObjects;
        }
    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return null;
}
 
開發者ID:timothymiko,項目名稱:narrate-android,代碼行數:36,代碼來源:DriveSyncService.java

示例4: getRemotePhotos

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
@Override
public List<RemoteDataInfo> getRemotePhotos() throws SyncFailedException {
    LogUtil.log(DriveSyncService.class.getSimpleName(), "getRemotePhotos()");

    List<RemoteDataInfo> dataObjects = new ArrayList<>();
    try {
        List<File> result = getPhotosContents();

        LogUtil.log(getClass().getSimpleName(), "Files in Narrate Drive Photos Folder:");

        if (result.size() > 0) {
            for (File f : result) {
                LogUtil.log(getClass().getSimpleName(), f.getTitle());
                RemoteDataInfo info = new RemoteDataInfo();
                info.name = f.getTitle();
                info.isDirectory = f.getMimeType().equals(FOLDER_MIME);
                info.isDeleted = f.getLabels().getTrashed();
                info.modifiedDate = f.getModifiedDate().getValue();
                info.revision = String.valueOf(f.getVersion());
                dataObjects.add(info);
            }
        }
    } catch (Exception e) {
        if (!BuildConfig.DEBUG) Crashlytics.logException(e);
        e.printStackTrace();
        throw new SyncFailedException(e.getMessage());
    }

    return dataObjects;
}
 
開發者ID:timothymiko,項目名稱:narrate-android,代碼行數:31,代碼來源:DriveSyncService.java

示例5: getFile

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
/**
 * Finds whether a file is existed by the name of track.
 * 
 * @param trackName name of track
 * @param drive a Google Drive object
 * @return the file be found
 * @throws IOException
 */
public static File getFile(String trackName, Drive drive) throws IOException {
  List<File> files = getDriveFiles(EndToEndTestUtils.trackListActivity.getApplicationContext(),
      drive);
  for (int i = 0; i < files.size(); i++) {
    File file = files.get(i);
    String title = file.getTitle();
    if (title.equals(trackName + KML_FILE_POSTFIX)) {
      return file;
    }
  }
  return null;
}
 
開發者ID:Plonk42,項目名稱:mytracks,代碼行數:21,代碼來源:SyncTestUtils.java

示例6: getStyledText

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Object element) {
	File file = (File) element;
	StyledString styledString = new StyledString(file.getTitle());
	if (Boolean.FALSE.equals(file.getEditable())) {
		styledString.append(" [readonly]", stylerProvider.getStyler(null,
				Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW), null));
	}
	if (file.getSharingUser() != null) {
		styledString.append(String.format(" [Shared by %s]", file.getSharingUser().getDisplayName()), stylerProvider
				.getStyler(null, Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW), null));
	}
	return styledString;
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:15,代碼來源:FileTableViewer.java


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