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


Java FileColumns类代码示例

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


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

示例1: isEmpty

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private boolean isEmpty(Uri uri, String type) {
    final ContentResolver resolver = getContext().getContentResolver();
    final long token = Binder.clearCallingIdentity();
    Cursor cursor = null;
    try {
        String[] mimeType;
        if (TYPE_DOCUMENT_ROOT.equals(type)) {
            mimeType = DOCUMENT_MIMES;
        } else if (TYPE_ARCHIVE_ROOT.equals(type)) {
            mimeType = ARCHIVE_MIMES;
        } else if (TYPE_APK_ROOT.equals(type)) {
            mimeType = APK_MIMES;
        } else {
            return true;
        }
        cursor = resolver.query(FILE_URI,
                FileQuery.PROJECTION,
                FileColumns.MIME_TYPE + " IN "+ "("+toString(mimeType)+")" , null, null);
        return (cursor == null) || (cursor.getCount() == 0);
    } finally {
        IoUtils.closeQuietly(cursor);
        Binder.restoreCallingIdentity(token);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:25,代码来源:NonMediaDocumentsProvider.java

示例2: onMediaStoreInsert

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
/**
 * When inserting the first item of each type, we need to trigger a roots
 * refresh to clear a previously reported {@link Root#FLAG_EMPTY}.
 */
static void onMediaStoreInsert(Context context, String volumeName, int type, long id) {
    if (!"external".equals(volumeName)) return;

    if (type == FileColumns.MEDIA_TYPE_IMAGE && sReturnedImagesEmpty) {
        sReturnedImagesEmpty = false;
        notifyRootsChanged(context);
    } else if (type == FileColumns.MEDIA_TYPE_VIDEO && sReturnedVideosEmpty) {
        sReturnedVideosEmpty = false;
        notifyRootsChanged(context);
    } else if (type == FileColumns.MEDIA_TYPE_AUDIO && sReturnedAudioEmpty) {
        sReturnedAudioEmpty = false;
        notifyRootsChanged(context);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:MediaDocumentsProvider.java

示例3: queryFile

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private void queryFile(ContentResolver resolver, Cursor cursor, MatrixCursor result, String[] mimeType, String like) {
    // single file
    cursor = resolver.query(FILE_URI,
            FileQuery.PROJECTION,
            FileColumns.MIME_TYPE + " IN "+ "("+toString(mimeType)+")"
            + " OR " + FileColumns.MIME_TYPE + " LIKE "+ "'"+like+"%'",
            null,
            null);
    copyNotificationUri(result, FILE_URI);
    while (cursor.moveToNext()) {
        includeFile(result, cursor);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:14,代码来源:NonMediaDocumentsProvider.java

示例4: queryRecentFile

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private void queryRecentFile(ContentResolver resolver, Cursor cursor, MatrixCursor result, String[] mimeType) {
    // single file
    cursor = resolver.query(FILE_URI,
            FileQuery.PROJECTION, FileColumns.MIME_TYPE + " IN "+ "("+toString(mimeType)+")" , null,
            FileQuery.DATE_MODIFIED + " DESC");
    copyNotificationUri(result, FILE_URI);
    while (cursor.moveToNext() && result.getCount() < 64) {
        includeFile(result, cursor);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:11,代码来源:NonMediaDocumentsProvider.java

示例5: loadBucketEntriesFromFilesTable

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private static BucketEntry[] loadBucketEntriesFromFilesTable(
        ThreadPool.JobContext jc, ContentResolver resolver, int type) {
    Uri uri = getFilesContentUri();
    Cursor cursor = resolver.query(uri,
            PROJECTION_BUCKET, BUCKET_GROUP_BY,
            null, BUCKET_ORDER_BY);
    if (cursor == null) {
        Log.w(TAG, "cannot open local database: " + uri);
        return new BucketEntry[0];
    }
    ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
    int typeBits = 0;
    if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
    }
    if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
    }
    try {
        while (cursor.moveToNext()) {
            if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
                BucketEntry entry = new BucketEntry(
                        cursor.getInt(INDEX_BUCKET_ID),
                        cursor.getString(INDEX_BUCKET_NAME));
                if (!buffer.contains(entry)) {
                    buffer.add(entry);
                }
            }
            if (jc.isCancelled()) return null;
        }
    } finally {
        Utils.closeSilently(cursor);
    }
    return buffer.toArray(new BucketEntry[buffer.size()]);
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:36,代码来源:BucketHelper.java

示例6: loadBucketEntries

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
public static  BucketEntry[] loadBucketEntries(Path path, ThreadPool.JobContext jc, Context mContext) {
    Uri uri = mBaseUri;
    Log.v("DebugLoadingTime", "start quering media provider");
    Cursor cursor = mContext.getContentResolver().query(
            uri, PROJECTION_BUCKET, BUCKET_GROUP_BY, null, BUCKET_ORDER_BY);
    if (cursor == null) {
        Log.w(TAG, "cannot open local database: " + uri);
        return new BucketEntry[0];
    }
    ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
    int typeBits = 0;
    int mType = getTypeFromPath(path);
    if ((mType & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
    }
    if ((mType & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
    }
    try {
        while (cursor.moveToNext()) {
            if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
                BucketEntry entry = new BucketEntry(
                        cursor.getInt(INDEX_BUCKET_ID),
                        cursor.getString(INDEX_BUCKET_NAME));
                if (!buffer.contains(entry)) {
                    buffer.add(entry);
                }
            }
            if (jc.isCancelled()) return null;
        }
        Log.v("DebugLoadingTime", "got " + buffer.size() + " buckets");
    } finally {
        cursor.close();
    }
    return buffer.toArray(new BucketEntry[buffer.size()]);
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:37,代码来源:BucketHelper.java

示例7: Job

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
public Job(String path, String id) {
    mPath = path;
    mId = id;
    mMft = ArchosMediaFile.getFileType(path);
    // default mime type / media type
    int mediaType = FileColumns.MEDIA_TYPE_NONE;
    String mimeType = "application/octet-stream";
    boolean retrieve = false;
    if (mMft != null) {
        mimeType = mMft.mimeType;
        if (!isNoMediaPath(path)) {
            if (ArchosMediaFile.isAudioFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_AUDIO;
                retrieve = true;
            } else if (ArchosMediaFile.isVideoFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_VIDEO;
            }  else if (ArchosMediaFile.isImageFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_IMAGE;
            } else if (ArchosMediaFile.isPlayListFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_PLAYLIST;
            }
        }
    }
    mMimeType = mimeType;
    mMediaType = mediaType;
    mRetrieve = retrieve;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:28,代码来源:MusicStoreImportImpl.java

示例8: processVideoNamesInDB

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private void processVideoNamesInDB(SQLiteDatabase db) {
    Cursor c = db.query(FILES_TABLE_NAME, new String[] {MediaColumns.DATA, "_id"}, "media_type like " + FileColumns.MEDIA_TYPE_VIDEO, null, null, null, null);
    if (c == null) {
        return;
    }

    while (c.moveToNext()) {
        String path = c.getString(0);
        long id = c.getLong(1);
        ContentValues cvExtra = VideoNameProcessor.extractValuesFromPath(path);
        db.update(FILES_TABLE_NAME, cvExtra, SELECTION_ID, new String[] { String.valueOf(id) });
    }
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:14,代码来源:VideoOpenHelper.java

示例9: Job

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
public Job(String path, String id, Blacklist blacklist) {
    mPath = Uri.parse(path);
    mId = id;
    mMft = ArchosMediaFile.getFileType(path);
    // default mime type / media type
    int mediaType = FileColumns.MEDIA_TYPE_NONE;
    String mimeType = "application/octet-stream";
    boolean retrieve = false;
    if (mMft != null) {
        mimeType = mMft.mimeType;
        if (!isNoMediaPath(path) && !blacklist.isBlacklisted(mPath)) {
            if (ArchosMediaFile.isAudioFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_AUDIO;
            } else if (ArchosMediaFile.isVideoFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_VIDEO;
                retrieve = true;
            }  else if (ArchosMediaFile.isImageFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_IMAGE;
            } else if (ArchosMediaFile.isPlayListFileType(mMft.fileType)) {
                mediaType = FileColumns.MEDIA_TYPE_PLAYLIST;
            }
        }
    }
    mMimeType = mimeType;
    mMediaType = mediaType;
    mRetrieve = retrieve;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:28,代码来源:VideoStoreImportImpl.java

示例10: getPath

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private static String getPath(Context context, Uri uri) {
	String path = null;
	String[] projection = {FileColumns.DATA};
	Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
	if (cursor == null) path = uri.getPath();
	else {
		cursor.moveToFirst();
		int column_index = cursor.getColumnIndexOrThrow(projection[0]);
		path = cursor.getString(column_index);
		cursor.close();
	}
	return path == null || path.isEmpty() ? uri.getPath() : path;
}
 
开发者ID:arunrajora,项目名称:Chit-Chat,代码行数:14,代码来源:MessageUtils.java

示例11: buildDocSelection

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private String buildDocSelection() {
	StringBuilder selection = new StringBuilder();
	Iterator<String> iter = PreparedResource.sDocMimeTypesSet.iterator();
	while (iter.hasNext()) {
		/*
		 * selection.append("(" + FileColumns.MIME_TYPE + "=='" +
		 * iter.next() + "') OR ");
		 */
		selection.append("(" + FileColumns.DATA + " LIKE '" + iter.next()
				+ "') OR ");
	}
	Log.e("hejie", selection.toString());
	return selection.substring(0, selection.lastIndexOf(")") + 1);
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:15,代码来源:RefreshData.java

示例12: getItemMimetype

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private String getItemMimetype(Object item) {
    int type = mDelegate.getItemMediaType(item);
    if (type == FileColumns.MEDIA_TYPE_IMAGE) {
        return GalleryUtils.MIME_TYPE_IMAGE;
    } else if (type == FileColumns.MEDIA_TYPE_VIDEO) {
        return GalleryUtils.MIME_TYPE_VIDEO;
    } else {
        return GalleryUtils.MIME_TYPE_ALL;
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:11,代码来源:MultiChoiceManager.java

示例13: loadInBackground

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
@Override
public Cursor loadInBackground() {
    // TODO: This probably doesn't work
    mMediaSet.reload();
    final MatrixCursor cursor = new MatrixCursor(PhotoSetLoader.PROJECTION);
    final Object[] row = new Object[PhotoSetLoader.PROJECTION.length];
    final SparseArray<MediaItem> mediaItems = new SparseArray<MediaItem>();
    mMediaSet.enumerateTotalMediaItems(new ItemConsumer() {
        @Override
        public void consume(int index, MediaItem item) {
            row[PhotoSetLoader.INDEX_ID] = index;
            row[PhotoSetLoader.INDEX_DATA] = item.getContentUri().toString();
            row[PhotoSetLoader.INDEX_DATE_ADDED] = item.getDateInMs();
            row[PhotoSetLoader.INDEX_HEIGHT] = item.getHeight();
            row[PhotoSetLoader.INDEX_WIDTH] = item.getWidth();
            row[PhotoSetLoader.INDEX_WIDTH] = item.getWidth();
            int rawMediaType = item.getMediaType();
            int mappedMediaType = FileColumns.MEDIA_TYPE_NONE;
            if (rawMediaType == MediaItem.MEDIA_TYPE_IMAGE) {
                mappedMediaType = FileColumns.MEDIA_TYPE_IMAGE;
            } else if (rawMediaType == MediaItem.MEDIA_TYPE_VIDEO) {
                mappedMediaType = FileColumns.MEDIA_TYPE_VIDEO;
            }
            row[PhotoSetLoader.INDEX_MEDIA_TYPE] = mappedMediaType;
            row[PhotoSetLoader.INDEX_SUPPORTED_OPERATIONS] =
                    item.getSupportedOperations();
            cursor.addRow(row);
            mediaItems.append(index, item);
        }
    });
    synchronized (mMediaSet) {
        mMediaItems = mediaItems;
    }
    return cursor;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:36,代码来源:MediaItemsLoader.java

示例14: loadBucketEntriesFromFilesTable

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private static BucketEntry[] loadBucketEntriesFromFilesTable(
        JobContext jc, ContentResolver resolver, int type) {
    Uri uri = getFilesContentUri();

    Cursor cursor = resolver.query(uri,
            PROJECTION_BUCKET, BUCKET_GROUP_BY,
            null, BUCKET_ORDER_BY);
    if (cursor == null) {
        Log.w(TAG, "cannot open local database: " + uri);
        return new BucketEntry[0];
    }
    ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
    int typeBits = 0;
    if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
    }
    if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
    }
    try {
        while (cursor.moveToNext()) {
            if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
                BucketEntry entry = new BucketEntry(
                        cursor.getInt(INDEX_BUCKET_ID),
                        cursor.getString(INDEX_BUCKET_NAME));
                if (!buffer.contains(entry)) {
                    buffer.add(entry);
                }
            }
            if (jc.isCancelled()) return null;
        }
    } finally {
        Utils.closeSilently(cursor);
    }
    return buffer.toArray(new BucketEntry[buffer.size()]);
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:37,代码来源:BucketHelper.java

示例15: loadBucketEntries

import android.provider.MediaStore.Files.FileColumns; //导入依赖的package包/类
private BucketEntry[] loadBucketEntries(JobContext jc) {
    Uri uri = mBaseUri;

    Log.v("DebugLoadingTime", "start quering media provider");
    Cursor cursor = mApplication.getContentResolver().query(uri,
            PROJECTION_BUCKET, BUCKET_GROUP_BY, null, BUCKET_ORDER_BY);
    if (cursor == null) {
        Log.w(TAG, "cannot open local database: " + uri);
        return new BucketEntry[0];
    }
    ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
    int typeBits = 0;
    if ((mType & MEDIA_TYPE_IMAGE) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
    }
    if ((mType & MEDIA_TYPE_VIDEO) != 0) {
        typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
    }
    try {
        while (cursor.moveToNext()) {
            if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
                BucketEntry entry = new BucketEntry(
                        cursor.getInt(INDEX_BUCKET_ID),
                        cursor.getString(INDEX_BUCKET_NAME));
                if (!buffer.contains(entry)) {
                    buffer.add(entry);
                }
            }
            if (jc.isCancelled())
                return null;
        }
        Log.v("DebugLoadingTime", "got " + buffer.size() + " buckets");
    } finally {
        cursor.close();
    }
    return buffer.toArray(new BucketEntry[buffer.size()]);
}
 
开发者ID:jituo666,项目名称:WoTu,代码行数:38,代码来源:LocalAlbumSet.java


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