Jump to: navigation, search
(Created page with "<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div> ==Widgets== Widgets can be divided in two groups: ::;1. Android widgets : all [")
(Redirected page to Category:Widgets)
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
#REDIRECT [[:Category:Widgets]]
Widgets can be divided in two groups:
::;1. Android widgets : all [ native Android widgets] (look for subtitle '''“Classes”'''). Widgets are provided by Android system.
::;2. ginstr widgets : custom made widgets. They can be composite widgets that consist of multiple Android views or a single view with special functionality.
Each file in '''“layout”''' folder is called layout. Mandatory layouts as mentioned before are '''“activity.xml”''' and '''“start.xml”'''. These layouts consist of widgets. Layout can have one top element (widget) as mentioned before.
Widgets can be divided by nesting:
::;1. Container widgets (ViewGroups) : those widgets are used as containers for other widgets. The purpose is positioning assistance and layout organization. The most important are: [[LinearLayout]], [[RelativeLayout]], [[ScrollView]] (can have one child), [[FrameLayout]]. More are mentioned here.
::;2. Action widgets : widgets that can’t nest or contain widgets within them. These widgets are used for providing functionality to app (i.e. input text, display text, call phone, send text message…), some of those are ([[TextView]], [[ImageView]], [[EditText]], [[EnEditText]], [[EnMediaAction]]…)
[[#Widget Library|Widget Library]] contains all custom ginstr widgets that contain features not provided out of the box by Android.
Attributes define how each widget behaves and what it looks like. Android widgets have attributes described for each widget for example [[TextView]], [[ImageView]], [[EditText]] (look under '''XML attributes''' and '''Inherited XML attributes'''). Each attribute has a description what its function is. This is provided for all Android widgets in Android documentation.
::Example Android widget with attributes:
[[File:attributes_example.png|frame|center|16.Attributes example]]
To use ginstr namespace attributes user has to define custom namespace in top (root) element (widget) of the layout. <code>xmlns:ek=</code>. To define custom attribute following syntax is used, <code>gn:customAttributeName=“attributeValue“</code>
::Example of a ginstr widget with attributes:
[[File:ginstr_widget_with_attributes.png|frame|center|17. ginstr widget with attributes]]
===Mandatory attributes===
<span style="color:#FF0000">'''!IMPORTANT!'''</span> Each widget has to have <code>android:layout_width</code>, <code>android:layout_height</code> defined. Custom widgets need custom ginstr attribute defined to work properly, check layout configuration of each widget. Attribute with asterisk (<code>*</code>) is a mandatory parameter when creating widget.
===Widgets positioning===
One of the most important things is how to handle widget positioning within container widgets. Positioning depends on each widget within a container which depends on the container which contains it. If a widget is contained for example in [[LinearLayout]] it will not have the same positioning options as in [[RelativeLayout]]. For an introduction on the two most common containers read [[this(linear)]] and [[this(relative)]].
::Example: Widget in [[RelativeLayout]] has the ability to position itself relative to other views by attribute (example under positions widget containing this attribute to right of widget with id mentioned in attribute)
Practice is needed to learn those few containers and their abilities. With combinations of containers any positioning can be achieved.
===Widget data persistence===
<span style="color:#FF0000">'''!IMPORTANT!'''</span> To enable widgets that retrieve data from a user to retain data between orientation changes a unique id for widget within that layout has to be provided. Id has to be identical in both layouts (landscape/portrait). It is encouraged to use portrait only layout due to better visibility on phone Android devices.
[[File:ID_for_persistence.png|frame|center|18. ID for persistence]]
==Widget Library==
The table below contains a brief description of all custom ginstr widgets that contain features not provided out of the box by Android. Full details on each widget can be found by clicking on the widget name.
{| class="wikitable"
!colspan="2"|Widget Library
|'''Widget Name'''
|'''Brief Description'''
|Primarily used to display text but can also be used to contain links
|Standard Android button that can be used with special ginstr abilities
|Multi-source editText used to enter text data or acquire it from other sources.
|Android imageView with some additional features
|Provides phone functionality (initiate phone call, text message/SMS, email, open webpage or download file)
|Provides media functionality (recording of audio, video or photo)
|Shows media items as images in table view
|Android TextView with some additional functionality
|Captures a signature and save to device
|Captures a signature to be drawn on to screen with other widgets
|Provides date entry
|Provides time entry
|Provides date and time entry
|Provides entry of dropdown values
|Extends [[GnDropDown]] widget with possibility to select multiple values from dropdown list
|Provides interface for a user login
|Provides option to send log on any screen
|Provides a button that when clicked launches preferences activity of GL
|Used to show data in a table appearance
|Provides a checkbox that can be either checked or unchecked
|Used to display time elapsed
|Provides support to enter phone number data into phone number datatype
|Container for [[GnRadioButton]] widgets
|Used to display a single choice list
|Can be pressed or clicked by the user to perform an action
|Supports storage and retrieval of email data to/from email database
|Simulates NFC scans
|Simulates QR scans

Latest revision as of 11:17, 29 June 2016

Redirect to: