TizenRefApp-4984 Implement Navibar-class 38/51638/4
authorDmytro Dragan <dm.dragan@samsung.com>
Wed, 11 Nov 2015 14:06:06 +0000 (16:06 +0200)
committerDmytro Dragan <dm.dragan@samsung.com>
Thu, 12 Nov 2015 09:53:24 +0000 (11:53 +0200)
Change-Id: I1d345cfb0d1d6bc2e151fd1e9e1ec5c7bcc8ae27
Signed-off-by: Dmytro Dragan <dm.dragan@samsung.com>
19 files changed:
edje/images/core_icon_back.png [new file with mode: 0644]
edje/images/core_icon_expand_close.png [new file with mode: 0644]
edje/images/core_icon_expand_open.png [new file with mode: 0644]
res/edje/button_theme.edc
src/Common/Controller/inc/FrameController.h
src/Common/Controller/src/FrameController.cpp
src/Common/Utils/inc/TextDecorator.h
src/Common/Utils/src/TextDecorator.cpp
src/Common/View/inc/NaviFrameItem.h
src/Common/View/inc/View.h
src/Common/View/src/NaviFrameItem.cpp
src/Common/View/src/NaviFrameView.cpp
src/Conversation/Controller/src/Conversation.cpp
src/MsgThread/Controller/src/MsgThread.cpp
src/MsgThread/Controller/src/MsgThreadSearch.cpp
src/Settings/Controller/src/MsgOnSimCard.cpp
src/Settings/Controller/src/Settings.cpp
src/Viewer/Controller/src/Viewer.cpp
test/TC/TestTextDecorator.cpp

