fix(android): fix Actionbar backgroundImage doc and improve setter #14044
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current ActionBar "backgroundImage" example: https://titaniumsdk.com/api/titanium/android/actionbar.html#action-bar-example says you can use
"/bg.png"
as a backgroundImage. That calls a function that will check for the String "Resources" in the path: https://github.com/tidev/titanium-sdk/blob/master/android/titanium/src/java/org/appcelerator/titanium/util/TiUIHelper.java#L983-L986 which is not the case.The current workaround is to use
Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'bg.png').nativePath;
instead so I've added that in the classic example.BUT I also made a change in the ActionBar so it will use images with just the image path as a string.
Changes:
Changes in the docs:
Test
actionBar.backgroundImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, '/images/bg_intro.jpg').nativePath;
(will work with 12.3.0.GA too)actionBar.backgroundImage = '/images/bg_intro.jpg';
(will only work with this PR)