public class

SignatureCaptureFormCell

extends ConstraintLayout
implements FormCell<T> SupportsKey
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.constraintlayout.widget.ConstraintLayout
         ↳ com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell
Known Direct Subclasses

Class Overview

A signature capture pad as a FormCell. By default it displays an x-mark and an underline for user guidance. You can attach a FormCell.CellValueChangeListener to listen to finger touch events on the cell. The value returned is a SignatureInfo object which contains important information about the cell. Information included are: title, date, Bitmap, SVG (as a String), and boolean indicating if the cell is signed.

Using SignatureCaptureFormCell.BitmapMode, the cell allows the developer to control what kind of bitmap is returned when the value is changed or when they call getValue(). For example, calling getValue() after the user has clicked a submit button. By default, the user's locale date and time format will be used to show the date and time value. Developer can specify their own DateFormat by setting setDateTimeFormatter(DateFormat). Both the title and the date are set as text for the watermark (which is invisible to the user). The watermark can be viewed by a Bitmap that supports watermark see SignatureCaptureFormCell.BitmapMode and getSignatureBitmapWithWatermark(boolean). This form cell is a subtype of ConstraintLayout.

Summary

Nested Classes
enum SignatureCaptureFormCell.BitmapMode BitmapMode controls the kind of bitmap returned in the value. 
class SignatureCaptureFormCell.OnSignedListener  
XML Attributes
Attribute Name Related Method Description
SignatureCaptureFormCell_android_maxLines  
SignatureCaptureFormCell_bitmapMode  
SignatureCaptureFormCell_cancelButtonEnabled  
SignatureCaptureFormCell_cancelButtonText  
SignatureCaptureFormCell_clearOnDoubleClick  
SignatureCaptureFormCell_dateTimeFormatter  
SignatureCaptureFormCell_isEditable  
SignatureCaptureFormCell_penColor  
SignatureCaptureFormCell_penStrokeMaximumWidth  
SignatureCaptureFormCell_penStrokeMinimumWidth  
SignatureCaptureFormCell_penVelocityFilterWeight  
SignatureCaptureFormCell_signatureField_marginHorizontal  
SignatureCaptureFormCell_underlineColor  
SignatureCaptureFormCell_underlineEnabled  
SignatureCaptureFormCell_underlineHeight  
SignatureCaptureFormCell_watermarkTextAppearance  
SignatureCaptureFormCell_xmarkEnabled  
SignatureCaptureFormCell_xmarkTextAppearance  
[Expand]
Inherited Constants
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.ViewGroup
From class android.view.View
Fields
protected AppCompatButton mCancelButton
protected PersistentFooter mFooter
protected TextView mHeaderText
protected int mHorizontalMargin
protected boolean mIsSaveListenerOnPrimaryButton
protected View.OnClickListener mOnCancelListener
protected int mPenColor
protected int mPenColorDark
protected boolean mShouldAttachOrientationListener
protected SignaturePad mSignaturePad
protected View mUnderline
protected TextView mWatermarkDateText
protected TextView mWatermarkTitleText
protected TextView mXmarkText
[Expand]
Inherited Fields
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.View
Public Constructors
SignatureCaptureFormCell(Context context)
SignatureCaptureFormCell(Context context, AttributeSet attrs)
Public Methods
void clearSignature()
Clears the signature from the form.
SignatureCaptureFormCell.BitmapMode getBitmapMode()
Get the bitmap mode, visible only for testing.
int getCellType()
Return the type of the filter control being used.
CellValueChangeListener<SignatureInfo> getCellValueChangeListener()
Return the value change handler of the control
String getDateText()
Get the watermark date as formatted, as a String.
PersistentFooter getFooter()
Get the footer to allow further customization.
CharSequence getKey()
Return the label of the property of control
List<TimedPoint> getPoints()
Get the signature represented as a list of points (TimedPoint), each point comes with a timestamp.
String getSignatureAsSvg()
Get the signature as a String representing a SVG.
Bitmap getSignatureBitmap()
Returns a Bitmap containing only the signature on a white background.
Bitmap getSignatureBitmapWithWatermark(boolean includeUnderlineXmark)
Constructs a visual of the signed form, included in the Bitmap are the signature, background, and watermark.
Bitmap getTransparentSignatureBitmap(boolean trimBlankSpace)
Get only the signature itself.
View getUnderline()
SignatureInfo getValue()
Return the value of the property of the control
String getWatermarkTitle()
Get the watermark title.
TextView getXmark()
boolean isCancelButtonEnabled()
Returns true if the Cancel button is enabled (visible).
boolean isEditable()
Returns if the control is enabled or not to modify values.
boolean isFooterEnabled()
boolean isKeyEnabled()
boolean isSigned()
boolean isUnderlineEnabled()
boolean isXmarkEnabled()
void setBitmapMode(SignatureCaptureFormCell.BitmapMode bitmapMode)
Sets the mode for the type of Bitmap to include in the value.
void setCancelButtonEnabled(boolean isEnabled)
Enables or disables the cancel button by changing its visibility
void setCancelButtonText(CharSequence cancelText)
Set the cancel button text.
void setCellValueChangeListener(CellValueChangeListener<SignatureInfo> listener)
void setClearButtonText(CharSequence clearButtonText)
void setDateTimeFormatter(DateFormat dateTimeFormatter)
Set the date time formatter used to format the date in the watermark.
void setEditable(boolean isEditable)
Set if the control is enabled or not to modify value of the control.
void setFooterEnabled(boolean enabled)
Enable/disable the footer, affecting its visibility.
void setHeight(int height)
Set the height.
void setHorizontalMargin(int margin)
Set the horizontal margin of the signing field (xmark and underline).
void setKey(CharSequence keyName)
Set the label for property of the control
void setKeyEnabled(boolean enabled)
void setKeyTextAppearance(int resId)
void setMaxLines(int maxLines)
Set maximum number of lines of the watermark title.
void setOnCancelListener(View.OnClickListener onCancelListener)
Set an OnClickListener to be triggered when the cancel button is clicked.
void setOnClearListener(View.OnClickListener onClearListener)
Set a callback to trigger when the user clicks the clear signature button.
void setOnSaveListener(View.OnClickListener onSaveListener)
Sets a 'save/submit' listener to one of the footer's actions.
void setPenColor(int color)
Sets the color of the signature pen.
void setPenColorFromResource(int colorRes)
Sets the color of the signature pen.
void setPenStrokeMaximumWidth(float maxWidthDp)
Set the pen stroke maximum width, in dp.
void setPenStrokeMinimumWidth(float minWidthDp)
Set the pen stroke minimum width, in dp.
void setPenVelocityFilterWeight(float velocityFilterWeight)
Set the velocity filter weight of the pen.
void setSaveButtonText(CharSequence saveButtonText)
void setShouldAttachOrientationListener(boolean shouldAttach)
Determines if an OrientationEventListener should be attached.
void setUnderlineColor(int color)
Sets the default color of the underline.
void setUnderlineColorFromResource(int colorRes)
Sets the color of the underline.
void setUnderlineEnabled(boolean isVisible)
Enables or disables the underline.
void setUnderlineHeight(int height)
Set the height of the signature underline.
void setValue(SignatureInfo value)
void setWatermarkTextAppearance(int resId)
Set the text appearance of the watermark, which is invisible to the user.
void setWatermarkTitle(String title)
Set the reason for signing, an example may be a Job #.
void setXmarkEnabled(boolean visible)
Enables or disables the xmark.
void setXmarkTextAppearance(int resId)
Overwrites the default style of the xmark TextView.
void swapSaveAndClearButtons()
Protected Methods
void adjustMargins()
void setOnSignedListener(SignaturePad.OnSignedListener listener)
void setSignatureBitmap(Bitmap signatureBitmap)
Sets the Bitmap.
[Expand]
Inherited Methods
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.SupportsKey

