public class

SignatureCaptureInline

extends SignatureCaptureFormCell
implements SupportsHelperText
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.constraintlayout.widget.ConstraintLayout
         ↳ com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell
           ↳ com.sap.cloud.mobile.fiori.formcell.SignatureCaptureInline

Class Overview

A 'scrolling friendly' SignatureCaptureFormCell. Out of the box, there is a scrim overlay and a helper text prompting the user to 'tap to start signing'. Once the user taps the scrim, the scrim will disappear allowing the user to sign. The user can then clear or save the signature (buttons provided in the footer). Upon saving a signature, the footer is swapped with another footer containing a 'reenter signature' button. A ViewModel is used for saving/restoring the state of the UI after any configuration change. One thing to note is that two bitmaps (one for light mode and one for dark mode) are passed into this ViewModel in case the user switches between a light/dark mode after they have already submitted their signature. The bitmaps are cleared after the FragmentActivity containing this FormCell finishes.

Summary

Nested Classes
class SignatureCaptureInline.OnSignedListener  
XML Attributes
Attribute Name Related Method Description
SignatureCaptureFormCell_footerEnabled  
SignatureCaptureFormCell_helperEnabled  
SignatureCaptureFormCell_helperText  
SignatureCaptureFormCell_helperTextAppearance  
SignatureCaptureFormCell_keyEnabled  
[Expand]
Inherited XML Attributes
From class com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell
Constants
float PEN_SUBMITTED_ALPHA
float SCRIM_AFFECTED_COMPONENTS_ALPHA
[Expand]
Inherited Constants
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.View
Public Constructors
SignatureCaptureInline(Context context)
SignatureCaptureInline(Context context, AttributeSet attrs)
Public Methods
void clickCancel()
void clickReenter()
void clickSave()
int getCellType()
Return the type of the filter control being used.
CharSequence getHelperText()
Returns the validation message specified for the view.
PersistentFooter getReenterFooter()
Get the 'reenter signature' footer to allow further customization.
Bitmap getSignatureBitmapWithWatermark(boolean includeUnderlineXmark)
Constructs a visual of the signed form, included in the Bitmap are the signature, background, and watermark.
boolean isHelperEnabled()
boolean isScrimEnabled()
boolean isUsingCancelButton()
void resetUIState()
Resets this view to its default (initial) state.
void setFooterEnabled(boolean enabled)
Enable/disable the default footer (Persistent footer with save and clear button), affecting its visibility.
void setHelperEnabled(boolean enabled)
void setHelperText(CharSequence validationMessage)
Sets the text which implies that the input is invalid and needs correction
void setHelperTextAppearance(int textAppearance)
Sets the text appearance on the error message
void setId(int id)
If creating and adding this FormCell dynamically, this method must be called in order to save/restore the UI state across configuration changes.
void setOnCancelListener(View.OnClickListener onCancelListener)
Set an OnClickListener to be triggered when the Cancel button is clicked.
void setOnReenterClickListener(View.OnClickListener onReenterClickListener)
Set a callback to trigger when the user clicks the "re-enter" signature button.
void setOnSaveListener(View.OnClickListener onSaveListener)
Sets a 'save/submit' listener to one of the footer's actions.
void setUseCancelButton(boolean isUsingCancelButton)
Set a flag to let the app know if the cancel button should be used.
void swapFooters()
Swaps the 'reenter signature' footer with the 'clear/save signature' footer (and vice versa).
Protected Methods
void adjustMargins()
void saveUpdatedUIState(boolean isSubmitted)
Saves the state of the UI into a ViewModel in case of a configuration change.
void setScrimEnabled(boolean isEnabled)
If true, enables the scrim and helper text and also reduces the opacity of the underlying components (xmark, underline, footer).
void setUIAsSavedState()
Swap the footers and set the UI state to stop taking user signature input.
void setUIAsSigningState()
Set the UI state to allow signing.
[Expand]
Inherited Methods
From class com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface com.sap.cloud.mobile.fiori.formcell.FormCell
From interface com.sap.cloud.mobile.fiori.formcell.SupportsHelperText
From interface com.sap.cloud.mobile.fiori.formcell.SupportsKey

XML Attributes

SignatureCaptureFormCell_footerEnabled

Related Methods

SignatureCaptureFormCell_helperEnabled

Related Methods

SignatureCaptureFormCell_helperText

Related Methods

SignatureCaptureFormCell_helperTextAppearance

Related Methods

SignatureCaptureFormCell_keyEnabled

Related Methods

Constants

public static final float PEN_SUBMITTED_ALPHA

Constant Value: 0.4

