From wiki.ginstr.com
Jump to: navigation, search

GnSignatureEmbedded

Widget XML tag
<com.ginstr.widgets.GnSignatureEmbedded>
Description
GnSignatureEmbedded inherits regular Android View widget.
It does not open new activity for signature entry and it allows a signature to be drawn directly into it on a screen containing other widgets.
If widget is used to take signature over existing layout this widget needs to be last in xml (top shown) in the hierarchy and stretch over all widgets to "overlay" existing layout and part of gn:signatureCaptureWidgetId root node

XML Attributes Description

Attribute Description
gn:s_overlayText Displays text in the middle of the widget

Can be

  • hardcoded
gn:backgroundColor Can be
  • any color from colors mentioned here
  • hardcoded - hex color value, i.e. #000000 or TRANSPARENT
gn:strokeColor Can be
  • any color from colors mentioned here
  • hardcoded - hex color value, i.e. #000000 or TRANSPARENT
gn:signatureCaptureWidgetId target WIDGET ONLY which represents root node of all that will be displayed in signature
gn:controlPaddingWidgetId target WIDGET ONLY which represents a widget which is set at the top of the gn:signatureCaptureWidgetId as child node. The widget will be removed after signature is taken to crop image of excess space that signature taking controls occupy
gn:act_setAfterSignatureTaken Event which will be executed after user has taken signature with this widget.
gn:act_setAfterSignatureNotTaken Event which will be executed after user has canceled or pressed back when taking media with this widget.

More information here

gn:disableInternalEvents disables internal event which is predefined for embedded signature controls (i.e. cancel or clear). This provides option to call internal events only externally by using this attribute together with action gn:callWidgetEvent.
  • Valid values:
    • cancel
    • clear
    • save
    • combinations with comma separator, i.e. cancel,clear
gn:controlLayout* Defines custom layout to parse for widget, by default is used: widget_en_embedded_signature_controls.xml

Events

gn:act_setClick
gn:act_setLongClick

Data types

Input
text
signature
Output
signature

Example

<com.ginstr.widgets.GnButton
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  gn:backgroundChecked="@drawable/fuelRed"
  gn:backgroundUnchecked="@drawable/fuelBlue" />	

Alternative layout

If the default look and feel needs to be changed, create or copy identical files from $defaultApp to current app "control" folder.
To provide alternative layout, the files mentioned above can be set into control folder of the current application. Files must be named as shown above and widgets with Id’s have to stay of same type and keep same id.

widget_en_embedded_signature_controls.xml

Widget Name Description
LinearLayout @+id/controlsContainer this is the container that holds all the controls
GnButton @+id/cancel Cancels taking signature and returns to previous screen
GnButton @+id/clear Clears user entered content on signature area
GnButton @+id/getsign Saves user entered content and signature background and returns to previous screen