Skip to content

Commit bff00da

Browse files
committed
Add androidhelper APIs structure
1 parent 9322bc0 commit bff00da

File tree

11 files changed

+836
-322
lines changed

11 files changed

+836
-322
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
.. image:: ../_static/sl4a.jpg
2+
3+
AndroidFacade
4+
===============
5+
6+
ApplicationManagerFacade
7+
=========================
8+
9+
CameraFacade
10+
=========================
11+
12+
CommonIntentsFacade
13+
=========================
14+
15+
ContactsFacade
16+
=========================
17+
18+
EventFacade
19+
=========================
20+
21+
LocationFacade
22+
=========================
23+
24+
PhoneFacade
25+
=========================
26+
27+
MediaRecorderFacade
28+
=========================
29+
30+
SensorManagerFacade
31+
=========================
32+
33+
SettingsFacade
34+
=========================
35+
36+
SmsFacade
37+
=========================
38+
39+
SpeechRecognitionFacade
40+
=========================
41+
42+
ToneGeneratorFacade
43+
=========================
44+
45+
WakeLockFacade
46+
=========================
47+
48+
WifiFacade
49+
=========================
50+
51+
52+
BatteryManagerFacade
53+
=========================
54+
55+
ActivityResultFacade
56+
=========================
57+
58+
MediaPlayerFacade
59+
=========================
60+
61+
PreferencesFacade
62+
=========================
63+
64+
QPyInterfaceFacade
65+
=========================
66+
67+
Execute a qpython script
68+
------------------------------
69+
70+
.. py:function:: AndroidHelper.executeQPy(script)
71+
72+
Execute a qpython script by absolute path
73+
74+
:param str script: The absolute path of the qpython script
75+
:return: boolean
76+
77+
78+
TextToSpeechFacade
79+
=========================
80+
81+
EyesFreeFacade
82+
=========================
83+
84+
BluetoothFacade
85+
=========================
86+
87+
SignalStrengthFacade
88+
=========================
89+
90+
WebCamFacade
91+
=========================
92+
93+
UiFacade
94+
=========================
95+
96+
97+
NFC APIs
98+
------------
99+
100+
**QPython NFC json result**
101+
::
102+
103+
{
104+
"role": <role>, # could be self/master/slave
105+
"stat": <stat>, # could be ok / fail / cancl
106+
"message": <message get>
107+
}
108+
109+
110+
NFC APIs
111+
------------
112+
NFC Message Beam APIs
113+
114+
.. py:function:: AndroidHelper.dialogCreateNFCBeamMaster()
115+
116+
Create a dialog which can send the message to NFC Beam Slave
117+
118+
:return: QPython NFC json result
119+
120+
.. py:function:: AndroidHelper.NFCBeamMessage(message)
121+
122+
Sendthe message to NFC Beam Slave without dialog
123+
124+
:return: QPython NFC json result
125+
126+
127+
.. py:function:: AndroidHelper.dialogCreateNFCBeamSlave()
128+
129+
Create a NFC Beam Slave to wait for the master's beam message
130+
131+
:return: QPython NFC json result
132+
133+
134+
Location API
135+
------------
136+
137+
.. py:function:: androidhelper.getLastKnownLocation
138+
139+
140+
::
141+
142+
Droid = androidhelper.Android()
143+
location = Droid.getLastKnownLocation().result
144+
location = location.get('network', location.get('gps'))
145+
146+
Sensor API
147+
------------
148+
149+
.. py:function:: androidhelper.sensorsReadOrientation()
150+
151+
::
152+
153+
Droid = androidhelper.Android()
154+
Droid.startSensingTimed(1, 250)
155+
sensor = Droid.sensorsReadOrientation().result
156+
Droid.stopSensing()
157+
158+
159+
Other SL4A APIs
160+
----------------
161+
162+
.. py:function:: AndroidHelper.dialogCreateSpinnerProgress(title,message,maximum progress)
163+
164+
Create a spinner progress dialog
165+
166+
.. py:function:: AndroidHelper.webViewShow(url,wait)
167+
168+
Display a WebView with the given URL.
169+
170+
:param str url: URL
171+
:param boolean wait(Optional): block until the user exits the WebView

docs/_sources/en/guide_libraries.txt

Lines changed: 4 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ QPython built-in Libraries
33
QPython is using the Python 2.7.2 and it support most Python stardard libraries. And you could see their documentation through Python documentation.
44

55
QPython dynload libraries (python built-in .so libraries)
6-
----------------------------------------------
6+
--------------------------------------------------------------
77
Usually, you don't need to import them manually, they were used in stardard libraries, and could be imported automatically.
88

99
* _codecs_cn.so
@@ -279,96 +279,12 @@ Python 3rd Libraries
279279

280280
Androidhelper APIs
281281
========================
282-
283-
.. image:: ../_static/sl4a.jpg
284-
285282
To simplify QPython SL4A development in IDEs with a
286283
"hepler" class derived from the default Android class containing
287284
SL4A facade functions & API documentation
288285

289286