XML Attributes

SignatureCaptureFormCell_android_maxLines

Related Methods

SignatureCaptureFormCell_bitmapMode

Related Methods

SignatureCaptureFormCell_cancelButtonEnabled

Related Methods

SignatureCaptureFormCell_cancelButtonText

Related Methods

SignatureCaptureFormCell_clearOnDoubleClick

Related Methods

SignatureCaptureFormCell_dateTimeFormatter

Related Methods

SignatureCaptureFormCell_isEditable

Related Methods

SignatureCaptureFormCell_penColor

Related Methods

SignatureCaptureFormCell_penStrokeMaximumWidth

Related Methods

SignatureCaptureFormCell_penStrokeMinimumWidth

Related Methods

SignatureCaptureFormCell_penVelocityFilterWeight

Related Methods

SignatureCaptureFormCell_signatureField_marginHorizontal

Related Methods

SignatureCaptureFormCell_underlineColor

Related Methods

SignatureCaptureFormCell_underlineEnabled

Related Methods

SignatureCaptureFormCell_underlineHeight

Related Methods

SignatureCaptureFormCell_watermarkTextAppearance

Related Methods

SignatureCaptureFormCell_xmarkEnabled

Related Methods

SignatureCaptureFormCell_xmarkTextAppearance

Related Methods