diff --git a/edje/images/core_icon_back.png b/edje/images/core_icon_back.png
new file mode 100644 (file)
index 0000000..1dad23a
Binary files /dev/null and b/edje/images/core_icon_back.png differ
diff --git a/edje/images/core_icon_expand_close.png b/edje/images/core_icon_expand_close.png
new file mode 100644 (file)
index 0000000..125f436
Binary files /dev/null and b/edje/images/core_icon_expand_close.png differ
diff --git a/edje/images/core_icon_expand_open.png b/edje/images/core_icon_expand_open.png
new file mode 100644 (file)
index 0000000..6742e6f
Binary files /dev/null and b/edje/images/core_icon_expand_open.png differ
index 1985772..0ace281 100755 (executable)
@@ -35,7 +35,7 @@
 
 collections {
 
-    base_scale: 1.8;
+    base_scale: 2.6;
 
 externals {
    external: "elm";
@@ -2877,4 +2877,640 @@ group { \
 
 MSG_BUBBLE_BUTTON_STYLE_TRANSLATE("translate_button", "M01_circle_button.png", "M01_circle_button_press.png", "M01_circle_button_dim.png", "M01_btn_translate.png")
 
+#define BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC 80 80
+#define BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC 80 80
+#define BUTTON_NAVIFRAME_BACK_CORNER_RADIUS "10"
+#define GLIDE_EASE_OUT(duration) CUBIC_BEZIER (duration) 0.25 0.46 0.45 1.0
+#define BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE 250 250 250 255
+#define BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE 61 185 204 255
+   group {
+      name: "elm/button/base/naviframe/arrow_back";
+      data.item: "vector_ux" "no_bg";
+      data.item: "corner_radius" BUTTON_NAVIFRAME_BACK_CORNER_RADIUS;
+      images {
+               image: "core_icon_back.png" COMP;
+      }
+      script {
+         public mouse_down = 0;
+         public multi_down = 0;
+         public animate = 0;
+         public disabled = 0;
+      }
+      parts {
+         part {
+            name: "button_bg";
+            type: SPACER;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "effect_spacer";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               fixed: 1 1;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.5 0.5;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+            }
+         }
+         part {
+            name: "tizen_vg_shape";
+            type: SWALLOW;
+            clip_to: "tizen_vg_shape_clipper";
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               fixed: 1 1;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.5 0.5;
+            }
+            description {
+               state: "ready" 0.0;
+               rel1.to: "effect_spacer";
+               rel2.to: "effect_spacer";
+               rel1.relative: 0.15 0.15;
+               rel2.relative: 0.85 0.85;
+            }
+            description {
+               state: "pressed" 0.0;
+               inherit: "ready" 0.0;
+               rel1.relative: 0.0 0.0;
+               rel2.relative: 1.0 1.0;
+            }
+         }
+         part {
+            name: "tizen_vg_shape_clipper";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               color: 0 0 0 0;
+               visible: 0;
+               fixed: 1 1;
+               rel1.to: "tizen_vg_shape";
+               rel2.to: "tizen_vg_shape";
+            }
+            description {
+               state: "ready" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+            description {
+               state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               color: 0 0 0 77;
+               visible: 1;
+            }
+         }
+         part {
+            name: "button_icon";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               fixed: 1 1;
+               color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE;
+               image.normal: "core_icon_back.png";
+            }
+            description {
+               state: "blue" 0.0;
+               inherit: "default" 0.0;
+               color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE;
+            }
+         }
+         part {
+            name: "event";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1.to: "button_bg";
+               rel2.to: "button_bg";
+               color: 0 0 0 0;
+            }
+         }
+      }
+      programs {
+         program {
+            name: "pressed_effect";
+            action: STATE_SET "ready" 0.0;
+            target: "tizen_vg_shape_clipper";
+            target: "tizen_vg_shape";
+            after: "pressed_effect2";
+         }
+         program {
+            name: "pressed_effect2";
+            action: STATE_SET "pressed" 0.0;
+            target: "tizen_vg_shape_clipper";
+            target: "tizen_vg_shape";
+            transition: GLIDE_EASE_OUT(0.15);
+            after: "pressed_effect3";
+         }
+         program {
+            name: "pressed_effect3";
+            script {
+               set_int(animate, 0);
+            }
+         }
+         program {
+            name: "delay_unpressed_effect";
+            in: 0.1 0.0;
+            after: "unpressed_effect";
+         }
+         program {
+            name: "unpressed_effect";
+            script {
+               run_program(PROGRAM:"unpressed_effect2");
+            }
+         }
+         program {
+            name: "unpressed_effect2";
+            action: STATE_SET "ready" 0.0;
+            target: "tizen_vg_shape_clipper";
+            transition: GLIDE_EASE_OUT(0.45);
+            after: "unpressed_effect3";
+         }
+         program {
+            name: "unpressed_effect3";
+            action: STATE_SET "default" 0.0;
+            target: "tizen_vg_shape";
+            target: "tizen_vg_shape_clipper";
+         }
+         program {
+            name: "pressed";
+            signal: "mouse,down,1*";
+            source: "event";
+            script {
+               if (get_int(multi_down) == 0) {
+                  set_int(mouse_down, 1);
+                  set_int(animate, 1);
+                  emit("elm,action,press", "");
+                  run_program(PROGRAM:"pressed_effect");
+               }
+            }
+         }
+         program {
+            name: "unpressed";
+            signal: "mouse,up,1";
+            source: "event";
+            script {
+               if (get_int(mouse_down) == 1) {
+                  set_int(mouse_down, 0);
+                  if (get_int(disabled) == 0) {
+                     if (get_int(animate) == 0) {
+                        run_program(PROGRAM:"unpressed_effect");
+                     }
+                     else {
+                        set_state(PART:"tizen_vg_shape", "pressed", 0.0);
+                        set_state(PART:"tizen_vg_shape_clipper", "pressed", 0.0);
+                        set_int(animate, 0);
+                        run_program(PROGRAM:"delay_unpressed_effect");
+                     }
+                     emit("elm,action,unpress", "");
+                  }
+               }
+            }
+         }
+         program {
+            name: "button_click";
+            signal: "mouse,clicked,1";
+            source: "event";
+            script {
+               if (get_int(multi_down) == 0) {
+                  run_program(PROGRAM:"clicked_signal");
+               }
+            }
+         }
+         program {
+            name: "play_sound";
+            action: RUN_PLUGIN "touch_sound";
+         }
+         program {
+            name: "clicked_signal";
+            in: 0.001 0.0;
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program {
+            name: "enable";
+            signal: "elm,state,enabled";
+            source: "elm";
+            script {
+               set_int(disabled, 0);
+            }
+         }
+         program {
+            name: "disable";
+            signal: "elm,state,disabled";
+            source: "elm";
+            script {
+               set_int(disabled, 1);
+            }
+         }
+         program {
+            name: "multi_down";
+            signal: "elm,action,multi,down";
+            source: "elm";
+            script {
+               set_int(multi_down, 1);
+            }
+         }
+         program {
+            name: "multi_up";
+            signal: "elm,action,multi,up";
+            source: "elm";
+            script {
+               set_int(multi_down, 0);
+            }
+         }
+         program {
+            name: "pass_event_enable";
+            signal: "elm,event,pass,enabled";
+            source: "elm";
+            script {
+               set_mouse_events(PART:"event", 0);
+            }
+         }
+         program {
+            name: "pass_event_disable";
+            signal: "elm,event,pass,disabled";
+            source:"elm";
+            script {
+               set_mouse_events(PART:"event", 1);
+            }
+         }
+         program {
+            name: "repeat_event_enable";
+            signal: "elm,event,repeat,enabled";
+            source: "elm";
+            script {
+              set_repeat_events(PART:"event", 1);
+            }
+         }
+         program {
+            name: "repeat_event_disable";
+            signal: "elm,event,repeat,disabled";
+            source:"elm";
+            script {
+               set_repeat_events(PART:"event", 0);
+            }
+         }
+         program {
+            name: "make_blue";
+            signal: "button,color,blue";
+            source: "*";
+            action: STATE_SET "blue" 0.0;
+            target: "button_icon";
+         }
+         program {
+            name: "make_white";
+            signal: "button,color,white";
+            source: "*";
+            action: STATE_SET "default" 0.0;
+            target: "button_icon";
+         }
+      }
+   }
+
+   group {
+      name: "elm/button/base/naviframe/arrow_down";
+      data.item: "vector_ux" "no_bg";
+      data.item: "corner_radius" BUTTON_NAVIFRAME_BACK_CORNER_RADIUS;
+      images {
+         image: "core_icon_expand_close.png" COMP;
+         image: "core_icon_expand_open.png" COMP;
+      }
+      script {
+         public mouse_down = 0;
+         public multi_down = 0;
+         public animate = 0;
+         public disabled = 0;
+      }
+      parts {
+         part {
+            name: "button_bg";
+            type: SPACER;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               fixed: 1 1;
+            }
+         }
+         part {
+            name: "effect_spacer";
+            type: SPACER;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               fixed: 1 1;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.5 0.5;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+            }
+         }
+         part {
+            name: "tizen_vg_shape";
+            type: SWALLOW;
+            clip_to: "tizen_vg_shape_clipper";
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               fixed: 1 1;
+               rel1.relative: 0.5 0.5;
+               rel2.relative: 0.5 0.5;
+            }
+            description {
+               state: "ready" 0.0;
+               rel1.to: "effect_spacer";
+               rel2.to: "effect_spacer";
+               rel1.relative: 0.15 0.15;
+               rel2.relative: 0.85 0.85;
+            }
+            description {
+               state: "pressed" 0.0;
+               inherit: "ready" 0.0;
+               rel1.relative: 0.0 0.0;
+               rel2.relative: 1.0 1.0;
+            }
+         }
+         part {
+            name: "tizen_vg_shape_clipper";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               color: 0 0 0 0;
+               visible: 0;
+               fixed: 1 1;
+               rel1.to: "tizen_vg_shape";
+               rel2.to: "tizen_vg_shape";
+            }
+            description {
+               state: "ready" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+            description {
+               state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               color: 0 0 0 77;
+               visible: 1;
+            }
+         }
+         part {
+            name: "button_icon";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+               fixed: 1 1;
+               image.normal: "core_icon_expand_close.png";
+            }
+            description {
+               state: "expanded" 0.0;
+               inherit: "default" 0.0;
+               image.normal: "core_icon_expand_open.png";
+            }
+         }
+         part {
+            name: "color_rect";
+            type: RECT;
+            scale: 1;
+            clip_to: "button_icon";
+            description {
+               state: "default" 0.0;
+               rel1.to: "button_icon";
+               rel2.to: "button_icon";
+               color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE;
+            }
+            description {
+               state: "blue" 0.0;
+               inherit: "default" 0.0;
+               color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE;
+            }
+         }
+         part {
+            name: "event";
+            type: RECT;
+            scale: 1;
+            description {
+               state: "default" 0.0;
+               rel1.to: "button_bg";
+               rel2.to: "button_bg";
+               color: 0 0 0 0;
+            }
+         }
+      }
+      programs {
+         program {
+            name: "pressed_effect";
+            action: STATE_SET "ready" 0.0;
+            target: "tizen_vg_shape_clipper";
+            target: "tizen_vg_shape";
+            after: "pressed_effect2";
+         }
+         program {
+            name: "pressed_effect2";
+            action: STATE_SET "pressed" 0.0;
+            target: "tizen_vg_shape_clipper";
+            target: "tizen_vg_shape";
+            transition: GLIDE_EASE_OUT(0.15);
+            after: "pressed_effect3";
+         }
+         program {
+            name: "pressed_effect3";
+            script {
+               set_int(animate, 0);
+            }
+         }
+         program {
+            name: "delay_unpressed_effect";
+            in: 0.1 0.0;
+            after: "unpressed_effect";
+         }
+         program {
+            name: "unpressed_effect";
+            script {
+               run_program(PROGRAM:"unpressed_effect2");
+            }
+         }
+         program {
+            name: "unpressed_effect2";
+            action: STATE_SET "ready" 0.0;
+            target: "tizen_vg_shape_clipper";
+            transition: GLIDE_EASE_OUT(0.45);
+            after: "unpressed_effect3";
+         }
+         program {
+            name: "unpressed_effect3";
+            action: STATE_SET "default" 0.0;
+            target: "tizen_vg_shape";
+            target: "tizen_vg_shape_clipper";
+         }
+         program {
+            name: "pressed";
+            signal: "mouse,down,1*";
+            source: "event";
+            script {
+               if (get_int(multi_down) == 0) {
+                  set_int(mouse_down, 1);
+                  set_int(animate, 1);
+                  emit("elm,action,press", "");
+                  run_program(PROGRAM:"pressed_effect");
+               }
+            }
+         }
+         program {
+            name: "unpressed";
+            signal: "mouse,up,1";
+            source: "event";
+            script {
+               if (get_int(mouse_down) == 1) {
+                  set_int(mouse_down, 0);
+                  if (get_int(disabled) == 0) {
+                     if (get_int(animate) == 0) {
+                        run_program(PROGRAM:"unpressed_effect");
+                     }
+                     else {
+                        set_state(PART:"tizen_vg_shape", "pressed", 0.0);
+                        set_state(PART:"tizen_vg_shape_clipper", "pressed", 0.0);
+                        set_int(animate, 0);
+                        run_program(PROGRAM:"delay_unpressed_effect");
+                     }
+                     emit("elm,action,unpress", "");
+                  }
+               }
+            }
+         }
+         program {
+            name: "button_click";
+            signal: "mouse,clicked,1";
+            source: "event";
+            script {
+               if (get_int(multi_down) == 0) {
+                  run_program(PROGRAM:"clicked_signal");
+               }
+            }
+         }
+         program {
+            name: "play_sound";
+            action: RUN_PLUGIN "touch_sound";
+         }
+         program {
+            name: "clicked_signal";
+            in: 0.001 0.0;
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program {
+            name: "enable";
+            signal: "elm,state,enabled";
+            source: "elm";
+            script {
+               set_int(disabled, 0);
+            }
+         }
+         program {
+            name: "disable";
+            signal: "elm,state,disabled";
+            source: "elm";
+            script {
+               set_int(disabled, 1);
+            }
+         }
+         program {
+            name: "multi_down";
+            signal: "elm,action,multi,down";
+            source: "elm";
+            script {
+               set_int(multi_down, 1);
+            }
+         }
+         program {
+            name: "multi_up";
+            signal: "elm,action,multi,up";
+            source: "elm";
+            script {
+               set_int(multi_down, 0);
+            }
+         }
+         program {
+            name: "pass_event_enable";
+            signal: "elm,event,pass,enabled";
+            source: "elm";
+            script {
+               set_mouse_events(PART:"event", 0);
+            }
+         }
+         program {
+            name: "pass_event_disable";
+            signal: "elm,event,pass,disabled";
+            source:"elm";
+            script {
+               set_mouse_events(PART:"event", 1);
+            }
+         }
+         program {
+            name: "repeat_event_enable";
+            signal: "elm,event,repeat,enabled";
+            source: "elm";
+            script {
+               set_repeat_events(PART:"event", 1);
+            }
+         }
+         program {
+            name: "repeat_event_disable";
+            signal: "elm,event,repeat,disabled";
+            source:"elm";
+            script {
+               set_repeat_events(PART:"event", 0);
+            }
+         }
+         program {
+            name: "make_blue";
+            signal: "button,color,blue";
+            source: "*";
+            action: STATE_SET "blue" 0.0;
+            target: "color_rect";
+         }
+         program {
+            name: "make_white";
+            signal: "button,color,white";
+            source: "*";
+            action: STATE_SET "default" 0.0;
+            target: "color_rect";
+         }
+         program {
+            name: "make_expand";
+            signal: "button,expand";
+            source: "*";
+            action: STATE_SET "expanded" 0.0;
+            target: "button_icon";
+         }
+         program {
+            name: "make_collapse";
+            signal: "button,collapse";
+            source: "*";
+            action: STATE_SET "default" 0.0;
+            target: "button_icon";
+         }
+      }
+   }
 }
