-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gary Mathews
committed
Dec 5, 2017
1 parent
956a211
commit a06c73e
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |