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

GnPhoneNumber

Widget XML tag
<com.ginstr.widgets.GnPhoneNumber>
Description
GnPhoneNumber provides support to enter phone number data into phone number datatype. It is used to store and retrieve data from the database.
Once data is in the widget it’s possible to edit the data by clicking the 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

Can be

  • true
  • false
gn:readOnlyDialog Allows user only to call existing phone number and to close the dialog

Can be

  • true
  • false
gn:s_contactListColor Defines the text color of phone numbers

Can be

  • hardcoded, i.e. #000000

Example

<com.ginstr.widgets.GnPhoneNumber
  android:id="@+id/resident_emergencyContacts"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  gn:displayCallButton="true"
  gn:s_contactListColor="#000000"
  gn:readOnlyDialog="true" />

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

Widget Name Description
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

widget_en_phonenumber_dialog.xml

Widget Name Description
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 will add new entry 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

Widget Name Description
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
Button @+id/etPhoneRowCall this button is used to make a phone call