aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--biblez.appcache2
-rw-r--r--source/main.js7
-rw-r--r--source/moduleManager.js112
3 files changed, 72 insertions, 49 deletions
diff --git a/biblez.appcache b/biblez.appcache
index 6825257..553fe4a 100644
--- a/biblez.appcache
+++ b/biblez.appcache
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# v21 - 2014-05-04
+# v22 - 2014-05-05
CACHE:
icon.png
index.html
diff --git a/source/main.js b/source/main.js
index bd9b96e..e6a010f 100644
--- a/source/main.js
+++ b/source/main.js
@@ -108,11 +108,12 @@ enyo.kind({
create: function () {
this.inherited(arguments);
- /*if(enyo.platform.firefox)
- this.$.verseList.onScroll = "handleScrolling"; */
this.startUp();
- //this.$.mainPanel.setIndexDirect(2);
+ //improve scrolling performance on Android
+ if(this.$.verseList.getStrategy().get("kind") === "TranslateScrollStrategy")
+ this.$.verseList.getStrategy().set("translateOptimized", true);
+
},
startUp: function () {
diff --git a/source/moduleManager.js b/source/moduleManager.js
index f3eba4b..343963f 100644
--- a/source/moduleManager.js
+++ b/source/moduleManager.js
@@ -34,7 +34,7 @@ enyo.kind({
]}
]},
{name: "panelDescription", kind: "enyo.FittableRows", components: [
- {kind: enyo.Scroller, fit: true, components: [
+ {name: "descrScroller", kind: enyo.Scroller, fit: true, components: [
{name: "detailsContainer", showing: false, classes: "content-container", components: [
{name: "detailsName", classes: "title"},
{kind: "onyx.Button", ontap: "installModule", name: "btnInstall", classes: "onyx-affirmative", content: $L("Install Module"), style: "margin-left: 10px;"},
@@ -77,6 +77,13 @@ enyo.kind({
}
this.getInstalledModules();
this.started = true;
+
+ //improve scrolling performance on Android
+ if(this.$.langList.getStrategy().get("kind") === "TranslateScrollStrategy") {
+ this.$.langList.getStrategy().set("translateOptimized", true);
+ this.$.modList.getStrategy().set("translateOptimized", true);
+ this.$.descrScroller.getStrategy().set("translateOptimized", true);
+ }
},
getInstalledModules: function () {
@@ -129,18 +136,11 @@ enyo.kind({
this.saveRepoData(inRepos);
} else {
this.handleError(inError);
+ this.getReopsXHR();
}
}));
} else {
- var xhr = new enyo.Ajax({url: "http://zefanjas.de/apps/biblezMasterlist.php"});
- xhr.go();
- xhr.response(this, function (inSender, inRepos) {
- this.saveRepoData(inRepos);
- });
- xhr.error(this, function (inSender, inResponse) {
- console.log(inSender, inResponse);
- this.handleError({message: "Couldn't download MasterList!"});
- });
+ this.getReopsXHR();
}
});
} //else handle non firefox browser
@@ -150,6 +150,18 @@ enyo.kind({
}
},
+ getReopsXHR: function (){
+ var xhr = new enyo.Ajax({url: "http://zefanjas.de/apps/biblezMasterlist.php"});
+ xhr.go();
+ xhr.response(this, function (inSender, inRepos) {
+ this.saveRepoData(inRepos);
+ });
+ xhr.error(this, function (inSender, inResponse) {
+ this.log(inSender, inResponse);
+ this.handleError({message: "Couldn't download MasterList!"});
+ });
+ },
+
saveRepoData: function (inRepos) {
api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}},
enyo.bind(this, function (inError, inId) {
@@ -202,22 +214,13 @@ enyo.kind({
if(!inError) {
if(!allModules) allModules = {id: "downloadedModules"};
this.handleGotRemoteModules(allModules, inModules, inRepo);
-
} else {
this.handleError((inError.message) ? inError.message : inError);
+ this.getRemoteModulesXHR(inRepo, allModules);
}
}));
} else {
- var xhr = new enyo.Ajax({url: "http://zefanjas.de/apps/biblezModules.php"});
- xhr.go({modUrl: inRepo.url});
- xhr.response(this, function (inSender, inModules) {
- inModules = api.cleanArray(inModules).sort(api.dynamicSortMultiple("Lang", "moduleKey"));
- if(!allModules) allModules = {id: "downloadedModules"};
- this.handleGotRemoteModules(allModules, inModules, inRepo);
- });
- xhr.error(this, function (inSender, inResponse) {
- this.handleError({message: "Couldn't download Modules!"});
- });
+ this.getRemoteModulesXHR(inRepo, allModules);
}
});
} //else handle non firefox browser
@@ -232,6 +235,19 @@ enyo.kind({
},
+ getRemoteModulesXHR: function (inRepo, allModules) {
+ var xhr = new enyo.Ajax({url: "http://zefanjas.de/apps/biblezModules.php"});
+ xhr.go({modUrl: inRepo.url});
+ xhr.response(this, function (inSender, inModules) {
+ inModules = api.cleanArray(inModules).sort(api.dynamicSortMultiple("Lang", "moduleKey"));
+ if(!allModules) allModules = {id: "downloadedModules"};
+ this.handleGotRemoteModules(allModules, inModules, inRepo);
+ });
+ xhr.error(this, function (inSender, inResponse) {
+ this.handleError({message: "Couldn't download Modules!"});
+ });
+ },
+
handleGotRemoteModules: function(allModules, inModules, inRepo) {
allModules[inRepo.name.replace(" ", "")] = {modules: inModules, name: inRepo.name};
api.put(allModules, enyo.bind(this, function (inError, inId) {
@@ -321,34 +337,39 @@ enyo.kind({
this.$.progressBar.animateProgressTo(inEvent.loaded/inEvent.total*100);
}));
} else {
- this.$.progressBar.setShowStripes(true);
- var xhr = new XMLHttpRequest({mozSystem: true, mozAnon: true});
- var url = "http://zefanjas.de/apps/biblezGetModule.php?modKey="+this.currentModule.moduleKey+"&type="+this.currentRepo.type;
- xhr.open('GET', url, true);
- xhr.responseType = "blob";
- xhr.onreadystatechange = enyo.bind(this, function (evt) {
- //console.log(xhr.readyState, evt, xhr.status);
- if (xhr.readyState == 4) {
- if(xhr.status === 200)
- sword.installMgr.installModule(xhr.response, enyo.bind(this, this.handleInstalled));
- else
- this.handleError({message: "Couldn't download module.", error: xhr.status});
- }
- });
- xhr.onprogress = enyo.bind(this, function (inEvent) {
- this.$.progressBar.animateProgressTo(100);
- });
- xhr.onerror = enyo.bind(this, function (inError) {
- this.handleError({message: "Couldn't download Module!"});
- this.$.btnInstall.show();
- this.$.btnRemove.hide();
- });
- xhr.send(null);
+ this.installModuleXHR();
}
});
}
},
+ installModuleXHR: function () {
+ this.$.progressBar.setShowStripes(true);
+ var xhr = new XMLHttpRequest({mozSystem: true, mozAnon: true});
+ var url = "http://zefanjas.de/apps/biblezGetModule.php?modKey="+this.currentModule.moduleKey+"&type="+this.currentRepo.type;
+ xhr.open('GET', url, true);
+ xhr.responseType = "blob";
+ xhr.onreadystatechange = enyo.bind(this, function (evt) {
+ //console.log(xhr.readyState, evt, xhr.status);
+ if (xhr.readyState == 4) {
+ if(xhr.status === 200)
+ sword.installMgr.installModule(xhr.response, enyo.bind(this, this.handleInstalled));
+ else
+ this.handleError({message: "Couldn't download module.", error: xhr.status});
+ }
+ });
+ xhr.onprogress = enyo.bind(this, function (inEvent) {
+ this.$.progressBar.animateProgressTo(100);
+ });
+ xhr.onerror = enyo.bind(this, function (inError) {
+ this.handleError({message: "Couldn't download Module!"});
+ this.$.btnInstall.show();
+ this.$.btnInstall.setDisabled(false);
+ this.$.btnRemove.hide();
+ });
+ xhr.send(null);
+ },
+
handleInstalled: function (inError, inModule) {
if (!inError) {
this.doInstalled();
@@ -356,10 +377,11 @@ enyo.kind({
this.$.btnInstall.hide();
this.$.btnRemove.show();
} else {
- console.log(inError);
+ this.log(inError);
this.handleError(inError);
this.$.btnInstall.show();
this.$.btnRemove.hide();
+ this.installModuleXHR();
}
this.$.progressBar.hide();
this.$.progressBar.setProgress(0);