From wiki.ginstr.com
Revision as of 12:13, 2 August 2017 by Mark (talk | contribs)
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

Events

gn:act_setOnTypingStart
gn:act_setOnTypingEnd
gn:event_onSelectedItem
gn:event_onClearedItem

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: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]"/>