index 71c511d..d1d1f99 100644 (file)
@@ -49,6 +49,9 @@ namespace Msg
             ContextPopup &getCtxPopup();
             void resetCtxPopup();
 
+            // NaviFrameItem
+            virtual void onViewItemCreated();
+
         private:
             Popup *m_pPopup;
             ContextPopup *m_pCtxPopup;
index 4f0a28c..b8c7a0f 100644 (file)
@@ -90,5 +90,8 @@ void FrameController::resetCtxPopup()
     }
 }
 
-
+void FrameController::onViewItemCreated()
+{
+    NaviFrameItem::onViewItemCreated();
+}
 
index 394a074..a162206 100644 (file)
@@ -24,6 +24,7 @@ namespace Msg
 {
     enum class TextAlign
     {
+        None,
         Left,
         Center,
         Right
@@ -37,7 +38,7 @@ namespace Msg
 
         public:
             TextStyle();
-            TextStyle(int size, const std::string &color, TextAlign align = TextAlign::Left);
+            TextStyle(int size, const std::string &color, TextAlign align = TextAlign::None);
             ~TextStyle();
 
             void setColor(const std::string &color);
@@ -61,7 +62,7 @@ namespace Msg
             static std::string make(const std::string &text,
                                     int size = TextStyle::defaultFontSize,
                                     const std::string &color = TextStyle::defaultColor,
-                                    TextAlign align = TextAlign::Left);
+                                    TextAlign align = TextAlign::None);
     };
 }
 
