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

GnEditText

Widget XML tag
<com.ginstr.widgets.GnEditText>
Description
GnEditText is a multi-source EditText.
It is used to enter text data or acquire it from other sources.

XML Attributes Description

Note: An attribute marked with asterisk (*) is a mandatory parameter when creating widget.

Attribute Description
gn:s_sourceType* Defines source type.

Additional information here

gn:showAddress Sets GPS datatype displayed in EditText

Can be

  • true - shows address of GPS location
  • false - shows coordinates of GPS location
gn:s_text Sets text into EditText

Can be

  • @string
gn:s_hint Sets text hint into EditText

Can be

  • @string
gn:textStyle Sets style for child EditText

Can be

  • normal
  • bold
  • italic
gn:textColor Sets font color for child EditText

Can be

  • hardcoded - hex color value, i.e. #000000
gn:s_nfcAlertType Sets alert type when NFC is scanned

Can be

  • sound - phone will vibrate with a NFC scan
  • vibrate - phone will play a sound with a NFC scan
  • none - alert is disabled
gn:s_gravity Sets the gravity of EditText content, this means text alignment within widget

Can be

  • CENTER_HORIZONTAL
  • top|left
gn:minLines Sets minimum lines for EditText

Can be

  • hardcoded - integer value, i.e. 3
gn:maxLines Sets maximum lines for EditText

Can be

  • hardcoded - integer value, i.e. 3
gn:noServiceOnUpdate Prevents content update if EditText contains some data

Can be

  • true
  • false
gn:focusable If present prevents user from focusing widget and entering data. In this case the widget will be a read-only

Can be

  • true
  • false
gn:nfcRequired Checks if NFC is required

Can be

  • true - (Relevant for NFC sourceType) if not present it shows error dialog, if present but turned off shows dialog to open Android settings NFC screen
  • false - (Relevant for NFC sourceType) does not check for NFC hardware
gn:visible Shows or hides widget

Can be

  • true
  • false
gn:nfcReadingsInterval Sets reading interval (in seconds) for NFC, if less time than defined has passed a message will be shown and reading ignored

Can be

  • hardcoded - number of seconds, i.e. 3
gn:s_nfcContentType When NFC is read instead of the ID the embedded content of NFC tag is read

Can be

  • embedded
gn:inputType Defines the input mode for the keyboard which appears on the screen

Additional information here

gn:nfcIntSequence Defines internal sequence of processing NFC scans when more then one NFC widget on screen is receiving NFC scan event
gn:isMasked Masks the content of EditText gets with password artefacts

Can be

  • true
  • false
gn:decimalFormat

gn:s_decimalFormat

If GnEditText is target of calculation, set this attribute to change format of result. By default format is set to 0.00 which will show calculation result as i.e. 2.13, 121.67,…

Please check format available on this page (under heading “Special Pattern Characters”).

Can be

  • hardcoded
gn:paddingLeft Defines internal space between text and left outer edge of the control

Can be

  • hardcoded - integer value, i.e. 5
gn:paddingRight Defines internal space between text and right outer edge of the control

Can be

  • hardcoded - integer value, i.e. 5
gn:paddingBottom Defines internal space between text and bottom outer edge of the control

Can be

  • hardcoded - integer value, i.e. 5
gn:paddingTop Defines internal space between text and top outer edge of the control

Can be

  • hardcoded - integer value, i.e. 5
gn:s_customLayoutXml Points to an XML file in “control” folder of ginstr app

Can be

  • hardcoded - i.e. someXmlLayoutName.xml
gn:trimDecimalPlaces Decimal value will be trimmed from widget when data is gathered from it

Can be

  • true
  • false
gn:actionSetOnFocusLost Activates on focus lost attribute triggering

Can be

  • true
  • false
gn:autoLoadTimestamp Prevents autoloading timestamp when widget with gn:s_sourceType="time" is loaded on screen

Can be

  • true
  • false
gn:dataType Defines datatype of widget
gn:typingTimeInterval Represents number of miliseconds after gn:act_setOnTypingEnd will be executed

Can be

  • hardcoded
gn:autoLoadLocation When set to false and widget is set to type GPS it disables auto loading of GPS location when screen is loaded. In this case GPS information will have to be loaded from database or gn:act_reloadAutoFilledWidgets will have to be called to resolve current location

Can be

  • true - enables auto loading of GPS location when screen is loaded
  • false - disables auto loading of GPS location when screen is loaded
gn:autoAdjustHeight Changes behaviour of input field. When input field has no content it is stretched to show entire hint text. As soon as text is entered into field height of field shrinks to size of inputted text.

Can be

  • true
  • false
gn:gpsPrecision Used in combination with gn:s_sourceType="gps" to increased GPS data accuracy

Can be

  • true - increased GPS data accuracy
  • false - normal GPS data accuracy
gn:imeOptions Defines keyboard functionality that will be valid when options are enabled upon that GnEditText.

Additional information here

gn:imeActionNext Used in combination with gn:imeOptions="actionNext", defines where to move focus after user clicks on the next button

Additional information here

gn:qrAutoEnableTorch Controls torch functionality when QR code is activated

Can be

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

Can be

  • true
  • false
gn:getPointerValue Used in combination with gn:dataType="pointer", defines which pointer value will be displayed in GnEditText

