public class

DownloadProgressFragment

extends DialogFragment
java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.fragment.app.DialogFragment
       ↳ com.pspdfkit.document.download.DownloadProgressFragment

Class Overview

A fragment for retaining a DownloadJob and showing its progress. Create the fragment via its constructor and call setJob(DownloadJob). This is a retained fragment and can't be used as nested fragment.

Summary

[Expand]
Inherited Constants
From class androidx.fragment.app.DialogFragment
Fields
protected Dialog dialog The currently displayed dialog.
Public Constructors
DownloadProgressFragment()
Public Methods
Dialog getDialog()
Returns the ProgressDialog that is used by this fragment.
DownloadJob getJob()
Returns the set DownloadJob (if any).
void onCancel(DialogInterface dialog)
void onCreate(Bundle savedInstanceState)
final Dialog onCreateDialog(Bundle savedInstanceState)
void onDestroyView()
void setDialogOnCancelListener(DialogInterface.OnCancelListener dialogCancelListener)
Set a Dialog.OnCancelListener that will be informed when the progress dialog was cancelled by the user.
void setJob(DownloadJob job)
Sets a DownloadJob.
Protected Methods
void configureDialog(Progress progress, boolean isIndeterminate)
Called when the first download progress was received to allow you to configure your dialog.
Dialog createDialog()
Called to allow you to create your download dialog.
void updateProgress(Progress progress)
Called when the download progress was updated.
[Expand]
Inherited Methods
From class androidx.fragment.app.DialogFragment
From class androidx.fragment.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.DialogInterface.OnCancelListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.view.View.OnCreateContextMenuListener
From interface androidx.lifecycle.LifecycleOwner
From interface androidx.lifecycle.ViewModelStoreOwner

Fields

protected Dialog dialog

The currently displayed dialog.

Public Constructors

public DownloadProgressFragment ()

Public Methods

public Dialog getDialog ()

Returns the ProgressDialog that is used by this fragment.

Returns
  • The ProgressDialog instance used by this fragment, or null if it's not yet initialized.

public DownloadJob getJob ()

Returns the set DownloadJob (if any). This can be used to retrieve the retained job after a configuration change happened.

Returns

public void onCancel (DialogInterface dialog)

public void onCreate (Bundle savedInstanceState)

public final Dialog onCreateDialog (Bundle savedInstanceState)

public void onDestroyView ()

public void setDialogOnCancelListener (DialogInterface.OnCancelListener dialogCancelListener)

Set a Dialog.OnCancelListener that will be informed when the progress dialog was cancelled by the user. Calling this method will replace any previously set listener. You may provide null to clear the listener.

Parameters
dialogCancelListener Dialog.OnCancelListener that should be notified, or null to clear the listener.

public void setJob (DownloadJob job)

Sets a DownloadJob. The fragment will retain the job across configuration changes (if added to the activity) and show its progress via a dialog.

Parameters
job The DownloadJob to retain and visualize.

Protected Methods

protected void configureDialog (Progress progress, boolean isIndeterminate)

Called when the first download progress was received to allow you to configure your dialog. Make sure to not call through to super.

Parameters
progress The first progress item received.
isIndeterminate If this progress is indeterminate.

protected Dialog createDialog ()

Called to allow you to create your download dialog. Make sure to not call through to super.

Returns

protected void updateProgress (Progress progress)

Called when the download progress was updated. Make sure to not call through to super.

Parameters
progress The current download progress.