From wiki.ginstr.com
Revision as of 15:32, 9 June 2016 by Bojan (talk | contribs) (Common widget code)
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>




Text editable variant

Widget id:

textEditable

Widget code

    gn:s_sourceType="input"




Text read only variant

Widget id:

textReadOnly

Widget code

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



Nfc variant

Widget id:

nfc

Widget code

    gn:s_sourceType="nfc"




Barcode variant

Widget id:

qr

Widget code

    gn:s_sourceType="qr"