Skip to content
Browse files

Bug 821456 - Provide feedback to user that e.me successfully added to…

… the homescreen
  • Loading branch information...
1 parent afbf700 commit 291b9918365dff310d58302327061f583e8034f7 @crh0716 crh0716 committed with vingtetun Dec 28, 2012
View
94 apps/homescreen/everything.me/js/Brain.js
@@ -41,7 +41,7 @@ Evme.Brain = new function Evme_Brain() {
"video": ["Video", "Camera"],
"local": ["Maps", "FM Radio"]
},
-
+
timeoutSetUrlAsActive = null,
timeoutHashChange = null,
_ = navigator.mozL10n.get;
@@ -104,7 +104,6 @@ Evme.Brain = new function Evme_Brain() {
*/
function catchCallback(_class, _event, _data) {
logger.debug(_class + "." + _event + "(", (_data || ""), ")");
-
Evme.Utils.log('Callback: ' + _class + '.' + _event);
try {
self[_class] && self[_class][_event] && self[_class][_event](_data || {});
@@ -174,9 +173,9 @@ Evme.Brain = new function Evme_Brain() {
}
}
}
-
+
window.setTimeout(self.hideKeyboardTip, 500);
-
+
Evme.Utils.setKeyboardVisibility(false);
self.setEmptyClass();
Evme.Apps.refreshScroll();
@@ -207,7 +206,7 @@ Evme.Brain = new function Evme_Brain() {
Searcher.empty();
self.setEmptyClass();
-
+
Evme.DoATAPI.cancelQueue();
Evme.ConnectionMessage.hide();
};
@@ -425,7 +424,7 @@ Evme.Brain = new function Evme_Brain() {
cleared = false;
Evme.Helper.getList().classList.remove("default");
-
+
if (type !== "refine") {
refineQueryShown = "";
}
@@ -456,7 +455,7 @@ Evme.Brain = new function Evme_Brain() {
case "history":
Evme.Helper.addLink('history-clear', function historyclearClick(e){
Evme.SearchHistory.clear();
-
+
if (Evme.Searchbar.getValue()) {
Evme.Helper.showSuggestions();
} else {
@@ -480,7 +479,7 @@ Evme.Brain = new function Evme_Brain() {
// modules/Location/
this.Location = new function Location() {
var self = this;
-
+
// Location is being requested
this.requesting = function requesting() {
elContainer.classList.add("requesting-location");
@@ -535,15 +534,14 @@ Evme.Brain = new function Evme_Brain() {
this.scrollBottom = function scrollBottom() {
Searcher.loadMoreApps();
};
-
+
this.clearIfHas = function() {
var hadApps = Evme.Apps.clear();
if (!hadApps) {
return false;
}
-
+
Evme.Searchbar.setValue('', true);
-
return true;
}
};
@@ -601,6 +599,8 @@ Evme.Brain = new function Evme_Brain() {
"title": data.data.name,
"icon": roundedAppIcon
});
+ // display system banner
+ Evme.Banner.show(_('app-added-to-home-screen', {name: data.data.name}));
});
};
@@ -621,7 +621,7 @@ Evme.Brain = new function Evme_Brain() {
Evme.Searchbar.blur();
Brain.Searchbar.cancelBlur();
}
-
+
window.setTimeout(function onTimeout(){
self.animateAppLoading(data);
}, 50);
@@ -641,7 +641,7 @@ Evme.Brain = new function Evme_Brain() {
this.animateAppLoading = function animateAppLoading(data) {
Searcher.cancelRequests();
-
+
loadingApp = data.app;
loadingAppId = data.data.id;
bNeedsLocation = data.data.requiresLocation && !Evme.DoATAPI.hasLocation();
@@ -658,13 +658,13 @@ Evme.Brain = new function Evme_Brain() {
"icon": data.data.icon,
"installed": data.data.installed || false
};
-
+
var elApp = data.el,
appBounds = elApp.getBoundingClientRect(),
-
+
elAppsList = elApp.parentNode.parentNode,
appsListBounds = elAppsList.getBoundingClientRect(),
-
+
oldPos = {
"top": elApp.offsetTop,
"left": elApp.offsetLeft
@@ -673,38 +673,38 @@ Evme.Brain = new function Evme_Brain() {
"top": (appsListBounds.height - appBounds.height)/2 - ((data.isFolder? elAppsList.dataset.scrollOffset*1 : Evme.Apps.getScrollPosition()) || 0),
"left": (appsListBounds.width - appBounds.width)/2
};
-
+
Evme.$remove("#loading-app");
-
+
var elPseudo = Evme.$create('li', {'class': "inplace", 'id': "loading-app"}, loadingApp.getHtml()),
useClass = !data.isFolder;
-
+
if (data.data.installed) {
elPseudo.classList.add("installed");
}
-
+
newPos.top -= appBounds.height/4;
-
+
elPseudo.style.cssText += 'position: absolute; top: ' + oldPos.top + 'px; left: ' + oldPos.left + 'px; -moz-transform: translate3d(0,0,0);';
var appName = Evme.Utils.l10n('apps', 'loading-app');
if (bNeedsLocation) {
appName = "";
}
-
+
Evme.$('b', elPseudo, function itemIteration(el) {
el.innerHTML = appName;
});
-
+
elApp.parentNode.appendChild(elPseudo);
elContainer.classList.add("loading-app");
-
+
window.setTimeout(function onTimeout(){
var x = -Math.round(oldPos.left-newPos.left),
y = -Math.round(oldPos.top-newPos.top);
-
+
elPseudo.style.cssText += "; -moz-transform: translate3d(" + x + "px, " + y + "px, 0);";
-
+
if (bNeedsLocation) {
Evme.Location.requestUserLocation(function onSuccess(data) {
if (Brain.SmartFolder.get()) {
@@ -824,7 +824,7 @@ Evme.Brain = new function Evme_Brain() {
};
};
- // modules/SmartFolder/
+ // modules/SmartFolder/
this.SmartFolder = new function SmartFolder() {
var self = this,
currentFolder = null,
@@ -836,18 +836,16 @@ Evme.Brain = new function Evme_Brain() {
elContainer.classList.add("smart-folder-visible");
currentFolder = data.folder;
-
window.setTimeout(self.loadAppsIntoFolder, 500);
};
-
+
// hiding the folder
this.hide = function hide() {
elContainer.classList.remove("smart-folder-visible");
-
Evme.Brain.SmartFolder.cancelRequests();
Evme.ConnectionMessage.hide();
};
-
+
// close button was clicked
this.close = function close() {
currentFolder = null;
@@ -1028,7 +1026,7 @@ Evme.Brain = new function Evme_Brain() {
}).show();
Brain.Searchbar.hideKeyboardTip();
-
+
self.loadFromAPI();
};
@@ -1082,7 +1080,7 @@ Evme.Brain = new function Evme_Brain() {
self.doneEdit();
return true;
}
-
+
return false;
};
};
@@ -1123,11 +1121,11 @@ Evme.Brain = new function Evme_Brain() {
isFirstShow = true,
requestSuggest = null,
isOpen = false;
-
+
this.show = function show() {
isOpen = true;
};
-
+
this.hide = function hide() {
Evme.ShortcutsCustomize.Loading.hide();
isOpen = false;
@@ -1229,7 +1227,7 @@ Evme.Brain = new function Evme_Brain() {
'</div>');
elCustomize.addEventListener("click", self.showUI);
-
+
el.appendChild(elCustomize);
};
};
@@ -1329,7 +1327,7 @@ Evme.Brain = new function Evme_Brain() {
Evme.DoATAPI.backOnline();
};
};
-
+
// api/DoATAPI.js
this.DoATAPI = new function DoATAPI() {
// trigger message when request fails
@@ -1393,11 +1391,11 @@ Evme.Brain = new function Evme_Brain() {
}
}
resetLastSearch();
-
+
this.isLoadingApps = function isLoadingApps() {
return requestSearch;
};
-
+
this.getApps = function getApps(options) {
var query = options.query,
type = options.type,
@@ -1441,14 +1439,14 @@ Evme.Brain = new function Evme_Brain() {
}
cancelSearch();
-
+
var installedApps = [];
if (appsCurrentOffset == 0) {
installedApps = Searcher.getInstalledApps({
"query": Evme.Searchbar.getValue()
});
}
-
+
options.hasInstalledApps = installedApps.length > 0;
Evme.Apps.load({
@@ -1461,7 +1459,7 @@ Evme.Brain = new function Evme_Brain() {
if (!exact && query.length < MINIMUM_LETTERS_TO_SEARCH) {
return;
}
-
+
requestSearch = Evme.DoATAPI.search({
"query": query,
"typeHint": type,
@@ -1484,7 +1482,7 @@ Evme.Brain = new function Evme_Brain() {
}
});
};
-
+
this.getInstalledApps = function getInstalledApps(options) {
if (!DISPLAY_INSTALLED_APPS) {
return [];
@@ -1520,11 +1518,11 @@ Evme.Brain = new function Evme_Brain() {
});
}
}
-
+
if (max) {
apps.splice(max);
}
-
+
return apps;
};
@@ -1598,14 +1596,14 @@ Evme.Brain = new function Evme_Brain() {
lastSearch.type = _type;
Evme.Apps.More.hide();
-
+
var method = _source == SEARCH_SOURCES.PAUSE? "updateApps" : "load";
// if just updating apps (user paused while typing) but we get different apps back from API- replace them instead of updating
if (method == "updateApps" && Evme.Apps.getAppsSignature() != Evme.Apps.getAppsSignature(apps)) {
method = "load";
}
-
+
var iconsResponse = Evme.Apps[method]({
"apps": apps,
"iconsFormat": iconsFormat,
@@ -1625,7 +1623,7 @@ Evme.Brain = new function Evme_Brain() {
"type": _type,
"isExact": isExactMatch
};
-
+
Evme.Apps.getElement().classList.add("has-more");
} else {
Evme.Apps.getElement().classList.remove("has-more");
View
22 apps/homescreen/everything.me/js/Core.js
@@ -46,20 +46,20 @@ window.Evme = new function Evme_Core() {
this.pageMove = function pageMove(value) {
Evme.BackgroundImage.changeOpacity(Math.floor(value*100)/100);
};
-
+
this.onShow = function onShow() {
document.body.classList.add('evme-displayed');
-
+
Evme.Shortcuts.refreshScroll();
Evme.Helper.refreshScroll();
};
this.onHide = function onHide() {
document.body.classList.remove('evme-displayed');
-
+
Evme.Brain.Shortcuts.doneEdit();
Evme.Brain.SmartFolder.closeCurrent();
};
-
+
this.onHideStart = function onHideStart(source) {
if (source === "homeButtonClick") {
if (
@@ -71,7 +71,7 @@ window.Evme = new function Evme_Core() {
) {
return true;
}
- }
+ }
Evme.Brain.Searchbar.blur();
return false; // allow navigation to homescreen
@@ -80,18 +80,18 @@ window.Evme = new function Evme_Core() {
function initObjects(data) {
Evme.ConnectionMessage.init({
});
-
+
Evme.Location.init({
-
+
});
-
+
Evme.Shortcuts.init({
"el": Evme.$("#shortcuts"),
"elLoading": Evme.$("#shortcuts-loading"),
"design": data.design.shortcuts,
"defaultShortcuts": data._defaultShortcuts
});
-
+
Evme.ShortcutsCustomize.init({
"elParent": Evme.Utils.getContainer()
});
@@ -129,6 +129,10 @@ window.Evme = new function Evme_Core() {
"defaultImage": data.defaultBGImage
});
+ Evme.Banner.init({
+ "el": Evme.$("#evmeBanner")
+ });
+
Evme.SearchHistory.init({
"maxEntries": data.maxHistoryEntries
});
View
2 apps/homescreen/everything.me/js/everything.me.js
@@ -77,6 +77,7 @@ var EverythingME = {
'js/Brain.js',
'modules/Apps/Apps.js',
'modules/BackgroundImage/BackgroundImage.js',
+ 'modules/Banner/Banner.js',
'modules/Dialog/Dialog.js',
'modules/Location/Location.js',
'modules/Shortcuts/Shortcuts.js',
@@ -102,6 +103,7 @@ var EverythingME = {
var css_files = ['css/common.css',
'modules/Apps/Apps.css',
'modules/BackgroundImage/BackgroundImage.css',
+ 'modules/Banner/Banner.css',
'modules/Dialog/Dialog.css',
'modules/Shortcuts/Shortcuts.css',
'modules/ShortcutsCustomize/ShortcutsCustomize.css',
View
57 apps/homescreen/everything.me/modules/Banner/Banner.css
@@ -0,0 +1,57 @@
+/* from building blocks, core.css - [role=dialog]*/
+.banner {
+ position: absolute;
+ background: orange;
+ width: 100%;
+ height: 8.13rem;
+ bottom: 0;
+ vertical-align: middle;
+ text-align: center;
+ background-attachment: scroll, scroll;
+ background-clip: border-box, border-box;
+ background-color: transparent;
+ background-image: url("/everything.me/images/shared/pattern.png"), url("/everything.me/images/shared/gradient.png");
+ background-origin: padding-box, padding-box;
+ background-position: left top, left top;
+ background-repeat: repeat, no-repeat;
+ background-size: auto auto, 100% 100%;
+ font-family: "MozTT",Sans-serif;
+ -moz-transition: all 600ms ease;
+ z-index: -1;
+ opacity: 0;
+}
+.banner.visible {
+ z-index: 10001;
+ opacity: 1;
+ -moz-transition: all 600ms ease;
+}
+.banner:before {
+ content: "";
+ display: inline-block;
+ height: 100%;
+ vertical-align: middle;
+ width: 1px;
+}
+.banner:after {
+ content: "";
+ display: inline-block;
+ height: 100%;
+ vertical-align: middle;
+ width: 1px;
+}
+.banner > p {
+ display: inline-block;
+ font-size: 1.56rem;
+ line-height: 2.34rem;
+ max-width: 75%;
+ vertical-align: middle;
+ white-space: normal;
+ color: #FFFFFF;
+ font-family: "MozTT",Sans-serif;
+}
+.banner > p > strong {
+ color: #0995B0;
+ font-weight: normal;
+ text-transform: uppercase;
+ white-space: nowrap;
+}
View
34 apps/homescreen/everything.me/modules/Banner/Banner.js
@@ -0,0 +1,34 @@
+Evme.Banner = new function Evme_Banner() {
+ var NAME = 'Banner', self = this,
+ el = null, timer_id = null, messageContainer = null;
+
+ this.init = function init(options) {
+ !options && (options = {});
+
+ el = options.el;
+ messageContainer = el.querySelector('p');
+ Evme.EventHandler.trigger(NAME, 'init');
+ };
+
+ this.show = function show(message, latency) {
+ if (timer_id)
+ clearTimeout(timer_id);
+
+ latency = latency || 4000;
+ timer_id = setTimeout((function bannerTimeout() {
+ timer_id = null;
+ this.hide();
+ }).bind(this), latency);
+
+ messageContainer.innerHTML = message;
+ el.classList.add('visible');
+ };
+
+ this.hide = function hide() {
+ el.classList.remove('visible');
+ };
+
+ this.getElement = function getElement() {
+ return el;
+ };
+}
View
3 apps/homescreen/index.html
@@ -109,6 +109,9 @@ <h1 id="search-title"></h1>
<div id="shortcuts-loading"></div>
</div>
</div>
+ <div id="evmeBanner" class="banner">
+ <p></p>
+ </div>
</div>
<div id="landing-page" data-current-page="true">
<div id="landing-time">
View
1 apps/homescreen/locales/homescreen.en-US.properties
@@ -6,6 +6,7 @@ address=Address
# Add app to homescreen from Ev.me
add-to-home-screen-question=Add {{name}} to Home Screen?
app-exists-in-home-screen={{name}} was already added to Home Screen
+app-added-to-home-screen={{name}} added to Home Screen
# Wrapper
wrapper-search-name={{topic}} on {{name}}
View
3 apps/homescreen/locales/homescreen.fr.properties
@@ -7,6 +7,7 @@ address=Adresse
# Add app to homescreen from Ev.me
add-to-home-screen-question=Ajouter {{name}} à l’écran d’accueil ?
app-exists-in-home-screen={{name}} a déjà été ajouté à l’écran d’accueil
+app-added-to-home-screen={{name}} added to Home Screen
# Wrapper
wrapper-search-name={{topic}} sur {{name}}
@@ -29,4 +30,4 @@ download=Télécharger
restart-download-title=Redémarrer le téléchargement
restart-download-body=Voulez-vous télécharger {{name}} ?
-# Evme
+# Evme
View
3 apps/homescreen/locales/homescreen.zh-TW.properties
@@ -6,6 +6,7 @@ address=網址
# Add app to homescreen from Ev.me
add-to-home-screen-question=新增 {{name}} 到裝置主畫面?
app-exists-in-home-screen={{name}} 已存在於裝置主畫面
+app-added-to-home-screen={{name}} added to Home Screen
# Wrapper
wrapper-search-name={{topic}} 於 {{name}}
@@ -25,7 +26,7 @@ remove=移除
loadingEvme=Everything.me
# Landing
-longDateFormat=%B %e 日 %A
+longDateFormat=%B %e 日 %A
# App reinstall
download=下載

0 comments on commit 291b991

Please sign in to comment.
Something went wrong with that request. Please try again.