Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3516] Android: density-specific splash screen not working on Windows

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-01-09T15:15:27.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-29, Release 1.8.0
ComponentsAndroid
LabelsdensitySpecificSplashScreen, qe-testadded
ReporterMatthew Lieder
AssigneeBill Dawson
Created2011-04-15T03:46:11.000+0000
Updated2012-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.

Comments

  1. Matthew Lieder 2011-04-15

    (looks like Lighthouse stripped out the second backslash from the first parameter to path.replace in my comment)

  2. Don Thorp 2011-07-06

    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.
  3. Bill Dawson 2011-07-19

    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.
  4. Don Thorp 2011-07-25

    Reviewed and tested.
  5. Michael Pettiford 2011-12-14

    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
  6. Michael Pettiford 2012-01-09

    Reopening/closing to add/remove labels

JSON Source