From wiki.ginstr.com
Jump to: navigation, search

GnAutoCompleteTextView

Widget XML tag
<com.ginstr.widgets.GnAutoCompleteTextView>
Description
GnAutoCompleteTextView inherits regular Android AutoCompleteTextView widget.
It consists of an EditText used to search entries of dropdown values and a DropDown list which displays a list of entries which match search string.
It has two ways of functioning. It can receive values either from local resources or from the database.
See gn:act_fill_dropdown for retrieving values from local source.

XML Attributes Description

Attribute Description
gn:s_sourceType Sets source for data load into dropdown

Can be

  • local - Sets the source as array from resources (@array/resourceId)
  • database - Sets the source as database
gn:s_decimalFormat Formats dropdown data to specified number format
gn:completionThreshold Defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu.
gn:typingTimeInterval Represents number of miliseconds after gn:act_setOnTypingEnd will be executed

Can be

  • hardcoded
gn:triggerOnTypingEndEmptyItem Triggers gn:act_setOnTypingEnd event even GnEditText content is empty.

Can be

  • true
  • false
gn:singleLine Forces widget to be used as single line widget

Can be

  • true
  • false
gn:allowNonSelectedItems If set to true it allows to retrieve items which are not selected but typed into the widget as text datatype. ginstr app developer can use gn:act_widgetContent action to check if widget is empty. If empty it means that widget has no selection and that only text is typed and he can then store this value to variable of type text and if action returns that widget is notempty this means that selection in widget was made and that value is pointer.

Can be

  • true
  • false
gn:autoCapitalize Changes the first letter of entered text to upper case

Can be

  • true
  • false
gn:dataType Defines datatype of widget
gn:displayColumns Represents a list of columns which data will be displayed in dropdown data as one item

Can be

  • hardcoded values separated by , character
gn:displayColumnsSeparator Represents a separator for column values

Can be

  • hardcoded
gn:s_sortOrder Toggles sort order between ascending & descending

Can be

  • regular - sorts from A-Z
  • reverse - sorts from Z-A
  • unsorted - sorting is disabled
gn:s_customLayoutXml Points to an XML file in “control” folder of ginstr app

Can be

  • hardcoded - i.e. someXmlLayoutName.xml
gn:textColor Represents a text color

Can be

  • hardcoded
gn:s_hint Sets text hint into AutoCompleteTextView

Can be

  • @string

Events

gn:act_setClick
gn:act_setLongClick
gn:act_setOnTypingStart
gn:act_setOnTypingEnd
gn:event_onSelectedItem
gn:event_onClearedItem

Data types

Input
rows
rowsColumn
iBeacon
Output
text
number
iBeacon
enum
pointer
status

Example

<com.ginstr.widgets.GnAutoCompleteTextView
  android:id="@+id/autoCompleteTextView1"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginLeft="-5dp"
  android:background="#00000000"
  gn:s_sourceType="local"
  gn:data_source_key_local="@array/localAutoComplete"
  gn:completionThreshold="1"
  gn:act_validate="[name:RequiredValidator],[message=@string/screen2_dnrRequiredValidatorMessage]"
  gn:typingTimeInterval="1000"
  gn:triggerOnTypingEndEmptyItem="true"
  gn:s_sortOrder="unsorted"
  gn:s_customLayoutXml="widget_en_autocompletetextview.xml"
  gn:act_setOnTypingStart="[gn:act_toast]|[START]"
  gn:act_setOnTypingEnd="[gn:act_toast]|[END]"
  gn:event_onSelectedItem="[gn:act_toast]|[SELECT]"
  gn:event_onClearedItem="[gn:act_toast]|[CLEAR]"/>