-
-
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
1 parent
6e69c90
commit 73fa558
Showing
2 changed files
with
84 additions
and
39 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
name: Titanium.UI.Shortcut | ||
summary: Manage application shortcuts. | ||
description: | | ||
Allows the creation of application shortcuts, which can be detected using | ||
the `shortcutitemclick` event from <Titanium.App>. | ||
Use the <Titanium.UI.createShortcut> method to manage shortcut creation. | ||
extends: Titanium.Proxy | ||
since: "9.1.0" | ||
platforms: [android] | ||
osver: {android: {min: "7.1"}} | ||
|
||
properties: | ||
- name: items | ||
summary: List current shortcuts. | ||
type: Array<ShortcutItem> | ||
|
||
- name: staticItems | ||
summary: List current pinned/static shortcuts. | ||
type: Array<ShortcutItem> | ||
|
||
methods: | ||
- name: add | ||
summary: Add shortcut to application. | ||
|
||
- name: remove | ||
summary: Remove shortcut from application. | ||
|
||
- name: removeAll | ||
summary: Remove all shortcuts from application. | ||
|
||
examples: | ||
- title: Simple Shortcut Example | ||
example: | | ||
Create a shortcut item and detect its click with the `shortcutitemclick` event. | ||
const win = Ti.UI.createWindow({ backgroundColor: 'grey' }), | ||
const btn = Ti.UI.createButton({ title: 'ADD SHORTCUT' }), | ||
const shortcut = Ti.UI.createShortcut(); | ||
const shortcutItem = Ti.UI.createShortcutItem({ | ||
id: 'test_shortcut', | ||
title: 'TEST', | ||
description: 'DESCRIPTION' | ||
}); | ||
Ti.App.addEventListener('shortcutitemclick', () => { | ||
// Set background to 'blue' on shortcut click event. | ||
win.backgroundColor = 'blue'; | ||
}); | ||
btn.addEventListener('click', () => { | ||
// Add shortcut. | ||
shortcut.add(shortcutItem); | ||
}); | ||
win.add(btn); | ||
win.open(); |
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