Adjust wearable popup UI 95/191295/11
authorErnest Borowski <e.borowski@partner.samsung.com>
Mon, 15 Oct 2018 12:11:55 +0000 (14:11 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Tue, 27 Nov 2018 06:02:36 +0000 (06:02 +0000)
Previously popup`s font size was calculated to fit 100% screen height.
Currently content will have constant font size.
Popup height will be variable and can be more than 100% screen height.

Change-Id: I553ef2f85535b403e0cd918a06751f16dfba7135
Signed-off-by: Ernest Borowski <e.borowski@partner.samsung.com>
src/notification-daemon/res/popup_custom.edc
src/notification-daemon/ui/PopupCheck.h
src/notification-daemon/ui/PopupCheckMobile.h
src/notification-daemon/ui/PopupCheckWearable.h

index 954f259c8bec09281e16761ac0d815459a717072..f7b316f1049a3be9689cbfa646f899a94dcbf9f5 100644 (file)
@@ -41,86 +41,40 @@ styles {
 
 group { name: "popup_checkview_internal"; //wearable
     parts {
-        part { name: "label"; // text: Allow ... priv_name
+        part { name: "elm.swallow.content"; // text: Allow ... priv_name
             scale: 1;
-            type: TEXTBLOCK;
-            desc { state: "default" 0.0;
-                visible: 1;
-                align: 0.5 0.5;
-                rel1.relative: 1.0 0.0;
-                rel1.to_x: "left_pad";
-                rel2.relative: 0.0 0.0;
-                rel2.to_x: "right_pad";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+                min: 0 100;
+                max: -1 100;
+                rel1.relative: 0.0 0.0;
+                rel1.offset: 0 -70;
+                rel2.relative: 1.0 1.0;
                 rel2.to_y: "elm.swallow.end";
-                rel2.offset: 0 0;
-                max: -1 210;
-                text {
-                    style: "small_text_style";
-                    fit: 0 1;
-                }
             }
         }
-
         part { name: "elm.swallow.end"; //checkbox
             scale: 1;
             type: SWALLOW;
             desc { state: "default" 0.0;
-                align: 0.5 0.5;
-                rel1.relative: 1.0 0.0;
-                rel1.to_x: "left_pad";
-                rel2.relative: 0.0 0.0;
-                rel2.to_x: "right_pad";
+                rel1.relative: 0.0 1.0;
+                rel1.to_y: "elm.swallow.content";
+                rel2.relative: 1.0 0.0;
                 rel2.to_y: "elm.privilege_counter";
-                rel2.offset: 0 150;
-                max: -1 10;
+                min: 20 20;
+                max: -1 100;
             }
         }
-
         part { name: "elm.privilege_counter";
             scale: 1;
-            type: TEXT;
+            type: SWALLOW;
             desc { state: "default" 0.0;
                 visible: 1;
-                align: 0.0 1.0;
-                rel1.relative: 1.0 1.0;
-                rel1.to_x: "left_pad";
-                rel1.to_y: "elm.swallow.end";
-                rel2.relative: 0.0 0.0;
-                rel2.to_x: "right_pad";
-                rel2.to_y: "bottom_pad";
-                rel2.offset: 0 80;
-                max: -1 25;
-                text {
-                    size: 20;
-                }
-            }
-        }
-        part { name: "bottom_pad";
-            scale: 1;
-            type: SPACER;
-            desc { state: "default" 0.0;
-                align: 0.0 1.0;
-                min: 0 4;
                 rel1.relative: 0.0 1.0;
-                rel1.offset: 0 50;
-            }
-        }
-        part { name: "left_pad";
-            scale: 1;
-            type: SPACER;
-            desc { state: "default" 0.0;
-                min: 16 0;
-                rel1.relative: 0.0 0.0;
-                rel2.relative: 0.0 1.0;
-            }
-        }
-        part { name: "right_pad";
-            scale: 1;
-            type: SPACER;
-            desc { state: "default" 0.0;
-                min: 16 0;
-                rel1.relative: 1.0 0.0;
+                rel1.to_y: "elm.swallow.end";
                 rel2.relative: 1.0 1.0;
+                min: 20 20;
+                max: -1 100;
             }
         }
     }
index f9e0fa7b62db4f3f654c2a7e3cfcc5b8be774070..b84ae3b42cf25d3e09efa59bdc5964f5947eca56 100644 (file)
@@ -48,17 +48,15 @@ public:
     void changePopupCounter() {
         if (m_privilegeCount == 1)
             return;
-        Evas_Object* obj = getAnimatedLayout();
-        if (!obj) {
-            ALOGE("Unable to get Evas_Object for changing privilege counter");
-            return;
-        }
 
         std::stringstream ss;
         ss << m_privilegeIndex << " / " << m_privilegeCount;
-        elm_object_part_text_set(obj, "elm.privilege_counter", ss.str().c_str());
+
+        changePopupCounterMsg(ss.str());
     }
 
+    virtual void changePopupCounterMsg(std::string counterMsg) = 0;
+
     void changePopupMessage() {
         changePopupTitle();
         changePopupCounter();
@@ -69,6 +67,7 @@ public:
     static void changePopupMessageCallback(void* data, Elm_Transit*) {
         PopupCheck *popupCheck = static_cast<PopupCheck*>(data);
         popupCheck->changePopupMessage();
+        popupCheck->resetPopupContentState();
     }
 
     static void enableButtonsAfterTransitionCallback(void* data, Elm_Transit*) {
@@ -130,6 +129,8 @@ public:
         return true;
     }
 
+    // optional method for reseting popup state during text transition
+    virtual void resetPopupContentState() {}
     virtual ~PopupCheck() {}
 
 protected:
index cf1028d4ba96fcdfcadea1f54e1a778f4afff5b6..4b6a3ba20dfd89267dda21d97a36c1d26ee897e4 100644 (file)
@@ -96,6 +96,10 @@ public:
         elm_object_content_set(m_popup, m_layout);
         evas_object_show(m_popup);
     }
+
+    virtual void changePopupCounterMsg(std::string counterMsg) {
+        elm_object_part_text_set(m_layout, "elm.privilege_counter", counterMsg.c_str());
+    }
     virtual void changePopupTitle() {
         // change content to next msg
         elm_object_text_set(m_content, m_msg.c_str());
index ab58552c0c5a359a44cc3fe8f509c5d41926ef12..77e48294ed95a40829cbd77684491d98c50b9787 100644 (file)
@@ -46,11 +46,13 @@ public:
         PopupCheckWearable *popup = static_cast<PopupCheckWearable*>(data);
 
         Po::setLocale();
-        elm_object_text_set(popup->m_content, Po::createPopupCheckMsg(popup->m_pkgId, popup->m_privacy).c_str());
         elm_object_text_set(popup->m_checkBox, Po::getCheckBoxMsg().c_str());
         elm_atspi_accessible_name_set(popup->m_allowButton, Po::getAllowButtonMsg().c_str());
         elm_atspi_accessible_name_set(popup->m_denyButton, Po::getDenyButtonMsg().c_str());
 
+        popup->m_msg = Po::createPopupCheckMsg(popup->m_pkgId, popup->m_privacy);
+        popup->changePopupTitle();
+        popup->resetPopupContentState();
     }
 
     virtual void create() {
@@ -120,7 +122,7 @@ public:
         elm_object_text_set(m_content, m_msg.c_str());
         elm_atspi_accessible_reading_info_type_set(m_content, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
         evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        elm_object_part_content_set(m_layoutInner, "label", m_content);
+        elm_object_part_content_set(m_layoutInner, "elm.swallow.content", m_content);
         evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
         m_checkBox = elm_check_add(m_popup);
@@ -129,12 +131,25 @@ public:
             throw Exception("Enlightenment failed");
         }
         elm_object_style_set(m_checkBox, "popup");
-        elm_object_text_set(m_checkBox, ("<font_size='20' valign='center'>" + Po::getCheckBoxMsg() + "</font_size>").c_str());
+        elm_object_text_set(m_checkBox, Po::getCheckBoxMsg().c_str());
         elm_check_state_set(m_checkBox, EINA_FALSE);
         evas_object_size_hint_align_set(m_checkBox, EVAS_HINT_FILL, 0.0);
         elm_object_part_content_set(m_layoutInner, "elm.swallow.end", m_checkBox);
         evas_object_show(m_checkBox);
 
+        m_counter = elm_label_add(m_layoutInner);
+        if (m_counter == nullptr) {
+            ALOGE("EFL : Failed to add counter");
+            throw Exception("Enlightenment failed");
+        }
+        elm_object_style_set(m_counter, "popup/default");
+        elm_label_line_wrap_set(m_counter, ELM_WRAP_MIXED);
+        elm_atspi_accessible_reading_info_type_set(m_counter, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+        evas_object_size_hint_weight_set(m_counter, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        elm_object_part_content_set(m_layoutInner, "elm.privilege_counter", m_counter);
+        evas_object_size_hint_align_set(m_counter, EVAS_HINT_FILL, EVAS_HINT_FILL);
+        evas_object_show(m_counter);
+
         m_allowButton = elm_button_add(m_popup);
         if (m_allowButton == nullptr) {
             ALOGE("EFL : Failed to add allow button");
@@ -180,15 +195,24 @@ public:
         evas_object_show(m_popup);
     }
 
+    virtual void changePopupCounterMsg(std::string counterMsg) {
+        elm_object_text_set(m_counter, counterMsg.c_str());
+    }
+
     virtual void changePopupTitle() {
         // change content to next msg
-        elm_object_part_text_set(m_layoutInner, "label", m_msg.c_str());
+        elm_object_text_set(m_content, m_msg.c_str());
     }
 
     virtual Evas_Object* getAnimatedLayout() {
         return m_layoutInner;
     }
 
+    virtual void resetPopupContentState() {
+        // reset popup scroller position
+        elm_scroller_page_show(m_scroller, 0, 0);
+    }
+
 private:
     Evas_Object *m_content = nullptr;
     Evas_Object *m_layout = nullptr;
@@ -197,6 +221,7 @@ private:
     Evas_Object *eext_scroller = nullptr;
     Eext_Circle_Surface *circle_surface = nullptr;
     Evas_Object *m_conform = nullptr;
+    Evas_Object *m_counter = nullptr;
     std::string m_pkgId;
     std::string m_privacy;
 };