Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update Ti.Android.R and Ti.App.Android.R docs #11492

Merged
merged 4 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apidoc/Titanium/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ properties:

- name: R
summary: Accessor for Android system resources.
type: Titanium.Android.R
type: RProxy
janvennemann marked this conversation as resolved.
Show resolved Hide resolved
permission: read-only
accessors: false

Expand Down
21 changes: 20 additions & 1 deletion apidoc/Titanium/App/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,26 @@ 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
integer id, as follows.
janvennemann marked this conversation as resolved.
Show resolved Hide resolved

var resid = Titanium.App.Android.R.drawable.icon;

To access system-wide resources, rather than application resources, use <Titanium.Android.R>
instead.

Starting in Titanium SDK 7.3.0, this API exposes all Android related R classes
janvennemann marked this conversation as resolved.
Show resolved Hide resolved
for the usage in Hyperloop. For example, it can be used to access `menu` resources
as part of native user interfaces, e.g. `BottomNavigationView` or `RecyclerView`.
See an example in the [Hyperloop Sample App](https://github.com/appcelerator/hyperloop-examples) for details!
type: RProxy
permission: read-only

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

This file was deleted.

21 changes: 16 additions & 5 deletions apidoc/Titanium/Android/R.yml → apidoc/common/RProxy.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
---
name: Titanium.Android.R
summary: The Titanium binding of the Android system-wide resources class.
name: RProxy
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);

If the file `platform/android/res/drawable/icon.png` exists in the project, it can be accessed
using its integer id, as follows:
drauggres marked this conversation as resolved.
Show resolved Hide resolved

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