[TIMOB-3516] Android: density-specific splash screen not working on Windows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-09T15:15:27.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-29, Release 1.8.0 |
Components | Android |
Labels | densitySpecificSplashScreen, qe-testadded |
Reporter | Matthew Lieder |
Assignee | Bill Dawson |
Created | 2011-04-15T03:46:11.000+0000 |
Updated | 2012-01-09T15:15:27.000+0000 |
Description
It's currently impossible to use density-specific splash screens on Android when building on Windows. The bug is easy to fix; in the following code from support/android/builder.py:
# look for density-specific default.png's first
if os.path.exists(android_images_dir):
pattern = r'/android/images/(high|medium|low|res-[^/]+)/default.png'
for root, dirs, files in os.walk(android_images_dir):
for f in files:
path = os.path.join(root, f)
if re.search(pattern, path):
res_folder = resource_drawable_folder(path)
debug('found %s splash screen at %s' % (res_folder, path))
dest_path = os.path.join(self.res_dir, res_folder)
dest_file = os.path.join(dest_path, 'background.png')
if not os.path.exists(dest_path):
os.makedirs(dest_path)
shutil.copy(path, dest_file)
change "if re.search(pattern, path):" to "if re.search(pattern, path.replace("\", "/")):"
It might be good to audit the rest of the code too for this problem.
(looks like Lighthouse stripped out the second backslash from the first parameter to path.replace in my comment)
the fix should probably not use pattern replacement specifically. The pattern should probably be built in a platform dependent way to begin with using os.path.join, then fixing the \ to be \\ to handle the escaping properly.
It's easy to see the problem. Just build a Titanium app on Windows, then look down in your project's build/android/res folder and you'll only see a few "drawable-xxx" folders. There should be a bunch of them. With the fix in place, re-build (you may need to "touch" the tiapp.xml first just one time after installing the newer SDK) and you'll see many more drawable folders under build/android/res.
Reviewed and tested.
Tested on Ti Studio 1.0.7.201112080131 Ti Mob SDK 1.8.0.1.v20111209102124 v8/rhino Windows 7 Expected behavior of the correct drawable folders is shown
Reopening/closing to add/remove labels