index d0d5bad..c8878ad 100644 (file)
@@ -48,7 +48,7 @@ namespace
 
 TextStyle::TextStyle()
     : m_Color(defaultColor)
-    , m_Align(TextAlign::Left)
+    , m_Align(TextAlign::None)
     , m_Size(defaultFontSize)
 {
 }
@@ -106,8 +106,16 @@ std::string TextDecorator::make(const std::string &text,
                                 TextAlign align)
 {
     std::ostringstream ss;
-    ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color) << OPEN_TAG("align", alignAsString(align));
+    ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color);
+    if (align != TextAlign::None)
+    {
+        ss << OPEN_TAG("align", alignAsString(align));
+    }
     ss << text;
-    ss << CLOSE_TAG("color") << CLOSE_TAG("font_size") << CLOSE_TAG("align");
+    if (align != TextAlign::None)
+    {
+        ss << CLOSE_TAG("align");
+    }
+    ss << CLOSE_TAG("color") << CLOSE_TAG("font_size");
     return ss.str();
 }
index 2a2646c..7c982f0 100644 (file)
@@ -19,6 +19,7 @@
 #define NaviFrameItem_h_
 
 #include "ViewItem.h"
+#include "View.h"
 
 #include <string>
 #include <memory>
@@ -38,7 +39,9 @@ namespace Msg
             {
                 NaviCancelButtonId = 0,
                 NaviOkButtonId,
+                NaviCenterButtonId,
                 NaviPrevButtonId,
+                NaviDownButtonId,
                 NaviButtonMax
             };
 
