From wiki.ginstr.com
Jump to: navigation, search
(Created page with "<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div> <span STYLE="font-size: xx-large">strings.xml naming convention</span> Category:ginstr_developers_manu...")
 
Line 1: Line 1:
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
<span STYLE="font-size: xx-large">strings.xml naming convention</span>
+
<span STYLE="font-size: xx-large">Launcher error codes</span>
 
[[Category:ginstr_developers_manual]]
 
[[Category:ginstr_developers_manual]]
  
This document serves as a set of rules how to form string resources id's for widgets that are used in ginstr apps.
+
This document describes ginstr launcher error codes.
  
 
=Definitions=
 
=Definitions=
Line 12: Line 12:
 
It is strictly forbidden to use one resource in two different places of an app. In this case 2 different resources must be implemented.
 
It is strictly forbidden to use one resource in two different places of an app. In this case 2 different resources must be implemented.
  
=Resources folder=
+
        msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_INVALID_USERNAME, 1001);
Resources folders are found at each ginstr app on path:
+
        msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_DISABLED_USER, 1003);
 
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_IO_EXCEPTION, 1004);
;default folder:
+
         msgBoxCodes.put(AgConstants.MSG_BOX_SERIAL_IMEI_MISSING, 1005);
:<code>appId/values/strings.xml</code>
+
         msgBoxCodes.put(AgConstants.MSG_BOX_REPLICATION_PUSH_DISABLED, 1006);
 
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_PASSWORD_EXPIRED, 1007);
;or for English:
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_AT_LEAST_ONE_LOGIN, 1008);
:<code>appId/values-en/strings.xml</code>
+
        msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_GINSTR_SERVERS_UNAVAILABLE, 109);
 
+
         msgBoxCodes.put(AgConstants.MSG_BOX_MISSING_ROLE, 1010);
;or where LANG is language parameter:
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_NO_RESPONSE_SERVER, 1011);
:<code>appId/values-LANG/strings.xml</code>
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_BAD_USER, 1012);
 
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_BAD_USER_SSO, 1013);
=String resource fallback mechanism and overriding rules=
+
         msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_NOTACTIVATED_USER, 1015);
If resource is not found in ginstr app ginstr launcher has fallback mechanism to load resources from $defaultApp.
+
        msgBoxCodes.put(AgConstants.MSG_BOX_APP_NOT_ENABLED_FOR_USER,1016);
 
 
All resources that are in '''$defaultApp''' are globally available to all ginstr apps.
 
If certain resource does not exist in any "'''[[Strings.xml|strings.xml]]'''" of a ginstr app but is referenced in "layouts" of ginstr app and exists in '''$defaultApp''' then it will be loaded from '''$defaultApp'''.
 
If you override a resource id that exists in '''$defaultApp''' in ginstr app '''$defaultApp''' resource will be ignored but this also means if you would change a generic message that is used across multiple ginstr apps for this app where is overridden it would not apply but additional modification of that overridden resource would be required.
 
 
 
There can be 3 situations when using resources in ginstr app:
 
#resource id is loaded from '''$defaultApp''' and is used as is
 
#resource id "template" is loaded from '''$defaultApp''' and has parameters which are variable per ginstr app
 
#resource id "template" is not loaded and does not exist in '''$defaultApp'''
 
==$defaultApp resource id's prefix==
 
