Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-7944] Added support for the startup splash screen #1732

Merged
merged 5 commits into from
Mar 19, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added mobileweb/splash/appc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions mobileweb/splash/splash.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#splash {
background: #9a0707;
background: -moz-linear-gradient(top,#9a0707 0%,#5c0404 100%);
background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#9a0707),color-stop(100%,#5c0404));
background: -webkit-linear-gradient(top,#9a0707 0%,#5c0404 100%);
background: -o-linear-gradient(top,#9a0707 0%,#5c0404 100%);
background: -ms-linear-gradient(top,#9a0707 0%,#5c0404 100%);
background: linear-gradient(top,#9a0707 0%,#5c0404 100%);
-webkit-box-shadow: inset 0px 0px 15px 6px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0px 0px 15px 6px rgba(0,0,0,0.5);
box-shadow: inset 0px 0px 15px 6px rgba(0,0,0,0.5);
bottom: 0;
min-height: 300px;
left: 0;
position: fixed;
right: 0;
top: 0;
}

#splash:before {
background: url(appc.png) no-repeat 0 0;
content: "";
height: 150px;
left: 50%;
margin-left: -85px;
position: absolute;
top: 15%;
width: 170px;
}

#splash:after {
background: url(titanium.png) no-repeat 0 0;
content: "";
height: 48px;
left: 50%;
margin-left: -105px;
position: absolute;
bottom: 15%;
width: 200px;
}

@media all and (min-height: 699px) {
#splash:before {
top: 25%;
}

#splash:after {
bottom: 25%;
}
}
Binary file added mobileweb/splash/titanium.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mobileweb/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
</style>
</head>
<body>
<div id="splash">${splash_screen}</div>
<script>
${ti_js}
</script>
Expand Down
40 changes: 22 additions & 18 deletions support/all/tiapp.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>__PROJECT_ID__</id>
<name>__PROJECT_NAME__</name>
<version>__PROJECT_VERSION__</version>
<publisher>not specified</publisher>
<url>not specified</url>
<description>not specified</description>
<copyright>not specified</copyright>
<icon>appicon.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>
<statusbar-hidden>false</statusbar-hidden>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<guid></guid>
<property name="ti.ui.defaultunit">system</property>
<id>__PROJECT_ID__</id>
<name>__PROJECT_NAME__</name>
<version>__PROJECT_VERSION__</version>
<publisher>not specified</publisher>
<url>not specified</url>
<description>not specified</description>
<copyright>not specified</copyright>
<icon>appicon.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>
<statusbar-hidden>false</statusbar-hidden>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<guid></guid>
<property name="ti.ui.defaultunit">system</property>
<iphone>
<orientations device="iphone">
<orientation>Ti.UI.PORTRAIT</orientation>
Expand All @@ -31,9 +31,13 @@
<android xmlns:android="http://schemas.android.com/apk/res/android">
</android>
<mobileweb>
<theme>titanium</theme>
<precache>
</precache>
<splash>
<enabled>true</enabled>
<inline-css-images>true</inline-css-images>
</splash>
<theme>titanium</theme>
</mobileweb>
<modules>
</modules>
Expand Down
33 changes: 32 additions & 1 deletion support/mobileweb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,43 @@ def addProp(prop, val):
# 6) close the titanium.js
ti_js.close()

# build the splash screen
splash_html = ''
splash_css = ''
if tiapp_xml['mobileweb']['splash']['enabled'] == 'true':
print '[INFO] Processing splash screen...'
splash_path = os.path.join(self.project_path, 'splash')
if not os.path.exists(splash_path):
splash_path = os.path.join(self.sdk_path, 'splash')
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):
splash_html = codecs.open(splash_html_file, 'r', 'utf-8').read()
if os.path.exists(splash_css_file):
splash_css = codecs.open(splash_css_file, 'r', 'utf-8').read()
if tiapp_xml['mobileweb']['splash']['inline-css-images'] == 'true':
parts = splash_css.split('url(')
for i in range(1, len(parts)):
j = parts[i].find(')')
if j != -1:
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)
if os.path.exists(img_path):
fname, ext = os.path.splitext(img_path.lower())
if ext in image_mime_types:
parts[i] = 'data:%s;base64,%s%s' % (image_mime_types[ext], base64.b64encode(open(img_path,'rb').read()), parts[i][j:])
splash_css = 'url('.join(parts)

# build the titanium.css file
print '[INFO] Assembling titanium.css...'
self.ti_css_file = os.path.join(self.build_path, 'titanium.css')
ti_css = codecs.open(self.ti_css_file, 'w', encoding='utf-8')

# TODO: need to rewrite absolute paths for urls
ti_css.write(HEADER + '\n' + codecs.open(os.path.join(self.themes_path, 'common.css'), 'r', 'utf-8').read())
ti_css.write(HEADER + '\n' + splash_css + '\n' + codecs.open(os.path.join(self.themes_path, 'common.css'), 'r', 'utf-8').read())

# TODO: get theme from tiapp.xml
theme = 'titanium'
Expand Down Expand Up @@ -475,6 +505,7 @@ def addProp(prop, val):
project_name = tiapp_xml['name'] or '',
app_description = tiapp_xml['description'] or '',
app_publisher = tiapp_xml['publisher'] or '',
splash_screen = splash_html,
ti_generator = 'Appcelerator Titanium Mobile ' + sdk_version,
ti_statusbar_style = status_bar_style,
ti_css = codecs.open(self.ti_css_file, 'r', 'utf-8').read(),
Expand Down
Binary file modified support/mobileweb/resources/Default-Landscape.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified support/mobileweb/resources/Default-Landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified support/mobileweb/resources/Default-Portrait.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified support/mobileweb/resources/Default-Portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified support/mobileweb/resources/Default.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified support/mobileweb/resources/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions support/mobileweb/tiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def __init__(self, xml_file, deploytype, parse_only=False):
'backend': 'Ti/_/Map/Google',
'apikey': ''
},
'splash': {
'enabled': 'true',
'inline-css-images': 'true'
},
'theme': 'titanium'
}
self['precache'] = {
Expand Down