@@ -57,59 +60,81 @@ namespace Msg
         protected:
             virtual void onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) {};
 
+            //ViewItem
+            virtual void onViewItemCreated();
+
         private:
             NaviFrameView &m_Owner;
             NaviBar *m_pNaviBar;
     };
 
     class NaviFrameItem::NaviBar
+        :public View
     {
         friend class NaviFrameItem;
 
         public:
+            enum NaviColorId
+            {
+                NaviBlueColorId = 0,
+                NaviWhiteColorId,
+                NaviColorMax
+            };
+
+        public:
             NaviFrameItem &getOwner();
             const NaviFrameItem &getOwner() const;
-            void show(bool value, bool transition = false);
-            bool isVisible();
+            void setVisible(bool visible);
             void setTitle(const std::string &title);
             void setTitle(const TText &title);
             std::string getTitle() const;
-            void setBadge(const std::string &badge);
-            void showBadge(bool value);
-            std::string getBadge() const;
             void showButton(NaviButtonId id, bool value);
             void disabledButton(NaviButtonId id, bool value);
+            void setButtonText(NaviButtonId id, const std::string &text);
+            void setButtonText(NaviButtonId id, const TText &text);
+            void clearBar();
+            void switchToSearch(Evas_Object *searchPanel);
+            void setColor(NaviColorId id);
+            void expandDownButton(bool value);
 
         private:
 
             NaviBar(NaviFrameItem &onwer);
-            ~NaviBar();
+            virtual ~NaviBar();
 
             void getButton(NaviButtonId id);
+            void setButtonColor(NaviButtonId id, NaviColorId titleColor);
             void showCancelButtonPart(bool value);
             void showOkButtonPart(bool value);
-            void setContent(Evas_Object * obj, const char *part);
+            void showCenterButtonPart(bool value, bool expand = false);
+            void showPrevButtonPart(bool value);
+            void showDownButtonPart(bool value);
+            void initNaviBar();
 
             static void on_button_clicked(void *data, Evas_Object *obj, void *event_info);
+            static void on_button_delete(void *data, Evas *e, Evas_Object *obj, void *event_info);
 
         private:
             struct ButtonStruct
             {
-                ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr)
+                ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr, const char *d = "IDS_MSG_OPT_DEFAULT")
                     : button(b)
                     , part(p)
                     , style(s)
+                    , default_text_id(d)
                 {
                 }
                 Evas_Object *button;
                 const char *part;
                 const char *style;
+                const char *default_text_id;
             };
 
         private:
             NaviFrameItem &m_Owner;
             std::string m_Badge;
             ButtonStruct ButtonList[NaviButtonMax];
+            NaviColorId m_CurrentColor;
     };
 }
 
index e83b778..578e16b 100644 (file)
@@ -166,7 +166,7 @@ namespace Msg
 
     inline void View::setText(const std::string &text, const char *part)
     {
-        setText(part, text.c_str());
+        setText(text.c_str(), part);
     }
 
     inline void View::setText(const TText &text, const char *part)
index 7156e83..35b74fb 100644 (file)
 
 
 #include "NaviFrameItem.h"
+#include "NaviFrameView.h"
 #include "Logger.h"
+#include "TextDecorator.h"
 
 using namespace Msg;
 
 namespace
 {
-    const char *okButtonPart = "title_right_btn";
-    const char *cancelButtonPart = "title_left_btn";
-    const char *prevButtonPart = "elm.swallow.prev_btn";
-    const char *okButtonStyle = "naviframe/title_done";
-    const char *cancelButtonStyle = "naviframe/title_cancel";
-    const char *prevButtonStyle = "naviframe/back_btn/default";
+    const char *titleStyleName = "title";
+    const char *naviTitlePart = "title";
+    const char *titleTextPart = "text.center";
+    const char *okButtonPart = "swallow.right";
+    const char *cancelButtonPart = "swallow.left";
+    const char *prevButtonPart = "swallow.left";
+    const char *downButtonPart = "swallow.right";
+    const char *centerButtonPart = "swallow.center";
+    const char *okButtonStyle = "naviframe/title_right";
+    const char *cancelButtonStyle = "naviframe/title_left";
+    const char *prevButtonStyle = "naviframe/arrow_back";
+    const char *downButtonStyle = "naviframe/arrow_down";
+    const char *cancelButtonDefTextId = "IDS_MSG_ACBUTTON_CANCEL_ABB";
+    const char *okButtonDefTextId = "IDS_MSG_ACBUTTON_DONE_ABB";
     const char *badgePart = "title_badge";
     const char *buttonTypeKey = "BTkey";
+    const char *textColorWhiteTitleButtons = "#3db9cc";
+    const char *textColorBlueTitleButtons = "#fafafa";
+    const int textSizeTitleButtons = 32;
 }
 
 NaviFrameItem::NaviFrameItem(NaviFrameView &owner)
