Search in sources :

Example 21 with Uri

use of android.net.Uri in project photo-picker-plus-android by chute.

the class MediaDAO method getLastVideoThumbnailFromCameraVideos.

/**
   * Returns the last video thumbnail URI from the camera videos on the
   * device.
   *
   * @param context The application context.
   * @return The URI for the requested query.
   */
public static Uri getLastVideoThumbnailFromCameraVideos(final Context context) {
    Cursor cameraVideos = getCameraVideosThumbnails(context);
    Uri uri = getFirstVideoThumbnailUri(cameraVideos);
    safelyCloseCursor(cameraVideos);
    if (uri == null) {
        return Uri.parse("");
    }
    return uri;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 22 with Uri

use of android.net.Uri in project photo-picker-plus-android by chute.

the class MediaDAO method getLastPhotoFromCameraPhotos.

/**
   * Returns the last photo URI from the camera photos on the device.
   *
   * @param context The application context.
   * @return The URI for the requested query.
   */
public static Uri getLastPhotoFromCameraPhotos(final Context context) {
    Cursor cameraPhotos = getCameraPhotos(context);
    Uri uri = getFirstImageItemUri(cameraPhotos);
    safelyCloseCursor(cameraPhotos);
    if (uri == null) {
        return Uri.parse("");
    }
    return uri;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 23 with Uri

use of android.net.Uri in project photo-picker-plus-android by chute.

the class MediaDAO method getLastVideoCursor.

/**
   * Request a specific record in {@link android.provider.MediaStore.Video.Media} database.
   *
   * @param context The application context.
   * @return Cursor object enabling read-write access to all videos on the
   * device.
   */
public static Cursor getLastVideoCursor(final Context context) {
    final String[] projection = new String[] { MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA };
    final Uri videos = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
    final String query = MediaStore.Video.Media.DATA + " LIKE \"%DCIM%\"";
    return context.getContentResolver().query(videos, projection, query, null, MediaStore.Video.Media.DATE_TAKEN);
}
Also used : Uri(android.net.Uri)

Example 24 with Uri

use of android.net.Uri in project photo-picker-plus-android by chute.

the class MediaDAO method getLastPhotoContentUri.

public static Uri getLastPhotoContentUri(Context context) {
    Cursor cursor = getCameraPhotos(context);
    Uri uri = null;
    if (cursor != null && cursor.moveToFirst()) {
        uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, cursor.getInt(cursor.getColumnIndex(MediaStore.Images.Media._ID)));
    }
    safelyCloseCursor(cursor);
    return uri;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 25 with Uri

use of android.net.Uri in project photo-picker-plus-android by chute.

the class MediaDAO method getCameraVideos.

/**
   * Request a specific record in {@link android.provider.MediaStore.Video.Media} database.
   *
   * @param context The application context.
   * @return Cursor object enabling read-write access to camera videos on the
   * device.
   */
public static Cursor getCameraVideos(final Context context) {
    final String[] projection = new String[] { MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA };
    final Uri videos = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
    final String query = MediaStore.Video.Media.DATA + " LIKE \"%DCIM%\"";
    return context.getContentResolver().query(videos, projection, query, null, MediaStore.Video.Media.DEFAULT_SORT_ORDER);
}
Also used : Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)6747 Intent (android.content.Intent)1547 Cursor (android.database.Cursor)894 File (java.io.File)744 Test (org.junit.Test)632 ContentValues (android.content.ContentValues)614 IOException (java.io.IOException)571 ContentResolver (android.content.ContentResolver)449 ArrayList (java.util.ArrayList)446 Bundle (android.os.Bundle)289 Context (android.content.Context)276 Bitmap (android.graphics.Bitmap)273 InputStream (java.io.InputStream)257 View (android.view.View)251 RemoteException (android.os.RemoteException)228 PendingIntent (android.app.PendingIntent)209 SuppressLint (android.annotation.SuppressLint)180 FileNotFoundException (java.io.FileNotFoundException)177 TextView (android.widget.TextView)175 ActivityNotFoundException (android.content.ActivityNotFoundException)169