public abstract class

BaseImagePickerFragment

extends Fragment
java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ com.pspdfkit.document.image.BaseImagePickerFragment
Known Direct Subclasses

Class Overview

Base fragment for image picker implementations.

Summary

Fields
protected BaseImagePickerFragment.ActivityResult lastActivityResult Holds last activity result when no listener is registered.
protected ImagePicker.OnImagePickedListener onImagePickedListener Currently set listener for image picking process (if any).
protected Intent pendingIntentForResult Intent that will get executed when this fragment is added to activity.
Public Constructors
BaseImagePickerFragment()
Public Methods
void finish()
Remove the fragment from its owning activity.
void onActivityResult(int requestCode, int resultCode, Intent data)
void onCreate(Bundle savedInstanceState)
void onSaveInstanceState(Bundle outState)
void setOnImagePickedListener(ImagePicker.OnImagePickedListener onImagePickedListener)
Sets on image picked listener.
Protected Methods
abstract Intent getImagePickerIntent()
Creates an intent to start image picking activity, an image gallery or a camera.
abstract int getRequestCode()
Gets request code to be given to the intent when starting image picker activity for result.
abstract void onImagePickerResult(int resultCode, Intent data)
Called when image picker gets result from the activity it started, whether camera or image picker.
abstract void queueStartActivityForResult(Intent intent)
Start activity for result with a given intent, or queues it up if the fragment is still not active.
[Expand]
Inherited Methods
From class androidx.fragment.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener
From interface androidx.lifecycle.LifecycleOwner
From interface androidx.lifecycle.ViewModelStoreOwner

Fields

protected BaseImagePickerFragment.ActivityResult lastActivityResult

Holds last activity result when no listener is registered.

protected ImagePicker.OnImagePickedListener onImagePickedListener

Currently set listener for image picking process (if any).

protected Intent pendingIntentForResult

Intent that will get executed when this fragment is added to activity.

Public Constructors

public BaseImagePickerFragment ()

Public Methods

public void finish ()

Remove the fragment from its owning activity.

public void onActivityResult (int requestCode, int resultCode, Intent data)

public void onCreate (Bundle savedInstanceState)

public void onSaveInstanceState (Bundle outState)

public void setOnImagePickedListener (ImagePicker.OnImagePickedListener onImagePickedListener)

Sets on image picked listener. Calling this method will replace any previously set listener. You may provide null to clear the listener.

Parameters
onImagePickedListener ImagePicker.OnImagePickedListener that should be notified, or null to clear the listener.

Protected Methods

protected abstract Intent getImagePickerIntent ()

Creates an intent to start image picking activity, an image gallery or a camera.

Returns
  • Image picking activity intent.

protected abstract int getRequestCode ()

Gets request code to be given to the intent when starting image picker activity for result.

Returns
  • Request code for the fragment.

protected abstract void onImagePickerResult (int resultCode, Intent data)

Called when image picker gets result from the activity it started, whether camera or image picker.

Parameters
resultCode Result code received from the activity.
data Received data.

protected abstract void queueStartActivityForResult (Intent intent)

Start activity for result with a given intent, or queues it up if the fragment is still not active.

Parameters
intent Intent to be fired.