[ContactsExchanger] updated ContactsExchanger sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Fri, 30 Aug 2013 07:13:19 +0000 (09:13 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Fri, 30 Aug 2013 07:13:19 +0000 (09:13 +0200)
Change-Id: Ib8592aa56e1ebb51537e83bc95befe42cb0df4e8

index.html
js/app.ui.js

index 92afd2c..f44d911 100644 (file)
 
                <div data-role="footer" id="footer-contact" data-position="fixed"></div>
        </div>
+       <div id="popupContainer" data-role="page">
+               <div data-role="popup" id="alertPopup">
+                       <div class="ui-popup-text"></div>
+                       <div class="ui-popup-button-bg">
+                               <a data-role="button" data-rel="back" data-inline="true">
+                                       OK
+                               </a>
+                       </div>
+               </div>
+       </div>
 </body>
 
 </html>
index 3b46782..74c709c 100644 (file)
@@ -12,8 +12,6 @@ App.Ui = null;
        };
 
        App.Ui.prototype = {
-               popup: null,
-
                prepareCallerName: function ui_prepareCallerName(contact) {
                        var callerName, firstName, lastName;
 
@@ -37,42 +35,25 @@ App.Ui = null;
                },
 
                /**
-                *
-                * @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() {
@@ -539,7 +520,8 @@ App.Ui = null;
                        $('#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 () {
@@ -562,7 +544,9 @@ App.Ui = null;
 
                        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();