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

Photo

Widget is represented by an image of camera. When image is clicked camera activity is opened where user can take image. After user has taken image, image is shown in gallery below the button.

Widget id, ${gbamID}:

mediaPhoto

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as pictures datatype.

Predefined user data

PreLoaded

Properties panel

User will configure this data in properties panels of selected widget:

GENERAL
  • "label", ${widgetLabel}
  • "max photos" , input field.
    • number can not be smaller than 1
    • if user did not provide any value set it to 5
    • if number 1 or more then add following attribute to widget : gn:maxMediaTaken and set to entered number
    • if number is 1 then add the following attribute to widget: gn:singleValueMode and set to true
VALIDATIONS
    <columnPicture required="true|false"></columnPicture>
ACTION
  • -
ACTION MESSAGES
  • -
DATABASE
  • "is part of database", checkbox option by default is set as checked. When checked database column is created for this widget.
  • "additional ginstr web column settings":
  • "replicate", if true, replicates audios from server to android client, add to configuration.xml:
<columnPicture>
    <replicate>true|false</replicate>
</columnPicture>

Code snippets

GBAM Code Variables

Variables which are used in code snippet below but not defined in user modifiable inputs.

Common widget code

<com.ginstr.widgets.GnTextView
        android:id="@+id/${widgetID}_label"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:text="@string/${widgetID}"
        gn:style="@style/mediaPhoto_label"/>

<RelativeLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content">

	<com.ginstr.widgets.GnMediaAction
		android:id="@+id/${widgetID}_button"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		gn:act_setAfterMediaTaken="[gn:act_copyData]|[@+id/${widgetID}_button,@+id/${widgetID}_gallery]"
		gn:s_actionType="photo"
                gn:dataType="pictures"
                gn:singleValueMode="false"
                gn:style="@style/mediaPhoto_button"/>
</RelativeLayout>

<com.ginstr.widgets.GnMediaGallery
    android:id="@+id/${widgetID}_gallery"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:allowPhotoDeletion="true"
    gn:mediaActionId="@+id/${widgetID}_button"
    gn:style="@style/mediaPhoto_gallery" />

strings.xml

Lines to be added for each language.

<string name="${widgetID}">${widgetLabel}</string>

internal widget layout

This widget has internal structure widget_en_mediaaction_photo.xml