Permalink
Browse files

Merge pull request #7241 from vingtetun/homescreen-e.me.systembanner

Bug 821456 - Provide feedback to user that e.me successfully added to th...
  • Loading branch information...
2 parents 85b6f11 + 291b991 commit b4f1debc70bec303e16fef2e8e68722a385ba4ae @vingtetun vingtetun committed Dec 28, 2012
@@ -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");
Oops, something went wrong.

0 comments on commit b4f1deb

Please sign in to comment.