Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbe committed Jul 6, 2012
2 parents d8554ce + 12454e5 commit 03387c1
Show file tree
Hide file tree
Showing 45 changed files with 12,224 additions and 743 deletions.
28 changes: 20 additions & 8 deletions Makefile
Expand Up @@ -76,6 +76,8 @@ else
GAIA_PORT?=
endif

# Force bash for all shell commands since we depend on bash-specific syntax
SHELL := /bin/bash

# what OS are we on?
SYS=$(shell uname -s)
Expand Down Expand Up @@ -128,6 +130,7 @@ webapp-manifests:
@echo "Generated webapps"
@mkdir -p profile/webapps
@echo { > profile/webapps/webapps.json
id=1; \
for d in `find ${GAIA_APP_SRCDIRS} -mindepth 1 -maxdepth 1 -type d` ;\
do \
if [ -f $$d/manifest.webapp ]; \
Expand All @@ -142,11 +145,13 @@ webapp-manifests:
echo \"installOrigin\": \"http://$$n.$(GAIA_DOMAIN)$(GAIA_PORT)\", ;\
echo \"receipt\": null, ;\
echo \"installTime\": 132333986000, ;\
echo \"manifestURL\": \"http://$$n.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp\" ;\
echo \"manifestURL\": \"http://$$n.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp\", ;\
echo \"localId\": $$id ;\
echo },) >> profile/webapps/webapps.json;\
: $$((id++)); \
fi \
done
@cd external-apps; \
done; \
cd external-apps; \
for d in `find * -maxdepth 0 -type d` ;\
do \
if [ -f $$d/manifest.webapp ]; \
Expand All @@ -159,8 +164,10 @@ webapp-manifests:
echo \"installOrigin\": \"`cat $$d/origin`\", ;\
echo \"receipt\": null, ;\
echo \"installTime\": 132333986000, ;\
echo \"manifestURL\": \"`cat $$d/origin`/manifest.webapp\" ;\
echo \"manifestURL\": \"`cat $$d/origin`/manifest.webapp\", ;\
echo \"localId\": $$id ;\
echo },) >> ../profile/webapps/webapps.json;\
: $$((id++)); \
fi \
done
@$(SED_INPLACE_NO_SUFFIX) -e '$$s|,||' profile/webapps/webapps.json
Expand Down Expand Up @@ -269,11 +276,11 @@ ifeq ($(DEBUG),1)
# httpd
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DIR@|$(CURDIR)|g' $(EXT_DIR)/httpd@gaiamobile.org
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DOMAIN@|$(GAIA_DOMAIN)|g' $(EXT_DIR)/httpd/content/httpd.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DIR@|$(CURDIR)|g' $(EXT_DIR)/httpd/content/loader.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DOMAIN@|$(GAIA_DOMAIN)|g' $(EXT_DIR)/httpd/content/loader.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_PORT@|$(subst :,,$(GAIA_PORT))|g' $(EXT_DIR)/httpd/content/loader.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_APP_SRCDIRS@|$(GAIA_APP_SRCDIRS)|g' $(EXT_DIR)/httpd/content/loader.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_APP_RELATIVEPATH@|$(GAIA_APP_RELATIVEPATH)|g' $(EXT_DIR)/httpd/content/httpd.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DIR@|$(CURDIR)|g' $(EXT_DIR)/httpd/bootstrap.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_DOMAIN@|$(GAIA_DOMAIN)|g' $(EXT_DIR)/httpd/bootstrap.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_PORT@|$(subst :,,$(GAIA_PORT))|g' $(EXT_DIR)/httpd/bootstrap.js
@$(SED_INPLACE_NO_SUFFIX) -e 's|@GAIA_APP_SRCDIRS@|$(GAIA_APP_SRCDIRS)|g' $(EXT_DIR)/httpd/bootstrap.js
endif
@echo "Done"

Expand Down Expand Up @@ -477,6 +484,11 @@ install-media-samples:
$(ADB) push media-samples/Movies /sdcard/Movies
$(ADB) push media-samples/Music /sdcard/Music

install-test-media:
$(ADB) push test_media/DCIM /sdcard/DCIM
$(ADB) push test_media/Movies /sdcard/Movies
$(ADB) push test_media/Music /sdcard/Music

dialer-demo:
@cp -R apps/contacts apps/dialer
@rm apps/dialer/contacts/manifest*
Expand Down
4 changes: 2 additions & 2 deletions apps/contacts/index.html
Expand Up @@ -250,7 +250,7 @@ <h1 id='contact-form-title'></h1>
<header role="toolbar" class="view-header">
<button class="negative" onclick="Contacts.goBack();"><span data-icon="back">back</span></button>
<menu role="menu" id='contact-form-actions' >
<button role="menuitem" onclick="Contacts.goBack();">Done</button>
<button role="menuitem" onclick="Contacts.doneTag();">Done</button>
</menu>
<h1>Label</h1>
</header>
Expand All @@ -259,7 +259,7 @@ <h1>Label</h1>
<div class="view-body-inner">
<ul id="tags-list" class="selection-list">
</ul>
<input class="textfield" type="text" placeholder="Custom Tag" value="">
<input class="textfield" type="text" placeholder="Custom Tag" value="" id='custom-tag'>
</div>
</article>
</div>
Expand Down
52 changes: 43 additions & 9 deletions apps/contacts/js/contacts.js
Expand Up @@ -124,6 +124,8 @@ var Contacts = (function() {
phonesContainer,
emailContainer,
selectedTag,
customTag,
contactTag,
contactDetails,
saveButton;

Expand All @@ -144,6 +146,7 @@ var Contacts = (function() {
emailContainer = document.getElementById('contacts-form-email');
contactDetails = document.getElementById('contact-detail');
saveButton = document.getElementById('save-button');
customTag = document.getElementById('custom-tag');

var list = document.getElementById('groups-list');
contactsList.init(list);
Expand Down Expand Up @@ -302,6 +305,7 @@ var Contacts = (function() {
var fillTagOptions = function fillTagOptions(options, tagList, update) {
var container = document.getElementById('tags-list');
container.innerHTML = '';
contactTag = update;

var selectedLink;
for (var option in options) {
Expand All @@ -312,10 +316,9 @@ var Contacts = (function() {

link.onclick = function(event) {
var index = event.target.dataset.index;
selectTag(event.target, tagList, update);
selectTag(event.target, tagList);
};

selectedLink = selectedLink || link;
if (update.textContent == TAG_OPTIONS[tagList][option].value) {
selectedLink = link;
}
Expand All @@ -324,20 +327,38 @@ var Contacts = (function() {
list.appendChild(link);
container.appendChild(list);
}

// Deal with the custom tag, clean or fill
customTag.value = '';
if (!selectedLink && update.textContent) {
customTag.value = update.textContent;
}
customTag.onclick = function(event) {
if (selectedTag) {
// Remove any mark if we had selected other option
selectedTag.removeChild(selectedTag.firstChild.nextSibling);
}
selectedTag = null;
}

selectTag(selectedLink);
};

var selectTag = function selectTag(link, tagList, update) {
var selectTag = function selectTag(link, tagList) {
if (link == null) {
return;
}

//Clean any trace of the custom tag
customTag.value = '';

var index = link.dataset.index;
if (update) {
update.textContent = TAG_OPTIONS[tagList][index].value;
if (tagList && contactTag) {
contactTag.textContent = TAG_OPTIONS[tagList][index].value;
}

if (selectedTag) {
// TODO: Regex
var tagContent = selectedTag.innerHTML;
var findIcon = tagContent.indexOf('<');
selectedTag.innerHTML = tagContent.substr(0, findIcon);
selectedTag.removeChild(selectedTag.firstChild.nextSibling);
}

var icon = document.createElement('span');
Expand All @@ -347,6 +368,18 @@ var Contacts = (function() {
selectedTag = link;
};

/*
* Finish the tag edition, check if we have a custom
* tag selected or use the predefined ones
*/
var doneTag = function doneTag() {
if (!selectedTag && customTag.value.length > 0 && contactTag) {
contactTag.textContent = customTag.value;
}
contactTag = null;
this.goBack();
};

var sendSms = function sendSms() {
SmsIntegration.sendSms(currentContact.tel[0].number);
}
Expand Down Expand Up @@ -513,6 +546,7 @@ var Contacts = (function() {

return {
'showEdit' : showEdit,
'doneTag': doneTag,
'showAdd': showAdd,
'addNewPhone' : insertEmptyPhone,
'addNewEmail' : insertEmptyEmail,
Expand Down
26 changes: 18 additions & 8 deletions apps/dialer/js/recents.js
Expand Up @@ -107,6 +107,8 @@ var Recents = {
' </section>' +
' </div>' +
' </section>' +
' <section class="call-log-contact-photo">' +
' </section>' +
'</li>';
return entry;
},
Expand Down Expand Up @@ -146,16 +148,24 @@ var Recents = {
},

updateContactDetails: function re_updateContactDetails() {
var itemSelector = '.log-item .primary-info';
var commLogItemPhoneNumbers = document.querySelectorAll(itemSelector);
var length = commLogItemPhoneNumbers.length;
var itemSelector = '.log-item';
var callLogItems = document.querySelectorAll(itemSelector);
var length = callLogItems.length;
for (var i = 0; i < length; i++) {
Contacts.findByNumber(commLogItemPhoneNumbers[i].textContent.trim(),
function re_contactCallBack(phoneNumberEl, contact) {
if (contact && contact.name) {
phoneNumberEl.textContent = contact.name;
Contacts.findByNumber(
callLogItems[i].querySelector('.primary-info').textContent.trim(),
function re_contactCallBack(itemLogEl, contact) {
if (contact) {
if (contact.name) {
itemLogEl.querySelector('.primary-info').textContent =
contact.name;
}
if (contact.photo) {
itemLogEl.querySelector('.call-log-contact-photo').
style.backgroundImage = 'url(' + contact.photo + ')';
}
}
}.bind(this, commLogItemPhoneNumbers[i]));
}.bind(this, callLogItems[i]));
}
},

Expand Down
11 changes: 9 additions & 2 deletions apps/dialer/style/commslog.css
Expand Up @@ -117,7 +117,7 @@ ol, ul {
.log-item-info {
float: left;
height: 100%;
width: -moz-calc(100% - 5rem);
width: -moz-calc(100% - 10rem);
}

.ellipsis {
Expand All @@ -138,4 +138,11 @@ ol, ul {
color: #5b5b5b;
}


.call-log-contact-photo {
float: left;
height: 100%;
width: 5rem;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
2 changes: 2 additions & 0 deletions apps/dialer/style/keypad.css
Expand Up @@ -122,6 +122,7 @@
background-size: 3rem 3rem;
background-position: center;
margin: auto;
pointer-events: none;
}

.sharp {
Expand All @@ -132,6 +133,7 @@
background-size: 3rem 3rem;
background-position: center;
margin: auto;
pointer-events: none;
}

#keypad-callbar {
Expand Down
11 changes: 7 additions & 4 deletions apps/homescreen/style/grid.css
Expand Up @@ -19,7 +19,7 @@
list-style-type: none;
display: block;
margin: 0 auto;
margin-top: 2rem;
margin-top: 1rem;
}

.apps ol > li {
Expand All @@ -28,7 +28,6 @@
display: inline-block;
float: left;
text-align: center;
padding-bottom: 2.2rem;
}

.apps ol > li[data-hidden] {
Expand All @@ -48,8 +47,8 @@
/* Option to delete apps */
.apps ol > li span.options {
position: absolute;
top: -10%;
left: 0;
top: .2rem;
left: 0;
width: 100%;
height: 33%;
z-index: 2;
Expand All @@ -60,6 +59,8 @@
.apps ol > li > div {
height: 100%;
width: 100%;
margin-top: 1rem;
margin-bottom: 1.2rem;
pointer-events: none; /* NO touchable area */
}

Expand Down Expand Up @@ -103,6 +104,8 @@

.apps .draggable > div {
width: 100%;
margin-top: 1rem;
margin-bottom: 1.2rem;
-moz-transform: scale(1.25);
-moz-transition: -moz-transform .4s;
}
Expand Down

0 comments on commit 03387c1

Please sign in to comment.