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"><code>gn:act_calculateDrivingDistance</code></span> Category:Action_...")
 
Line 3: Line 3:
 
[[Category:Action_Library]]
 
[[Category:Action_Library]]
  
;Description: Action is used to get ginstr user data and store it into [[target]]
+
;Description: Action is used to calculate driving distance between two GPS coordinates and store the result into target
 
;Action returns: void
 
;Action returns: void
 
==Action signatures==
 
==Action signatures==
  
===Gets ginstr user data===
+
===Calculate driving distance===
  
:;<code>[gn:act_getUserData]|[target,keyword]</code>
+
:;<code>[gn:act_calculateDrivingDistance]|[target,source1,source2]</code>
  
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
Line 17: Line 17:
 
|-
 
|-
 
| <code>[[target]]</code>
 
| <code>[[target]]</code>
| [[target]] into which user data will be stored
+
| [[target]] into which calculated driving distance will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
:*<code>[[Datatypes#text|text]]</code>
+
:*<code>[[Datatypes#number|number]]</code>
 
|-
 
|-
| <code>keyword</code>
+
| <code>[[source|source1]]</code>
| defines which type of ginstr user information we will retrieve
+
| [[target]] into which calculated driving distance will be stored
Can be:
+
* Valid [[source|sources]]:
* <code>dateFormat</code> - gets date format set for ginstr user in [[setup_ginstr_web#General_Settings|ginstr web settings]], returned formats [https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html formats]
+
:*<code>[[Datatypes#gps|gps]]</code>
* <code>timeFormat</code> - gets time format set for ginstr user in [[setup_ginstr_web#General_Settings|ginstr web settings]], returned formats [https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html formats]
+
|-
* <code>dateTimeFormat</code> - gets dateTime format set for ginstr user in [[setup_ginstr_web#General_Settings|ginstr web settings]], returned formats [https://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html formats]
+
| <code>[[source|source2]]</code>
* <code>userName</code> - gets userName of ginstr user
+
| [[target]] into which calculated driving distance will be stored
 +
* Valid [[source|sources]]:
 +
:*<code>[[Datatypes#gps|gps]]</code>
 
|-
 
|-
 
|}
 
|}
Line 33: Line 35:
 
====Example====
 
====Example====
  
=====screen.xml=====
+
[gn:act_calculateDrivingDistance]|[@+id/deviceKm,@+id/gpsInput,@+id/deviceGps;@+id/onDistanceReceive,gn:act_set]
<syntaxhighlight lang="xml">
 
<FrameLayout
 
    android:id="@+id/exampleFrame"
 
    android:layout_width="wrap_content"
 
    android:layout_height="wrap_content"
 
    android:visibility="gone"
 
    gn:act_set="[gn:act_getUserData]|[@+id/testWidget,dateFormat]" />
 
 
 
<com.ginstr.widgets.GnTextView
 
    android:id="@+id/testWidget"
 
    android:layout_width="wrap_content"
 
    android:layout_height="wrap_content"/>
 
</syntaxhighlight>
 
 
 
 
<hr>
 
<hr>
 
=====after action execution=====
 
value in <code>testWidget</code>: <code>dd MMM yyyy</code> (depends on setting in [[ginstr web]])
 

Revision as of 17:17, 20 July 2017

gn:act_calculateDrivingDistance

Description
Action is used to calculate driving distance between two GPS coordinates and store the result into target
Action returns
void

Action signatures

Calculate driving distance

[gn:act_calculateDrivingDistance]|[target,source1,source2]
Parameter Description
target target into which calculated driving distance will be stored
source1 target into which calculated driving distance will be stored
source2 target into which calculated driving distance will be stored

Example

[gn:act_calculateDrivingDistance]|[@+id/deviceKm,@+id/gpsInput,@+id/deviceGps;@+id/onDistanceReceive,gn:act_set]