From wiki.ginstr.com
Revision as of 11:03, 13 June 2016 by Bojan (talk | contribs) ($defaultApp user deleted generated content)
Jump to: navigation, search

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/defaultRequiredValidator]"
user changed autogenerated content
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}requiredField]"

strings.xml

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