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


Java VideoColumns.DATE_TAKEN属性代码示例

本文整理汇总了Java中android.provider.MediaStore.Video.VideoColumns.DATE_TAKEN属性的典型用法代码示例。如果您正苦于以下问题:Java VideoColumns.DATE_TAKEN属性的具体用法?Java VideoColumns.DATE_TAKEN怎么用?Java VideoColumns.DATE_TAKEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.MediaStore.Video.VideoColumns的用法示例。


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

示例1: LocalAlbum

public LocalAlbum(Path path, GalleryApp application, int bucketId,
        boolean isImage, String name) {
    super(path, nextVersionNumber());
    mApplication = application;
    mResolver = application.getContentResolver();
    mBucketId = bucketId;
    mName = name;
    mIsImage = isImage;

    if (isImage) {
        mWhereClause = ImageColumns.BUCKET_ID + " = ?";
        mOrderClause = ImageColumns.DATE_TAKEN + " DESC, "
                + ImageColumns._ID + " DESC";
        mBaseUri = Images.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalImage.PROJECTION;
        mItemPath = LocalImage.ITEM_PATH;
    } else {
        mWhereClause = VideoColumns.BUCKET_ID + " = ?";
        mOrderClause = VideoColumns.DATE_TAKEN + " DESC, "
                + VideoColumns._ID + " DESC";
        mBaseUri = Video.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalVideo.PROJECTION;
        mItemPath = LocalVideo.ITEM_PATH;
    }

    mNotifier = new ChangeNotifier(this, mBaseUri, application);
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:27,代码来源:LocalAlbum.java

示例2: LocalAlbum

public LocalAlbum(Path path, MediaDataContext application, int bucketId,
                  boolean isImage, String name) {
    super(path, nextVersionNumber());
    mApplication = application;
    mResolver = application.getContentResolver();
    mBucketId = bucketId;
    mName = name;
    mIsImage = isImage;

    if (isImage) {
        mWhereClause = ImageColumns.BUCKET_ID + " = ?";
        mOrderClause = ImageColumns.DATE_TAKEN + " DESC, "
                + ImageColumns._ID + " DESC";
        mBaseUri = Images.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalImage.PROJECTION;
        mItemPath = LocalImage.ITEM_PATH;
    } else {
        mWhereClause = VideoColumns.BUCKET_ID + " = ?";
        mOrderClause = VideoColumns.DATE_TAKEN + " DESC, "
                + VideoColumns._ID + " DESC";
        mBaseUri = Video.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalVideo.PROJECTION;
        mItemPath = LocalVideo.ITEM_PATH;
    }

    mNotifier = new ChangeNotifier(this, mBaseUri, application);
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:27,代码来源:LocalAlbum.java

示例3: LocalAlbum

public LocalAlbum(Path path, WoTuApp application, long bucketId,
        boolean isImage, String name) {
    super(path, nextVersionNumber());
    mApplication = application;
    mResolver = application.getContentResolver();
    mBucketId = bucketId;
    mName = getLocalizedName(application.getResources(), bucketId, name);
    mIsImage = isImage;

    if (isImage) {
        mWhereClause = ImageColumns.BUCKET_ID + " = ?";
        mOrderClause = ImageColumns.DATE_TAKEN + " DESC, "
                + ImageColumns._ID + " DESC";
        mBaseUri = Images.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalImage.PROJECTION;
        mItemPath = LocalImage.ITEM_PATH;
    } else {
        mWhereClause = VideoColumns.BUCKET_ID + " = ?";
        mOrderClause = VideoColumns.DATE_TAKEN + " DESC, "
                + VideoColumns._ID + " DESC";
        mBaseUri = Video.Media.EXTERNAL_CONTENT_URI;
        mProjection = LocalVideo.PROJECTION;
        mItemPath = LocalVideo.ITEM_PATH;
    }

    mNotifier = new DataNotifier(this, mBaseUri, application);
}
 
开发者ID:jituo666,项目名称:WoTu,代码行数:27,代码来源:LocalAlbum.java

示例4: getLatestMedia

private Media getLatestMedia(boolean video) {
	Media media = null;
	Uri baseUri = video ? Video.Media.EXTERNAL_CONTENT_URI
			: MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
	Uri query = baseUri.buildUpon().appendQueryParameter("limit", "1")
			.build();
	String[] projection = video ? new String[] { VideoColumns._ID,
			VideoColumns.DATE_TAKEN } : new String[] { ImageColumns._ID,
			ImageColumns.DATE_TAKEN, ImageColumns.ORIENTATION };
	String selection = video ? "" : ImageColumns.MIME_TYPE
			+ "='image/jpeg'";
	String order = video ? VideoColumns.DATE_TAKEN + " DESC,"
			+ VideoColumns._ID + " DESC" : ImageColumns.DATE_TAKEN
			+ " DESC," + ImageColumns._ID + " DESC";
	Cursor cursor = null;
	try {
		cursor = getContentResolver().query(query, projection, selection,
				null, order);
		if (cursor != null && cursor.moveToFirst()) {
			long id = cursor.getLong(0);
			long date = cursor.getLong(1);
			int orientation = video ? 0 : cursor.getInt(2);
			Uri uri = ContentUris.withAppendedId(baseUri, id);
			if (MyDebug.LOG)
				Log.d(TAG, "found most recent uri for "
						+ (video ? "video" : "images") + ": " + uri);
			media = new Media(id, video, uri, date, orientation);
		}
	} finally {
		if (cursor != null) {
			cursor.close();
		}
	}
	return media;
}
 
开发者ID:pov1912,项目名称:Selfie-Camera,代码行数:35,代码来源:MainActivity.java

示例5: insertContent

/**
 * Insert the content (saved file) with proper video properties.
 */
public static Uri insertContent(SaveVideoFileInfo mDstFileInfo,
        ContentResolver contentResolver, Uri uri ) {
    long nowInMs = System.currentTimeMillis();
    long nowInSec = nowInMs / 1000;
    final ContentValues values = new ContentValues(13);
    values.put(Video.Media.TITLE, mDstFileInfo.mFileName);
    values.put(Video.Media.DISPLAY_NAME, mDstFileInfo.mFile.getName());
    values.put(Video.Media.MIME_TYPE, "video/mp4");
    values.put(Video.Media.DATE_TAKEN, nowInMs);
    values.put(Video.Media.DATE_MODIFIED, nowInSec);
    values.put(Video.Media.DATE_ADDED, nowInSec);
    values.put(Video.Media.DATA, mDstFileInfo.mFile.getAbsolutePath());
    values.put(Video.Media.SIZE, mDstFileInfo.mFile.length());
    int durationMs = retriveVideoDurationMs(mDstFileInfo.mFile.getPath());
    values.put(Video.Media.DURATION, durationMs);
    // Copy the data taken and location info from src.
    String[] projection = new String[] {
            VideoColumns.DATE_TAKEN,
            VideoColumns.LATITUDE,
            VideoColumns.LONGITUDE,
            VideoColumns.RESOLUTION,
    };

    // Copy some info from the source file.
    querySource(contentResolver, uri, projection,
            new ContentResolverQueryCallback() {
            @Override
                public void onCursorResult(Cursor cursor) {
                    long timeTaken = cursor.getLong(0);
                    if (timeTaken > 0) {
                        values.put(Video.Media.DATE_TAKEN, timeTaken);
                    }
                    double latitude = cursor.getDouble(1);
                    double longitude = cursor.getDouble(2);
                    // TODO: Change || to && after the default location
                    // issue is
                    // fixed.
                    if ((latitude != 0f) || (longitude != 0f)) {
                        values.put(Video.Media.LATITUDE, latitude);
                        values.put(Video.Media.LONGITUDE, longitude);
                    }
                    values.put(Video.Media.RESOLUTION, cursor.getString(3));

                }
            });

    return contentResolver.insert(Video.Media.EXTERNAL_CONTENT_URI, values);
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:51,代码来源:SaveVideoFileUtils.java


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