Skip to content

Commit

Permalink
Apply automatic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi authored and github-actions[bot] committed Aug 20, 2024
1 parent 122f40b commit d2fb07d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -24247,11 +24247,11 @@
"examples": [
{
"description": "Action Bar using Alloy XML Markup",
"code": "Adds action items and sets several properties on a window's action bar in the XML and TSS files.\n\n`app/views/index.xml`:\n``` xml\n<Alloy>\n <Window title=\"My Test App\">\n <ActionBar id=\"actionbar\" title=\"My XML Menu\" onHomeIconItemSelected=\"doMenuClick\" />\n <Menu>\n <MenuItem id=\"item1\" title=\"Settings\" onClick=\"openSettings\" />\n <MenuItem id=\"item2\" title=\"Search\" onClick=\"doSearch\" />\n </Menu>\n <Label id=\"label\">Welcome!</Label>\n </Window>\n</Alloy>\n```\n\n`app/styles/index.tss`:\n```\n\"MenuItem\": {\n showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\n},\n\"#item1\": {\n icon: Ti.Android.R.drawable.ic_menu_preferences\n},\n\"#item2\": {\n icon: Ti.Android.R.drawable.ic_menu_search\n},\n\"#actionbar\": {\n icon: \"/actionicon.png\",\n displayHomeAsUp: true,\n backgroundImage: \"/actionbackground.png\"\n}\n```\n"
"code": "Adds action items and sets several properties on a window's action bar in the XML and TSS files.\n\n`app/views/index.xml`:\n``` xml\n<Alloy>\n <Window title=\"My Test App\">\n <ActionBar id=\"actionbar\" title=\"My XML Menu\" onHomeIconItemSelected=\"doMenuClick\" />\n <Menu>\n <MenuItem id=\"item1\" title=\"Settings\" onClick=\"openSettings\" />\n <MenuItem id=\"item2\" title=\"Search\" onClick=\"doSearch\" />\n </Menu>\n <Label id=\"label\">Welcome!</Label>\n </Window>\n</Alloy>\n```\n\n\n`app/controllers/index.js`:\n```\nfunction doMenuClick() {}\nfunction openSettings() {}\nfunction doSearch() {}\n$.index.open();\n```\n\n`app/styles/index.tss`:\n```\n\"MenuItem\": {\n showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\n},\n\"#item1\": {\n icon: Ti.Android.R.drawable.ic_menu_preferences\n},\n\"#item2\": {\n icon: Ti.Android.R.drawable.ic_menu_search\n},\n\"#actionbar\": {\n icon: \"/actionicon.png\",\n displayHomeAsUp: true,\n backgroundImage: \"/actionbackground.png\"\n}\n```\n"
},
{
"description": "Action Bar Example",
"code": "The following example sets several properties on a window's action bar.\n\n``` js\nconst win = Ti.UI.createWindow({\n title: \"Old Title\",\n navBarHidden: false\n});\nif (OS_ANDROID) {\n win.activity.onCreate = () => {\n const actionBar = win.activity.actionBar;\n if (actionBar) {\n actionBar.backgroundImage = \"/bg.png\";\n actionBar.title = \"New Title\";\n actionBar.onHomeIconItemSelected = () => {\n Ti.API.info(\"Home icon clicked!\");\n };\n }\n };\n}\nwin.open();\n```\n\nThe above can be done for a tab group via its [activity](Titanium.UI.TabGroup.activity) property.\nNote that individual tab windows do not have an activity. Only the root tab group (which hosts the tabs)\nprovides an activity property.\n"
"code": "The following example sets several properties on a window's action bar.\n\n``` js\nconst win = Ti.UI.createWindow({\n title: \"Old Title\",\n navBarHidden: false\n});\nif (OS_ANDROID) {\n win.activity.onCreate = () => {\n const actionBar = win.activity.actionBar;\n if (actionBar) {\n actionBar.backgroundImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'bg.png').nativePath;\n actionBar.title = \"New Title\";\n actionBar.onHomeIconItemSelected = () => {\n Ti.API.info(\"Home icon clicked!\");\n };\n }\n };\n}\nwin.open();\n```\n\nThe above can be done for a tab group via its [activity](Titanium.UI.TabGroup.activity) property.\nNote that individual tab windows do not have an activity. Only the root tab group (which hosts the tabs)\nprovides an activity property.\n"
}
],
"methods": [
Expand Down
11 changes: 10 additions & 1 deletion docs/api/titanium/android/actionbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Adds action items and sets several properties on a window's action bar in the XM
</Alloy>
```


`app/controllers/index.js`:
```
function doMenuClick() {}
function openSettings() {}
function doSearch() {}
$.index.open();
```

`app/styles/index.tss`:
```
"MenuItem": {
Expand Down Expand Up @@ -89,7 +98,7 @@ if (OS_ANDROID) {
win.activity.onCreate = () => {
const actionBar = win.activity.actionBar;
if (actionBar) {
actionBar.backgroundImage = "/bg.png";
actionBar.backgroundImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'bg.png').nativePath;
actionBar.title = "New Title";
actionBar.onHomeIconItemSelected = () => {
Ti.API.info("Home icon clicked!");
Expand Down

0 comments on commit d2fb07d

Please sign in to comment.