@@ -42,7 +55,6 @@ NaviFrameItem::NaviFrameItem(NaviFrameView &owner)
 
 NaviFrameItem::~NaviFrameItem()
 {
-    delete m_pNaviBar;
 }
 
 const NaviFrameItem::NaviBar &NaviFrameItem::getNaviBar() const
@@ -68,14 +80,22 @@ const NaviFrameView &NaviFrameItem::getOwner() const
 NaviFrameItem::NaviBar::NaviBar(NaviFrameItem &onwer)
     : m_Owner(onwer)
     , ButtonList()
+    , m_CurrentColor(NaviBlueColorId)
 {
-    ButtonList[NaviCancelButtonId] = ButtonStruct(nullptr, cancelButtonPart, cancelButtonStyle);
-    ButtonList[NaviOkButtonId] = ButtonStruct(nullptr, okButtonPart, okButtonStyle);
+    ButtonList[NaviCancelButtonId] = ButtonStruct(nullptr, cancelButtonPart, cancelButtonStyle, cancelButtonDefTextId);
+    ButtonList[NaviOkButtonId] = ButtonStruct(nullptr, okButtonPart, okButtonStyle, okButtonDefTextId);
+    //TODO: implement style for center button
+    ButtonList[NaviCenterButtonId] = ButtonStruct(nullptr, centerButtonPart, prevButtonStyle);
     ButtonList[NaviPrevButtonId] = ButtonStruct(nullptr, prevButtonPart, prevButtonStyle);
+    ButtonList[NaviDownButtonId] = ButtonStruct(nullptr, downButtonPart, downButtonStyle);
 }
 
 NaviFrameItem::NaviBar::~NaviBar()
 {
+    for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++)
+    {
+        evas_object_del(ButtonList[iter].button);
+    }
 }
 
 NaviFrameItem &NaviFrameItem::NaviBar::getOwner()
@@ -88,58 +108,41 @@ const NaviFrameItem &NaviFrameItem::NaviBar::getOwner() const
     return m_Owner;
 }
 
-void NaviFrameItem::NaviBar::show(bool value, bool transition)
-{
-    elm_naviframe_item_title_enabled_set(m_Owner.getElmObjItem(), value, transition);
-}
-
-bool NaviFrameItem::NaviBar::isVisible()
+//TODO: fix show (update title part in naviframe item manually)
+void NaviFrameItem::NaviBar::setVisible(bool visible)
 {
-    return elm_naviframe_item_title_enabled_get(m_Owner.getElmObjItem());
+    const char *sig = visible ? "title,state,show" :"title,state,hide";
+    emitSignal(sig, "*");
+    elm_naviframe_item_title_visible_set(getOwner(), visible);
 }
 
 void NaviFrameItem::NaviBar::setTitle(const std::string &title)
 {
-    m_Owner.setText(title);
+    setText(title, titleTextPart);
 }
 
 void NaviFrameItem::NaviBar::setTitle(const TText &title)
 {
-    m_Owner.setText(title);
+    setText(title, titleTextPart);
 }
 
 std::string NaviFrameItem::NaviBar::getTitle() const
 {
-    return m_Owner.getText();
-}
-
-void NaviFrameItem::NaviBar::setBadge(const std::string &badge)
-{
-    elm_object_item_part_text_set(m_Owner.getElmObjItem(), badgePart, badge.c_str());
-}
-
-void NaviFrameItem::NaviBar::showBadge(bool value)
-{
-    const char *sig = value ? "elm,state,title_badge,show" :"elm,state,title_badge,hide";
-    m_Owner.emitSignal(sig);
-}
-
-std::string NaviFrameItem::NaviBar::getBadge() const
-{
-    const char *text = elm_object_item_part_text_get(m_Owner.getElmObjItem(), badgePart);
-    return text ? text : std::string();
+    return getText(titleTextPart);
 }
 
 void NaviFrameItem::NaviBar::getButton(NaviButtonId id)
 {
     if(!ButtonList[id].button)
     {
-        Evas_Object *parent = getOwner().getWidget();
+        Evas_Object *parent = getEo();
         Evas_Object *btn = elm_button_add(parent);
         ButtonList[id].button = btn;
         elm_object_style_set(btn, ButtonList[id].style);
+        setButtonText(id, msgt(ButtonList[id].default_text_id));
         evas_object_data_set(btn, buttonTypeKey, (void*)id);
         evas_object_smart_callback_add(btn, "clicked", on_button_clicked, this);
+        evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, on_button_delete, this);
     }
 }
 
