Skip to content

Commit

Permalink
[TIMOB-25048] Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Dec 5, 2017
1 parent 956a211 commit a06c73e
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.proxy.IntentProxy;
import org.appcelerator.titanium.util.TiUIHelper;

import android.content.Context;
Expand Down
9 changes: 9 additions & 0 deletions apidoc/Titanium/App/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ properties:
permission: read-only
since: 3.3.0

events:
- name: shortcutitemclick
summary: Fired when a <Titanium.UI.ShortcutItem> is clicked.
properties:
- name: id
summary: Identifier of the clicked shortcut item.
type: String
since: 7.1.0

examples:
- title: Custom String Resource
example: |
Expand Down
77 changes: 77 additions & 0 deletions apidoc/Titanium/UI/ShortcutItem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Titanium.UI.ShortcutItem
summary: An application shortcut.
description: |
Allows the creation of application shortcuts, which can be detected using
the `shortcutitemclick` event from <Titanium.App>.
Use the <Titanium.UI.createShortcutItem> method to create a shortcut.
extends: Titanium.Proxy
since: "7.1.0"
methods:

- name: show
description: Allow the shortcut to show.
platforms: [android, iphone, ipad]

- name: hide
description: Hide the shortcut.
platforms: [android, iphone, ipad]

properties:
- name: id
summary: Determines shortcut id.
description: This should be a unique identifier for the shortcut.
type: String
platforms: [android, iphone, ipad]
availability: creation

- name: title
description: Title of the shortcut.
type: String
platforms: [android, iphone, ipad]
availability: creation

- name: subtitle
description: Subtitle of the shortcut.
type: String
platforms: [android, iphone, ipad]
availability: creation

- name: icon
summary: Shortcut icon.
description: This can be set as a resource id or file path.
type: [String, Number]
platforms: [android, iphone, ipad]
availability: creation

examples:
- title: Simple ShortcutItem Example
example: |
Create a shortcut item and detect its click with the `shortcutitemclick` event.
var win = Ti.UI.createWindow({backgroundColor: 'grey'}),
btn = Ti.UI.createButton({title: 'TOGGLE SHORTCUT'}),
shortcut = Ti.UI.createShortcutItem({
id: 'test_shortcut',
title: 'TEST',
text: 'DESCRIPTION'
});
Ti.App.addEventListener('shortcutitemclick', function() {
win.backgroundColor = 'blue';
});
btn.addEventListener('click', function() {
if (shortcut.visible) {
win.backgroundColor = 'red';
shortcut.hide();
} else {
win.backgroundColor = 'green';
shortcut.show();
}
});
win.add(btn);
win.open();

0 comments on commit a06c73e

Please sign in to comment.