Fields

protected AppCompatButton mCancelButton

protected PersistentFooter mFooter

protected TextView mHeaderText

protected int mHorizontalMargin

protected boolean mIsSaveListenerOnPrimaryButton

protected View.OnClickListener mOnCancelListener

protected int mPenColor

protected int mPenColorDark

protected boolean mShouldAttachOrientationListener

protected SignaturePad mSignaturePad

protected View mUnderline

protected TextView mWatermarkDateText

protected TextView mWatermarkTitleText

protected TextView mXmarkText

Public Constructors

public SignatureCaptureFormCell (Context context)

public SignatureCaptureFormCell (Context context, AttributeSet attrs)

Public Methods

public void clearSignature ()

Clears the signature from the form.

public SignatureCaptureFormCell.BitmapMode getBitmapMode ()

Get the bitmap mode, visible only for testing.

public int getCellType ()

Return the type of the filter control being used.

Returns
  • WidgetType type of the control

public CellValueChangeListener<SignatureInfo> getCellValueChangeListener ()

Return the value change handler of the control

Returns
  • OnCellChangeListener - value change listener of the control

public String getDateText ()

Get the watermark date as formatted, as a String.

Returns
  • the date/time, as a String

public PersistentFooter getFooter ()

Get the footer to allow further customization.

Returns
  • the footer associated with this FormCell.

public CharSequence getKey ()

Return the label of the property of control

Returns
  • CharSequence keyName

public List<TimedPoint> getPoints ()

Get the signature represented as a list of points (TimedPoint), each point comes with a timestamp.

Returns
  • The signature as a list of points, with a timestamp for each point

public String getSignatureAsSvg ()

Get the signature as a String representing a SVG.

Returns
  • String representing a SVG or an empty String if there is no signature present

public Bitmap getSignatureBitmap ()

Returns a Bitmap containing only the signature on a white background. Application developers should call isSigned() before calling this. Note: this will return a blank (white) bitmap if there is no signature.

Returns
  • Bitmap of signature in white background

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. Note: If there is no signature present when this is called, a Bitmap will still be returned with the watermark and background.

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

public Bitmap getTransparentSignatureBitmap (boolean trimBlankSpace)

Get only the signature itself. Application developers should call isSigned() before calling this. Note: If there is no signature present when this is called, null will be returned if trimBlankSpace is true, and an empty Bitmap will be returned if trimBlankSpace is false.

Parameters
trimBlankSpace if true, removes extra blank space from the bitmap
Returns
  • a Bitmap containing the signature

public View getUnderline ()

public SignatureInfo getValue ()

Return the value of the property of the control

Returns
  • T - value of the property

public String getWatermarkTitle ()

Get the watermark title.

Returns
  • the watermark title, as a String

public TextView getXmark ()

public boolean isCancelButtonEnabled ()

Returns true if the Cancel button is enabled (visible).

Returns
  • true if cancel button is enabled, false otherwise.

public boolean isEditable ()

Returns if the control is enabled or not to modify values.

Returns
  • Boolean user is allowed to modify the value of the control

public boolean isFooterEnabled ()

public boolean isKeyEnabled ()

public boolean isSigned ()

Returns
  • true if the signature form is signed.

public boolean isUnderlineEnabled ()

Returns
  • true if the underline is enabled (visible), false otherwise

public boolean isXmarkEnabled ()

Returns
  • true if the xmark is enabled (visible), false otherwise

public void setBitmapMode (SignatureCaptureFormCell.BitmapMode bitmapMode)

Sets the mode for the type of Bitmap to include in the value.

Parameters
bitmapMode BitmapMode

public void setCancelButtonEnabled (boolean isEnabled)

Enables or disables the cancel button by changing its visibility

Parameters
isEnabled if true, sets the cancel button as visible, invisible otherwise

public void setCancelButtonText (CharSequence cancelText)

Set the cancel button text.

Parameters
cancelText the text that will be set on the cancel button

public void setCellValueChangeListener (CellValueChangeListener<SignatureInfo> listener)

public void setClearButtonText (CharSequence clearButtonText)

public void setDateTimeFormatter (DateFormat dateTimeFormatter)

Set the date time formatter used to format the date in the watermark.

Parameters
dateTimeFormatter DateFormat