@@ -149,24 +152,40 @@ void NaviFrameItem::NaviBar::showButton(NaviButtonId id, bool value)
     {
         getButton(id);
 
-        if(!getOwner().getContent(ButtonList[id].part))
-            getOwner().setContent(ButtonList[id].button, ButtonList[id].part);
-
+        if(!getContent(ButtonList[id].part) != ButtonList[id].button)
+            setContent(ButtonList[id].button, ButtonList[id].part);
+        setButtonColor(id, m_CurrentColor);
         evas_object_show(ButtonList[id].button);
     }
     else
     {
-        evas_object_hide(ButtonList[id].button);
+        if (getContent(ButtonList[id].part) == ButtonList[id].button)
+        {
+            elm_object_part_content_unset(getEo(),ButtonList[id].part);
+            evas_object_hide(ButtonList[id].button);
+        }
     }
 
     switch(id)
     {
         case NaviCancelButtonId:
-            showOkButtonPart(value);
+            showCancelButtonPart(value);
             break;
 
         case NaviOkButtonId:
-            showCancelButtonPart(value);
+            showOkButtonPart(value);
+            break;
+
+        case NaviCenterButtonId:
+            showCenterButtonPart(value);
+            break;
+
+        case NaviPrevButtonId:
+            showPrevButtonPart(value);
+            break;
+
+        case NaviDownButtonId:
+            showDownButtonPart(value);
             break;
 
         default:
@@ -181,14 +200,34 @@ void NaviFrameItem::NaviBar::disabledButton(NaviButtonId id, bool value)
 
 void NaviFrameItem::NaviBar::showCancelButtonPart(bool value)
 {
-    const char *sig = value ? "elm,state,title_left_btn,show" : "elm,state,title_left_btn,hide";
-    m_Owner.emitSignal(sig);
+    const char *sig = value ? "cancel,show,btn" : "left,clear";
+    emitSignal(sig, "*");
 }
 
 void NaviFrameItem::NaviBar::showOkButtonPart(bool value)
 {
-    const char *sig = value ? "elm,state,title_right_btn,show" : "elm,state,title_right_btn,hide";
-    m_Owner.emitSignal(sig);
+    const char *sig = value ? "done,show,btn" : "right,clear";
+    emitSignal(sig, "*");
+}
+
+void NaviFrameItem::NaviBar::showCenterButtonPart(bool value, bool expand)
+{
+    const char *sig = value ? "center,show,btn" : "center,hide,btn";
+    emitSignal(sig, "*");
+}
+
+void NaviFrameItem::NaviBar::showPrevButtonPart(bool value)
+{
+    const char *sig1 = value ? "back,show,btn" : "left,clear";
+    const char *sig2 = value ? "empty,right,show" : "right,clear";
+    emitSignal(sig1, "*");
+    emitSignal(sig2, "*");
+}
+
+void NaviFrameItem::NaviBar::showDownButtonPart(bool value)
+{
+    const char *sig = value ? "down,show,btn" : "right,clear";
+    emitSignal(sig, "*");
 }
 
 void NaviFrameItem::NaviBar::on_button_clicked(void *data, Evas_Object *obj, void *event_info)
@@ -197,3 +236,124 @@ void NaviFrameItem::NaviBar::on_button_clicked(void *data, Evas_Object *obj, voi
     int type = (int)evas_object_data_get(obj, buttonTypeKey);
     naviBar->getOwner().onButtonClicked(naviBar->getOwner(), (NaviButtonId)type);
 }
+
+void NaviFrameItem::NaviBar::on_button_delete(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+    NaviFrameItem::NaviBar *naviBar = static_cast<NaviFrameItem::NaviBar*>(data);
+    int type = (int)evas_object_data_get(obj, buttonTypeKey);
+    naviBar->ButtonList[type] = nullptr;
+}
+
+void NaviFrameItem::onViewItemCreated()
+{
+    ViewItem::onViewItemCreated();
+    m_pNaviBar->initNaviBar();
+    setContent(*m_pNaviBar, naviTitlePart);
+}
+
+void NaviFrameItem::NaviBar::initNaviBar()
+{
+    setEo(elm_layout_add(m_Owner.getOwner()));
+    std::string edjPath = ResourceUtils::getResourcePath(MSG_TITLE_EDJ_PATH);
+    elm_layout_file_set(getEo(), edjPath.c_str(), titleStyleName);
+}
+
+void NaviFrameItem::NaviBar::setColor(NaviColorId id)
+{
+    switch(id)
+    {
+        case NaviBlueColorId:
+            emitSignal("title,color,blue", "*");
+            m_CurrentColor = NaviBlueColorId;
+            break;
+
+        case NaviWhiteColorId:
+            emitSignal("title,color,white", "*");
+            m_CurrentColor = NaviWhiteColorId;
+            break;
+
+        default:
+            break;
+    }
+}
+
+void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const std::string &text)
+{
+    elm_object_text_set(ButtonList[id].button, text.c_str());
+}
+
+void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const TText &text)
+{
+    elm_object_domain_translatable_text_set(ButtonList[id].button, text.getDomain(), text.getMsg());
+}
+
+void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleColor)
+{
+    // Note that, button's color is opposite to title's color
+    if (id == NaviPrevButtonId || id == NaviDownButtonId)
+    {
+        switch(titleColor)
+        {
+            case NaviBlueColorId:
+                elm_object_signal_emit(ButtonList[id].button, "button,color,white", "*");
+                break;
+
+            case NaviWhiteColorId:
+                elm_object_signal_emit(ButtonList[id].button, "button,color,blue", "*");
+                break;
+
+            default:
+                break;
+        }
+    }
+    else
+    {
+        TextStyle style;
+
+        switch(titleColor)
+        {
+            case NaviBlueColorId:
+                style.setColor(textColorBlueTitleButtons);
+                break;
+
+            case NaviWhiteColorId:
+                style.setColor(textColorWhiteTitleButtons);
+                break;
+
+            default:
+                break;
+        }
+        style.setSize(textSizeTitleButtons);
+        const char *buttonText = elm_object_text_get(ButtonList[id].button);
+        if (buttonText != nullptr)
+        {
+            setButtonText(id, TextDecorator::make(buttonText, style).c_str());
+        }
+    }
+}
+
+void NaviFrameItem::NaviBar::clearBar()
+{
+    emitSignal("sides,clear", "*");
+    for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++)
+    {
+        evas_object_hide(elm_object_part_content_unset(getEo(), ButtonList[iter].part));
+    }
+}
+
+void NaviFrameItem::NaviBar::switchToSearch(Evas_Object *searchPanel)
+{
+    //TODO: implement switchToSearch
+}
+
+void NaviFrameItem::NaviBar::expandDownButton(bool value)
+{
+    if (!value)
+    {
+        elm_object_signal_emit(ButtonList[NaviDownButtonId].button, "button,expand", "*");
+    }
+    else
+    {
+        elm_object_signal_emit(ButtonList[NaviDownButtonId].button, "button,collapse", "*");
+    }
+}
index 0d42907..ec962ca 100644 (file)
 
 using namespace Msg;
 
