Class PictureFileUtils

    • Constructor Detail

    • Method Detail

      • isExternalStorageDocument

         static boolean isExternalStorageDocument(Uri uri)
        Parameters:
        uri - The Uri to check.
        Returns:

        Whether the Uri authority is ExternalStorageProvider.

      • isDownloadsDocument

         static boolean isDownloadsDocument(Uri uri)
        Parameters:
        uri - The Uri to check.
        Returns:

        Whether the Uri authority is DownloadsProvider.

      • isMediaDocument

         static boolean isMediaDocument(Uri uri)
        Parameters:
        uri - The Uri to check.
        Returns:

        Whether the Uri authority is MediaProvider.

      • isGooglePhotosUri

         static boolean isGooglePhotosUri(Uri uri)
        Parameters:
        uri - The Uri to check.
        Returns:

        Whether the Uri authority is Google Photos.

      • getDataColumn

         static String getDataColumn(Context context, Uri uri, String selection, Array<String> selectionArgs)

        Get the value of the data column for this Uri. This is useful for MediaStore Uris, and other file-based ContentProviders.

        Parameters:
        context - The context.
        uri - The Uri to query.
        selection - (Optional) Filter used in the query.
        selectionArgs - (Optional) Selection arguments used in the query.
        Returns:

        The value of the _data column, which is typically a file path.

      • getPath

         static String getPath(Context context, Uri uri)

        Get a file path from a Uri. This will get the the path for Storage Access Framework Documents, as well as the _data field for the MediaStore and other file-based ContentProviders. Callers should check whether the path is local before assuming it represents a local file.

        Parameters:
        context - The context.
        uri - The Uri to query.
      • readPictureDegree

         static int readPictureDegree(Context context, String path)

        Read image EXIF rotation angle

        Parameters:
        path - absolute image path
        Returns:

        degree the rotation angle

      • rotatingImageView

         static Bitmap rotatingImageView(int angle, Bitmap bitmap)

        Rotate Bitmap

      • deleteCacheDirFile

         static void deleteCacheDirFile(Context mContext, int type)

        set empty PictureSelector Cache

        Parameters:
        type - image or video ...
      • deleteAllCacheDirFile

         static void deleteAllCacheDirFile(Context context)

        set empty PictureSelector Cache

      • parUri

         static Uri parUri(Context context, File cameraFile)

        Generate URI

      • rotateImage

         static void rotateImage(int degree, String path)

        Check and rotate captured image if needed