[UI] Generic list popup added. Clock mode view added. 50/122850/5
authorMichal Skorupinski <m.skorupinsk@samsung.com>
Mon, 3 Apr 2017 16:14:26 +0000 (18:14 +0200)
committerKiseok Chang <kiso.chang@samsung.com>
Tue, 11 Apr 2017 07:09:02 +0000 (16:09 +0900)
TODO:
 * Popup list item styles.
 * System layout button update.
 * Popup style.

* svace warning is fixed in view_clock_mode.c (kiseok chang)

Change-Id: Ibcd46782588f092490eece315772fa97d9d7cccb
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
Signed-off-by: Kiseok Chang <kiso.chang@samsung.com>
13 files changed:
CMakeLists.txt
include/define.h
include/view/common/view_generic_popup.h
include/view/system/view_clock_mode.h [new file with mode: 0644]
res/settings.edc
res/view/common/popup_2btns.edc
res/view/common/popup_list.edc [new file with mode: 0644]
src/layout/layout_system.c
src/main.c
src/view/common/view_generic_popup.c
src/view/system/view_clock_mode.c [new file with mode: 0755]
src/view/system/view_language.c
src/view/system/view_voice_control.c

index 00237ed..1908608 100755 (executable)
@@ -93,6 +93,7 @@ SET(SRCS
        src/view/picture/view_picture_tint.c
        src/view/system/view_clock.c
        src/view/system/view_voice_control.c
+       src/view/system/view_clock_mode.c
        src/view/system/view_language.c
        src/view/system/view_reset.c
        src/view/view_base.c
index 478372e..6ce391a 100644 (file)
@@ -28,6 +28,7 @@
 
 /* View ID - System */
 #define VIEW_CLOCK "VIEW_CLOCK"
+#define VIEW_CLOCK_MODE "VIEW_CLOCK_MODE"
 #define VIEW_LANGUAGE "VIEW_LANGUAGE"
 #define VIEW_VOICE_CONTROL "VOICE_CONTROL"
 #define VIEW_RESET "VIEW_RESET"
@@ -48,6 +49,7 @@
 
 #define GRP_VIEW_POPUP_BUTTONS_LIST "grp.view.popup_buttons_list"
 #define GRP_VIEW_POPUP_2BTNS "grp.view.popup_2btns"
+#define GRP_VIEW_POPUP_LIST "grp.view.popup_list"
 #define GRP_VIEW_GENERIC_SLIDER "grp.view.generic_slider"
 
 #define GRP_VIEW_TOAST_MESSAGE "grp.toast.message"
@@ -93,7 +95,8 @@
 
 #define PART_POPUP_BTN_BOX "popup.btn.box"
 
-#define PART_POPUP_NAME "part.popup.name"
+#define PART_POPUP_TITLE "part.popup.name"
+#define PART_POPUP_LIST "part.popup.list"
 
 #define PART_WIFI_POPUP_BTN_CANCEL "part.popup.bottom.cancel"
 #define PART_WIFI_POPUP_BTN_OK "part.popup.bottom.ok"
index 8504025..82e438c 100644 (file)
@@ -40,6 +40,8 @@ typedef struct {
        input_handler *handler;                 /**< popup's input handler */
        int buttns_count;                       /**< popup's buttons count - valid for popups with buttons only */
        const char **btn_texts;                 /**< labels to be set on popup's buttons - valid for popup with buttons only */
+       int items_count;
+       const char **item_texts;
        int (*ui_id_on_show_focus)(void);       /**< callback function to be invoked when popup is shown;
                                                * returns ID of the widget that should receive focus first.
                                                */
diff --git a/include/view/system/view_clock_mode.h b/include/view/system/view_clock_mode.h
new file mode 100644 (file)
index 0000000..24988de
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VIEW_CLOCK_MODE_H_
+#define VIEW_CLOCK_MODE_H_
+
+/**
+* @brief Get the pointer to the view_class object of clock mode view.
+*
+* @return The pointer to clock mode view_class object.
+*/
+view_class *view_clock_mode_get_vclass(void);
+
+#endif /* VIEW_CLOCK_MODE_H_ */
index 347e8c5..683e78c 100644 (file)
@@ -54,4 +54,5 @@ collections {
        #include "layout/system.edc"
        #include "layout/voice.edc"
        #include "view/common/toast_message.edc"
+       #include "view/common/popup_list.edc"
 }
index 8f7569a..36363f4 100644 (file)
@@ -42,7 +42,7 @@ group {
                }
 
                part {
-                       name, PART_POPUP_NAME;
+                       name, PART_POPUP_TITLE;
                        type, TEXT;
                        scale, 1;
                        description {
@@ -67,8 +67,8 @@ group {
                        description {
                                state, "default" 0.0;
                                min, 0 32;
-                               rel1 { to, PART_POPUP_NAME; relative, 0.0 1.0; }
-                               rel2.to, PART_POPUP_NAME;
+                               rel1 { to, PART_POPUP_TITLE; relative, 0.0 1.0; }
+                               rel2.to, PART_POPUP_TITLE;
                                align, 0.5 0.0;
                                fixed, 0 1;
                        }
diff --git a/res/view/common/popup_list.edc b/res/view/common/popup_list.edc
new file mode 100644 (file)
index 0000000..f7085ee
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+       name: GRP_VIEW_POPUP_LIST;
+       parts {
+               part {
+                       name: "tint";
+                       type: RECT;
+                       scale: 0;
+                       description {
+                               state: "default" 0.0;
+                               rel1.relative: 0.0 0.0;
+                               rel2.relative: 1.0 1.0;
+                               color: 0 0 0 128;
+                       }
+               }
+               part {
+                       name: "title_bg";
+                       type: RECT;
+                       scale: 0;
+                       description {
+                               state: "default" 0.0;
+                               rel1.to: PART_POPUP_TITLE;
+                               rel2.to: PART_POPUP_TITLE;
+                               min: 0 52;
+                               color: 0 0 255 255;
+                       }
+               }
+               part {
+                       name: PART_POPUP_TITLE;
+                       type: TEXT;
+                       scale: 0;
+                       description {
+                               state: "default" 0.0;
+                               rel1.relative: 0.0 -1.0;
+                               rel1.to: PART_POPUP_LIST;
+                               rel2.relative: 1.0  0.0;
+                               rel2.to: PART_POPUP_LIST;
+                               align: 0.5 1.0;
+                               color: COLOR_TEXT_POPUP;
+                               text {
+                                       font: FONT_LIGHT;
+                                       size: 32;
+                                       min: 0 1;
+                                       max: 0 1;
+                               }
+                       }
+               }
+               part {
+                       name: "bg";
+                       type: RECT;
+                       scale: 0;
+                       description {
+                               state: "default" 0.0;
+                               rel1.to: PART_POPUP_LIST;
+                               rel2.to: PART_POPUP_LIST;
+                               color: 255 255 255 255;
+                       }
+               }
+               part {
+                       name: PART_POPUP_LIST;
+                       type: SWALLOW;
+                       scale: 0;
+                       description {
+                               state: "default" 0.0;
+                               rel1.relative: 0.40 0.48;
+                               rel2.relative: 0.60 0.52;
+                       }
+               }
+       }
+}
\ No newline at end of file
index e020482..9ac5bee 100755 (executable)
@@ -142,7 +142,7 @@ static void _selected(void *data, int id)
 {
        switch (id) {
        case MENU_CLOCK:
-               if (!viewmgr_push_view(VIEW_CLOCK))
+               if (!viewmgr_show_view(VIEW_CLOCK_MODE))
                        _ERR("Push Clock view failed.");
                break;
        case MENU_LANGUAGE:
index 31d80ee..24f776b 100644 (file)
@@ -26,6 +26,7 @@
 #include "view/picture/view_picture_color.h"
 #include "view/picture/view_picture_tint.h"
 #include "view/system/view_clock.h"
+#include "view/system/view_clock_mode.h"
 #include "view/system/view_language.h"
 #include "view/system/view_voice_control.h"
 #include "view/system/view_reset.h"
@@ -206,6 +207,11 @@ static bool _create_system_ui(void)
 {
        SETTING_TRACE_BEGIN;
 
+       if (!viewmgr_add_view(view_clock_mode_get_vclass(), NULL)) {
+               _ERR("Adding clock view failed.");
+               return false;
+       }
+
        if (!viewmgr_add_view(view_clock_get_vclass(), NULL)) {
                _ERR("Adding clock view failed.");
                return false;
index dd82a69..d6cb47e 100644 (file)
 #include "common/viewmgr.h"
 #include "common/inputmgr.h"
 #include "common/utils.h"
+#include "view/common/view_generic_popup.h"
 
 #define GENERIC_POPUP_BTN_NAME_MAX 128
 #define BUTTON_BOX_PADDING 8
+#define FOCUS_DIR_TYPES 2
 
 struct _priv {
        Evas_Object *popup;
-       Evas_Object *layout;
+       Evas_Object *box;
        Eina_List *popup_buttons;
        int (*ui_id_on_show_focus)(void);
 };
@@ -41,9 +43,14 @@ static void _show(void *view_data);
 static void _hide(void *view_data);
 static void _destroy(void *view_data);
 
+void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+
+static input_handler _input_handler = {
+       .key_down = _key_down_cb,
+};
+
 /* Helper: */
-static bool _fill_popup_btns(struct _priv *priv, Evas_Object *layout,
-       int btn_count, const char **btn_text, input_handler *handler);
+static bool _fill_items(struct _priv *priv, Evas_Object *popup, int item_count, const char **item_text, input_handler *handler);
 
 static view_class _vclass = {
        .view_id = NULL,
@@ -60,6 +67,7 @@ view_class *view_generic_popup_get_vclass(void)
 
 static Evas_Object *_create(Evas_Object *win, void *data)
 {
+       SETTING_TRACE_BEGIN;
        struct _priv *priv = NULL;
        generic_popup_attr *g_data = (generic_popup_attr *)data;
 
@@ -74,66 +82,51 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       priv->popup = utils_add_popup(win, NULL, g_data->popup_title, NULL);
+       priv->popup = utils_add_layout(win, g_data->popup_layout_group, EINA_TRUE);
        if (!priv->popup) {
-               _ERR("Add popup failed");
-               free(priv);
-               return NULL;
-       }
-
-       priv->layout = utils_add_layout(priv->popup, g_data->popup_layout_group, EINA_FALSE);
-       if (!priv->layout) {
                _ERR("Add layout failed.");
                evas_object_del(priv->popup);
                free(priv);
                return NULL;
        }
 
-       elm_object_part_text_set(priv->layout, PART_POPUP_NAME, g_data->popup_description);
+       elm_object_part_text_set(priv->popup, PART_POPUP_TITLE, g_data->popup_title);
 
-       if (!_fill_popup_btns(priv, priv->layout, g_data->buttns_count, g_data->btn_texts, g_data->handler)) {
-               evas_object_del(priv->popup);
-               free(priv);
-               return NULL;
+       if (g_data->items_count != 0) {
+               _fill_items(priv, priv->popup, g_data->items_count, g_data->item_texts, g_data->handler);
        }
 
-       priv->ui_id_on_show_focus = g_data->ui_id_on_show_focus;
-
-       elm_object_content_set(priv->popup, priv->layout);
-
+       inputmgr_add_callback(priv->popup, 0, &_input_handler, NULL);
        g_data->generic_popup_data = priv;
 
+       SETTING_TRACE_END;
        return priv->popup;
 }
 
 static void _show(void *data)
 {
-       Evas_Object *ui_element_to_focus = NULL;
-       int ui_id_to_focus = 0;
+       SETTING_TRACE_BEGIN;
        struct _priv *priv = (struct _priv *)data;
+       Eina_List *children = NULL;
+       Evas_Object *first = NULL;
 
        if (!priv) {
                _ERR("Invalid parameter.");
                return;
        }
 
-       evas_object_show(priv->popup);
-
-       if(priv->ui_id_on_show_focus) {
-               ui_id_to_focus = priv->ui_id_on_show_focus();
+       children = elm_box_children_get(priv->box);
+       first = eina_list_data_get(children);
+       elm_object_focus_set(first, EINA_TRUE);
 
-               ui_element_to_focus = eina_list_nth(priv->popup_buttons, ui_id_to_focus);
-               if (!ui_element_to_focus) {
-                       _ERR("ui_element_to_focus == NULL");
-                       return;
-               }
 
-               elm_object_focus_set(ui_element_to_focus, EINA_TRUE);
-       }
+       evas_object_show(priv->popup);
+       SETTING_TRACE_END;
 }
 
 static void _hide(void *data)
 {
+       SETTING_TRACE_BEGIN;
        struct _priv *priv = (struct _priv *)data;
 
        if (!priv) {
@@ -142,10 +135,12 @@ static void _hide(void *data)
        }
 
        evas_object_hide(priv->popup);
+       SETTING_TRACE_END;
 }
 
 static void _destroy(void *data)
 {
+       SETTING_TRACE_BEGIN;
        struct _priv *priv = (struct _priv *)data;
 
        if (!priv) {
@@ -155,51 +150,118 @@ static void _destroy(void *data)
 
        evas_object_del(priv->popup);
        free(priv);
+       SETTING_TRACE_END;
 }
 
-static bool _fill_popup_btns(struct _priv *priv, Evas_Object *layout,
-                                                               int btn_count, const char **btn_text, input_handler *handler)
+inline static void _focus_link_set(Evas_Object *prev, Evas_Object *next,
+               Elm_Focus_Direction *next_dirs, Elm_Focus_Direction *prev_dirs,
+               int count)
 {
-       int i = 0;
-       Evas_Object *btn = NULL;
-       Evas_Object *scroller = NULL;
-       Evas_Object *box = NULL;
-
-       scroller = elm_scroller_add(layout);
-       if (!scroller) {
-               _ERR("scroller == NULL");
-               return false;
-       }
+       int i;
+       for (i = 0; i < count; ++i) {
+               elm_object_focus_next_object_set(prev, next, next_dirs[i]);
 
-       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
+               if (prev_dirs)
+                       elm_object_focus_next_object_set(next, prev, prev_dirs[i]);
+       }
+}
 
-       box = elm_box_add(scroller);
-       if (!box) {
-               _ERR("box == NULL");
-               return false;
+static void _focus_chain_set(Evas_Object *box, bool is_last)
+{
+       Elm_Focus_Direction next_types[FOCUS_DIR_TYPES] = {ELM_FOCUS_DOWN, ELM_FOCUS_NEXT};
+       Elm_Focus_Direction prev_types[FOCUS_DIR_TYPES] = {ELM_FOCUS_UP,  ELM_FOCUS_PREVIOUS};
+       Elm_Focus_Direction left_right[FOCUS_DIR_TYPES] = {ELM_FOCUS_LEFT, ELM_FOCUS_RIGHT};
+       Eina_List *children = elm_box_children_get(box);
+       Eina_List *last = eina_list_last(children);
+       Eina_List *prev = eina_list_prev(last);
+       Evas_Object *obj_last = eina_list_data_get(last);
+       Evas_Object *obj_prev = eina_list_data_get(prev);
+
+       _focus_link_set(obj_last, obj_last, left_right, NULL, FOCUS_DIR_TYPES);
+
+       if (!obj_prev) {
+               _focus_link_set(obj_last, obj_last, prev_types, NULL, FOCUS_DIR_TYPES);
+               return;
        }
 
-       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_box_padding_set(box, BUTTON_BOX_PADDING, BUTTON_BOX_PADDING);
+       _focus_link_set(obj_last, obj_prev, prev_types, next_types, FOCUS_DIR_TYPES);
 
-       for(i = 0; i < btn_count; i++) {
-               btn = elm_button_add(box);
-               if (!btn) {
-                       _ERR("Add button failed.");
-                       return false;
-               }
+       if (is_last)
+               _focus_link_set(obj_last, obj_last, next_types, NULL, FOCUS_DIR_TYPES);
+}
 
-               evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
-               elm_object_text_set(btn, btn_text[i]);
-               elm_box_pack_end(box, btn);
-               evas_object_show(btn);
+static void _focus_chain_debug(Evas_Object *box)
+{
+       int i = 0;
+       Elm_Focus_Direction dir = 0;
+       Eina_List *children = elm_box_children_get(box);
+       int count = eina_list_count(children);
+       Evas_Object *item;
+       Evas_Object *focus_to;
+       const char *text;
+
+       char *dir_names[] = {
+               "ELM_FOCUS_PREVIOUS",
+               "ELM_FOCUS_NEXT",
+               "ELM_FOCUS_UP",
+               "ELM_FOCUS_DOWN",
+               "ELM_FOCUS_RIGHT",
+               "ELM_FOCUS_LEFT",
+       };
+
+       for (i = 0; i < count; ++i) {
+               item = eina_list_nth(children, i);
+
+               text = elm_object_text_get(item);
+               dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] ITEM: %s", __FILE__, __LINE__, text);
+
+               for (dir = 0; dir < sizeof(dir_names) / sizeof(dir_names[0]); ++dir) {
+
+                       focus_to = elm_object_focus_next_object_get(item, dir);
+                       text = elm_object_text_get(focus_to);
+                       dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] >>>>>>>>>>> %s: %s", __FILE__, __LINE__, dir_names[dir], text);
+               }
+       }
+}
 
-               inputmgr_add_callback(btn, i, handler, priv);
+static bool _fill_items(struct _priv *priv, Evas_Object *popup, int item_count, const char **item_text, input_handler *handler)
+{
+       Evas_Object *radio = NULL;
+       priv->box = elm_box_add(priv->popup);
+       elm_box_horizontal_set(priv->box, EINA_FALSE);
+
+       evas_object_size_hint_weight_set(priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(priv->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_min_set(priv->box, 300, 300);
+
+       int i;
+       for (i = 0; i < item_count; i++) {
+               radio = utils_add_radio(priv->box, NULL, NULL, item_text[i % item_count]);
+               evas_object_size_hint_min_set(radio, 300, 50);
+               evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
+               evas_object_show(radio);
+               elm_box_pack_end(priv->box, radio);
+               _focus_chain_set(priv->box, i == item_count - 1);
+
+               inputmgr_add_callback(radio, i, handler, NULL);
        }
 
-       elm_layout_content_set(layout, PART_POPUP_BTN_BOX, scroller);
-       elm_object_content_set(scroller, box);
-       priv->popup_buttons = elm_box_children_get(box);
+       elm_object_part_content_set(priv->popup, PART_POPUP_LIST, priv->box);
 
+       _focus_chain_debug(priv->box);
        return true;
 }
+
+void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+       if (!obj || !ev) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_WAY) ||
+                       !strcmp(ev->keyname, KEY_ESC) || !strcmp(ev->keyname, KEY_ESC_WAY)) {
+               viewmgr_pop_view();
+       }
+}
diff --git a/src/view/system/view_clock_mode.c b/src/view/system/view_clock_mode.c
new file mode 100755 (executable)
index 0000000..11c3cca
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <Elementary.h>
+#include <time.h>
+
+#include "common/viewmgr.h"
+#include "common/inputmgr.h"
+#include "app_debug.h"
+#include "define.h"
+#include "common/utils.h"
+#include "view/system/view_clock.h"
+#include "view/common/view_generic_popup.h"
+#include "data/system/settings_clock.h"
+#include "app_string.h"
+
+#define BUTTON_RETURN 36
+
+enum setup_type {
+       TYPE_MANUAL = 0,
+       TYPE_AUTO,
+       TYPE_MAX
+};
+
+static const char *str_setup_type_opt[] = {
+       STR_MANUAL,
+       STR_AUTO
+};
+
+typedef struct {
+       Evas_Object *win;
+       Evas_Object *ly;
+       Evas_Object *conformant;
+
+       enum setup_type cur_type;
+       bool input_panel_show;
+       Evas_Object *focused_entry;
+
+} clock_mode_view_priv_data;
+
+static void _popup_item_selected_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+
+static input_handler _input_handler = {
+       .key_down = _popup_item_selected_cb,
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       SETTING_TRACE_BEGIN;
+       view_class *vc = view_generic_popup_get_vclass();
+       generic_popup_attr *g_data = NULL;
+
+       if (!win) {
+               _ERR("Get window object failed.");
+               return NULL;
+       }
+
+       g_data = calloc(1, sizeof(generic_popup_attr));
+       if (!g_data) {
+               _ERR("Calloc failed.");
+               return NULL;
+       }
+
+       g_data->popup_title = "Clock";
+       g_data->popup_description = NULL;
+       g_data->popup_layout_group = GRP_VIEW_POPUP_LIST;
+       g_data->handler = &_input_handler;
+       g_data->buttns_count = 0;
+       g_data->btn_texts = NULL;
+       g_data->items_count = sizeof(str_setup_type_opt) / sizeof(str_setup_type_opt[0]);
+       g_data->item_texts = calloc(g_data->items_count, sizeof(char *));
+       g_data->ui_id_on_show_focus = NULL;
+       g_data->generic_popup_data = NULL;
+
+       int i;
+       for(i = 0; i < sizeof(str_setup_type_opt) / sizeof(str_setup_type_opt[0]); ++i) {
+               g_data->item_texts[i] = str_setup_type_opt[i];
+       }
+
+       if (!viewmgr_set_view_data(VIEW_CLOCK_MODE, g_data)) {
+               free(g_data);
+               _ERR("Set view data failed.");
+               return NULL;
+       }
+
+       SETTING_TRACE_END;
+       return vc->create(win, g_data);
+}
+
+static void _popup_item_selected_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+       dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] BUTTON = %d", __FILE__, __LINE__, ev->keycode);
+       if (ev->keycode != BUTTON_RETURN)
+               return;
+
+       viewmgr_pop_view();
+
+       if (id == TYPE_MANUAL) {
+               settings_clock_set_time_automatic(true);
+               viewmgr_show_view(VIEW_CLOCK);
+       } else {
+               settings_clock_set_time_automatic(true);
+       }
+
+       viewmgr_update_view(VIEW_BASE, UPDATE_CONTENT, NULL);
+}
+
+static void _show(void *data)
+{
+       SETTING_TRACE_BEGIN
+       generic_popup_attr *g_data = data;
+       view_class *vc = view_generic_popup_get_vclass();
+       vc->show(g_data->generic_popup_data);
+       SETTING_TRACE_END
+}
+
+static void _hide(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       generic_popup_attr *g_data = data;
+       view_class *vc = view_generic_popup_get_vclass();
+       vc->hide(g_data->generic_popup_data);
+       SETTING_TRACE_END;
+}
+
+static void _destroy(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       generic_popup_attr *g_data = data;
+       view_class *vc = view_generic_popup_get_vclass();
+       vc->destroy(g_data->generic_popup_data);
+       SETTING_TRACE_END;
+}
+
+static view_class _vclass = {
+       .view_id = VIEW_CLOCK_MODE,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy,
+};
+
+view_class *view_clock_mode_get_vclass(void)
+{
+       return &_vclass;
+}
index b80882e..7e4233a 100644 (file)
@@ -103,7 +103,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       elm_object_part_text_set(ly, PART_POPUP_NAME, STR_LANGUAGE_DES);
+       elm_object_part_text_set(ly, PART_POPUP_TITLE, STR_LANGUAGE_DES);
 
        if (!_fill_popup_btns(priv, ly, LANG_TYPE_MAX, PART_POPUP_BUTTON_X,
                        language_option, EO_BTN_LANG_ENG)) {
index e98b35e..d21d1d6 100644 (file)
@@ -95,7 +95,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       elm_object_translatable_part_text_set(ly, PART_POPUP_NAME,
+       elm_object_translatable_part_text_set(ly, PART_POPUP_TITLE,
                                                                                        _("IDS_ST_HEADER_VOICE_CONTROL"));
 
        snprintf(part_name, sizeof(part_name), PART_POPUP_BUTTON_X, BUTTON_ID_ON);