本文整理汇总了Java中com.google.android.gms.drive.DriveApi.MetadataBufferResult类的典型用法代码示例。如果您正苦于以下问题:Java MetadataBufferResult类的具体用法?Java MetadataBufferResult怎么用?Java MetadataBufferResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataBufferResult类属于com.google.android.gms.drive.DriveApi包,在下文中一共展示了MetadataBufferResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public PendingResult<DriveApi.MetadataBufferResult> query(GoogleApiClient paramGoogleApiClient, final Query paramQuery)
{
if (paramQuery == null)
throw new IllegalArgumentException("Query must be provided.");
return paramGoogleApiClient.a(new j(paramQuery)
{
protected void a(j paramAnonymousj)
{
try
{
paramAnonymousj.cN().a(new QueryRequest(paramQuery), new h.i(this));
return;
}
catch (RemoteException localRemoteException)
{
a(new h.f(new Status(8, localRemoteException.getLocalizedMessage(), null), null));
}
}
});
}
示例2: onResult
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving files");
return;
}
mDriveResultsAdapter.setData(result.getMetadataBuffer());
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent,
View view, int position, long id) {
Metadata metadata = mDriveResultsAdapter.getItem(position);
StringBuilder sb = new StringBuilder();
sb.append(metadata.getTitle() + "\n")
.append(metadata.getMimeType() + "\n")
.append(metadata.getFileSize() + "\n")
.append(metadata.getCreatedDate() + "\n")
.append(metadata.getModifiedDate() + "\n");
showMessage(sb.toString());
return false;
}
});
}
示例3: queryChildren
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public PendingResult<DriveApi.MetadataBufferResult> queryChildren(GoogleApiClient paramGoogleApiClient, Query paramQuery)
{
Query.Builder localBuilder = new Query.Builder().addFilter(Filters.in(SearchableField.PARENTS, getDriveId()));
if (paramQuery != null)
{
if (paramQuery.getFilter() != null)
localBuilder.addFilter(paramQuery.getFilter());
localBuilder.setPageToken(paramQuery.getPageToken());
}
return new h().query(paramGoogleApiClient, localBuilder.build());
}
示例4: onResult
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving files");
return;
}
mResultsAdapter.append(result.getMetadataBuffer());
mNextPageToken = result.getMetadataBuffer().getNextPageToken();
mHasMore = mNextPageToken != null;
}
示例5: onResult
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving results");
return;
}
mResultsAdapter.clear();
mResultsAdapter.append(result.getMetadataBuffer());
}
示例6: onResult
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving files");
return;
}
mResultsAdapter.clear();
mResultsAdapter.append(result.getMetadataBuffer());
showMessage("Successfully listed files.");
}
示例7: onResult
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
/**
* Called when query has executed and a result has been retrieved. Files
* list view should be re-rendered with the new results.
*/
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
Toast.makeText(this, R.string.msg_errorretrieval, Toast.LENGTH_SHORT).show();
return;
}
Log.d(TAG, "Retrieved file count: " + result.getMetadataBuffer().getCount());
mMetadataBuffer = result.getMetadataBuffer();
((ResultsAdapter) mListViewFiles.getAdapter()).notifyDataSetChanged();
}
示例8: searchByTitle
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public List<Metadata> searchByTitle(String title) {
Query query = new Query.Builder()
.addFilter(Filters.in(SearchableField.PARENTS, Drive.DriveApi
// .getAppFolder(mGoogleApiClient)
.getRootFolder(mGoogleApiClient).getDriveId()))
.addFilter(Filters.eq(SearchableField.TITLE, title))
.addFilter(Filters.eq(SearchableField.TRASHED, false))
.build();
MetadataBufferResult mMetadataBufferResult = Drive.DriveApi.query(mGoogleApiClient, query).await();
List<Metadata> list = getMetadata(mMetadataBufferResult);
return list;
}
示例9: i
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public i(a.c<DriveApi.MetadataBufferResult> paramc)
{
this.jW = paramc;
}
示例10: p
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public DriveApi.MetadataBufferResult p(Status paramStatus)
{
return new h.f(paramStatus, null);
}
示例11: listChildren
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
public PendingResult<DriveApi.MetadataBufferResult> listChildren(GoogleApiClient paramGoogleApiClient)
{
return queryChildren(paramGoogleApiClient, null);
}
示例12: sync_getFile
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
/**
* Looks for the specified file name (or title).<br><br>
*
* <b>Note</b><br>
* Only returns the first found file if there is more than one file
* with the same filename/title.
*
* @param fileName The file name or title of the desired file.
* @returns DriveFile The desired file or null if there is none. See
* {@link DriveFile}.
*
*/
public synchronized DriveFile sync_getFile(String fileName) throws TBDriveException {
DriveFile driveFile = null;
//Look for a file with title/filename
SortOrder sortOrder = new SortOrder.Builder()
.addSortAscending(SortableField.TITLE)
.addSortDescending(SortableField.MODIFIED_DATE).build();
Query query = new Query.Builder().addFilter(
Filters.and(
Filters.eq(SearchableField.TITLE, fileName)
, Filters.eq(SearchableField.TRASHED, false)
//, Filters.eq(SearchableField.MIME_TYPE, "text/plain")
//, Filters.eq(customPropertyKey, "world")
)
)
.setSortOrder(sortOrder)
.build();
MetadataBufferResult result = Drive.DriveApi.query(getGoogleApiClient(), query).await();
if (!result.getStatus().isSuccess()) {
Log.e(TAG, "Problem while retrieving files: '" + result.getStatus().getStatusMessage() + "'");
result.release();
throw new TBDriveException("Problem while retrieving files: '" + result.getStatus().getStatusMessage() + "'");
}
Iterator<Metadata> iterator = result.getMetadataBuffer().iterator();
Metadata mData = null;
while(iterator.hasNext()) {
mData = iterator.next();
if(!mData.isFolder()){
driveFile = Drive.DriveApi.getFile(getGoogleApiClient(), mData.getDriveId());
if(driveFile==null) {
//Error getting Drive File from id. Should never happen
Log.e(TAG, "Problem while retrieving file with DriveId: " + mData.getDriveId());
result.release();
throw new TBDriveException("Problem while retrieving file with DriveId: " + mData.getDriveId() + ". Not found in Drive!!");
}
}
break; //Should only be one.
}
result.release();
return driveFile;
}
示例13: async_search
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
/**
* Search for a file.
*
* @param fileName The filename/title to search for.
* @param callback See {@link TBDriveFileSearchCallback}
*/
public void async_search(String fileName, final TBDriveFileSearchCallback callback) {
final ResultCallback<MetadataBufferResult> metadataBufferCallback = new
ResultCallback<MetadataBufferResult>() {
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
Log.e(TAG, "Problem while retrieving files: '" + result.getStatus().getStatusMessage() + "'");
if(callback!=null) {
callback.setErrorCode(ERROR_FILE_SEARCH);
callback.setErrorMessage(ERROR_FILE_SEARCH_STRING);
callback.setErrorDetails(result.getStatus().getStatusMessage());
callback.run();
}
result.release();
return;
}
List<FileInfo> searchResults = new ArrayList<FileInfo>();
FileInfo fInfo = null;
Iterator<Metadata> iterator = result.getMetadataBuffer().iterator();
Metadata mData = null;
while(iterator.hasNext()) {
mData = iterator.next();
//Files found!
DriveFile driveFile = Drive.DriveApi.getFile(getGoogleApiClient(), mData.getDriveId());
if(driveFile!=null) {
fInfo = new FileInfo(driveFile, mData);
searchResults.add(fInfo);
}
}
if(callback!=null) {
callback.setSearchResult(searchResults);
callback.run();
}
result.release();
}
};
//Look for a file with title/filename
SortOrder sortOrder = new SortOrder.Builder()
.addSortAscending(SortableField.TITLE)
.addSortDescending(SortableField.MODIFIED_DATE).build();
Query query = new Query.Builder().addFilter(
Filters.and(
Filters.eq(SearchableField.TITLE, fileName)
, Filters.eq(SearchableField.TRASHED, false)
//, Filters.eq(SearchableField.MIME_TYPE, "text/plain")
//, Filters.eq(customPropertyKey, "world")
)
)
.setSortOrder(sortOrder)
.build();
Drive.DriveApi.query(getGoogleApiClient(), query)
.setResultCallback(metadataBufferCallback);
}
示例14: sync_search
import com.google.android.gms.drive.DriveApi.MetadataBufferResult; //导入依赖的package包/类
/**
* Search for a file.
*
* @param fileName The filename/title to search for.
* @throws TBDriveFileSearchCallback
*/
public List<FileInfo> sync_search(String fileName) throws TBDriveException {
List<FileInfo> searchResults = null;
//Look for a file with title/filename
SortOrder sortOrder = new SortOrder.Builder()
.addSortAscending(SortableField.TITLE)
.addSortDescending(SortableField.MODIFIED_DATE).build();
Query query = new Query.Builder().addFilter(
Filters.and(
Filters.eq(SearchableField.TITLE, fileName)
, Filters.eq(SearchableField.TRASHED, false)
//, Filters.eq(SearchableField.MIME_TYPE, "text/plain")
//, Filters.eq(customPropertyKey, "world")
)
)
.setSortOrder(sortOrder)
.build();
MetadataBufferResult result = Drive.DriveApi.query(getGoogleApiClient(), query).await();
if (!result.getStatus().isSuccess()) {
Log.e(TAG, "Problem while retrieving files: '" + result.getStatus().getStatusMessage() + "'");
result.release();
throw new TBDriveException("Problem while retrieving files: '" + result.getStatus().getStatusMessage() + "'");
}
searchResults = new ArrayList<FileInfo>();
DriveFile driveFile = null;
FileInfo fInfo = null;
Metadata mData = null;
Iterator<Metadata> iterator = result.getMetadataBuffer().iterator();
while(iterator.hasNext()) {
mData = iterator.next();
driveFile = Drive.DriveApi.getFile(getGoogleApiClient(), mData.getDriveId());
if(driveFile!=null) {
fInfo = new FileInfo(driveFile, mData);
searchResults.add(fInfo);
}
}
result.release();
return searchResults;
}