From wiki.ginstr.com
Jump to: navigation, search
(Created page with "{|align=right |__TOC__ |} =Dropdown local text= Widget is represented by a label and dropdown below label. Data that is saved to database is of datatype "text". Widget id,...")
 
Line 24: Line 24:
 
=====GENERAL=====
 
=====GENERAL=====
 
* "label", [[GBAMRulesForIDGeneration#.24.7BwidgetLabel.7D|<code>${widgetLabel}</code>]]
 
* "label", [[GBAMRulesForIDGeneration#.24.7BwidgetLabel.7D|<code>${widgetLabel}</code>]]
 +
* "no selection text", if $defaultApp resource ${$dropDownZeroItem}, if we override then it has to be formed  ${@string/${widgetID}ZeroItem} - text which appears when dropdown is initially loaded and nothing is selected in it
  
 
=====VALIDATIONS=====
 
=====VALIDATIONS=====
Line 33: Line 34:
  
 
======ACTION MESSAGES======
 
======ACTION MESSAGES======
* -
+
* "no data", if $defaultApp resource ${$dropDownNoData}, if we override then it has to be formed {@string/${widgetID}NoData} - message which appears when user clicks on dropdown and no data is loaded into dropdown
  
 
== Code snippets ==
 
== Code snippets ==
Line 56: Line 57:
 
android:layout_width="match_parent"
 
android:layout_width="match_parent"
 
android:layout_height="wrap_content"
 
android:layout_height="wrap_content"
gn:s_ZeroItemText="@string/${widgetID}ZeroItem"
+
gn:s_ZeroItemText="@string/$dropDownZeroItem"
gn:msg_nodata="@string/${widgetID}NoData"  
+
gn:msg_nodata="@string/$dropDownNoData"  
 
gn:s_sourceType="local"
 
gn:s_sourceType="local"
 
gn:data_source_key_local="@array/${widgetID}"
 
gn:data_source_key_local="@array/${widgetID}"

Revision as of 12:44, 15 November 2016

Dropdown local text

Widget is represented by a label and dropdown below label. Data that is saved to database is of datatype "text".

Widget id, ${gbamID}:

dropdownLocalText

Back to GBAM widgets table

Predefined user data

PreLoaded

Properties panel

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

GENERAL
  • "label", ${widgetLabel}
  • "no selection text", if $defaultApp resource ${$dropDownZeroItem}, if we override then it has to be formed ${@string/${widgetID}ZeroItem} - text which appears when dropdown is initially loaded and nothing is selected in it
VALIDATIONS
ACTION
  • "dropdown items", ${dropdownItemsList} = ${<item>${dropdownListItem}</item>} - repeats to how many dropdown items were entered by user
  • ${dropdownListItem} - single "dropdown items" item entered by user
ACTION MESSAGES
  • "no data", if $defaultApp resource ${$dropDownNoData}, if we override then it has to be formed {@string/${widgetID}NoData} - message which appears when user clicks on dropdown and no data is loaded into dropdown

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="match_parent"
	android:layout_height="wrap_content"
	android:text="@string/${widgetID}"
	gn:style="@style/dropdownLocalText_label" />

<com.ginstr.widgets.GnDropDown
	android:id="@+id/${widgetID}_input"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	gn:s_ZeroItemText="@string/$dropDownZeroItem"
	gn:msg_nodata="@string/$dropDownNoData" 
	gn:s_sourceType="local"
	gn:data_source_key_local="@array/${widgetID}"
	gn:act_afterLoad="[gn:act_fill_dropdown]|[@+id/${widgetID}_input]"
	gn:style="@style/dropdownLocalText_input"/>

strings.xml

Lines to be added for each language.

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


arrays.xml

<?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="${widgetID}"> ${dropdownItemsList} </string-array> </resources>