public void setEditable (boolean isEditable)

Set if the control is enabled or not to modify value of the control. In readOnly mode, however, the text labels and text values will be selectable. By default, the control will be editable( user can modify value of the control)

Parameters
isEditable Boolean

public void setFooterEnabled (boolean enabled)

Enable/disable the footer, affecting its visibility.

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

public void setHeight (int height)

Set the height. NOTE: This method will not work if this View is not attached to a parent ViewGroup or setLayoutParams(android.view.ViewGroup.LayoutParams) was not invoked successfully. See getLayoutParams().

Parameters
height the height in dp

public void setHorizontalMargin (int margin)

Set the horizontal margin of the signing field (xmark and underline). As a consequence, this method will resize the underline's width which is calculated by subtracting the sum of following from the formcell's width: the input (margin), the padding of this formcell (default 16dp), the width of the xmark (if present), and the space between the xmark and the underline (if xmark is present). Note: This FormCell may not display correctly if the margin is too big.

Parameters
margin the horizontal margin in dp

public void setKey (CharSequence keyName)

Set the label for property of the control

Parameters
keyName label of the property

public void setKeyEnabled (boolean enabled)

public void setKeyTextAppearance (int resId)

public void setMaxLines (int maxLines)

Set maximum number of lines of the watermark title.

Parameters
maxLines int

public void setOnCancelListener (View.OnClickListener onCancelListener)

Set an OnClickListener to be triggered when the cancel button is clicked.

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

public void setOnClearListener (View.OnClickListener onClearListener)

Set a callback to trigger when the user clicks the clear signature button. The listener is set to one of the footer's buttons.

Parameters
onClearListener the listener to be set on the button

public void setOnSaveListener (View.OnClickListener onSaveListener)

Sets a 'save/submit' listener to one of the footer's actions.

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

public void setPenColor (int color)

Sets the color of the signature pen.

Parameters
color int

public void setPenColorFromResource (int colorRes)

Sets the color of the signature pen.

Parameters
colorRes the color as a resource reference

public void setPenStrokeMaximumWidth (float maxWidthDp)

Set the pen stroke maximum width, in dp. Default is 7dp.

Parameters
maxWidthDp the maximum width of the signature pen in dp

public void setPenStrokeMinimumWidth (float minWidthDp)

Set the pen stroke minimum width, in dp. Default is 3dp.

Parameters
minWidthDp the minimum width of the signature pen in dp

public void setPenVelocityFilterWeight (float velocityFilterWeight)

Set the velocity filter weight of the pen. Default is 0.9f.

public void setSaveButtonText (CharSequence saveButtonText)

public void setShouldAttachOrientationListener (boolean shouldAttach)

Determines if an OrientationEventListener should be attached.

Parameters
shouldAttach Whether the FormCell should consider attaching an OrientationEventListener or not

public void setUnderlineColor (int color)

Sets the default color of the underline.

public void setUnderlineColorFromResource (int colorRes)

Sets the color of the underline.

Parameters
colorRes the color as a resource reference

public void setUnderlineEnabled (boolean isVisible)

Enables or disables the underline. Note: The underline still takes space for layout purposes. Thus, the visibility is only modified.

Parameters
isVisible if true the underline will be visible, invisible otherwise

public void setUnderlineHeight (int height)

Set the height of the signature underline.

Parameters
height the height of the underline in dp

public void setValue (SignatureInfo value)

public void setWatermarkTextAppearance (int resId)

Set the text appearance of the watermark, which is invisible to the user. The watermark includes the title defined by the user as well as the date.

Parameters
resId int

public void setWatermarkTitle (String title)

Set the reason for signing, an example may be a Job #. Note: The watermark is invisible to the user signing, developers must display this info outside the signature form.

Parameters
title - what the user is signing for

public void setXmarkEnabled (boolean visible)

Enables or disables the xmark. If an underline is present, it is shifted to the center by adjusting the horizontal margin. Note: The xmark will be marked as View.GONE for layout purposes.

Parameters
visible if true, the xmark will be visible, gone otherwise

public void setXmarkTextAppearance (int resId)

Overwrites the default style of the xmark TextView.

Parameters
resId the style to apply to the xmark

public void swapSaveAndClearButtons ()

Protected Methods

protected void adjustMargins ()

protected void setOnSignedListener (SignaturePad.OnSignedListener listener)

protected void setSignatureBitmap (Bitmap signatureBitmap)

Sets the Bitmap. If one is not set, a default one will be created.

Parameters
signatureBitmap Bitmap