All string resource id's in '''$defaultApp''' should start with <code>$</code> symbol:
 
 
 
i.e.
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$txtAppManagerInstall">install</string>
 
<string name="$txtAppManagerUninstall">uninstall</string>
 
<string name="$txtAppRecreateShortcuts">create icons&lt;BR/&gt;on the launch screen</string>
 
</syntaxhighlight>
 
==Labels: for ginstr app input fields==
 
Label represents text above the input field of a widget.
 
Resource id "template" is not loaded and does not exist in '''$defaultApp'''
 
Labels should have the resource id formed as:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}
 
</syntaxhighlight>
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnTextView
 
    android:id="..."
 
    android:layout_width="match_parent"
 
    android:layout_height="wrap_content"
 
    android:text="@string/${pageName}_${widgetName}"
 
    gn:style="..."/>
 
</syntaxhighlight>
 
 
 
and in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}">example label</string>
 
</syntaxhighlight>
 
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnTextView
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    android:text="@string/pageOne_customerName"
 
    gn:style="..."/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerName">example label</string>
 
</syntaxhighlight>
 
==Hints: for ginstr app input fields==
 
Hint represents text which is shown in input field when it's empty as a suggestion to user.
 
Resource id "template" is not loaded and does not exist in '''$defaultApp'''
 
 
 
Hints should have resource id formed as:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}Hint
 
</syntaxhighlight>
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:s_hint="@string/${pageName}_${widgetName}Hint"
 
    gn:data_type="..."
 
    gn:style="..."/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}Hint">example label hint</string>
 
</syntaxhighlight>
 
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:s_hint="@string/pageOne_customerNameHint"
 
    gn:data_type="..."
 
    gn:style="..."/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameHint">example label hint</string>
 
</syntaxhighlight>
 
 
 
=Validators for ginstr app widgets=
 
[[Validation|Validators]] are mechanisms that check if user entry is valid and prevent user from typing something that should not be typed in certain input field, i.e. typing text into a kilos field when number is expected.
 
There can be multiple [[Validation|validators]] on a widget. Validation messages can also be loaded from '''$defaultApp'''.
 
There are multiple validators and multiple strings that each validator contains.
 
 
 
'''$defaultApp''' contains predefined validation messages which are used for various purposes, in that case resourceId prefix is:
 
 
 
;PREFIX + SUFFIX:
 
:<code>{PredefinedNameOfValidation} + ValidatorNameKeyValue</code>
 
 
 
;Prefix:is defined by ginstr app developer with purpose of [[Validation|validation]], i.e. <code>"checkIfAllFieldsFilled"</code>
 
 
 
;Suffix: in the validator resourceId defines which validator and which message within validator is targeted:
 
 
 
Validator types <code>"ValidatorName"</code>:
 
*<code>[[TextValidator]]</code>
 
*<code>[[ComparatorValidator]]</code>
 
*<code>[[RequiredValidator]]</code>
 
 
 
Validator messages for override <code>"KeyValue"</code> (see all of them [[Validation|<u>here</u>]]) :
 
<pre>
 
MinLength
 
MaxLength
 
REGEX
 
PhoneErrMsg
 
EmailErrMsg
 
MinLengthErrMsg
 
.... </pre>
 
 
 
The above information should be used in forming rules for different cases.
 
 
 
==Forming rules for different cases:==
 
 
 
===Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)===
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$PredefinedNameOfValidationValidatorNameKeyValue
 
</syntaxhighlight>
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText
 
         android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$PredefinedNameOfValidationValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$PredefinedNameOfValidationValidatorNameKeyValue">this is a default predefined message for validation</string>
 
</syntaxhighlight>
 
example if <code>predefinedNameOfValidation="checkIfAllFieldsFilled"</code> and <code>validatorName="[[RequiredValidator]]"</code> and <code>KeyValue="message"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
         android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$checkIfAllFieldsFilledRequiredValidatorMessage]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]] at '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="checkIfAllFieldsFilledRequiredValidatorMessage">please fill all fields which have a '*'</string>
 
</syntaxhighlight>
 
===Resource id "template" is loaded from $defaultApp and has parameters which are variable per ginstr app===
 
 
 
In this case resource should be copied from '''$defaultApp''' and variable content should be "replaced" and when done saved into ginstr app '''[[Strings.xml|strings.xml]]'''
 
Rule for forming resource ID in such case:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}ValidatorNameKeyValue
 
</syntaxhighlight>
 
Content in '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$PredefinedNameOfValidationValidatorNameKeyValue">some value using params, %1$s , %2$s</string>
 
</syntaxhighlight>
 
i.e.
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="checkIfFieldIsFilledRequiredRequiredValidatorMessage">entering the %1$s is required</string>
 
</syntaxhighlight>
 
should be generated in ginstr app as:
 
 
 
on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText 
 
         android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}ValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at ginstr app:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ValidatorNameKeyValue">entering the ${widgetName} is required</string>
 
</syntaxhighlight>
 
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and <code>validatorName="RequiredValidator"</code> and <code>KeyValue="message"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
         android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$pageOne_customerNameRequiredValidatorMessage]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameRequiredValidatorMessage">entering the customerName is required</string>
 
</syntaxhighlight>
 
===Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only===
 
Rule for forming resource ID in such case:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}ValidatorNameKeyValue
 
</syntaxhighlight>
 
should be generated in ginstr app as:
 
 
 
on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText
 
         android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}ValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at ginstr app:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ValidatorNameKeyValue">entering this value is required</string>
 
</syntaxhighlight>
 
===Example of decimal numerical validator for english (EN)===
 
Maximum allowed number length is 15 which can be stored into ginstr back-end. For that reason there are 2 validator rules used.
 
 
 
====Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)====
 
resourceId prefix for number decimal is :
 
<code>widgetId + ValidatorName + KeyValue</code>
 
i.e. <code>NumberDecimal + TextValidator + MaxLength</code> (see [[Number#Decimal_variant|NumberDecimal]] for further information)
 
 
 
'''$defaultApp''' contains:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$NumberDecimalTextValidatorMaxLength">maximum allowed number length is 15</string>
 
<string name="$NumberDecimalTextValidatorREGEX">only decimal numbers are allowed</string>
 
<string name="$NumberDecimalTextValidatorPattern">^[-+]?[0-9]*(\.)?[0-9]+\b$</string>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
         android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/$NumberDecimalTextValidatorMaxLength]"
 
        gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/$NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
====Resource id "template" is loaded from $defaultApp and has parameters which are variable per ginstr app====
 
'''$defaultApp''' contains:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$NumberDecimalTextValidatorMaxLength">maximum allowed %1$s length is %2$s</string>
 
<string name="$NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for %1$s</string>
 
<string name="$NumberDecimalTextValidatorPattern">^[-+]?[0-9]*(\.)?[0-9]+\b$</string>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
         android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/$NumberDecimalTextValidatorMaxLength]"
 
         gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/$NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
app specific generated:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength]"
 
         gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength">maximum allowed ${widgetName} length is ${maxLength}</string>
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for ${widgetName}</string>
 
</syntaxhighlight>
 
====Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only====
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/${pageName}${widgetName}NumberDecimalTextValidatorMaxLength]"
 
         gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorREGEX],[pattern=@string/$NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength">maximum allowed ${widgetName} length is ${maxLength}</string>
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for ${widgetName}</string>
 
</syntaxhighlight>
 
 
 
=Buttons: execute some logic=
 
Buttons should have the resource id formed as:
 
<code>@string/${pageName}_${widgetName}</code>
 
 
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<Button
 
  android:id="..."
 
  android:layout_width="..."
 
  android:layout_height="..."
 
  android:background="..."
 
  gn:setBackgroundPressed="..."
 
  gn:style="..."
 
  android:text="@string/${pageName}_${widgetName}"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}">button function</string>
 
</syntaxhighlight>
 
 
 
Example if <code>pageName="pageOne"</code> and <code>widgetName="saveCustomerData"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<Button
 
  android:id="..."
 
  android:layout_width="..."
 
  android:layout_height="..."
 
  android:background="..."
 
  gn:setBackgroundPressed="..."
 
  gn:style="..."
 
  android:text="@string/pageOne_saveCustomerData"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_saveCustomerData">save customer data</string>
 
</syntaxhighlight>
 
=Actions: actions are basic building blocks of logic=
 
[[Actions]] can simply execute some logic behind the scenes or they have some UI dependency. When there is UI usually some message to the user is shown, in that case we need to provide string resources for it, i.e. toasts, dialogs...
 
 
 
Each action should have individually defined string resourceID. In app composer those IDs should be defined by each app composer widget individually. We can call those IDs ActionSpecificId.
 
 
 
==Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)==
 
Some strings can be default for all ginstr app and in that case their resourceID is unique.
 
 
 
In '''$defaultApp''' action message should have the resource id formed as:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$meaningfulNameBasedOnPurpose">some generic text message</string>
 
</syntaxhighlight>
 
 
 
:where '''<code>meaningfulNameBasedOnPurpose</code>''' is the default message resourceID that is shown across multiple apps
 
 
 
in action it is shown as:
 
 
 
<code>[gn:act_toast]|[@string/$meaningfulNameBasedOnPurpose]</code>
 
 
 
i.e. we show message when screen validation is executed if some fields are not filled and this message is same in all apps:
 
 
 
In '''$defaultApp''' resourceId:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$toastValidateAllRequiredFields">please filled all required field marked with '*'</string>
 
</syntaxhighlight>
 
in action:
 
 
 
<code>...[gn:act_toast]|[@string/$toastValidateAllRequiredFields]...</code>
 
 
 
==Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only==
 
In case some action message or UI should be shown and it does not relate to some generic message for all apps then resourceID is defined within action definition.
 
 
 
If action is used multiple times on same widget then the SUFFIX +1 is added at end of resourceID starting with 2
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ActionNameActionSpecificId">${widgetName}</string>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and action that is used is toast :
 
toast has only single message internally so <code>ActionSpecifiId</code> is not required.
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast">customerName</string>
 
</syntaxhighlight>
 
If two toasts would be executed on a widget <code>customerName</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast2">${widgetName}</string>
 
</syntaxhighlight>
 
If three toasts would be executed on a widget <code>customerName</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast3">${widgetName}</string>
 
</syntaxhighlight>
 
==Yes/No choice dialog example==
 
Example of action which contains multiple text resources
 
<syntaxhighlight lang="xml" enclose="div">
 
[gn:act_showYesNoDialog]|[@string/title,@string/message,@string/yesText,@string/noText]
 
</syntaxhighlight>
 
in this case of this action contains multiple strings and <code>ActionSpecificId</code> is required.
 
 
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and action that is used is <code>[[gn:act_showYesNoDialog]]</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameShowYesNoDialogTitle">dialog title text</string>
 
<string name="pageOne_customerNameShowYesNoDialogMessage">dialog message text</string>
 
<string name="pageOne_customerNameShowYesNoDialogYesText">dialog yes text</string>
 
<string name="pageOne_customerNameShowYesNoDialogNoText">dialog no text</string>
 
</syntaxhighlight>
 
 
 
=ListViews: display data in rows=
 
Data is displayed in rows and the format of the row recycles each time new row is shown, this means that "design" of row remains while few dynamic contents that depend on data from row, change.
 
 
 
Labels should have the resource id formed as:
 
<code>@string/${pageName}_${widgetName}${columnName}</code>
 
i.e. if <code>pageName="pageOne"<code> and <code>widgetName="customerName"<code> and name of column in listview is <code>customer</code>:
 
 
 
<code><string name="pageOne_customerNameCustomer">customer column label</string></code>
 
 
 
=<code>[[GnMediaAction]]</code> widgets: used to take pictures,video,audio,documents=
 
Consist of two widgets one is "label" which goes above <code>[[GnMediaAction]]</code> and other is <code>[[GnMediaAction]]</code> itself which is shown as icon
 
label describes widget name while <code>[[GnMediaAction]]</code> takes and stores the media.
 
 
 
Labels for <code>[[GnMediaAction]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
=Checkbox widgets: for <code>true</code> or <code>false</code> state=
 
Consist of two widgets one is "label" which goes next to <code>[[GnCheckBox]]</code> widget and other is <code>[[GnCheckBox]]</code> itself which is shown as "square" which is filled with "check" symbol (depending if checked or not checked)
 
Labels for <code>[[GnCheckBox]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
=Dropdown widgets: selection lists=
 
Consists of two widgets one is "label" which goes above <code>[[GnDropDown]]</code> widget and other is <code>[[GnDropDown]]</code> itself which is shown as selection box with text
 
 
 
Labels for <code>[[GnDropDown]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
==Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)==
 
In '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$GnDropDownZeroItem
 
@string/$GnDropDownNoData
 
</syntaxhighlight>
 
which is then used internally by GnDropdown
 
 
 
==Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only==
 
In '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$GnDropDownZeroItem
 
@string/$GnDropDownNoData
 
</syntaxhighlight>
 
On widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnDropDown
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:singleItemMode="..."
 
    gn:s_sourceType="..."
 
    gn:data_source_request="..."
 
    gn:data_source_field="..."
 
    gn:s_ZeroItemText="@string/${pageName}_${widgetName}ZeroItem"
 
    gn:msg_nodata="@string/${pageName}_${widgetName}NoData"
 
    gn:zeroItemEventEnabled="..."/>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ZeroItem">custom zero item message</string>
 
<string name="${pageName}_${widgetName}NoData">custom no data message</string>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"<code> and <code>widgetName="customerName"</code>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnDropDown
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:singleItemMode="..."
 
    gn:s_sourceType="..."
 
    gn:data_source_request="..."
 
    gn:data_source_field="..."
 
    gn:s_ZeroItemText="@string/pageOne_customerNameZeroItem"
 
    gn:msg_nodata="@string/pageOne_customerNameNoData"
 
    gn:zeroItemEventEnabled="..."/>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameZeroItem">custom zero item message</string>
 
<string name="pageOne_customerNameNoData">custom no data message</string>
 
</syntaxhighlight>
 
=<code>[[GnRadioGroup]]</code> widgets: multiple choice, single selection=
 
<code>[[GnRadioGroup]]</code> offers set of predefined choices where user can choose only single option (or none depending on business logic).
 
Consists of two widgets one is "label" which goes above <code>[[GnRadioGroup]]</code> widget and other is <code>[[GnRadioGroup]]</code> itself which is shown as group of X <code>[[GnRadioButton|GnRadioButtons]]</code>
 
 
 
Labels for <code>[[GnRadioGroup]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
<code>[[GnRadioGroup]]</code> radio buttons should have the resourceID formed as:
 
 
 
<code>@string/${pageName}_${widgetName}${radioButtonName}</code>
 
 
 
On widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnRadioGroup
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:dataType="..."
 
    android:orientation="...">
 
 
 
    <com.ginstr.widgets.GnRadioButton
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        android:text="@string/${pageName}_${widgetName}${radioButtonName}"/>
 
</com.ginstr.widgets.GnRadioGroup>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="textColor"</code> and <code>radioButtonName="red"</code>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnRadioGroup
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:dataType="..."
 
    android:orientation="...">
 
 
 
    <com.ginstr.widgets.GnRadioButton
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        android:text="@string/pageOne_textColorRed"/>
 
</com.ginstr.widgets.GnRadioGroup>
 
</syntaxhighlight>
 
In [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_textColorRed">red</string>
 
</syntaxhighlight>
 

Revision as of 12:23, 18 May 2020

Contents

Launcher error codes

This document describes ginstr launcher error codes.

Definitions

${pageName}
defined by android:id attribute of the root screen element, NOT by fileName of file which contains widgets
${widgetName}
defined by ginstr app developer or in case of app-composer auto generated

It is strictly forbidden to use one resource in two different places of an app. In this case 2 different resources must be implemented.

       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_INVALID_USERNAME, 1001);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_DISABLED_USER, 1003);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_IO_EXCEPTION, 1004);
       msgBoxCodes.put(AgConstants.MSG_BOX_SERIAL_IMEI_MISSING, 1005);
       msgBoxCodes.put(AgConstants.MSG_BOX_REPLICATION_PUSH_DISABLED, 1006);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_PASSWORD_EXPIRED, 1007);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_AT_LEAST_ONE_LOGIN, 1008);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_GINSTR_SERVERS_UNAVAILABLE, 109);
       msgBoxCodes.put(AgConstants.MSG_BOX_MISSING_ROLE, 1010);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_NO_RESPONSE_SERVER, 1011);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_BAD_USER, 1012);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_BAD_USER_SSO, 1013);
       msgBoxCodes.put(AgConstants.MSG_BOX_LOGIN_NOTACTIVATED_USER, 1015);
       msgBoxCodes.put(AgConstants.MSG_BOX_APP_NOT_ENABLED_FOR_USER,1016);