public static final float SCRIM_AFFECTED_COMPONENTS_ALPHA

Constant Value: 0.2

Public Constructors

public SignatureCaptureInline (Context context)

public SignatureCaptureInline (Context context, AttributeSet attrs)

Public Methods

public void clickCancel ()

public void clickReenter ()

public void clickSave ()

public int getCellType ()

Return the type of the filter control being used.

Returns
  • WidgetType type of the control

public CharSequence getHelperText ()

Returns the validation message specified for the view.

Returns
  • CharSequence validation string

public PersistentFooter getReenterFooter ()

Get the 'reenter signature' footer to allow further customization. This footer has 1 button enabled by default.

Returns
  • the footer that contains the button that allows the user to reenter their signature

public Bitmap getSignatureBitmapWithWatermark (boolean includeUnderlineXmark)

Constructs a visual of the signed form, included in the Bitmap are the signature, background, and watermark. The xmark and underline are optional.

Parameters
includeUnderlineXmark if true, the resulting Bitmap will include the xmark and underline if they were present
Returns
  • a Bitmap with the signature and watermark, as well as the background (default white background)

public boolean isHelperEnabled ()

public boolean isScrimEnabled ()

public boolean isUsingCancelButton ()

Returns
  • true if the cancel button is being used.

public void resetUIState ()

Resets this view to its default (initial) state.

public void setFooterEnabled (boolean enabled)

Enable/disable the default footer (Persistent footer with save and clear button), affecting its visibility. If enabled while the scrim is present an alpha is applied to it making it semi-transparent.

Parameters
enabled if false, set the footer's visibility to invisible

public void setHelperEnabled (boolean enabled)

public void setHelperText (CharSequence validationMessage)

Sets the text which implies that the input is invalid and needs correction

Parameters
validationMessage CharSequence

public void setHelperTextAppearance (int textAppearance)

Sets the text appearance on the error message

Parameters
textAppearance resource id

public void setId (int id)

If creating and adding this FormCell dynamically, this method must be called in order to save/restore the UI state across configuration changes.

Parameters
id used to restore UI state after configuration change

public void setOnCancelListener (View.OnClickListener onCancelListener)

Set an OnClickListener to be triggered when the Cancel button is clicked. By default, clicking the cancel button will clear the signature, enable the scrim, and pause user signature input. The user will have to tap on the scrim again if they wish to restart the signing process.

Parameters
onCancelListener the View.OnClickListener that will be set on the cancel button

public void setOnReenterClickListener (View.OnClickListener onReenterClickListener)

Set a callback to trigger when the user clicks the "re-enter" signature button. Calling this method is optional, but may need to be set if wanting to add more behavior (or overriding this method if modifying the behavior is desired).

Parameters
onReenterClickListener a callback triggered when the user wishes to re-enter the signature

public void setOnSaveListener (View.OnClickListener onSaveListener)

Sets a 'save/submit' listener to one of the footer's actions. Note: Upon saving, there is some pre-behavior for the inline feature (and this method may be overridden if modifying the behavior is desired): This FormCell will stop taking user signature input. If a signature is present, the footer will update so it allows the user to reenter their signature if they'd like. If a signature is not present, the scrim and helper text will be re-enabled.

Parameters
onSaveListener the listener to be set on one of the footer's buttons

public void setUseCancelButton (boolean isUsingCancelButton)

Set a flag to let the app know if the cancel button should be used. If true, the cancel button will be enabled/disabled within internal logic also causing the footer to be semi-transparent when there is a blank form (no signature). If false, cancel button will be ignored in internal logic and footer will be completely opaque when there is a blank form (no signature).

Parameters
isUsingCancelButton include the cancel button in the internal logic if true, ignore otherwise

public void swapFooters ()

Swaps the 'reenter signature' footer with the 'clear/save signature' footer (and vice versa).

Protected Methods

protected void adjustMargins ()

protected void saveUpdatedUIState (boolean isSubmitted)

Saves the state of the UI into a ViewModel in case of a configuration change. The ViewModel saves 2 bitmaps to account for day/night configuration change after a signature has already been submitted (used to restore the UI in either mode). NOTE: If there is a signature present and the user has not clicked submit/save, the signature will not be restored upon a configuration change.

Parameters
isSubmitted true if the user signed and saved/submitted

protected void setScrimEnabled (boolean isEnabled)

If true, enables the scrim and helper text and also reduces the opacity of the underlying components (xmark, underline, footer).

Parameters
isEnabled if true, show the scrim

protected void setUIAsSavedState ()

Swap the footers and set the UI state to stop taking user signature input.

protected void setUIAsSigningState ()

Set the UI state to allow signing.