From wiki.ginstr.com
Jump to: navigation, search
($defaultApp user did not change content)
Line 100: Line 100:
  
 
<br /><hr />
 
<br /><hr />
 
+
=== Variants ===
=== <span id="textEditable">Text editable</span> variant===
+
<br /><hr />
 +
==== <span id="textEditable">Text editable</span> variant====
 
Widget id:
 
Widget id:
 
<pre>
 
<pre>
 
textEditable
 
textEditable
 
</pre>
 
</pre>
==== Widget code ====
+
===== Widget code =====
 
<section begin=text.Variant.Editable.Attributes />
 
<section begin=text.Variant.Editable.Attributes />
 
<pre>
 
<pre>
Line 112: Line 113:
 
</pre>
 
</pre>
 
<section end=Number.Variant.Editable.Attributes  />
 
<section end=Number.Variant.Editable.Attributes  />
 +
 +
<br /><hr />
 +
==== <span id="textNfc">Nfc</span> variant====
 +
Widget id:
 +
<pre>
 +
nfc
 +
</pre>
 +
===== Widget code =====
 +
<section begin=text.Variant.Nfc.Attributes />
 +
<pre>
 +
    gn:s_sourceType="nfc"
 +
</pre>
 +
<section end=Number.Variant.Nfc.Attributes  />
  
 
<br /><hr />
 
<br /><hr />
  
=== <span id="textReadOnly">Text read only</span> option===
+
==== <span id="textBarcode">Barcode</span> variant====
 +
Widget id:
 +
<pre>
 +
qr
 +
</pre>
 +
===== Widget code =====
 +
<section begin=text.Variant.Qr.Attributes />
 +
<pre>
 +
    gn:s_sourceType="qr"
 +
</pre>
 +
<section end=Number.Variant.Qr.Attributes  />
 +
<br /><hr />
 +
=== Options ===
 +
<br /><hr />
 +
==== <span id="textReadOnly">Text read only</span> option====
 
Widget id:
 
Widget id:
 
<pre>
 
<pre>
Line 121: Line 149:
 
</pre>
 
</pre>
 
Read only is property of widget. When checked data can not be input into widget by user.
 
Read only is property of widget. When checked data can not be input into widget by user.
==== Widget code ====
+
===== Widget code =====
 
<section begin=text.Variant.ReadOnly.Attributes />
 
<section begin=text.Variant.ReadOnly.Attributes />
 
<pre>
 
<pre>
Line 131: Line 159:
 
<hr />
 
<hr />
  
=== <span id="textRequired">Text required</span> option===
+
==== <span id="textRequired">Text required</span> option====
 
Widget id:
 
Widget id:
 
<pre>
 
<pre>
Line 137: Line 165:
 
</pre>
 
</pre>
 
Required is property of widget.
 
Required is property of widget.
==== Widget code ====
+
===== Widget code =====
====$defaultApp user deleted generated content====
+
=====$defaultApp user deleted generated content=====
 
<pre>
 
<pre>
 
     gn:act_validate="[name:RequiredValidator],[message=@string/requiredField]"
 
     gn:act_validate="[name:RequiredValidator],[message=@string/requiredField]"
 
</pre>
 
</pre>
  
====user changed the content====
+
=====user changed the content=====
 
<pre>
 
<pre>
 
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}requiredField]"
 
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}requiredField]"
Line 151: Line 179:
 
<string name="${pageName}${widgetName}requiredField">${userInput}</string>
 
<string name="${pageName}${widgetName}requiredField">${userInput}</string>
 
</pre>
 
</pre>
 
<br /><hr />
 
 
=== <span id="textNfc">Nfc</span> variant===
 
Widget id:
 
<pre>
 
nfc
 
</pre>
 
==== Widget code ====
 
<section begin=text.Variant.Nfc.Attributes />
 
<pre>
 
    gn:s_sourceType="nfc"
 
</pre>
 
<section end=Number.Variant.Nfc.Attributes  />
 
 
<br /><hr />
 
 
=== <span id="textBarcode">Barcode</span> variant===
 
Widget id:
 
<pre>
 
qr
 
</pre>
 
==== Widget code ====
 
<section begin=text.Variant.Qr.Attributes />
 
<pre>
 
    gn:s_sourceType="qr"
 
</pre>
 
<section end=Number.Variant.Qr.Attributes  />
 

Revision as of 10:55, 13 June 2016

Text

Widget is used for textual input of data by user. Value will be stored as datatype TEXT.

Widget id:

text

Back to ginstr app composer reference

Predefined user data

PreLoaded

AutoLoaded data which is known:

  • ${pageName} - name of the page to which widgets are added

Prompts

User enters this data when widget is dropped to screen:

  • ${widgetName} - name of the widget user added to the screen
  • ${hintText} - hint text

Widget references

If widget is added via app composer autogenerated ids will be created according to table below.

Control Attribute Value
TextView android:id @+id/${pageName}${widgetName}Label
TextView android:text @string/${pageName}${widgetName}Label
GnEditText android:id @+id/${pageName}${widgetName}Input
GnEditText gn:s_hint @string/${pageName}${widgetName}Hint
TextView gn:style @style/textLabel
GnEditText gn:style @style/textInput

Code snippets

Common widget code

<com.ginstr.widgets.GnTextView
    android:id="@+id/${pageName}${widgetName}Label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/${pageName}${widgetName}"
    gn:style="@style/textLabel"/>

<com.ginstr.widgets.GnEditText
    android:id="@+id/${pageName}${widgetName}Input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:s_hint="@string/${pageName}${widgetName}Hint"
    gn:data_type="text"
    gn:style="@style/textInput"/>


strings.xml

Lines to be added for EN language

<string name="${pageName}${widgetName}Label">${widgetName}</string>
<string name="${pageName}${widgetName}Hint">${hintText}</string>


Lines to be added for DE language

<string name="${pageName}${widgetName}Label">${widgetName}</string>
<string name="${pageName}${widgetName}Hint">${hintText}</string>




Variants



Text editable variant

Widget id:

textEditable
Widget code
    gn:s_sourceType="input"




Nfc variant

Widget id:

nfc
Widget code
    gn:s_sourceType="nfc"




Barcode variant

Widget id:

qr
Widget code
    gn:s_sourceType="qr"



Options



Text read only option

Widget id:

Id of variant is used

Read only is property of widget. When checked data can not be input into widget by user.

Widget code
    gn:s_sourceType="input"
    gn:focusable="false"



Text required option

Widget id:

Id of variant is used

Required is property of widget.

Widget code
$defaultApp user deleted generated content
    gn:act_validate="[name:RequiredValidator],[message=@string/requiredField]"
user changed the content
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}requiredField]"

strings.xml

<string name="${pageName}${widgetName}requiredField">${userInput}</string>