From wiki.ginstr.com
Revision as of 18:13, 29 June 2016 by Mark (talk | contribs)
Jump to: navigation, search
Inherited classes
View
Android class type
LinearLayout
Child elements
TextView, Button
Widget XML tag
<com.ginstr.widgets.GnPhoneNumber>


GnPhoneNumber provides support to enter phone number data into phone number datatype. It’s used to store and retrieve data from the database. Once data is in the widget it’s possible to edit the data by clicking edit button.

On click, a new dialog window will open which has add, edit, remove and close buttons which can be used to manipulate phone numbers.

The dialog has a built in validate screen action when add or edit is executed.

By default, widget definition can be found in $defaultApp/control/widget_en_phonenumber.xml. This layout describes how the widget will look on screen.

The dialog screen that loads on clicking edit is defined by $defaultApp/control/dialog_en_phonenumber.xml

Dialog screen listview row definition can be found at $defaultApp/control/dialog_en_phonenumber_row.xml

All of the aforementioned layouts can be used to modify the look and feel of the widget.

XML Attributes Description

Attribute Description
gn:displayCallButton Displays a call button in GnPhoneNumber dialog to the right of each phone number
gn:readOnlyDialog Allows user to call existing phone number and to close the dialog

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_phonenumber.xml

TextView @+id/etPhoneNumber
this text field represents phone numbers stored in the widget
Button@+id/etPhoneManage
this button opens dialog screen to manage phone number entries

dialog_en_phonenumber.xml

GnEditText @+id/etPhoneNumberDialogName
this input field is used to define phone number entry name attribute
GnEditText @+id/etPhoneNumberDialogInfo
this input field is used to define phone number entry info attribute
GnEditText @+id/etPhoneNumberDialogNumber
this input field is used to define phone number entry number attribute
ListView @+id/lstPhoneNumberDialogNumbers
displays currently stored phone number entries in widget
Button@+id/btnPhoneNumberDialogAdd
this button, after clicking on list item and modifying entry data will replace stored entry data with newly entered data
Button@+id/btnPhoneNumberDialogEdit
this button, after clicking on list item and modifying entry data, will replace stored entry data with newly entered data
Button@+id/btnPhoneNumberDialogRemove
after clicking on list item, clicking this button will remove the entry from the list
Button@+id/btnPhoneNumberDialogClose
this button closes dialog and refreshes widget on screen with data

dialog_en_phonenumber_row.xml

LinearLayout @+id/etPhoneNumberRow
this container represents a single list row
TextView @+id/etPhoneRowName
this text widget will display phone number entry name attribute
TextView @+id/etPhoneRowInfo
this text widget will display phone number entry info attribute
TextView @+id/etPhoneRowNumber
this text widget will display phone number entry number attribute

The aforementioned widgets must keep their type and id but the rest of the attributes and customisations can be done as required. Remaining widgets not mentioned in this xml files structure can be added/modified as required, there are no constraints.

gn:displayCallButton

Displays a call button in GnPhoneNumber dialog to the right of each phone number

(Boolean) values = true, false

Default value = false

gn:readOnlyDialog

Allows user to call existing phone number and to close the dialog

(Boolean) values = true, false

Default value = false