From wiki.ginstr.com
Jump to: navigation, search
Line 13: Line 13:
 
* name of the page to which widgets are added = "page one"
 
* name of the page to which widgets are added = "page one"
 
* user entered the following data for the widget:<br>- label name = "first name"<br>- hint for input field = "please enter first name"<br>- table name = "users"
 
* user entered the following data for the widget:<br>- label name = "first name"<br>- hint for input field = "please enter first name"<br>- table name = "users"
 
== Widget internal composition ==
 
Internal elements of the widget
 
* [[TextView]]
 
* [[GnEditText]]
 
  
 
== Widget references ==
 
== Widget references ==
 
If widget is added via app composer autogenerated ids will be created according to table below.<br>
 
If widget is added via app composer autogenerated ids will be created according to table below.<br>
Each new widget of this type with identical label added to screen will generate identical ids with increment number +1 at end of id;<br>
 
id of first widget will have no number at the end, 2nd widget with same label will have "2" at the end, i.e. @+id/pageOneFirstNameLabel on first widget will be @+id/pageOneFirstNameLabel2 on 2nd widget with identical label
 
 
 
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
|-
Line 110: Line 102:
 
| title="Attribute" | ek:data_type
 
| title="Attribute" | ek:data_type
 
| title="Value" | text
 
| title="Value" | text
 +
|-
 +
| title="Attribute" | ek:style
 +
| title="Value" | textGnEditText
 
|}
 
|}
  
Line 121: Line 116:
 
| title="Value" | @string/pageOneFirstNameHint
 
| title="Value" | @string/pageOneFirstNameHint
 
|}
 
|}
 
== Changes to other files ==
 
When widget is dropped from toolbox to the composer screen in app composer the following file changes will be performed.
 
 
=== strings.xml ===
 
Lines to be added for all languages.
 
 
<source lang="xml">
 
<string name="pageOneFirstNameLabel">first name</string>
 
<string name="pageOneFirstNameHint">please enter first name</string>
 
</source>
 
 
== When dropping widget to screen from toolbox actions ==
 
 
=== Prompts ===
 
 
* User will be prompted to write "label" for TextView (label).
 
* User will be prompted to write "hint" for GnEditText (input).
 
 
=== Post prompt events ===
 
 
* Value that user provided for label and page will be used as identifier of widget "pageOne" + "FirstName" + "Label" (+ "2" in case this is 2nd widget with same label)
 
* Value that user provided for label and page "pageOne" + "label" will be used as identifier for label string in strings.xml (user entered input will be transformed to adapt to camel case convention, blanks will be removed)
 
* Value that user provided for label will and page be added to strings.xml under the identifier as value; leading, trailing and duplicate blanks will be removed;
 
* Value that user provided for label will and page be used as identifier of widget "pageOne" + "FirstName" (+ "2" in case this is 2nd widget with same label)
 
* value that user provided for label and page + "hint" will be used as identifier for hint string in strings.xml (user entered input will be transformed to adapt to camel case convention)
 
* Value that user provided for hint will be added to strings.xml under the identifier as value
 
 
== Validators ==
 
Contains no validators
 
 
== Logic ==
 
Contains no logic
 
  
 
== Code snippets ==
 
== Code snippets ==
Line 171: Line 133:
 
     ek:s_hint="@string/pageOneFirstNameHint"
 
     ek:s_hint="@string/pageOneFirstNameHint"
 
     ek:data_type="text"
 
     ek:data_type="text"
 +
    ek:style="@style/textGnEditText"
 
     --variant content goes here--/>
 
     --variant content goes here--/>
 
</source>
 
</source>
  
==== <span id="textEditable">Text editable</span> variant:====
+
=== strings.xml ===
===== Widget code =====
+
Lines to be added for <b>EN</b> language
 +
 
 +
<source lang="xml">
 +
<string name="pageOneFirstNameLabel">first name</string>
 +
<string name="pageOneFirstNameHint">please enter first name</string>
 +
</source>
 +
 
 +
Lines to be added for <b>DE</b> language
 +
 
 +
<source lang="xml">
 +
<string name="pageOneFirstNameLabel">first name</string>
 +
<string name="pageOneFirstNameHint">please enter first name</string>
 +
</source>
 +
 
 +
==== Prompts ====
 +
 
 +
* User will be prompted to enter value for parameter "pageOneFirstNameLabel"
 +
* User will be prompted to enter value for parameter "pageOneFirstNameHint"
 +
