From wiki.ginstr.com
Jump to: navigation, search
m (formatting)
Line 3: Line 3:
 
[[Category:Action_Library]]
 
[[Category:Action_Library]]
  
;Description: Action is used to update a listener thath is attached to ginstr launcher service, listeners can be widgets or variables (targets). When listener attached to a service is updated it copies all "individual" service parameters configuration from service see more details in [[gn:act_service]] serviceParameters to see which parameters are individual. Global parameters are not copied to the service listener.
+
;Description: Action is used to update a listener that is attached to [[ginstr launcher]] service, listeners can be widgets or variables ([[target|targets]]).
 +
:When listener attached to a service is updated it copies all "individual" service parameters configuration from service see more details in <code>[[gn:act_service]]</code> serviceParameters to see which parameters are individual.
 +
:Global parameters are not copied to the service listener.
 
;Action returns: void
 
;Action returns: void
 
==Action signatures==
 
==Action signatures==
Line 25: Line 27:
  
 
====Example====
 
====Example====
On before load service is started and default <code>sourceType</code> is "tagId" configuration is initialized, listener is attached. After that service configuration is changed to <code>sourceType</code> "embedded". Because "embedded" is individual service parameter we need to update the listener(in this case widget) that it copies and uses the new service configuration.
+
:On before load service is started and default <code>sourceType</code> is "tagId" configuration is initialized, listener is attached. After that service configuration is changed to <code>sourceType</code> "embedded".
 +
:Because "embedded" is individual service parameter we need to update the listener(in this case widget) that it copies and uses the new service configuration.
  
 
=====hardware nfc data=====
 
=====hardware nfc data=====
id: <code>04C357BA482780</code><br>
+
::<code>04C357BA482780</code> - id
embedded: <code>test</code>
+
::<code>test</code> - embedded
  
 
=====initial contents=====
 
=====initial contents=====
@+id/screen_nfc_input widget
+
::<code>@+id/screen_nfc_input widget</code> <code></code>
<code></code>
 
  
 
=====screen.xml=====
 
=====screen.xml=====
Line 53: Line 55:
  
 
=====after nfc scan contents=====
 
=====after nfc scan contents=====
@+id/screen_nfc_input widget
+
::<code>@+id/screen_nfc_input widget</code> <code>test</code>
<code>test</code>
 
 
<hr>
 
<hr>

Revision as of 17:24, 24 January 2018

added in Milestone 100

gn:act_updateServiceListener

Description
Action is used to update a listener that is attached to ginstr launcher service, listeners can be widgets or variables (targets).
When listener attached to a service is updated it copies all "individual" service parameters configuration from service see more details in gn:act_service serviceParameters to see which parameters are individual.
Global parameters are not copied to the service listener.
Action returns
void

Action signatures

[gn:act_addServiceListener]|[serviceId;target{n}]
Parameter Description
serviceId Name of the service which will be used
  • Valid services:
    • nfc, nfc service
    • gps, gps service
target{n} target id's of the widgets which were already added as listeners to the service via gn:act_addServiceListener action

Example

On before load service is started and default sourceType is "tagId" configuration is initialized, listener is attached. After that service configuration is changed to sourceType "embedded".
Because "embedded" is individual service parameter we need to update the listener(in this case widget) that it copies and uses the new service configuration.
hardware nfc data
04C357BA482780 - id
test - embedded
initial contents
@+id/screen_nfc_input widget
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_beforeLoad="[gn:act_service]|[nfc;start],[gn:act_addServiceListener]|[nfc;@+id/screen_nfc_input],[gn:act_service]|[nfc;sourceType,embedded],[gn:act_updateServiceListener]|[nfc;@+id/screen_nfc_input]" />

 <com.ginstr.widgets.GnEditText
    android:id="@+id/screen_nfc_input"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    gn:dataType="text"
    gn:s_sourceType="input"/>
after nfc scan contents
@+id/screen_nfc_input widget test