Modal Dialogs Styling

PSPDFKit styles all dialogs according to your theme by default without any additional work. This produces light dialogs with light application themes and dark dialogs with dark application themes.

If default behavior is not enough, a large set of style attributes is available to alter the appearance to your needs. For a comprehensive usage example have a look at the DarkThemeExample and DarkThemeActivity inside the catalog app.

Alert dialogs

PSPDFKit supports the standard alertDialogTheme attribute from appcompat-v7 for styling all AlertDialog instances:

Copy
styles.xml
1
2
3
<style name="MyApp.PSPDFKitTheme" parent="PSPDFKit.Theme.Default">
    <item name="alertDialogTheme>@style/PSPDFKit.AlertDialog</item>
</style>

Modal Dialogs

PSPDFKit allows styling the appearance of common properties of custom modal dialogs - Sharing/Printing dialogs, Bottom sheets, Stamp and Signature pickers, New page dialog etc.

1
<item name="pspdf__modalDialogStyle">@style/MyApp.ModalDialogStyle</item>

Attributes:

Attribute Description
pspdf__titleBackground Dialog title bar background color.
pspdf__titleTextColor Dialog title bar text color.
pspdf__titleIconsColor Dialog title bar icons color.
pspdf__titleHeight Dialog title height.
pspdf__titleTextSize Dialog title text size.
pspdf__titlePadding Dialog title padding.
pspdf__cornerRadius Dialog corner radius.

To use different modal dialog styles, override pspdf__modalDialogStyle theme attribute in style controlling your dialog theming.

Sharing Dialog

Sharing/Printing options dialog style is controlled by the following theme attribute:

1
<item name="pspdf__sharingDialogStyle">@style/MyApp.SharingDialogStyle</item>

Attributes:

Attribute Description
pspdf__backgroundColor Sharing dialog background color.
pspdf__errorColor Error highlight color used in text fields.

Style of controls inside sharing dialog are controlled by existing theme attributes. For example:

Attribute Description
android:colorBackground Color used in spinner popups.
android:textColorPrimary Text color inside dialog.
android:textColorSecondary Text color used for captions.

New Page Dialog

To control new page dialog's style just add the following attribute to your theme:

1
<item name="pspdf__newPageDialogStyle">@style/MyApp.NewPageDialogStyle</item>

Attributes:

Attribute Description
pspdf__backgroundColor Dialog background color.

Style of controls inside new page dialog are controlled by existing theme attributes. For example:

Attribute Description
android:colorBackground Color used in spinner popups.
android:textColorPrimary Text color inside dialog.
android:textColorSecondary Text color used for captions.

Stamp Picker Dialog

Stamp picker dialog style is controlled by the following theme attribute:

1
<item name="pspdf__stampPickerStyle">@style/MyApp.StampPickerStyle</item>

Attributes:

Attribute Description
pspdf__maxHeight Maximal height of the stamp picker dialog.
pspdf__maxWidth Maximal width of the stamp picker dialog.
pspdf__backgroundColor Dialog background color.
pspdf__textColor Stamp picker text color.
pspdf__hintColor Stamp picker edit text hint color.
pspdf__acceptCustomStampIcon Icon for accepting custom stamp when editing it, will be displayed inside the FAB. Check mark by default.
pspdf__acceptCustomStampIconColor Color for custom stamp acceptance icon.
pspdf__acceptCustomStampIconBackgroundColor Color for custom stamp acceptance icon background.

Add Signature Dialog

Signature dialog style is controlled by the following theme attribute:

1
<item name="pspdf__signatureLayoutStyle">@style/MyApp.SignatureLayoutStyle</item>

Attributes:

Attribute Description
pspdf__backgroundColor Signature layout background color.
pspdf__textColor Signature layout foreground color.
pspdf__addSignatureIcon Icon for adding signature (displayed in FAB by default.)
pspdf__addSignatureIconColor Color for the "Add Signature" icon.
pspdf__addSignatureIconBackgroundColor Background color for the "Add Signature" icon, the background of the FAB.
pspdf__acceptSignatureIcon Icon for accepting signature when editing it, will be displayed inside the FAB. Check mark by default.
pspdf__acceptSignatureIconColor Color for signature acceptance icon.
pspdf__acceptSignatureIconBackgroundColor Color for signature acceptance icon background.
pspdf__signatureListSelectedItemBackground Color for the selected signature list item background.
pspdf__deleteSelectedSignaturesIcon Icon for deleting selected signature, will be displayed inside the FAB. Trash icon by default.
pspdf__deleteSelectedSignaturesIconColor Color for signature deletion icon.
pspdf__deleteSelectedSignaturesIconBackgroundColor Background color for signature deletion icon.
pspdf__clearSignatureCanvasIcon Signature layout icon for clearing signature canvas.
pspdf__clearSignatureCanvasIconColor Color of the clear canvas icon.
pspdf__colorIconsBorderColor Color of the border for signature ink color icons.
pspdf__signatureInkColorPrimary First color offered in signature ink color picker.
pspdf__signatureInkColorSecondary Second color offered in signature ink color picker.
pspdf__signatureInkColorTertiary Third color offered in signature ink color picker.

Annotation Inspector

Use this to change the appearance of the annotation inspector:

1
<item name="pspdf__propertyInspectorStyle">@style/MyApp.PropertyInspectorStyle</item>

Attributes:

Attribute Description
pspdf__backgroundColor Inspector background color.
pspdf__textColor Inspector text color.
pspdf__minHeight Minimum height of the inspector when resized.
pspdf__maxHeight Maximum height of the inspector when resized.
pspdf__maxWidth Maximum width of the inspector.

Action Menu

Action menu style is controlled by the following theme attribute:

1
<item name="pspdf__actionMenuStyle">@style/MyApp.ActionMenuStyle</item>

Attributes:

Attribute Description
pspdf__maxWidth Maximum width of the action menu on tablets.
pspdf__backgroundColor Background color used in the action menu.
pspdf__labelColor Action labels text color.
pspdf__fixedActionsPanelBackgroundColor Fixed actions background color.
pspdf__fixedActionsIconColor Fixed actions icon color.
pspdf__fixedActionsIconBackground Fixed actions circular background color.

Using Light Dialogs With Dark Themes

You could want to use dark application theme like Theme.AppCompat.NoActionBar and still use light themed dialogs. To achieve this, change dialog style parent to Theme.AppCompat.Dialog.Light or ThemeOverlay.AppCompat.Light. First variant will override all theme values like primaryColor, colorAccent etc. Latter will just overlay dark theme colors with their light variants.

For example to produce lightly colored sharing dialog just set the following as your pspdf__sharingDialogStyle:

Copy
1
2
3
4
<style name="MyApp.SharingDialogStyle" parent="ThemeOverlay.AppCompat.Light">
    <item name="pspdf__backgroundColor">@color/pspdf__color_white</item>
    <item name="pspdf__errorColor">@color/pspdf__color_error</item>
</style>