<hr />
 +
 
 +
=== <span id="textEditable">Text editable</span> variant===
 +
==== Widget code ====
 
<source lang="xml"><
 
<source lang="xml"><
    ek:style="@style/textEditableGnEditText"
 
 
     ek:s_sourceType="input"
 
     ek:s_sourceType="input"
 
</source>
 
</source>
 +
<br /><hr />
  
==== <span id="textReadOnly">Text read only</span> variant:====
+
=== <span id="textReadOnly">Text read only</span> variant===
===== Widget code =====
+
==== Widget code ====
 
<source lang="xml"><
 
<source lang="xml"><
    ek:style="@style/textReadOnlyGnEditText"
 
 
     ek:s_sourceType="input"
 
     ek:s_sourceType="input"
 
     ek:focusable="false"
 
     ek:focusable="false"
 
</source>
 
</source>
 +
<br /><hr />
  
==== <span id="textNfc">Nfc</span> variant:====
+
=== <span id="textNfc">Nfc</span> variant===
===== Widget code =====
+
==== Widget code ====
 
<source lang="xml"><
 
<source lang="xml"><
    ek:style="@style/textNfcGnEditText"
 
 
     ek:s_sourceType="nfc"
 
     ek:s_sourceType="nfc"
 
</source>
 
</source>
 +
<br /><hr />
  
==== <span id="textBarcode">Barcode</span> variant:====
+
=== <span id="textBarcode">Barcode</span> variant===
===== Widget code =====
+
==== Widget code ====
 
<source lang="xml"><
 
<source lang="xml"><
    ek:style="@style/textBarcodeGnEditText"
 
 
     ek:s_sourceType="qr"
 
     ek:s_sourceType="qr"
 
</source>
 
</source>

Revision as of 09:33, 27 July 2015

Text

Widget is used for textual input of data by user. Value will be stored as datatype TEXT.
Back to ginstr app composer reference

Predefined user data

To read specification and understand it better we will assume that

  • name of the page to which widgets are added = "page one"
  • user entered the following data for the widget:
    - label name = "first name"
    - hint for input field = "please enter first name"
    - table name = "users"

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/pageOneFirstNameLabel
TextView android:text @string/pageOneFirstNameLabel
GnEditText android:id @+id/pageOnefirstName
GnEditText ek:s_hint @string/pageOneFirstNameHint
TextView ek:style @style/textTextView
GnEditText ek:style @style/textGnEditText

Attributes configuration

TextView

Preset attributes:

Attribute Value
android:id @+id/pageOneFirstNameLabel
android:layout_width match_parent
android:layout_height wrap_content
ek:style @style/textTextView

User defined attributes:

Attribute Value
android:text @string/pageOneFirstName

GnEditText

Represents the internal organization of a widget:

Preset attributes:

Attribute Value
android:id @+id/pageOneFirstName
android:layout_width match_parent
android:layout_height wrap_content
ek:data_type text
ek:style textGnEditText

User defined attributes:

Attribute Value
ek:s_hint @string/pageOneFirstNameHint

Code snippets

Common widget code:

<source lang="xml"> <TextView

   android:id="@+id/pageOneFirstNameLabel"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:text="@string/pageOneFirstName"
   ek:style="@style/textTextView"/>

<com.ginstr.widgets.GnEditText

   android:id="@+id/pageOneFirstName"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   ek:s_hint="@string/pageOneFirstNameHint"
   ek:data_type="text"
   ek:style="@style/textGnEditText"
   --variant content goes here--/>

</source>

strings.xml

Lines to be added for EN language

<source lang="xml"> <string name="pageOneFirstNameLabel">first name</string> <string name="pageOneFirstNameHint">please enter first name</string> </source>

Lines to be added for DE language

<source lang="xml"> <string name="pageOneFirstNameLabel">first name</string> <string name="pageOneFirstNameHint">please enter first name</string> </source>

Prompts

  • User will be prompted to enter value for parameter "pageOneFirstNameLabel"
  • User will be prompted to enter value for parameter "pageOneFirstNameHint"

Text editable variant

Widget code

<source lang="xml"><

   ek:s_sourceType="input"

</source>



Text read only variant

Widget code

<source lang="xml"><

   ek:s_sourceType="input"
   ek:focusable="false"

</source>



Nfc variant

Widget code

<source lang="xml"><

   ek:s_sourceType="nfc"

</source>



Barcode variant

Widget code

<source lang="xml"><

   ek:s_sourceType="qr"

</source>