From wiki.ginstr.com
Jump to: navigation, search
Line 41: Line 41:
 
| title="Widget" | GnTextView
 
| title="Widget" | GnTextView
 
| title="Attribute" | android:text
 
| title="Attribute" | android:text
| title="Value" | @string/${pageName}${widgetName}
+
| title="Value" | @string/${pageName}_${widgetName}
 
|-
 
|-
 
| title="Widget" | GnEditText
 
| title="Widget" | GnEditText
Line 49: Line 49:
 
| title="Widget" | GnEditText
 
| title="Widget" | GnEditText
 
| title="Attribute" | gn:s_hint
 
| title="Attribute" | gn:s_hint
| title="Value" | @string/${pageName}${widgetName}Hint
+
| title="Value" | @string/${pageName}_${widgetName}Hint
 
|-
 
|-
 
| title="Widget" | GnTextView
 
| title="Widget" | GnTextView
Line 68: Line 68:
 
     android:layout_width="match_parent"
 
     android:layout_width="match_parent"
 
     android:layout_height="wrap_content"
 
     android:layout_height="wrap_content"
     android:text="@string/${pageName}${widgetName}"
+
     android:text="@string/${pageName}_${widgetName}"
 
     gn:style="@style/${widgetID}Label"/>
 
     gn:style="@style/${widgetID}Label"/>
  
Line 75: Line 75:
 
     android:layout_width="match_parent"
 
     android:layout_width="match_parent"
 
     android:layout_height="wrap_content"
 
     android:layout_height="wrap_content"
     gn:s_hint="@string/${pageName}${widgetName}Hint"
+
     gn:s_hint="@string/${pageName}_${widgetName}Hint"
 
     gn:dataType="text"
 
     gn:dataType="text"
 
     gn:style="@style/${widgetID}Input"/>
 
     gn:style="@style/${widgetID}Input"/>
Line 86: Line 86:
 
<section begin=text.Strings.En />
 
<section begin=text.Strings.En />
 
<pre>
 
<pre>
<string name="${pageName}${widgetName}">${widgetName}</string>
+
<string name="${pageName}_${widgetName}">${widgetName}</string>
<string name="${pageName}${widgetName}Hint">${hintText}</string>
+
<string name="${pageName}_${widgetName}Hint">${hintText}</string>
 
</pre>
 
</pre>
 
<section end=text.Strings.En />
 
<section end=text.Strings.En />
Line 94: Line 94:
 
<section begin=text.Strings.De />
 
<section begin=text.Strings.De />
 
<pre>
 
<pre>
<string name="${pageName}${widgetName}">${widgetName}</string>
+
<string name="${pageName}_${widgetName}">${widgetName}</string>
<string name="${pageName}${widgetName}Hint">${hintText}</string>
+
<string name="${pageName}_${widgetName}Hint">${hintText}</string>
 
</pre>
 
</pre>
 
<section end=text.Strings.De />
 
<section end=text.Strings.De />
Line 169: Line 169:
 
====== Widget code ======
 
====== Widget code ======
 
<pre>
 
<pre>
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}Required]"
+
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"
 
</pre>
 
</pre>
 
app composer will use from $defaultApp:
 
app composer will use from $defaultApp:
Line 183: Line 183:
 
strings.xml
 
strings.xml
 
<pre>
 
<pre>
<string name="${pageName}${widgetName}Required">entering the ${widgetName} is required</string>
+
<string name="${pageName}_${widgetName}Required">entering the ${widgetName} is required</string>
 
</pre>
 
</pre>
  
Line 189: Line 189:
 
====== Widget code ======
 
====== Widget code ======
 
<pre>
 
<pre>
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}Required]"
+
     gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"
 
</pre>
 
</pre>
 
strings.xml
 
strings.xml
 
<pre>
 
<pre>
<string name="${pageName}${widgetName}Required">${userInput}</string>
+
<string name="${pageName}_${widgetName}Required">${userInput}</string>
 
</pre>
 
</pre>

Revision as of 16:03, 14 October 2016

Text

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

Widget id:

see variants

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
GnTextView android:id @+id/${pageName}${widgetName}Label
GnTextView android:text @string/${pageName}_${widgetName}
GnEditText android:id @+id/${pageName}${widgetName}Input
GnEditText gn:s_hint @string/${pageName}_${widgetName}Hint
GnTextView gn:style @style/${widgetID}Label
GnEditText gn:style @style/${widgetID}Input

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/${widgetID}Label"/>

<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:dataType="text"
    gn:style="@style/${widgetID}Input"/>


strings.xml

Lines to be added for EN language

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


Lines to be added for DE language

<string name="${pageName}_${widgetName}">${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

Options can be used in combination with variants. i.e. field can be editableText with option required



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.

autogenerated content
Widget code
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"

app composer will use from $defaultApp:

    gn:act_validate="[name:RequiredValidator],[message=@string/defaultRequiredValidator]"

strings.xml

<string name="defaultRequiredValidator">entering the %1$s is required</string>

app composer will produce: strings.xml

<string name="${pageName}_${widgetName}Required">entering the ${widgetName} is required</string>
user changed autogenerated content
Widget code
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"

strings.xml

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