+namespace
+{
+    const char *naviTitleStyleEmpty = "empty";
+}
+
 NaviFrameView::NaviFrameView(Evas_Object *parent)
     : View()
 {
@@ -53,6 +58,7 @@ bool NaviFrameView::isLastFrame() const
 void NaviFrameView::push(NaviFrameItem &item, Evas_Object *content)
 {
     Elm_Object_Item *it = elm_naviframe_item_push(getEo(), NULL, NULL, NULL, content, NULL);
+    elm_naviframe_item_style_set(it, naviTitleStyleEmpty);
     item.setElmObjItem(it);
 }
 
index f7439c6..336b7e4 100644 (file)
@@ -224,7 +224,9 @@ void Conversation::onMsgStorageChange()
 
 void Conversation::onViewItemCreated()
 {
+    FrameController::onViewItemCreated();
     getNaviBar().setTitle("Conversation");
+    getNaviBar().setColor(NaviBar::NaviWhiteColorId);
     setHwButtonListener(getContent(), this);
 }
 
index c159305..8fc6331 100644 (file)
@@ -77,7 +77,9 @@ MsgThread::~MsgThread()
 
 void MsgThread::onViewItemCreated()
 {
+    FrameController::onViewItemCreated();
     getNaviBar().setTitle(msgt("IDS_MSG_HEADER_MESSAGES"));
+    getNaviBar().setColor(NaviBar::NaviBlueColorId);
     setHwButtonListener(getContent(), this);
 }
 
index 2e7da13..f86d40e 100644 (file)
@@ -40,7 +40,7 @@ void MsgThread::setSearchMode(bool value)
 
     m_pLayout->showSearchPanel(value);
     m_pSearchPanel->setEntryFocus(value);
-    getNaviBar().show(!value);
+    getNaviBar().setVisible(!value);
 }
 
 void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj)
index 44d925b..f9083b5 100644 (file)
@@ -64,7 +64,9 @@ void MsgOnSimCard::create()
 
 void MsgOnSimCard::onViewItemCreated()
 {
+    FrameController::onViewItemCreated();
     setTitleTranslatable();
+    getNaviBar().setColor(NaviBar::NaviWhiteColorId);
     setHwButtonListener(getContent(), this);
 
  /*   auto list = getMsgEngine().getStorage().getSimMsgList();
index af8a72e..a3075d8 100644 (file)
@@ -364,7 +364,9 @@ void Settings::autoRetRoamingItemHandler(SettingsListItem &item)
 
 void Settings::onViewItemCreated()
 {
+    FrameController::onViewItemCreated();
     getNaviBar().setTitle("Settings");
+    getNaviBar().setColor(NaviBar::NaviWhiteColorId);
 }
 
 Evas_Object *Settings::getContent()
index b7aa163..0dae0d9 100644 (file)
@@ -36,7 +36,9 @@ Viewer::~Viewer()
 
 void Viewer::onViewItemCreated()
 {
+    FrameController::onViewItemCreated();
     getNaviBar().setTitle("Viewer");
+    getNaviBar().setColor(NaviBar::NaviBlueColorId);
     setHwButtonListener(getContent(), this);
 }
 
index 61a07b5..38da18c 100644 (file)
@@ -55,5 +55,5 @@ TEST( TestTextDecorator, defaultFormatTest )
     ASSERT_NE(foundPos, std::string::npos);
 
     foundPos = result.find("<align=left");
-    ASSERT_NE(foundPos, std::string::npos);
+    ASSERT_EQ(foundPos, std::string::npos);
 }