From wiki.ginstr.com
Jump to: navigation, search
m (XML Attributes Description)
(XML Attributes Description)
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 +
<span STYLE="font-size: xx-large"><code>GnSignatureEmbedded</code></span>
 
[[Category:Widget_Library]]
 
[[Category:Widget_Library]]
;Inherited classes: <code>[http://developer.android.com/reference/android/view/View.html View]</code>
 
;Android class type: <code>[http://developer.android.com/reference/android/widget/Button.html Button]</code>
 
;Widget XML tag: <code><com.ginstr.widgets.GnCaptureSignatureEmbedded></code>
 
;Special Behaviours: Long click clears drawn image
 
  
Widget provides ability to capture a signature. The difference between <code>[[GnCaptureSignatureEmbedded]]</code> and <code>[[GnCaptureSignature]]</code> is that <code>[[GnCaptureSignatureEmbedded]]</code> 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.
+
;Widget XML tag
 +
: <code><com.ginstr.widgets.GnSignatureEmbedded></code>
 +
 
 +
;Description
 +
: <code>[[GnSignatureEmbedded]]</code> inherits regular Android <code>[http://developer.android.com/reference/android/widget/View.html View]</code> 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 <code>gn:signatureCaptureWidgetId</code> root node
  
 
==XML Attributes Description==
 
==XML Attributes Description==
Line 14: Line 17:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| title="Attribute" | <code>[[#gn:s_overlayText|gn:s_overlayText]]</code>
+
| title="Attribute" | <code>gn:s_overlayText</code>
 
| title="Description" | Displays text in the middle of the widget
 
| title="Description" | Displays text in the middle of the widget
 +
Can be
 +
* hardcoded
 +
|-
 +
| title="Attribute" | <code>gn:backgroundColor</code>
 +
| title="Description" | Can be
 +
* any color from colors mentioned [https://developer.android.com/reference/android/graphics/Color.html#constants here]
 +
* hardcoded - hex color value, i.e. <code>#000000</code> or <code>TRANSPARENT</code>
 +
|-
 +
| title="Attribute" | <code>gn:strokeColor</code>
 +
| title="Description" | Can be
 +
* any color from colors mentioned [https://developer.android.com/reference/android/graphics/Color.html#constants here]
 +
* hardcoded - hex color value, i.e. <code>#000000</code> or <code>TRANSPARENT</code>
 +
|-
 +
| title="Attribute" | <code>gn:signatureCaptureWidgetId</code>
 +
| title="Description" | <code>[[target]]</code> WIDGET ONLY which represents root node of all that will be displayed in signature
 +
|-
 +
| title="Attribute" | <code>gn:controlPaddingWidgetId</code>
 +
| title="Description" | <code>[[target]]</code> WIDGET ONLY which represents a widget which is set at the top of the <code>gn:signatureCaptureWidgetId</code> as child node. The widget will be removed after signature is taken to crop image of excess space that signature taking controls occupy
 +
|-
 +
| title="Attribute" | <code>gn:act_setAfterSignatureTaken</code>
 +
| title="Description" | [[Events|Event]] which will be executed after user has taken signature with this widget.
 +
|-
 +
| title="Attribute" | <code>gn:act_setAfterSignatureNotTaken</code>
 +
| title="Description" | [[Events|Event]] which will be executed after user has canceled or pressed back when taking media with this widget.
 +
 +
More information [[gn:setAfterMediaTaken|here]]
 +
|-
 +
| title="Attribute" | <code>gn:disableInternalEvents</code>
 +
| title="Description" | 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:
 +
** <code>cancel</code>
 +
** <code>clear</code>
 +
** <code>save</code>
 +
** combinations with comma separator, i.e. <code>cancel,clear</code>
 +
|-
 +
| title="Attribute" | <code>gn:controlLayout</code><span style="color:#FF0000">*</span>
 +
| title="Description" | Defines custom layout to parse for widget, by default is used: [[widget_en_embedded_signature_controls.xml]]
 +
|}
 +
 +
==Events==
 +
: <code>[[gn:act_setClick]]</code>
 +
: <code>[[gn:act_setLongClick]]</code>
 +
 +
==Data types==
 +
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 +
|-
 +
! scope="col" | Input
 +
|-
 +
| title="Value" | <code>[[Datatypes#text|text]]</code>
 +
|-
 +
| title="Value" | <code>[[Datatypes#signature|signature]]</code>
 
|}
 
|}
  
==gn:s_overlayText==
+
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
Displays text in the middle of the widget. As soon as the user starts drawing on the widget, text is cleared. If user long clicks and resets the drawing, the text reappears.
+
|-
 +
! scope="col" | Output
 +
|-
 +
| title="Value" | <code>[[Datatypes#signature|signature]]</code>
 +
|}
 +
 
 +
==Example==
 +
<syntaxhighlight code="xml">
 +
<com.ginstr.widgets.GnButton
 +
  android:layout_width="wrap_content"
 +
  android:layout_height="wrap_content"
 +
  gn:backgroundChecked="@drawable/fuelRed"
 +
  gn:backgroundUnchecked="@drawable/fuelBlue" />
 +
</syntaxhighlight>
 +
 
 +
==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_en_embedded_signature_controls.xml]] is added to [[Controls]] folder
 +
 
 +
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 +
|-
 +
! scope="col" | Widget
 +
! scope="col" | Name
 +
! scope="col" | Description
 +
|-
 +
| title="Widget" | <code>[https://developer.android.com/guide/topics/ui/layout/linear LinearLayout]</code>
 +
| title="Name" | <code>@+id/controlsContainer</code>
 +
| title="Description" | this is the container that holds all the controls
 +
|-
 +
| title="Widget" | <code>[[GnButton]]</code>
 +
| title="Name" | <code>@+id/cancel</code>
 +
| title="Description" | Cancels taking signature and returns to previous screen
 +
|-
 +
| title="Widget" | <code>[[GnButton]]</code>
 +
| title="Name" | <code>@+id/clear</code>
 +
| title="Description" | Clears user entered content on signature area
 +
|-
 +
| title="Widget" | <code>[[GnButton]]</code>
 +
| title="Name" | <code>@+id/getsign</code>
 +
| title="Description" | Saves user entered content and signature background and returns to previous screen
 +
|}

Latest revision as of 07:14, 29 September 2020

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