waitingBox.append(waitingContent);
contentTransfer.append(waitingBox);
$('#content-start').trigger('create');
- $('#waitingBox').css("display", "table-cell");
this.app.countDown(10, $('#counter'));
+ this.verticalCenter($('#waitingBox'));
},
/**
/**
* @returns {string}
*/
+ showPopupWarning: function ui_showPopupWarning(){
+ setTimeout(function(){
+ $("#contact-nfc-error").popup("open",{"positionTo":"window"});
+ },500);
+ },
+
getTemporaryBoxContentHtml: function ui_getTemporaryBoxContentHtml() {
return '<p class="defaultText">'
+ 'Default card is not defined yet!<br/>'
* @param {string} lastName
* @returns {string}
*/
- getCommentHtml: function ui_getCommentHtml(firstName, lastName) {
- var html = '<div id="comment">'
+ getCommentHtml: function ui_getCommentHtml(data) {
+ return '<div id="comment">'
+ '<p class="comment">Your default contact</p>'
+ '<p class="comment" id="comment-name">'
- + (firstName || '') + ' ' + (lastName || '')
- + '</p>'
+ + data.caller + '</p>'
+ + '<p class="comment" id="comment-phone">'
+ + data.phoneNumber + '</p>'
+ '</div>';
- return html;
},
/**
contentStart = $('#content-start');
startBox = $('<div class="box" id="startBox"></div>');
gap = $('<div class="gap"></div>');
- comment = $(this.getCommentHtml(localStorage.firstName, localStorage.lastName));
+ comment = $(this.getCommentHtml(localStorage));
contentStart.empty();
startBox
} else {
this.loadStartContent();
}
+ $.mobile.activePage.page('refresh');
+ $('#start, #content-start').css("min-height", 0);
},
/**
if (contact.phoneNumber !== '') {
listElement = $(this.getContactsListElement(contact));
listElement
+ .data('caller', contact.caller)
.data('firstName', contact.firstName)
.data('lastName', contact.lastName)
.data('phoneNumber', contact.phoneNumber)
$.mobile.tizen.disableSelection(document);
},
- /**
- * Fix for height of the content area
- */
- fixContentHeight: function fixContentHeight() {
- var contentHeight = screen.availHeight - $('div[data-role="header"]').outerHeight() - $('div[data-role="footer"]').outerHeight();
- $('div[data-role="content"]').css('height', contentHeight);
+ verticalCenter: function (obj) {
+ var marginTop = ($(window).height()
+ - $('[data-role=header]:visible').height()
+ - $('[data-role=footer]:visible').height()
+ - obj.outerHeight())/2;
+ if (parseInt(obj.css('margin-top'), 10) !== marginTop) {
+ obj.hide().css('margin-top', marginTop).show();
+ }
},
defineEvents: function ui_defineEvents() {
if (self.app.started) {
self.loadStartPage();
}
+ self.verticalCenter($('#startBox'));
});
$('#start').on('pageshow', function () {
}
});
+ $('#start').one('pageshow', function () {
+ setTimeout(function () {
+ self.verticalCenter($('#startBox'));
+ }, 20);
+ });
+ $( "#contact-nfc-error" ).bind({
+ popupafterclose: function(){
+ tizen.application.getCurrentApplication().exit();
+ }
+ });
+
document.addEventListener('tizenhwkey', function(e) {
if (e.keyName == "back") {
if ($.mobile.activePage.attr('id') === 'start') {
tizen.application.getCurrentApplication().exit();
} else {
- history.back();
+ self.app.nfc.timeExpired();
+ }
+ }
+ });
+
+ document.addEventListener('webkitvisibilitychange', function () {
+ if(document.webkitVisibilityState === "visible") {
+ if ($.mobile.activePage.attr('id') === "choose") {
+ $.mobile.activePage.trigger('pageshow');
}
}
});
try {
var option = $(this).data('option');
if (option === 'read') {
- self.prepareWaitingPage('Card to Device', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ self.prepareWaitingPage('Card to device', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
self.app.nfc.card.setTagDetectRead();
} else if (option === 'write') {
- self.prepareWaitingPage('Device to Card', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ self.prepareWaitingPage('Device to card', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
self.app.nfc.card.setTagDetectWrite();
} else {
- self.prepareWaitingPage('Device to Device', 'PUT YOUR DEVICE<br>CLOSE TO<br>OTHER DEVICE');
+ self.prepareWaitingPage('Device to device', 'PUT YOUR DEVICE<br>CLOSE TO<br>OTHER DEVICE');
self.app.nfc.peer.setTargetDetect();
}
} catch (e) {