290-
Structure
291-
------------
292-
293-
294-
QPython NFC json result
295-
::
296-
297-
{
298-
"role": <role>, # could be self/master/slave
299-
"stat": <stat>, # could be ok / fail / cancl
300-
"message": <message get>
301-
}
302-
303-
QPy APIs
304-
----------
305-
306-
.. py:function:: AndroidHelper.executeQPy(script)
307-
308-
Execute a qpython script by absolute path
309-
310-
:param str script: The absolute path of the qpython script
311-
:return: boolean
312-
313-
314-
NFC APIs
315-
------------
316-
NFC Message Beam APIs
317-
318-
.. py:function:: AndroidHelper.dialogCreateNFCBeamMaster()
319-
320-
Create a dialog which can send the message to NFC Beam Slave
321-
322-
:return: QPython NFC json result
323-
324-
.. py:function:: AndroidHelper.NFCBeamMessage(message)
325-
326-
Sendthe message to NFC Beam Slave without dialog
327-
328-
:return: QPython NFC json result
329-
330-
331-
.. py:function:: AndroidHelper.dialogCreateNFCBeamSlave()
332-
333-
Create a NFC Beam Slave to wait for the master's beam message
334-
335-
:return: QPython NFC json result
336-
337-
338-
Location API
339-
------------
340-
341-
.. py:function:: androidhelper.getLastKnownLocation
342-
343-
344-
::
345-
346-
Droid = androidhelper.Android()
347-
location = Droid.getLastKnownLocation().result
348-
location = location.get('network', location.get('gps'))
349-
350-
Sensor API
351-
------------
352-
353-
.. py:function:: androidhelper.sensorsReadOrientation()
354-
355-
::
356-
357-
Droid = androidhelper.Android()
358-
Droid.startSensingTimed(1, 250)
359-
sensor = Droid.sensorsReadOrientation().result
360-
Droid.stopSensing()
361-
362-
Other SL4A APIs
363-
----------------
364-
365-
.. py:function:: AndroidHelper.dialogCreateSpinnerProgress(title,message,maximum progress)
366-
367-
Create a spinner progress dialog
368-
369-
.. py:function:: AndroidHelper.webViewShow(url,wait)
370-
371-
Display a WebView with the given URL.
287+
.. toctree::
288+
:maxdepth: 2
372289

373-
:param str url: URL
374-
:param boolean wait(Optional): block until the user exits the WebView
290+
guide_androidhelpers

docs/en/guide.html

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,33 @@ <h1>Programming Guide<a class="headerlink" href="#programming-guide" title="Perm
121121
</li>
122122
<li class="toctree-l1"><a class="reference internal" href="guide_libraries.html#python-3rd-libraries">Python 3rd Libraries</a></li>
123123
<li class="toctree-l1"><a class="reference internal" href="guide_libraries.html#androidhelper-apis">Androidhelper APIs</a><ul>
124-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#structure">Structure</a></li>
125-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#qpy-apis">QPy APIs</a></li>
126-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#nfc-apis">NFC APIs</a></li>
127-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#location-api">Location API</a></li>
128-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#sensor-api">Sensor API</a></li>
129-
<li class="toctree-l2"><a class="reference internal" href="guide_libraries.html#other-sl4a-apis">Other SL4A APIs</a></li>
124+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html">AndroidFacade</a></li>
125+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#applicationmanagerfacade">ApplicationManagerFacade</a></li>
126+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#camerafacade">CameraFacade</a></li>
127+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#commonintentsfacade">CommonIntentsFacade</a></li>
128+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#contactsfacade">ContactsFacade</a></li>
129+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#eventfacade">EventFacade</a></li>
130+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#locationfacade">LocationFacade</a></li>
131+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#phonefacade">PhoneFacade</a></li>
132+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#mediarecorderfacade">MediaRecorderFacade</a></li>
133+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#sensormanagerfacade">SensorManagerFacade</a></li>
134+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#settingsfacade">SettingsFacade</a></li>
135+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#smsfacade">SmsFacade</a></li>
136+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#speechrecognitionfacade">SpeechRecognitionFacade</a></li>
137+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#tonegeneratorfacade">ToneGeneratorFacade</a></li>
138+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#wakelockfacade">WakeLockFacade</a></li>
139+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#wififacade">WifiFacade</a></li>
140+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#batterymanagerfacade">BatteryManagerFacade</a></li>
141+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#activityresultfacade">ActivityResultFacade</a></li>
142+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#mediaplayerfacade">MediaPlayerFacade</a></li>
143+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#preferencesfacade">PreferencesFacade</a></li>
144+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#qpyinterfacefacade">QPyInterfaceFacade</a></li>
145+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#texttospeechfacade">TextToSpeechFacade</a></li>
146+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#eyesfreefacade">EyesFreeFacade</a></li>
147+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#bluetoothfacade">BluetoothFacade</a></li>
148+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#signalstrengthfacade">SignalStrengthFacade</a></li>
149+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#webcamfacade">WebCamFacade</a></li>
150+
<li class="toctree-l2"><a class="reference internal" href="guide_androidhelpers.html#uifacade">UiFacade</a></li>
130151
</ul>
131152
</li>
132153
<li class="toctree-l1"><a class="reference internal" href="guide_extend.html">How to call QPython script in your application?</a><ul>

0 commit comments

Comments
 (0)