};
App.Ui.prototype = {
- popup: null,
-
prepareCallerName: function ui_prepareCallerName(contact) {
var callerName, firstName, lastName;
},
/**
- *
- * @param {string} message
- * @param {string} onclick
- * @returns {string}
- */
- getPopupHtml: function ui_getPopupHtml(message, onclick) {
- var html = '<div id="popup" data-role="popupwindow"'
- + ' data-style="center_basic_1btn">'
- + '<p data-role="text">' + message + '</p>'
- + '<div data-role="button-bg">'
- + '<a href="#" data-role="button" data-inline="true"'
- + ' onclick="' + onclick + '">OK</a>'
- + '</div>'
- + '</div>';
- return html;
- },
-
- /**
* Show a popup
* @param {string} message
- * @param {jQuery} page
*/
- showPopup: function ui_showPopup(message, page) {
- this.popup = $(this.getPopupHtml(message, "app.ui.closePopup();"));
- page.append(this.popup);
- page.trigger('create');
- this.popup.data('page', page);
- this.popup.popupwindow('open');
+ showPopup: function ui_showPopup(message) {
+ var popup = $("#alertPopup");
+ if(!popup.hasClass('ui-popup')) {
+ popup.popup().trigger('create');
+ }
+ $(".ui-popup-text", popup).text(message);
+ popup.popup("open", {positionTo: 'window'});
},
closePopup: function ui_closePopup() {
- var page = this.popup.data('page');
- page.data('monit', '');
- this.popup.popupwindow('close');
- this.popup.remove();
- this.popup = null;
+ var activePopup = $.mobile.popup.active;
+ if (activePopup) {
+ if (activePopup.attr('id') === 'alertPopup') {
+ activePopup.close();
+ }
+ }
},
createListRecord: function ui_createListRecord() {
$('#start').on('pageshow', function () {
var obj = $(this), monit = obj.data('monit');
if (monit !== '' && monit !== undefined) {
- self.showPopup(obj.data('monit'), obj);
+ self.showPopup(obj.data('monit'));
+ obj.data('monit', '');
}
self.verticalCenter($('.box'));
setTimeout(function () {
document.addEventListener('tizenhwkey', function(e) {
if (e.keyName == "back") {
- if ($.mobile.activePage.attr('id') === 'start') {
+ if ($.mobile.popup.active) {
+ $.mobile.popup.active.close();
+ } else if ($.mobile.activePage.attr('id') === 'start') {
tizen.application.getCurrentApplication().exit();
} else {
self.app.nfc.timeExpired();