Fix layout for resolution independent 06/75006/2
authorsangwan.kwon <sangwan.kwon@samsung.com>
Thu, 16 Jun 2016 02:26:45 +0000 (11:26 +0900)
committerkyungwook tak <k.tak@samsung.com>
Thu, 16 Jun 2016 09:03:26 +0000 (02:03 -0700)
Change-Id: I7647cd41233427572f6e149ff93b9f2015b3bdaa

src/framework/ui/popup/logic.cpp
src/framework/ui/popup/popup.cpp
src/framework/ui/popup/popup.h

index a0cc90e..917aeec 100755 (executable)
@@ -57,10 +57,10 @@ RawBuffer Logic::csPromptData(const std::string &message, const CsDetected &d) c
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone is<br>"
+       p.setHeader("  Malware which is harm your phone is"
                                "  detected.");
        p.setBody(FORMAT("  - Risk : " << risk << " (" << d.malwareName << ")"));
-       p.setFooter("  If you really want to process anyway,<br>"
+       p.setFooter("  If you really want to process anyway,"
                                "  tap ignore.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -89,15 +89,15 @@ RawBuffer Logic::csPromptFile(const std::string &message, const CsDetected &d) c
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone is<br>"
+       p.setHeader("  Malware which is harm your phone is"
                                "  detected.");
        p.setBody(FORMAT(
                "  - File name : " << fileName << "<br>" <<
                "  - Path : " << extraPath << "<br>" <<
                "  - Risk : " << risk << " (" << d.malwareName << ")"));
        p.setFooter(
-               "  Tap Delete to delete infected files and<br>"
-               "  protect your phone. If you really want to<br>"
+               "  Tap Delete to delete infected files and"
+               "  protect your phone. If you really want to"
                "  process anyway, tap Ignore.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -129,7 +129,7 @@ RawBuffer Logic::csPromptApp(const std::string &message, const CsDetected &d) co
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone<br>"
+       p.setHeader("  Malware which is harm your phone"
                                "  is detected.");
        p.setBody(FORMAT(
                "  App name : " << info.getLabel() << "<br>" <<
@@ -137,9 +137,9 @@ RawBuffer Logic::csPromptApp(const std::string &message, const CsDetected &d) co
                "  Risk : " << risk << " (" << d.malwareName << ")"));
        p.setIcon(info.getIconPath());
        p.setFooter(
-               "  Tap Uninstall to uninstall infected<br>"
-               "  application and protect your phone. If<br>"
-               "  you really want to process anyway, tap<br>"
+               "  Tap Uninstall to uninstall infected"
+               "  application and protect your phone. If"
+               "  you really want to process anyway, tap"
                "  Ignore.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -168,10 +168,10 @@ RawBuffer Logic::csNotifyData(const std::string &message, const CsDetected &d) c
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone is<br>"
+       p.setHeader("  Malware which is harm your phone is"
                                "  detected.");
        p.setBody(FORMAT("  - Risk : " << "High" << " (" << d.malwareName << ")"));
-       p.setFooter("  Processing is prohibited to protect<br>"
+       p.setFooter("  Processing is prohibited to protect"
                                "  your phone.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -194,14 +194,14 @@ RawBuffer Logic::csNotifyFile(const std::string &message, const CsDetected &d) c
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone is<br>"
+       p.setHeader("  Malware which is harm your phone is"
                                "  detected.");
        p.setBody(FORMAT(
                "  - File name : " << fileName << "<br>" <<
                "  - Path : " << extraPath << "<br>" <<
                "  - Risk : " << "High" << " (" << d.malwareName << ")"));
        p.setFooter(
-               "  Tap Delete to delete infected files and<br>"
+               "  Tap Delete to delete infected files and"
                "  protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -228,7 +228,7 @@ RawBuffer Logic::csNotifyApp(const std::string &message, const CsDetected &d) co
 
        p.setMessage(message);
        p.setTitle("  Malware detected");
-       p.setHeader("  Malware which is harm your phone is<br>"
+       p.setHeader("  Malware which is harm your phone is"
                                "  detected.");
        p.setIcon(info.getIconPath());
        p.setBody(FORMAT(
@@ -236,7 +236,7 @@ RawBuffer Logic::csNotifyApp(const std::string &message, const CsDetected &d) co
                "  Version : " << info.getVersion() << "<br>" <<
                "  Risk : " << "High" << " (" << d.malwareName << ")"));
        p.setFooter(
-               "  Tap Uninstall to uninstall infected<br>"
+               "  Tap Uninstall to uninstall infected"
                "  application and protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -268,7 +268,7 @@ RawBuffer Logic::wpPrompt(const std::string &message, const UrlItem &item) const
                "  - URL : " << item.url << "<br>" <<
                "  - Risk : " << risk));
        p.setFooter(
-               "  Accessing to this URL is prohibited to<br>"
+               "  Accessing to this URL is prohibited to"
                "  protect your phone.");
 
        p.setText(p.m_buttons[0], "OK");
@@ -293,7 +293,7 @@ RawBuffer Logic::wpNotify(const std::string &message, const UrlItem &item) const
                "  - URL : " << item.url << "<br>" <<
                "  - Risk : " << "High"));
        p.setFooter(
-               "   If you really want to process anyway,<br>"
+               "   If you really want to process anyway,"
                "   tap View");
 
        p.setText(p.m_buttons[0], "OK");
index 6835d2d..06ce285 100644 (file)
@@ -46,31 +46,30 @@ Popup::Popup(int buttonN)
        elm_win_indicator_opacity_set(m_win, ELM_WIN_INDICATOR_TRANSLUCENT);
        elm_win_borderless_set(m_win, EINA_TRUE);
        elm_win_alpha_set(m_win, EINA_TRUE);
+       elm_win_screen_size_get(m_win, NULL, NULL, &m_winW, &m_winH);
+       evas_object_size_hint_max_set(m_win, m_winW, m_winH);
+       evas_object_size_hint_min_set(m_win, m_winW, m_winH / 4);
 
        // Set popup properties.
        m_popup = elm_popup_add(m_win);
-       elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
-       evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       setDefaultProperties(m_popup);
 
        // Wrap objects with box.
        m_box = elm_box_add(m_popup);
-       evas_object_size_hint_weight_set(m_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_header, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       elm_box_padding_set(m_box, 10, 10);
+       setDefaultProperties(m_box);
+       elm_box_padding_set(m_box, 0, 20);
        evas_object_show(m_box);
 
        m_header = elm_label_add(m_box);
-       evas_object_size_hint_weight_set(m_header, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_header, EVAS_HINT_FILL, 0);
+       setDefaultProperties(m_header);
        elm_box_pack_end(m_box, m_header);
        evas_object_show(m_header);
 
        // Subbox is for icon.
        m_subBox = elm_box_add(m_box);
-       evas_object_size_hint_weight_set(m_subBox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_subBox, 0, 0);
+       setDefaultProperties(m_subBox);
        elm_box_horizontal_set(m_subBox, EINA_TRUE);
-
+       elm_box_padding_set(m_subBox, 20, 0);
        // If icon is not set, it doesn't appear.
        m_icon = elm_icon_add(m_subBox);
        elm_image_resizable_set(m_icon, EINA_FALSE, EINA_FALSE);
@@ -78,8 +77,7 @@ Popup::Popup(int buttonN)
        evas_object_show(m_icon);
 
        m_body = elm_label_add(m_subBox);
-       evas_object_size_hint_weight_set(m_body, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_body, EVAS_HINT_FILL, 0);
+       setDefaultProperties(m_body);
        elm_box_pack_end(m_subBox, m_body);
        evas_object_show(m_body);
 
@@ -88,17 +86,14 @@ Popup::Popup(int buttonN)
 
        // This label is for linking to webview.
        m_hypertext = elm_label_add(m_box);
-       elm_object_text_set(m_hypertext, "<a href=><color=#0000FFFF>"
-               "  More information</color></a>");
-       evas_object_size_hint_weight_set(m_hypertext, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_hypertext, 0, 0);
-       evas_object_size_hint_min_set(m_hypertext, 400, 80);
+       setDefaultProperties(m_hypertext);
+       setText(m_hypertext, "<a href=><color=#0000FFFF>"
+               "More information</color></a>");
        elm_box_pack_end(m_box, m_hypertext);
        evas_object_show(m_hypertext);
 
        m_footer = elm_label_add(m_box);
-       evas_object_size_hint_weight_set(m_footer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(m_footer, EVAS_HINT_FILL, 0);
+       setDefaultProperties(m_footer);
        elm_box_pack_end(m_box, m_footer);
        evas_object_show(m_footer);
 
@@ -126,17 +121,17 @@ Popup::~Popup()
 
 void Popup::setHeader(const std::string &header) noexcept
 {
-       setText(m_header, "<wrap = word>" + header + "</wrap>");
+       setText(m_header, header);
 }
 
 void Popup::setBody(const std::string &body) noexcept
 {
-       setText(m_body, "<wrap = word>" + body + "</wrap>");
+       setText(m_body, body);
 }
 
 void Popup::setFooter(const std::string &footer) noexcept
 {
-       setText(m_footer, "<br>""<wrap = word>" + footer + "</wrap>");
+       setText(m_footer, footer);
 }
 
 void Popup::setMessage(const std::string &msg) noexcept
@@ -169,8 +164,18 @@ void Popup::setTitle(const std::string &title) noexcept
        elm_object_part_text_set(m_popup, "title,text", title.c_str());
 }
 
+void Popup::setDefaultProperties(Evas_Object *obj) noexcept
+{
+       // Set width as maximum, height as minimum.
+       evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
+       // Set width as fill parent, height as center.
+       evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0.5);
+}
+
 void Popup::setText(Evas_Object *obj, const std::string &text) noexcept
 {
+       // Eable text line-break automatically.
+       elm_label_line_wrap_set(obj, ELM_WRAP_WORD);
        elm_object_text_set(obj, text.c_str());
 }
 
index e770006..350ee68 100644 (file)
@@ -83,6 +83,8 @@ public:
        std::vector<int> m_types;
 
 private:
+       void setDefaultProperties(Evas_Object *obj) noexcept;
+
        Evas_Object *m_win;
        Evas_Object *m_popup;
        Evas_Object *m_box;
@@ -97,6 +99,9 @@ private:
        std::string m_hypertextUrl;
 
        static int response;
+
+       int m_winW;
+       int m_winH;
 };
 
 } // namespace Ui