java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | androidx.constraintlayout.widget.ConstraintLayout | |||
↳ | com.sap.cloud.mobile.fiori.formcell.SignatureCaptureFormCell |
![]() |
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
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | SignatureCaptureFormCell.BitmapMode | BitmapMode controls the kind of bitmap returned in the value. | |||||||||
class | SignatureCaptureFormCell.OnSignedListener |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Clears the signature from the form.
Get the bitmap mode, visible only for testing.
Return the type of the filter control being used.
Return the value change handler of the control
Get the watermark date as formatted, as a String.
Get the footer to allow further customization.
Return the label of the property of control
Get the signature represented as a list of points (TimedPoint), each point comes with a timestamp.
Get the signature as a String representing a SVG.
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.
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.
includeUnderlineXmark | if true, the resulting Bitmap will include the xmark and underline |
---|
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.
trimBlankSpace | if true, removes extra blank space from the bitmap |
---|
Return the value of the property of the control
Get the watermark title.
Returns true if the Cancel button is enabled (visible).
Returns if the control is enabled or not to modify values.
Sets the mode for the type of Bitmap to include in the value.
bitmapMode | BitmapMode |
---|
Enables or disables the cancel button by changing its visibility
isEnabled | if true, sets the cancel button as visible, invisible otherwise |
---|
Set the cancel button text.
cancelText | the text that will be set on the cancel button |
---|
Set the date time formatter used to format the date in the watermark.
dateTimeFormatter | DateFormat |
---|
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)
isEditable | Boolean |
---|
Enable/disable the footer, affecting its visibility.
enabled | if false, set the footer's visibility to invisible |
---|
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()
.
height | the height in dp |
---|
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.
margin | the horizontal margin in dp |
---|
Set the label for property of the control
keyName | label of the property |
---|
Set maximum number of lines of the watermark title.
maxLines | int |
---|
Set an OnClickListener to be triggered when the cancel button is clicked.
onCancelListener | the View.OnClickListener that will be set on the cancel button |
---|
Set a callback to trigger when the user clicks the clear signature button. The listener is set to one of the footer's buttons.
onClearListener | the listener to be set on the button |
---|
Sets a 'save/submit' listener to one of the footer's actions.
onSaveListener | the listener to be set on one of the footer's buttons |
---|
Sets the color of the signature pen.
color | int |
---|
Sets the color of the signature pen.
colorRes | the color as a resource reference |
---|
Set the pen stroke maximum width, in dp. Default is 7dp.
maxWidthDp | the maximum width of the signature pen in dp |
---|
Set the pen stroke minimum width, in dp. Default is 3dp.
minWidthDp | the minimum width of the signature pen in dp |
---|
Set the velocity filter weight of the pen. Default is 0.9f.
Determines if an OrientationEventListener should be attached.
shouldAttach | Whether the FormCell should consider attaching an OrientationEventListener or not |
---|
Sets the default color of the underline.
Sets the color of the underline.
colorRes | the color as a resource reference |
---|
Enables or disables the underline. Note: The underline still takes space for layout purposes. Thus, the visibility is only modified.
isVisible | if true the underline will be visible, invisible otherwise |
---|
Set the height of the signature underline.
height | the height of the underline in dp |
---|
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.
resId | int |
---|
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.
title | - what the user is signing for |
---|
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.
visible | if true, the xmark will be visible, gone otherwise |
---|
Overwrites the default style of the xmark TextView.
resId | the style to apply to the xmark |
---|
Sets the Bitmap. If one is not set, a default one will be created.
signatureBitmap | Bitmap |
---|