File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
android/titanium/src/java/org/appcelerator/titanium/proxy Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 15
15
import org .appcelerator .titanium .TiC ;
16
16
import org .appcelerator .titanium .util .TiConvert ;
17
17
import org .appcelerator .titanium .util .TiUIHelper ;
18
+ import org .appcelerator .titanium .view .TiDrawableReference ;
18
19
19
20
@ SuppressWarnings ("deprecation" )
20
21
@ Kroll .proxy (propertyAccessors = { TiC .PROPERTY_ON_HOME_ICON_ITEM_SELECTED , TiC .PROPERTY_CUSTOM_VIEW })
@@ -102,6 +103,17 @@ public void setBackgroundImage(String url)
102
103
actionBar .setDisplayShowTitleEnabled (showTitleEnabled );
103
104
104
105
actionBar .setBackgroundDrawable (backgroundImage );
106
+ } else {
107
+ // fallback check with TiDrawableReference
108
+ TiDrawableReference source = TiDrawableReference .fromUrl (this , url );
109
+ if (source .getDrawable () != null ) {
110
+ actionBar .setDisplayShowTitleEnabled (!showTitleEnabled );
111
+ actionBar .setDisplayShowTitleEnabled (showTitleEnabled );
112
+ actionBar .setBackgroundDrawable (source .getDrawable ());
113
+ } else {
114
+ // fail - show error
115
+ Log .e (TAG , "Image " + url + " not found" );
116
+ }
105
117
}
106
118
}
107
119
Original file line number Diff line number Diff line change @@ -55,6 +55,15 @@ examples:
55
55
</Alloy>
56
56
```
57
57
58
+
59
+ `app/controllers/index.js`:
60
+ ```
61
+ function doMenuClick() {}
62
+ function openSettings() {}
63
+ function doSearch() {}
64
+ $.index.open();
65
+ ```
66
+
58
67
`app/styles/index.tss`:
59
68
```
60
69
"MenuItem": {
@@ -85,7 +94,7 @@ examples:
85
94
win.activity.onCreate = () => {
86
95
const actionBar = win.activity.actionBar;
87
96
if (actionBar) {
88
- actionBar.backgroundImage = "/ bg.png" ;
97
+ actionBar.backgroundImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, ' bg.png').nativePath ;
89
98
actionBar.title = "New Title";
90
99
actionBar.onHomeIconItemSelected = () => {
91
100
Ti.API.info("Home icon clicked!");
You can’t perform that action at this time.
0 commit comments