Skip to content

Commit

Permalink
Merge pull request #1830 from cb1kenobi/timob-8266
Browse files Browse the repository at this point in the history
[TIMOB-8266] Organized the splash screen assets and added some quick and dirty splash docs
  • Loading branch information
nebrius committed Mar 24, 2012
2 parents cfac873 + b498177 commit d894dd0
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 19 deletions.
51 changes: 32 additions & 19 deletions support/mobileweb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ def __init__(self, project_path, deploytype):

# copy all of the project's resources to the build directory
self.copy(self.themes_path, os.path.join(self.build_path, 'themes'))
self.copy(self.resources_path, self.build_path)
self.copy(os.path.join(self.resources_path, 'mobileweb'), self.build_path)
self.copy(self.resources_path, self.build_path, ['android', 'iphone'])
self.copy(os.path.join(self.resources_path, 'mobileweb'), self.build_path, ['apple_startup_images', 'splash'])
self.copy(os.path.join(self.resources_path, 'mobileweb', 'apple_startup_images', 'Default.jpg'), self.build_path)
self.copy(os.path.join(self.resources_path, 'mobileweb', 'apple_startup_images', 'Default-Portrait.jpg'), self.build_path)
self.copy(os.path.join(self.resources_path, 'mobileweb', 'apple_startup_images', 'Default-Landscape.jpg'), self.build_path)
self.copy(self.ti_package_path, os.path.join(self.build_path, 'titanium'))

# scan project for dependencies
Expand Down Expand Up @@ -402,9 +405,11 @@ def addProp(prop, val):
splash_css = ''
if tiapp_xml['mobileweb']['splash']['enabled'] == 'true':
print '[INFO] Processing splash screen...'
splash_path = os.path.join(self.project_path, 'splash')
splash_path = os.path.join(self.project_path, 'Resources', 'mobileweb', 'splash')
splash_root_path = os.path.join(self.project_path, 'Resources')
if not os.path.exists(splash_path):
splash_path = os.path.join(self.sdk_path, 'splash')
splash_root_path = splash_path
splash_html_file = os.path.join(splash_path, 'splash.html')
splash_css_file = os.path.join(splash_path, 'splash.css')
if os.path.exists(splash_html_file):
Expand All @@ -419,8 +424,9 @@ def addProp(prop, val):
img = parts[i][:j].replace('"', '').replace('\'', '').strip()
if img.find('data:') == -1:
if img[1] == '/':
img = img[1:]
img_path = os.path.join(splash_path, img)
img_path = os.path.join(splash_root_path, img[1:])
else:
img_path = os.path.join(splash_path, img)
if os.path.exists(img_path):
fname, ext = os.path.splitext(img_path.lower())
if ext in image_mime_types:
Expand Down Expand Up @@ -594,21 +600,28 @@ def resolve(self, it, ref):
return [self.compact_path(os.path.join(self.build_path, p['location'])), it]
return [self.build_path, it]

def copy(self, src_path, dest_path):
def copy(self, src_path, dest_path, ignore=None):
print '[INFO] Copying %s...' % src_path
for root, dirs, files in os.walk(src_path):
for name in ignoreDirs:
if name in dirs:
dirs.remove(name)
for file in files:
if file in ignoreFiles or file.startswith('._'):
continue
source = os.path.join(root, file)
dest = os.path.expanduser(source.replace(src_path, dest_path, 1))
dest_dir = os.path.expanduser(os.path.split(dest)[0])
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy(source, dest)
if os.path.isdir(src_path):
for root, dirs, files in os.walk(src_path):
for name in ignoreDirs:
if name in dirs:
dirs.remove(name)
if ignore is not None:
for name in ignore:
if name in dirs:
dirs.remove(name)
for file in files:
if file in ignoreFiles or file.startswith('._'):
continue
source = os.path.join(root, file)
dest = os.path.expanduser(source.replace(src_path, dest_path, 1))
dest_dir = os.path.expanduser(os.path.split(dest)[0])
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy(source, dest)
else:
shutil.copy(src_path, dest_path)

def compact_path(self, path):
result = []
Expand Down
File renamed without changes
File renamed without changes
8 changes: 8 additions & 0 deletions support/mobileweb/resources/apple_startup_images/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
These startup images are used by iPhone and iPad apps that are installed to the
home screen. These images are displayed before the splash screen is displayed.

If you want to create a new splash screen, it is recommended that you start by
modifying the files in the adjacent "splash" folder, then take screenshots of
device, crop, and save into this directory. This is the best way to avoid visual
artifacts when the app transitions from the Apple startup images to the splash
screen assets.
49 changes: 49 additions & 0 deletions support/mobileweb/resources/splash/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
This folder contains assets to make the startup splash screen assets. Splash
screens are made up of HTML and CSS. This allows you the flexibility to
customize your splash screen to fit a variety of screen sizes and orientations.


splash.html
-----------
Contains an HTML fragment that is inserted into a div tag with an id="splash".
You can choose to leave this file empty. You can put <script> tags in this file,
though it is not recommended.

Currently, the HTML code is NOT minified before being inserted into the page.


splash.css
----------
Contains the styles used to control the display of the HTML. In addition to
styling the default splash div, you can style other HTML elements.

One advantage of using CSS background images in your splash screen is the images
will be inlined in the CSS using data: URIs. It's best to keep the size of your
images as small as possible. You can use PNG, JPG, or GIF images. You should use
an image optimization tool to remove unnecessary meta data from the images such
as smushit.com or crushpng.

It is recommended that you develop your splash screen on an iPhone-sized screen
so that you make your splash screen look good on small screens.

Additionally, it is recommended that you use CSS media queries to tweak the
layout for various screen sizes.

The CSS code is minified when your mobile web application is packaged.


Apple Startup Images
--------------------
After crafting your startup screen, it is recommended that you:

1) Create a sample application with an empty app.js
2) Run your sample app in both the iphone and ipad simulator
3) Take screenshots of your splash screen in both portrait and landscape
4) Crop the screenshots to remove the status bar from the top
5) Save the images in the Resources/mobileweb/apple_startup_images directory

These steps are the best way to avoid visual artifacts when the app transitions
from the Apple startup images to the splash screen assets.

It is recommended you save these images in the JPG format so that these images
download faster.
File renamed without changes
File renamed without changes.
Empty file.
File renamed without changes

0 comments on commit d894dd0

Please sign in to comment.