Skip to content

Commit

Permalink
docs: update Ti.Android.R and Ti.App.Android.R docs (#11492)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Vennemann <jan.vennemann@gmx.net>
  • Loading branch information
janvennemann authored Mar 5, 2020
1 parent 7a08810 commit 62d3f58
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
2 changes: 2 additions & 0 deletions apidoc/Titanium/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,8 @@ properties:

- name: R
summary: Accessor for Android system resources.
description: |
To access your application's resources, use <Titanium.App.Android.R>.
type: Titanium.Android.R
permission: read-only
accessors: false
Expand Down
24 changes: 19 additions & 5 deletions apidoc/Titanium/Android/R.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
---
name: Titanium.Android.R
summary: The Titanium binding of the Android system-wide resources class.
summary: |
The Titanium binding of the native Android `R` class, giving access to
Android system-wide resources or application resources.
description: |
To access system-wide resources your application's resources, use
<Titanium.Android.R>.
To access your application's resources, use <Titanium.App.Android.R>.
These properties and sub-properties correspond directly to the properties of the the `android.R`
class, and should have the same syntax. For example, to retrieve the "OK" string in Android:
These properties and sub-properties correspond directly to the properties
of the the `android.R` class, and should have the same syntax.
To retrieve the "OK" string from system resources in Android:
Ti.Android.currentActivity.getString(Ti.Android.R.string.ok);
See also: [android.R](https://developer.android.com/reference/android/R.html) in the
If the file `platform/android/res/drawable/icon.png` exists in the
project, it can be accessed using its resource name, as follows:
var resid = Titanium.App.Android.R.drawable.icon;
See also:
[android.R](https://developer.android.com/reference/android/R.html) in the
Android Developer Reference.
For more information, refer to the official documentation on the Android
Developer website about
[accessing application resources](https://developer.android.com/guide/topics/resources/accessing-resources.html).
Starting in Titanium SDK 7.3.0, this API exposes all Android related R classes
for the usage in Hyperloop. For example, it can be used to access `menu` resources
Expand Down
17 changes: 16 additions & 1 deletion apidoc/Titanium/App/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,22 @@ platforms: [android]
properties:
- name: R
summary: The `R` namespace for application resources.
type: Titanium.App.Android.R
description: |
The properties and sub-properties of this object relate directly to the
native application resources `R` class, and thus have the same syntax.
For more information, refer to the official documentation on the
Android Developer website about
[accessing application resources](https://developer.android.com/guide/topics/resources/accessing-resources.html).
For example, if the file `platform/android/res/drawable/icon.png`
exists in the project, it can be accessed using its resource name,
as follows.
var resid = Titanium.App.Android.R.drawable.icon;
To access system-wide resources, rather than application resources, use
<Titanium.Android.R> instead.
type: Titanium.Android.R
permission: read-only

- name: appVersionCode
Expand Down
28 changes: 0 additions & 28 deletions apidoc/Titanium/App/Android/R.yml

This file was deleted.

0 comments on commit 62d3f58

Please sign in to comment.