Skip to content

Commit 86f96bf

Browse files
committed
Merge pull request kivy#183 from blagarde/python_api_doc_update
FIX: Typos and style details
2 parents c87a33c + 3f0f2c9 commit 86f96bf

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

docs/source/android.rst

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
Python API
22
==========
33

4-
Python for android project include a "android" python module. The module is
5-
composed of multiple part, mostly done for a easier usage of Java API. The
6-
module is not designed to wrap anything you want.
4+
The Python for android project includes a Python module called "android". It
5+
consists of multiple parts which are mostly there to facilitate the use of the Java API.
76

8-
Most of the Java API is accessible with PyJNIus, and then. prefer to see if you
9-
can use Java API directly first.
7+
This module is not designed to be comprehensive. Most of the Java API is also accessible with PyJNIus,
8+
so if you can't find what you need here you can try using the Java API directly instead.
109

1110

1211
Android (``android``)
@@ -17,18 +16,18 @@ Android (``android``)
1716
.. function:: check_pause()
1817

1918
This should be called on a regular basis to check to see if Android
20-
expects the game to pause. If it return true, the game should call
21-
:func:`android.wait_for_resume()`, after persisting its state as necessary.
19+
expects the application to pause. If it returns true, the app should call
20+
:func:`android.wait_for_resume()`, after storing its state as necessary.
2221

2322
.. function:: wait_for_resume()
2423

25-
This function should be called after :func:`android.check_pause()` returns
24+
This function should be called after :func:`android.check_pause()` and returns
2625
true. It does not return until Android has resumed from the pause. While in
27-
this function, Android may kill a game without further notice.
26+
this function, Android may kill the app without further notice.
2827

2928
.. function:: map_key(keycode, keysym)
3029

31-
This maps between an android keycode and a python keysym. The android
30+
This maps an android keycode to a python keysym. The android
3231
keycodes are available as constants in the android module.
3332

3433

@@ -37,7 +36,7 @@ Activity (``android.activity``)
3736

3837
.. module:: android.activity
3938

40-
The default PythonActivity have a observer pattern for `onActivityResult <http://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)>`_ and `onNewIntent <http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)>`_.
39+
The default PythonActivity has a observer pattern for `onActivityResult <http://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)>`_ and `onNewIntent <http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)>`_.
4140

4241
.. function:: bind(eventname=callback, ...)
4342

@@ -51,8 +50,7 @@ The default PythonActivity have a observer pattern for `onActivityResult <http:/
5150

5251
Example::
5352

54-
# this example is a snippet from an NFC p2p app, and are located into a
55-
# kivy App class implementation
53+
# This example is a snippet from an NFC p2p app implemented with Kivy.
5654

5755
from android import activity
5856

@@ -81,9 +79,9 @@ Billing (``android.billing``)
8179

8280
.. module:: android.billing
8381

84-
This billing module give an access to the `In-App Billing <http://developer.android.com/guide/google/play/billing/billing_overview.html>`_:
82+
This billing module gives an access to the `In-App Billing <http://developer.android.com/guide/google/play/billing/billing_overview.html>`_:
8583

86-
#. `Setup a test accounts <http://developer.android.com/guide/google/play/billing/billing_admin.html#billing-testing-setup>`_, and get your Public Key
84+
#. `Setup a test account <http://developer.android.com/guide/google/play/billing/billing_admin.html#billing-testing-setup>`_, and get your Public Key
8785
#. Export your public key::
8886

8987
export BILLING_PUBKEY="Your public key here"
@@ -104,18 +102,18 @@ This billing module give an access to the `In-App Billing <http://developer.andr
104102
# Start the billing service, and attach our callback
105103
self.service = BillingService(billing_callback)
106104

107-
# Start a clock to check billing service message every seconds
105+
# Start a clock to check billing service message every second
108106
Clock.schedule_interval(self.service.check, 1)
109107

110108
def billing_callback(self, action, *largs):
111-
'''Callback that will receive all the event from the Billing service
109+
'''Callback that will receive all the events from the Billing service
112110
'''
113111
if action == BillingService.BILLING_ACTION_ITEMSCHANGED:
114112
items = largs[0]
115113
if 'org.kivy.gopremium' in items:
116-
print 'Congratulation, you have a premium acess'
114+
print "Congratulations, you have a premium acess"
117115
else:
118-
print 'Unfortunately, you dont have premium access'
116+
print "Unfortunately, you don't have premium access"
119117

120118
def buy(self, sku):
121119
# Method to buy something.
@@ -125,7 +123,7 @@ This billing module give an access to the `In-App Billing <http://developer.andr
125123
# Return all the items purchased
126124
return self.service.get_purchased_items()
127125

