本文整理汇总了Java中android.provider.MediaStore.Images.ImageColumns.DATE_TAKEN属性的典型用法代码示例。如果您正苦于以下问题:Java ImageColumns.DATE_TAKEN属性的具体用法?Java ImageColumns.DATE_TAKEN怎么用?Java ImageColumns.DATE_TAKEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.MediaStore.Images.ImageColumns
的用法示例。
在下文中一共展示了ImageColumns.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);
}
示例2: getContentValues
private static ContentValues getContentValues(Context context, Uri sourceUri,
File file, long time) {
final ContentValues values = new ContentValues();
time /= 1000;
values.put(Images.Media.TITLE, file.getName());
values.put(Images.Media.DISPLAY_NAME, file.getName());
values.put(Images.Media.MIME_TYPE, "image/jpeg");
values.put(Images.Media.DATE_TAKEN, time);
values.put(Images.Media.DATE_MODIFIED, time);
values.put(Images.Media.DATE_ADDED, time);
values.put(Images.Media.ORIENTATION, 0);
values.put(Images.Media.DATA, file.getAbsolutePath());
values.put(Images.Media.SIZE, file.length());
final String[] projection = new String[] {
ImageColumns.DATE_TAKEN,
ImageColumns.LATITUDE, ImageColumns.LONGITUDE,
};
SaveImage.querySource(context, sourceUri, projection,
new ContentResolverQueryCallback() {
@Override
public void onCursorResult(Cursor cursor) {
values.put(Images.Media.DATE_TAKEN, cursor.getLong(0));
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(Images.Media.LATITUDE, latitude);
values.put(Images.Media.LONGITUDE, longitude);
}
}
});
return values;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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;
}