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

GnMediaGallery

Widget XML tag
<com.ginstr.widgets.GnMediaGallery>
Description
Widget which shows media items as images in table view. It is a composite control made of TableLayout, TableRow and ImageView.
Clicking on the selected image will display it in full screen mode as a top overlay item.
It can be used in conjunction with GnMediaAction widget, e.g. use gn:act_copyData action to display a picture in gallery widget just after the picture is taken.

XML Attributes Description

Attribute Description
gn:numberOfColumns* Defines number of displayed items per row

Can be

  • hardcoded, i.e. 3
gn:itemHorizontalSpacing Defines horizontal spacing between columns

Can be

  • hardcoded, i.e. 2 (expressed in dp)
gn:itemVerticalSpacing Defines vertical spacing between rows

Can be

  • hardcoded, i.e. 2 (expressed in dp)
gn:itemSameSize Defines how the images will be displayed in the widget. By default true is set.

Can be

  • true - all images will be cropped to same (squared) size
  • false - each image will maintain aspect ratio
gn:clearOnNewDataAdd If set to true, each time data is added to gallery all previous data will be removed from it

Can be

  • true
  • false
gn:allowPhotoDeletion If set to true, it will allow user to delete photos from related GnMediaAction, in order to use this attribute gn:mediaActionId has to be present on current widget and point to valid GnMediaAction widget. When user long clicks on an image in gallery or image preview it will show dialog to delete image. (milestone 101)

Can be

  • true
  • false
gn:mediaActionId id of GnMediaAction widget which is used to display images in this widget. (milestone 101)

Can be

  • widgetId - i.e. @+id/mediaAction
gn:dataType Defines datatype of widget

Example

<com.ginstr.widgets.GnMediaGallery
  android:id="@+id/cleaningServicePhotosShow"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  gn:numberOfColumns="3"
  gn:itemHorizontalSpacing="5"
  gn:itemVerticalSpacing="5"
  gn:itemSameSize="true" />