128-
#. To initiate a in-app purchase, just call the buy method::
126+
#. To initiate an in-app purchase, just call the buy() method::
129127

130128
# Note: start the service at the start, and never twice!
131129
bs = MyBillingService()
@@ -136,7 +134,7 @@ This billing module give an access to the `In-App Billing <http://developer.andr
136134
print bs.get_purchased_items()
137135
{'org.kivy.gopremium': {'qt: 1}}
138136

139-
#. You'll receive all the notification about the billing process in the callback.
137+
#. You'll receive all the notifications about the billing process in the callback.
140138

141139
#. Last step, create your application with `--with-billing $BILLING_PUBKEY`::
142140

@@ -157,8 +155,8 @@ or categories filters.
157155

158156
.. warning::
159157

160-
The callback will be called in another thread than the main thread. Be
161-
careful to not access to OpenGL or something like that.
158+
The callback will be called in another thread than the main thread. In
159+
that thread, be careful not to access OpenGL or something like that.
162160

163161
.. method:: __init__(callback, actions=None, categories=None)
164162

@@ -200,7 +198,7 @@ Example::
200198
else:
201199
print 'The headset is unplugged'
202200

203-
# don't forget to stop and restart the receiver when the app is going
201+
# Don't forget to stop and restart the receiver when the app is going
204202
# to pause / resume mode
205203

206204
def on_pause(self):
@@ -225,26 +223,26 @@ intended to be imported as an alternative to pygame.mixer, using code like: ::
225223
except ImportError:
226224
import android.mixer as mixer
227225

228-
Note that if you're using `kivy.core.audio
226+
Note that if you're using the `kivy.core.audio
229227
<http://kivy.org/docs/api-kivy.core.audio.html>`_ module, you don't have to do
230-
anything, all is automatic.
228+
anything, it is all automatic.
231229

232230
The `android.mixer` module is a wrapper around the Android MediaPlayer
233231
class. This allows it to take advantage of any hardware acceleration
234232
present, and also eliminates the need to ship codecs as part of an
235233
application.
236234

237-
It has several differences from the pygame mixer:
235+
It has several differences with the pygame mixer:
238236

239-
* The init and pre_init methods work, but are ignored - Android chooses
240-
appropriate setting automatically.
237+
* The init() and pre_init() methods work, but are ignored - Android chooses
238+
appropriate settings automatically.
241239

242240
* Only filenames and true file objects can be used - file-like objects
243241
will probably not work.
244242

245243
* Fadeout does not work - it causes a stop to occur.
246244

247-
* Looping is all or nothing, there's no way to choose the number of
245+
* Looping is all or nothing, there is no way to choose the number of
248246
loops that occur. For looping to work, the
249247
:func:`android.mixer.periodic` function should be called on a
250248
regular basis.
@@ -304,13 +302,13 @@ This can be used to prevent errors like:
304302
Service (``android.service``)
305303
-----------------------------
306304

307-
Service part of the application is controlled through the class :class:`AndroidService`.
305+
Services of an application are controlled through the class :class:`AndroidService`.
308306

309307
.. module:: android.service
310308

311309
.. class:: AndroidService(title, description)
312310

313-
Run ``service/main.py`` from application directory as a service.
311+
Run ``service/main.py`` from the application directory as a service.
314312

315313
:param title: Notification title, default to 'Python service'
316314
:param description: Notification text, default to 'Kivy Python service started'
@@ -321,8 +319,8 @@ Service part of the application is controlled through the class :class:`AndroidS
321319

322320
Start the service.
323321

324-
:param arg: Argument to pass to a service, through environment variable
325-
``PYTHON_SERVICE_ARGUMENT``, default to ''
322+
:param arg: Argument to pass to a service, through the environment variable
323+
``PYTHON_SERVICE_ARGUMENT``. Defaults to ''
326324
:type arg: str
327325

328326
.. method:: stop()
@@ -359,7 +357,7 @@ Application service part example, ``service/main.py``:
359357
arg = os.getenv('PYTHON_SERVICE_ARGUMENT')
360358
361359
while True:
362-
# this will print 'Hello From Service' continually, even when application is switched
360+
# this will print 'Hello From Service' continually, even when the application is switched
363361
print arg
364362
time.sleep(1)
365363

0 commit comments

Comments
 (0)