m |
m (→XML Attributes Description) |
||
Line 18: | Line 18: | ||
! scope="col" | Description | ! scope="col" | Description | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:s_actionType]]</code><span style="color:#FF0000">*</span> | + | | title="Attribute" | <code>[[#gn:s_actionType|gn:s_actionType]]</code><span style="color:#FF0000">*</span> |
| title="Description" | Sets media type (photo, video, audio, document etc...) | | title="Description" | Sets media type (photo, video, audio, document etc...) | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:maxFileSize]]</code> | + | | title="Attribute" | <code>[[#gn:maxFileSize|gn:maxFileSize]]</code> |
| title="Description" | Sets maximum file size in kilobytes for photos. Images are resized before being saved to database | | title="Description" | Sets maximum file size in kilobytes for photos. Images are resized before being saved to database | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:maxMediaTaken]]</code> | + | | title="Attribute" | <code>[[#gn:maxMediaTaken|gn:maxMediaTaken]]</code> |
| title="Description" | Defines maximum media content to be added by user. Once user reaches maximum a message will be shown and user will be not be able to store more media | | title="Description" | Defines maximum media content to be added by user. Once user reaches maximum a message will be shown and user will be not be able to store more media | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:backgroundPhoto]]</code> | + | | title="Attribute" | <code>[[#gn:backgroundPhoto|gn:backgroundPhoto]]</code> |
| title="Description" | Defines background image of the widget | | title="Description" | Defines background image of the widget | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:backgroundPhotoPressed]]</code> | + | | title="Attribute" | <code>[[#gn:backgroundPhotoPressed|gn:backgroundPhotoPressed]]</code> |
| title="Description" | Defines background image (pressed) of the widget | | title="Description" | Defines background image (pressed) of the widget | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:singleValueMode]]</code> | + | | title="Attribute" | <code>[[#gn:singleValueMode|gn:singleValueMode]]</code> |
| title="Description" | If enabled, widget will store only a single media item. Each new media item will overwrite the old one | | title="Description" | If enabled, widget will store only a single media item. Each new media item will overwrite the old one | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:hidePhotoText]]</code> | + | | title="Attribute" | <code>[[#gn:hidePhotoText|gn:hidePhotoText]]</code> |
| title="Description" | Hides text on button that is displayed as standard | | title="Description" | Hides text on button that is displayed as standard | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:hideCounter]]</code> | + | | title="Attribute" | <code>[[#gn:hideCounter|gn:hideCounter]]</code> |
| title="Description" | Hides counter text that is displayed as standard | | title="Description" | Hides counter text that is displayed as standard | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:setAfterMediaTaken]]</code> | + | | title="Attribute" | <code>[[#gn:setAfterMediaTaken|gn:setAfterMediaTaken]]</code> |
| title="Description" | Defines [[Action_Sets|action set]] which will be executed after user has taken media with this widget. | | title="Description" | Defines [[Action_Sets|action set]] which will be executed after user has taken media with this widget. | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:qrAutoEnableTorch]]</code> | + | | title="Attribute" | <code>[[#gn:qrAutoEnableTorch|gn:qrAutoEnableTorch]]</code> |
| title="Description" | If set, flashlight will turn on automatically when QR scan screen opens | | title="Description" | If set, flashlight will turn on automatically when QR scan screen opens | ||
|- | |- | ||
− | | title="Attribute" | <code>[[#gn:rep_attachment]]</code> | + | | title="Attribute" | <code>[[#gn:rep_attachment|gn:rep_attachment]]</code> |
| title="Description" | Enables server side replication flag to replicate files from server to device for certain column at “generate table” moment | | title="Description" | Enables server side replication flag to replicate files from server to device for certain column at “generate table” moment | ||
|} | |} |
Revision as of 17:14, 28 June 2016
- Inherited classes
View
- Android class type
LinearLayout
- Child elements
TextView
,Button
- Widget XML tag
<com.ginstr.widgets.GnMediaAction>
Widget provides media functionality. Recording of audio, video or photo material. It is a composite control made of TextView
and Button
. Widget saves files to a certain folder depending on the media type. Upon saving file, string path to file is added to the array list which contains all paths to the media taken in this form.
Only one actionType
can be set on widget.
XML Attributes Description
Note: An attribute marked with asterisk (*) is a mandatory parameter when creating widget.
Attribute | Description |
---|---|
gn:s_actionType *
|
Sets media type (photo, video, audio, document etc...) |
gn:maxFileSize
|
Sets maximum file size in kilobytes for photos. Images are resized before being saved to database |
gn:maxMediaTaken
|
Defines maximum media content to be added by user. Once user reaches maximum a message will be shown and user will be not be able to store more media |
gn:backgroundPhoto
|
Defines background image of the widget |
gn:backgroundPhotoPressed
|
Defines background image (pressed) of the widget |
gn:singleValueMode
|
If enabled, widget will store only a single media item. Each new media item will overwrite the old one |
gn:hidePhotoText
|
Hides text on button that is displayed as standard |
gn:hideCounter
|
Hides counter text that is displayed as standard |
gn:setAfterMediaTaken
|
Defines action set which will be executed after user has taken media with this widget. |
gn:qrAutoEnableTorch
|
If set, flashlight will turn on automatically when QR scan screen opens |
gn:rep_attachment
|
Enables server side replication flag to replicate files from server to device for certain column at “generate table” moment |
Alternative layout
Alternative layout can be set into control folder. It must be named "widget_en_mediaaction.xml"
and it must have valid XML structure.
It must contain three widgets with following ids:
TextView
@+id/enMediaActionTextView
- this text field represents counter of taken media that is visible over the buttons
Button
@+id/enMediaActionButton
- this button is the main button and is always visible
Button
@+id/enMediaActionButton2
- this button is visible in situations when two options are available (i.e. when user can take media by taking a picture or selecting it from gallery)
The rest of the widgets and attributes in this XML structure can be defined as required, there are no constraints.
gn:s_actionType
Sets media type
(String) values = photo
, video
, audio
, gallery
, photogallery
, document
Value | Description |
---|---|
photo
|
Initiates the camera with a button press, after successful photo action it saves file to path and saves path to array of paths |
video
|
Initiates the video camera with a button press, after successful capture of a video it saves file to path and saves path to array of paths |
audio
|
Initiates the microphone with a button press, with the next button press stops recording and saves file to path and saves path to array of paths |
gallery
|
Initiates the menu to select a photo from a device with a button press, after a successful photo selection, the image path is saved to array of paths |
photogallery
|
Displays two buttons : “take photo” which works like photo , and “select photo” which works as gallery . Once photo is taken, the image path is saved to array of paths
|
document
|
Initiates the menu to select a file from a device. After file is selected, its path is added to array of document paths in widget |
gn:maxFileSize
Before image is saved to database, presence of this attribute reduces image multiple times until it reaches to first value under defined size.
(Integer) value = i.e. 75
, expressed in kilobytes.
This attribute is only valid on GnMediaAction
that is of actionType = photo
gn:maxMediaTaken
Defines maximum media content to be added by user. Once user reaches maximum a message will be shown and user will be not be able to store more media.
(Integer) value = 1
, 2
, ... 10
gn:backgroundPhoto
Defines background image of the widget
(String) value = resource pointer i.e. @drawable/button_red
or patch 9 resource pointer @drawable/button_red.9
gn:backgroundPhotoPressed
Defines background image pressed for the widget
(String) value = resource pointer i.e. @drawable/button_red
or patch 9 resource pointer @drawable/button_red.9
gn:singleValueMode
If enabled, widget will store only a single media item. Each new media item will overwrite the old one.
(Boolean) values = true
, false
gn:hidePhotoText
Hides text on button that is displayed as standard
gn:hideCounter
Hides counter text that is displayed as standard
gn:setAfterMediaTaken
Defines action set which will be executed after user has taken media with this widget.
gn:qrAutoEnableTorch
If set, flashlight will turn on automatically when QR scan screen opens
gn:rep_attachment
Enables server side replication flag to replicate files from server to device for certain column at “generate table” moment
(Boolean) values = true
, false