public class

NewPageDialog

extends AppCompatDialogFragment
java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.fragment.app.DialogFragment
       ↳ androidx.appcompat.app.AppCompatDialogFragment
         ↳ com.pspdfkit.document.editor.page.NewPageDialog

Class Overview

Dialog for choosing properties for a newly created PDF page. A call to show(FragmentManager, Size, List, Callback) will prepare and show the dialog, creating it if necessary. When calling this method after a configuration change, it will restore and use the previously added dialog.

Summary

Nested Classes
interface NewPageDialog.Callback This listener interface needs to be implemented by any class that wishes to handle new page creation event. 
Constants
String ARG_DOCUMENT_PAGE_SIZE Name of the fragment argument carrying the document page Size.
String FRAGMENT_TAG Fragment transaction tag used by this dialog.
[Expand]
Inherited Constants
From class androidx.fragment.app.DialogFragment
Public Constructors
NewPageDialog()
Primary constructor of the NewPageDialog.
Public Methods
Context getContext()
static void hide(FragmentManager fragmentManager)
Hides the dialog if visible.
void onCreate(Bundle savedInstanceState)
Dialog onCreateDialog(Bundle savedInstanceState)
void onDismiss(DialogInterface dialog)
void onStart()
static boolean restore(FragmentManager fragmentManager, List<PageTemplate> pageTemplates, boolean showPageTemplatesLast, NewPageDialog.Callback callback)
Restore existing dialog.
static boolean restore(FragmentManager fragmentManager, NewPageDialog.Callback callback)
Restore existing dialog.
static boolean restore(FragmentManager fragmentManager, List<PageTemplate> pageTemplates, NewPageDialog.Callback callback)
Restore existing dialog.
void setupDialog(Dialog dialog, int style)
static void show(FragmentManager fragmentManager, Size documentPageSize, List<PageTemplate> pageTemplates, boolean showPageTemplatesLast, NewPageDialog.Callback callback)
Shows the dialog to the user.
static void show(FragmentManager fragmentManager, Size documentPageSize, NewPageDialog.Callback callback)
Shows the dialog to the user.
static void show(FragmentManager fragmentManager, Size documentPageSize, List<PageTemplate> pageTemplates, NewPageDialog.Callback callback)
Shows the dialog to the user.
Protected Methods
void onAddButtonClicked()
Called when the user presses the "Add" button of the dialog.
[Expand]
Inherited Methods
From class androidx.appcompat.app.AppCompatDialogFragment
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

Constants

public static final String ARG_DOCUMENT_PAGE_SIZE

Name of the fragment argument carrying the document page Size. The argument use is optional.

Constant Value: "com.pspdfkit.ui.dialog.page.NewPageDialog.ARG_DOCUMENT_PAGE_SIZE"

public static final String FRAGMENT_TAG

Fragment transaction tag used by this dialog. When using show(FragmentManager, Size, List, Callback) the dialog will automatically use this tag.

Constant Value: "com.pspdfkit.ui.dialog.page.NewPageDialog.FRAGMENT_TAG"

Public Constructors

public NewPageDialog ()

Primary constructor of the NewPageDialog.

Public Methods

public Context getContext ()

public static void hide (FragmentManager fragmentManager)

Hides the dialog if visible.

Parameters
fragmentManager Fragment manager for performing necessary fragment transactions.

public void onCreate (Bundle savedInstanceState)

public Dialog onCreateDialog (Bundle savedInstanceState)

public void onDismiss (DialogInterface dialog)

public void onStart ()

public static boolean restore (FragmentManager fragmentManager, List<PageTemplate> pageTemplates, boolean showPageTemplatesLast, NewPageDialog.Callback callback)

Restore existing dialog.

Parameters
fragmentManager Fragment manager for querying dialog fragment state.
pageTemplates A list of PageTemplates that the user can select from in addition to the original patterns.
showPageTemplatesLast Set to true to display your PageTemplates after page pattern options. Set to false by default.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.
Returns
  • True when dialog has been restored, false otherwise.

public static boolean restore (FragmentManager fragmentManager, NewPageDialog.Callback callback)

Restore existing dialog.

Parameters
fragmentManager Fragment manager for querying dialog fragment state.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.
Returns
  • True when dialog has been restored, false otherwise.

public static boolean restore (FragmentManager fragmentManager, List<PageTemplate> pageTemplates, NewPageDialog.Callback callback)

Restore existing dialog.

Parameters
fragmentManager Fragment manager for querying dialog fragment state.
pageTemplates A list of PageTemplates that the user can select from in addition to the original patterns.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.
Returns
  • True when dialog has been restored, false otherwise.

public void setupDialog (Dialog dialog, int style)

public static void show (FragmentManager fragmentManager, Size documentPageSize, List<PageTemplate> pageTemplates, boolean showPageTemplatesLast, NewPageDialog.Callback callback)

Shows the dialog to the user.

Parameters
fragmentManager Fragment manager for performing necessary fragment transactions.
documentPageSize A custom size representative for the current document. This size option will be called "document size" inside the page size dropdown list, and will be selected by default. The caller needs to define this size, or pass in null to deactivate that option.
pageTemplates A list of PageTemplates that the user can select from in addition to the default patterns.
showPageTemplatesLast Set to true to display your PageTemplates after page pattern options. Set to false by default.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.

public static void show (FragmentManager fragmentManager, Size documentPageSize, NewPageDialog.Callback callback)

Shows the dialog to the user.

Parameters
fragmentManager Fragment manager for performing necessary fragment transactions.
documentPageSize A custom size representative for the current document. This size option will be called "document size" inside the page size dropdown list, and will be selected by default. The caller needs to define this size, or pass in null to deactivate that option.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.

public static void show (FragmentManager fragmentManager, Size documentPageSize, List<PageTemplate> pageTemplates, NewPageDialog.Callback callback)

Shows the dialog to the user.

Parameters
fragmentManager Fragment manager for performing necessary fragment transactions.
documentPageSize A custom size representative for the current document. This size option will be called "document size" inside the page size dropdown list, and will be selected by default. The caller needs to define this size, or pass in null to deactivate that option.
pageTemplates A list of PageTemplates that the user can select from in addition to the default patterns.
callback A NewPageDialog.Callback that will be notified of confirmation or dismissal of the dialog.

Protected Methods

protected void onAddButtonClicked ()

Called when the user presses the "Add" button of the dialog. The default implementation will dismiss the dialog and notify any NewPageDialog.Callback.