From wiki.ginstr.com
Jump to: navigation, search
(Created page with "<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div> Category:Widget_Library ;Inherited classes: <code>[http://developer.android.com/reference/android/vi...")
 
m
Line 13: Line 13:
 
The dialog has a built in [[gn:act_validateScreen|validate screen action]] when <code>add</code> or <code>edit</code> is executed.
 
The dialog has a built in [[gn:act_validateScreen|validate screen action]] when <code>add</code> or <code>edit</code> 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.
+
By default, widget definition can be found in '''$defaultApp/control/[[#widget_en_phonenumber.xml|widget_en_phonenumber.xml]]'''. This layout describes how the widget will look on screen.
  
The dialog screen that loads on clicking <code>edit</code> is defined by '''$defaultApp/control/dialog_en_phonenumber.xml'''
+
The dialog screen that loads on clicking <code>edit</code> is defined by '''$defaultApp/control/[[#dialog_en_phonenumber.xml|dialog_en_phonenumber.xml]]'''
  
Dialog screen listview row definition can be found at '''$defaultApp/control/dialog_en_phonenumber_row.xml'''
+
Dialog screen listview row definition can be found at '''$defaultApp/control/[[#dialog_en_phonenumber_row.xml|dialog_en_phonenumber_row.xml]]'''
  
All of the above mentioned layouts can be used to modify the look and feel of the widget.
+
All of the aforementioned layouts can be used to modify the look and feel of the widget.
  
 
==XML Attributes Description==
 
==XML Attributes Description==
Line 33: Line 33:
 
| title="Description" | Allows user to call existing phone number and to close the dialog
 
| title="Description" | 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===
 +
;<code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code> <code>@+id/etPhoneNumber</code>: this text field represents phone numbers stored in the widget
 +
;<code>[http://developer.android.com/reference/android/widget/Button.html Button]</code><code>@+id/etPhoneManage</code>: this button opens dialog screen to manage phone number entries
 +
 +
===dialog_en_phonenumber.xml===
 +
;<code>[[GnEditText]]</code> <code>@+id/etPhoneNumberDialogName</code>: this input field is used to define phone number entry <code>name</code> attribute
 +
;<code>[[GnEditText]]</code> <code>@+id/etPhoneNumberDialogInfo</code>: this input field is used to define phone number entry <code>info</code> attribute
 +
;<code>[[GnEditText]]</code> <code>@+id/etPhoneNumberDialogNumber</code>: this input field is used to define phone number entry <code>number</code> attribute
 +
;<code>[http://developer.android.com/reference/android/widget/ListView.html ListView]</code> <code>@+id/lstPhoneNumberDialogNumbers</code>: displays currently stored phone number entries in widget
 +
;<code>[http://developer.android.com/reference/android/widget/Button.html Button]</code><code>@+id/btnPhoneNumberDialogAdd</code>: this button, after clicking on list item and modifying entry data will replace stored entry data with newly entered data
 +
;<code>[http://developer.android.com/reference/android/widget/Button.html Button]</code><code>@+id/btnPhoneNumberDialogEdit</code>: this button, after clicking on list item and modifying entry data, will replace stored entry data with newly entered data
 +
;<code>[http://developer.android.com/reference/android/widget/Button.html Button]</code><code>@+id/btnPhoneNumberDialogRemove</code>: after clicking on list item, clicking this button will remove the entry from the list
 +
;<code>[http://developer.android.com/reference/android/widget/Button.html Button]</code><code>@+id/btnPhoneNumberDialogClose</code>: this button closes dialog and refreshes widget on screen with data
 +
 +
===dialog_en_phonenumber_row.xml===
 +
;<code>[http://developer.android.com/reference/android/widget/LinearLayout.html LinearLayout]</code> <code>@+id/etPhoneNumberRow</code>: this container represents a single list row
 +
;<code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code> <code>@+id/etPhoneRowName</code>: this text widget will display phone number entry <code>name</code> attribute
 +
;<code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code> <code>@+id/etPhoneRowInfo</code>: this text widget will display phone number entry <code>info</code> attribute
 +
;<code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code> <code>@+id/etPhoneRowNumber</code>: this text widget will display phone number entry <code>number</code> 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==
 
==gn:displayCallButton==

Revision as of 18:13, 29 June 2016

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