Search in sources :

Example 26 with Uri

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

the class MediaDAO method getLastVideoFromCameraVideos.

/**
   * Returns the last video URI from the camera videos on the device.
   *
   * @param context The application context.
   * @return The URI for the requested query.
   */
public static Uri getLastVideoFromCameraVideos(final Context context) {
    Uri uri = null;
    Cursor cursor = getLastVideoCursor(context);
    if (cursor != null && cursor.moveToLast()) {
        uri = Uri.fromFile(new File(cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA))));
    }
    safelyCloseCursor(cursor);
    if (uri == null) {
        return Uri.parse("");
    }
    return uri;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri) File(java.io.File)

Example 27 with Uri

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

the class MediaDAO method getLastPhotoThumbnailFromAllPhotos.

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

Example 28 with Uri

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

the class MediaDAO method getLastVideoThumbnailFromAllVideos.

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

Example 29 with Uri

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

the class MediaDAO method getLastVideoFromAllVideos.

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

Example 30 with Uri

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

the class MediaDAO method getLastPhotoFromAllPhotos.

/* LAST MEDIA */
/**
   * Returns the last photo URI from all photos on the device.
   *
   * @param context The application context.
   * @return The URI for the requested query.
   */
public static Uri getLastPhotoFromAllPhotos(final Context context) {
    Cursor allMediaPhotos = getAllMediaPhotos(context);
    Uri uri = getFirstImageItemUri(allMediaPhotos);
    safelyCloseCursor(allMediaPhotos);
    if (uri == null) {
        return Uri.parse("");
    }
    return uri;
}
Also used : Cursor(android.database.Cursor) 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