Class UploadWidget


  • public class UploadWidget
    extends java.lang.Object
    Helper class to start the UploadWidget and preprocess its results.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UploadWidget.Action
      Define how the upload widget handles the selected files to upload
      static class  UploadWidget.Options
      This class is used to define the required launch behaviour of the upload widget.
      static class  UploadWidget.Result
      Result data of the upload widget activity
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACTION_EXTRA  
      static java.lang.String RESULT_EXTRA
      The key used to pass upload widget result data back from UploadWidgetActivity.
      static java.lang.String URIS_EXTRA
      The key used to pass the uris to the upload widget.
    • Constructor Summary

      Constructors 
      Constructor Description
      UploadWidget()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void openMediaChooser​(android.app.Activity activity, int requestCode)
      Open the native android picker to choose a media file.
      static com.cloudinary.android.UploadRequest preprocessResult​(android.content.Context context, com.cloudinary.android.UploadRequest uploadRequest, UploadWidget.Result result)
      Preprocess the uploadRequest's with the upload widget results.
      static com.cloudinary.android.UploadRequest preprocessResult​(android.content.Context context, UploadWidget.Result result)
      Create a new UploadRequest with the upload widget's preprocess results.
      static java.util.ArrayList<com.cloudinary.android.UploadRequest> preprocessResults​(android.content.Context context, android.content.Intent data)
      Create a preprocessed list of UploadRequests from the UploadWidget's results data.
      static void startActivity​(android.app.Activity activity, int requestCode)
      Start the UploadWidgetActivity configured for full process - Launch file selection UI as well as dispatching the created upload request automatically.
      static void startActivity​(android.app.Activity activity, int requestCode, UploadWidget.Options options)
      Start the UploadWidgetActivity configured according to the supplied launch options.
      static void startActivity​(android.app.Activity activity, int requestCode, java.util.ArrayList<android.net.Uri> uris)
      Deprecated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UploadWidget

        public UploadWidget()
    • Method Detail

      • startActivity

        @Deprecated
        public static void startActivity​(@NonNull
                                         android.app.Activity activity,
                                         int requestCode,
                                         @NonNull
                                         java.util.ArrayList<android.net.Uri> uris)
        Deprecated.
        Start the UploadWidgetActivity with a pre-populated list of files to upload, and return a list of upload request to dispatch. This is equivalent to RequiredAction.NONE. Deprecated - please use startActivity(Activity, int, Options) directly.
        Parameters:
        activity - The activity which requested the upload widget.
        requestCode - A request code to start the upload widget with.
        uris - Uris of the selected media files.
      • startActivity

        public static void startActivity​(@NonNull
                                         android.app.Activity activity,
                                         int requestCode)
        Start the UploadWidgetActivity configured for full process - Launch file selection UI as well as dispatching the created upload request automatically.
        Parameters:
        activity - The activity which requested the upload widget.
        requestCode - A request code to start the upload widget with.
      • startActivity

        public static void startActivity​(@NonNull
                                         android.app.Activity activity,
                                         int requestCode,
                                         UploadWidget.Options options)
        Start the UploadWidgetActivity configured according to the supplied launch options.
        Parameters:
        activity - The activity which requested the upload widget.
        requestCode - A request code to start the upload widget with.
        options - The launch option to define the required upload widget behaviour
      • preprocessResults

        public static java.util.ArrayList<com.cloudinary.android.UploadRequest> preprocessResults​(android.content.Context context,
                                                                                                  android.content.Intent data)
        Create a preprocessed list of UploadRequests from the UploadWidget's results data.
        Parameters:
        data - Results data from the upload widget.
        Returns:
        Preprocessed UploadRequests.
      • preprocessResult

        public static com.cloudinary.android.UploadRequest preprocessResult​(android.content.Context context,
                                                                            UploadWidget.Result result)
        Create a new UploadRequest with the upload widget's preprocess results.
        Parameters:
        result - Result data from the upload widget.
        Returns:
        Newly created UploadRequest.
      • preprocessResult

        public static com.cloudinary.android.UploadRequest preprocessResult​(android.content.Context context,
                                                                            @NonNull
                                                                            com.cloudinary.android.UploadRequest uploadRequest,
                                                                            UploadWidget.Result result)
        Preprocess the uploadRequest's with the upload widget results.
        Parameters:
        uploadRequest - Already constructed upload request.
        result - Result data from the upload widget.
        Returns:
        Preprocessed UploadRequest
        Throws:
        java.lang.IllegalStateException - if uploadRequest was already dispatched.
      • openMediaChooser

        public static void openMediaChooser​(android.app.Activity activity,
                                            int requestCode)
        Open the native android picker to choose a media file.
        Parameters:
        activity - The activity that the native android picker was initiated from.
        requestCode - A request code to start the native android picker with.