Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17215] Android Module Resources cannot be overridden

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-07-07T16:23:59.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsTooling
Labelsmodule_xml, overwrite, qe-testadded, xml
ReporterMads Moller
AssigneeChris Barber
Created2014-06-25T07:28:01.000+0000
Updated2014-07-07T16:23:59.000+0000

Description

Its not possible to override resources such as xml or images that is used by a android module. e.g. changing the theme of a module's activity. So the app folder APPFOLDER/platform/android/res/ will not override the MODULEFOLDER/platform/android/res/ This makes modules very unflexible to style/setup.

Comments

  1. Ingo Muschenetz 2014-06-25

    Thank you. And to confirm, this exists as of 3.2.0?
  2. Mads Moller 2014-06-25

    Correct
  3. Chris Barber 2014-06-25

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5850 3_3_X pull request: https://github.com/appcelerator/titanium_mobile/pull/5851 I also added warning messages whenever a resource or xml value is being overwritten. This is useful to make sure you are overwriting the module's resources.
  4. Mads Moller 2014-06-26

    Hi Chris, That was quick :) Will it also take into account the tiapp.xml manifest changes? Lets say I want to override an module activity within my tiapp with a new custom android theme. will that work as well ? cheers
  5. Tim Poulsen 2014-06-26

    I need a test app and functional review steps before I can review this PR. [~viezel] can you attach a test project?
  6. Chris Barber 2014-06-26

    To test, I simply created the folder platform/android/res/values and create a strings.xml file in it with the following contents:
       <?xml version="1.0" encoding="UTF-8"?>
       <resources>
       	<string name="test" formatted="false">Test</string>
           <string name="com_facebook_loginview_log_in_button">Log Me In</string>
       </resources>
       
    Next, enable the Facebook module in the tiapp.xml:
       <modules>
           <module platform="android">facebook</module>
       </modules>
       
    Run:
       ti build -p android --build-only --log-level trace
       
    Examine the generated build/android/res/values/strings.xml and make sure that the "com_facebook_loginview_log_in_button" says "Log Me In" instead of "Log In".
  7. Tim Poulsen 2014-06-26

    Using the steps described by Chris, the change works as expected.
  8. Samuel Dowse 2014-07-01

    Verified fixed on: Mac OSX 10.9.3 Appcelerator Studio, build: 3.3.0.201406271159 Titanium SDK, build: 3.3.0.v20140701104113 Titanium CLI, build: 3.3.0-rc4 Alloy: 1.4.0-rc3 Followed test steps provided by [~cbarber]. Module resource has been overridden successfully. "com_facebook_loginview_log_in_button" says "Log Me In" as expected. Closing.

JSON Source