Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15879] Android: Nine-patch images not displayed when placed in density-specific folder

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-12-05T07:21:56.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 25, 2013 Sprint 25 Core, Release 3.2.0, Release 3.3.0
ComponentsAndroid
Labelsmodule_imageview, nine-patch, qe-testadded, regression, triage
ReporterFokke Zandbergen
AssigneeChris Barber
Created2013-12-04T12:06:51.000+0000
Updated2014-07-29T20:36:18.000+0000

Description

To reproduce:

1. Create a project: ti create -p android -n nine --id test.nine -d . 2. Replace app.js code by:
    var win = Titanium.UI.createWindow({  
        backgroundColor:'#fff'
    });

    var view = Ti.UI.createView({
        width: 100,
        height: 100,
        backgroundImage: '/images/foo.png'
    });

    win.add(view);

    win.open();
    
3. Place the attached (or any) image in /images/foo.9.png 4. Run the project to confirm it works. 5. Move the image to /android/images/foo.9.png 6. Run the project again to confirm it works. 5. Move the image to /android/images/res-mdpi/foo.9.png (or any other density-specific folder) 6. Run the project again to confirm it does *not* work.

Attachments

FileDateSize
foo.9.png2013-12-04T12:06:51.000+00008076

Comments

  1. Ingo Muschenetz 2013-12-04

    Thanks. Which version is this a regression against?
  2. Fokke Zandbergen 2013-12-04

    Works fine in 3.1.3.GA SDK and 3.1.2 CLI It might be more of a CLI problem? I should test 3.1.3.GA against 3.2.0-beta3 CLI then?
  3. Ingo Muschenetz 2013-12-04

    Yes, you should be able to test 3.1.3.GA SDK + 3.2.0-beta3 CLI.
  4. Fokke Zandbergen 2013-12-04

    * Verified working on 3.1.3.GA SDK + 3.2.0-beta CLI * Verified working on 3.1.3.GA SDK + 3.1.2 CLI * Verified broken on 3.2.0.v20131126144841 SDK + 3.2.0-beta CLI
  5. Fokke Zandbergen 2013-12-04

    So the cause seems to be the SDK, not the CLI.
  6. Ingo Muschenetz 2013-12-04

    Thanks. Moving to a SDK issue.
  7. Ping Wang 2013-12-04

    This is a CLI issue. Similar to TIMOB-10806, the hash of the nine-patch image is not calculated correctly. From the log
       E/TiRHelper(18156): (main) [19,316] Error looking up resource: foo_643a3006c7
       E/TiRHelper(18156): java.lang.NoSuchFieldException: foo_643a3006c7
       E/TiRHelper(18156): 	at java.lang.Class.getDeclaredField(Class.java:631)
       E/TiRHelper(18156): 	at org.appcelerator.titanium.util.TiRHelper.lookupResource(TiRHelper.java:77)
       E/TiRHelper(18156): 	at org.appcelerator.titanium.util.TiRHelper.getResource(TiRHelper.java:105)
       
    we can see we are looking for the image "foo_643a3006c7". But in the build/android/res/drawable-hdpi/ folder, the image name is "foo_cc63ca97ae.9.png" if using the master, while the image name is "foo_643a3006c7.9.png" if using 3.1.3.GA.
  8. Chris Barber 2013-12-04

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5061 3.2.x pull request: https://github.com/appcelerator/titanium_mobile/pull/5062
  9. Paras Mishra 2013-12-05

    Moved image foo.9.png to all three locations as above mentioned /images/foo.9.png /android/images/foo.9.png /android/images/res-mdpi/foo.9.png Image is getting displayed in all conditions. Verified fix on: Device : Google Nexus 7, Android Version: 4.3 SDK: 3.2.0.v20131204220843 CLI version : 3.2.0-beta OS : MAC OSX 10.9 Alloy: 1.3.0-beta ACS: 1.0.9 Appcelerator Studio, build: 3.2.0.201312042306 titanium-code-processor: 1.1.0-beta XCode : 5.0.2

JSON Source