Can be

  • true - pointer value will be displayed
  • false - pointer id will be displayed
gn:nfcPlaySoundAssetsFileName Used in combination with gn:s_nfcAlertType="sound", defines which customized sound file from assets folder will be used.

Can be

  • hardcoded, i.e. soundFile.mp3
gn:continuousLocationService When set to true and widget is set to type gn:s_sourceType="gps", GPS location will be constantly refreshed in GnEditText

Can be

  • true - GPS location will be constantly refreshed
  • false - GPS location will be loaded only once
gn:isInteger DEPRECATED

Used in combination with gn:dataType="number", defines how numeric value will be displayed in GnEditText Can be

  • true - value will be displayed as integer
  • false - value will be displayed as double
gn:isButtonTextVisible Hides or shows text on button when QR code is activated

Can be

  • true - shows the button text, enabled by default
  • false - hides the button text
gn:maxNumberOfDecimals Used in combination with gn:inputType="TYPE_NUMBER_FLAG_DECIMAL", defines how many decimals user is allowed to type in via keyboard after decimal point (milestone 101)

Can be

  • hardcoded - integer value which is non negative and not 0
gn:autoCapitalize Changes the first letter of entered text to upper case

Can be

  • true
  • false

Example

<com.ginstr.widgets.GnEditText
  android:id="@+id/bebraObjekte_ObjektNummer"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  gn:s_hint="@string/txtObjectNumberHint"
  gn:s_sourceType="input"
  gn:inputType="NUMBER" />

Source types

Defines source type

Value Description
input (default) Standard input via an on screen keyboard
NFC Input via a keyboard or by scanning a NFC tag. If there are multiple fields in same screen click on one to set active before scanning
QR Displays QR scan child button. Input via a keyboard or by selecting the button which will launch scanning application
GPS displays GPS location, there can be multiple GPS widgets on the same screen (related to attribute gn:showAddress)
serial Displays serial number generated from IMEI. If attribute gn:useEntry is present then it will look for serial based on IMEI number provided in widget otherwise it will get IMEI from the device
time Displays current date time in milliseconds in widget
aguser Sets current logged ag user into GnEditText widget on load of screen
wifi Displays WiFi fingerprint, there can be multiple WiFi fingerprint widgets on the same screen
gsm Displays GSM fingerprint, there can be multiple GSM fingerprint widgets on the same screen
bt Displays Bluetooth fingerprint, there can be multiple Bluetooth fingerprint widgets on the same screen
ble Displays Bluetooth LE fingerprint, there can be multiple Bluetooth LE fingerprint widgets on the same screen

Input types

Defines the input mode for the keyboard which appears on the screen. For example setting the input type to number will display a numeric keyboard when user taps on this GnEditText.

Input types and combinations supported:

Input Type Description
TYPE_CLASS_NUMBER allows “0123456789” characters to be entered
TYPE_CLASS_NUMBER|TYPE_NUMBER_FLAG_SIGNED|TYPE_NUMBER_FLAG_DECIMAL allows "0123456789.,-" to be entered
TYPE_CLASS_NUMBER|TYPE_NUMBER_FLAG_SIGNED allows "0123456789-" to be entered

Note that when signed integer is entered maximum allowed characters into input field including "-" is 15. "-" is also counted as a digit.

TYPE_NUMBER_FLAG_DECIMAL allows "0123456789.," to be entered
TYPE_CLASS_PHONE allows “0123456789+” and opens numerical keyboard

IME options

imeOptions define keyboard functionality that will be valid when options are enabled upon that GnEditText.

To activate imeOptions on a GnEditText attribute “gn:imeOptions” has to be set.

Input types and combinations supported:

Input Type Description
actionGo When action go is set on GnEditText it is necessary to add another attribute "gn:imeActionGo".

The imeActionGo defines target layout that will be opened by pressing the "enter/go" key on a virtual keyboard.

actionSend When action sent is set on GnEditText it is necessary to add another attribute "gn:imeActionSend"

actionSend defines action or action set that will get executed when the keyboard button enter/go is pressed.

actionNext When action next is set on GnEditText it is necessary to add another attribute "gn:imeActionNext".

actionNext will take user to the next field that accepts text on pressing enter/go on keyboard.

Options to navigate to the next fields are:

  • FOCUS_UP
  • FOCUS_DOWN
  • FOCUS_LEFT
  • FOCUS_RIGHT
  • FOCUS_BACKWARD
  • FOCUS_FORWARD
actionDone actionDone will hide the keyboard when enter/go on virtual keyboard is pressed.

Example

actionGo
gn:imeOptions="actionGo"
gn:imeActionGo="@+id/targetRootLayout"
actionSend
gn:imeOptions="actionSend"
gn:imeActionSend="[action]|[action values],..."
actionNext
gn:imeOptions="actionNext"
gn:imeActionNext="FOCUS_DOWN"
actionDone
gn:imeOptions="actionDone"

Alternative layout

If the default look and feel needs to be changed, create or copy identical files from $defaultApp to current app "control" folder.
To provide alternative layout, the files mentioned above can be set into control folder of the current application. Files must be named as shown above and widgets with Id’s have to stay of same type and keep same id.

widget_en_edittext.xml

Widget Name Description
EditText @+id/enEditText this text field represents input field
Button @+id/enEditTextButton if gn:s_sourceType="QR", this button starts QR service