added new (android toast like) notification
This commit is contained in:
parent
124ebe8938
commit
6d198182da
2 changed files with 27 additions and 3 deletions
|
@ -57,6 +57,7 @@ enyo.kind({
|
||||||
onPrefReset: "resetPreferences"
|
onPrefReset: "resetPreferences"
|
||||||
}
|
}
|
||||||
]},
|
]},
|
||||||
|
{name: "toaster", kind: "HtmlContent"},
|
||||||
{name: "dropbox", kind: "Dropbox",
|
{name: "dropbox", kind: "Dropbox",
|
||||||
onAuthSuccess: "enableDropbox",
|
onAuthSuccess: "enableDropbox",
|
||||||
onAuthFailure: "disableDropbox",
|
onAuthFailure: "disableDropbox",
|
||||||
|
@ -298,7 +299,7 @@ enyo.kind({
|
||||||
if (inEvent.error) {
|
if (inEvent.error) {
|
||||||
console.log("error: "+inEvent.error.message);
|
console.log("error: "+inEvent.error.message);
|
||||||
} else {
|
} else {
|
||||||
enyo.windows.addBannerMessage(inEvent.path + " saved", "{}");
|
this.showToast(inEvent.path + " saved");
|
||||||
console.log(inEvent.path + " saved...");
|
console.log(inEvent.path + " saved...");
|
||||||
console.log(inEvent.bytes + " bytes...");
|
console.log(inEvent.bytes + " bytes...");
|
||||||
}
|
}
|
||||||
|
@ -377,7 +378,7 @@ enyo.kind({
|
||||||
} else {
|
} else {
|
||||||
console.log("went offline...");
|
console.log("went offline...");
|
||||||
if (this.preferences["offline"] == false) {
|
if (this.preferences["offline"] == false) {
|
||||||
enyo.windows.addBannerMessage("offline mode", "{}");
|
this.showToast("offline mode");
|
||||||
this.preferences["offline"] = true;
|
this.preferences["offline"] = true;
|
||||||
this.$.preferenceView.$.offline.setChecked(true);
|
this.$.preferenceView.$.offline.setChecked(true);
|
||||||
}
|
}
|
||||||
|
@ -387,7 +388,7 @@ enyo.kind({
|
||||||
fail: function(inSender, inResponse, inRequest) {
|
fail: function(inSender, inResponse, inRequest) {
|
||||||
console.log("error");
|
console.log("error");
|
||||||
console.log(JSON.stringify(inResponse));
|
console.log(JSON.stringify(inResponse));
|
||||||
enyo.windows.addBannerMessage(inResponse.error, "{}");
|
this.showToast(inResponse.error);
|
||||||
},
|
},
|
||||||
|
|
||||||
enableDropbox: function() {
|
enableDropbox: function() {
|
||||||
|
@ -413,6 +414,15 @@ enyo.kind({
|
||||||
this.preferences["dboxtoken"] = "";
|
this.preferences["dboxtoken"] = "";
|
||||||
this.preferences["dboxsecret"] = "";
|
this.preferences["dboxsecret"] = "";
|
||||||
localStorage.setItem("TodoPreferences", JSON.stringify(this.preferences));
|
localStorage.setItem("TodoPreferences", JSON.stringify(this.preferences));
|
||||||
|
},
|
||||||
|
|
||||||
|
showToast: function(message) {
|
||||||
|
this.$.toaster.setContent("<div id=\"toast\">" +
|
||||||
|
message + "</div>");
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var toast = document.getElementById("toast");
|
||||||
|
toast.style.opacity = 0;
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,3 +34,17 @@
|
||||||
.ver-history { font-size: 16px; }
|
.ver-history { font-size: 16px; }
|
||||||
.version { font-weight: bold;}
|
.version { font-weight: bold;}
|
||||||
.enyo-modaldialog > * { height:100%; }
|
.enyo-modaldialog > * { height:100%; }
|
||||||
|
#toast {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20%;
|
||||||
|
left: 50%;
|
||||||
|
width: 200px;
|
||||||
|
margin-left: -100px;
|
||||||
|
border: 1px solid #666;
|
||||||
|
background-color: #444;
|
||||||
|
color: #FFF;
|
||||||
|
padding: 10px 0 ;
|
||||||
|
text-align:center;
|
||||||
|
opacity: .9;
|
||||||
|
-webkit-transition: opacity 0.5s ease-out;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue