Update channel number UX 31/44231/1
authorjinwoo.shin <jw0227.shin@samsung.com>
Mon, 20 Jul 2015 05:58:14 +0000 (14:58 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Mon, 20 Jul 2015 05:58:14 +0000 (14:58 +0900)
Change-Id: I6467cdf570398f218add973d5334b9a899339d11
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
data/view/channelnumber.edc
include/define.h
src/main.c
src/tv_service.c
src/util.c
src/view_channelinfo.c
src/view_channelnumber.c

index 9892029..387b8f7 100644 (file)
@@ -159,8 +159,8 @@ group {
                        }
                }
                part {
-                       name, "bg.list.border";
-                       type, RECT;
+                       name, PART_CHANNELNUMBER_LIST;
+                       type, SWALLOW;
                        scale, 1;
                        description {
                                state, "default" 0.0;
@@ -172,48 +172,8 @@ group {
                                        to, "padding.list";
                                        relative, 1.0 1.0;
                                }
-                               color, COLOR_OPTION_BORDER;
                                min, 216 224;
                                align, 0.0 0.0;
-                               fixed, 1 1;
-                       }
-               }
-               part {
-                       name, "bg.list";
-                       type, RECT;
-                       scale, 1;
-                       description {
-                               state, "default" 0.0;
-                               rel1 {
-                                       to, "bg.list.border";
-                                       relative, 0.5 0.5;
-                               }
-                               rel2 {
-                                       to, "bg.list.border";
-                                       relative, 0.5 0.5;
-                               }
-                               color, COLOR_BG_NORMAL;
-                               min, 214 222;
-                               align, 0.5 0.5;
-                               fixed, 1 1;
-                       }
-               }
-               part {
-                       name, PART_CHANNELNUMBER_LIST;
-                       type, SWALLOW;
-                       scale, 1;
-                       description {
-                               state, "default" 0.0;
-                               rel1 {
-                                       to, "bg.list";
-                                       relative, 0.0 0.0;
-                               }
-                               rel2 {
-                                       to, "bg.list";
-                                       relative, 1.0 1.0;
-                               }
-                               align, 0.0 0.0;
-                               fixed, 1 1;
                        }
                }
        }
@@ -304,6 +264,94 @@ group {
                                color, COLOR_TEXT_FOCUSED;
                        }
         }
+               part {
+                       name, "border.top";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "bg";
+                                       relative, 0.0 0.0;
+                               }
+                               rel2 {
+                                       to, "bg";
+                                       relative, 1.0 0.0;
+                               }
+                               color, COLOR_OPTION_BORDER;
+                               min, 0 1;
+                               align, 0.0 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "first" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+               part {
+                       name, "border.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "bg";
+                                       relative, 0.0 0.0;
+                               }
+                               rel2 {
+                                       to, "bg";
+                                       relative, 0.0 1.0;
+                               }
+                               color, COLOR_OPTION_BORDER;
+                               min, 1 0;
+                               align, 0.0 0.0;
+                       }
+               }
+               part {
+                       name, "border.bottom";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "bg";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "bg";
+                                       relative, 1.0 1.0;
+                               }
+                               color, COLOR_OPTION_BORDER;
+                               min, 0 1;
+                               align, 0.0 1.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "last" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+               part {
+                       name, "border.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "bg";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "bg";
+                                       relative, 1.0 1.0;
+                               }
+                               color, COLOR_OPTION_BORDER;
+                               min, 1 0;
+                               align, 1.0 0.0;
+                       }
+               }
     }
        programs {
                program {
@@ -322,6 +370,20 @@ group {
                        target, "bg";
                        target, PART_TEXT;
                }
+               program {
+                       name, "first";
+                       signal, SIGNAL_FIRST;
+                       source, "";
+                       action, STATE_SET "first" 0.0;
+                       target, "border.top";
+               }
+               program {
+                       name, "last";
+                       signal, SIGNAL_LAST;
+                       source, "";
+                       action, STATE_SET "last" 0.0;
+                       target, "border.bottom";
+               }
        }
 }
 
index 372275a..aedb0e9 100644 (file)
@@ -29,6 +29,8 @@
 
 #define SIGNAL_FOCUSED "elm,action,focus"
 #define SIGNAL_UNFOCUSED "elm,action,unfocus"
+#define SIGNAL_FIRST "elm,state,first"
+#define SIGNAL_LAST "elm,state,last"
 
 #define FONT_REGULAR "TizenSans"
 #define FONT_LIGHT "TizenSans:style=Light"
index bfcfa18..6a846b1 100644 (file)
@@ -79,7 +79,6 @@ static Eina_Bool _key_down_cb(void *data, int type, void *ei)
                        if (!strcmp(ev->keyname, g_kmap[i].key[j])) {
                                viewmgr_update_view(g_kmap[i].view,
                                                UPDATE_TYPE_INPUT_KEY_DOWN, ev);
-                               viewmgr_show_view(g_kmap[i].view);
                                return ECORE_CALLBACK_DONE;
                        }
                        j++;
@@ -265,6 +264,8 @@ static bool _create(void *data)
        ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
                        _key_up_cb, NULL);
 
+       elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
+
        return true;
 }
 
index ea18fe7..ee44fac 100644 (file)
@@ -120,7 +120,7 @@ static void init_data()
                channel = (TvServiceChannel *)g_malloc0(sizeof(TvServiceChannel));
                init_constant_channel_data(channel);
                channel->service_id = i;
-               channel->major = (5 + i);
+               channel->major = (10 + i);
                channel->favorite = i % 2 == 0 ? TRUE : FALSE;
                snprintf(channel->program_name, PROGRAM_NAME_MAX_LEN - 1, "Super Channel %d", i);
                channel_list = g_list_append(channel_list, (gpointer)channel);
index 43c098e..ba2acdd 100644 (file)
@@ -86,6 +86,8 @@ Evas_Object *util_add_scroller(Evas_Object *parent, const char *part)
 
        evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND,
                        EVAS_HINT_EXPAND);
+       elm_scroller_policy_set(scroll, ELM_SCROLLER_POLICY_OFF,
+                       ELM_SCROLLER_POLICY_OFF);
 
        if (part)
                elm_object_part_content_set(parent, part, scroll);
index c607039..a9fb0cd 100644 (file)
@@ -454,6 +454,8 @@ static void _update(void *view_data, int type, void *data)
                        layoutmgr_update_layout(priv->lmgr,
                                        LAYOUT_CHANNELINFO_LIST, type, ev);
                }
+
+               viewmgr_show_view(VIEW_CHANNELINFO);
        } else if (type == UPDATE_TYPE_INPUT_KEY_UP) {
                Evas_Event_Key_Up *ev = data;
 
index f016f86..89048ca 100644 (file)
@@ -35,6 +35,7 @@ struct _priv {
 
        int major;
        int minor;
+       char number[NUMBER_MAX+1];
 };
 
 static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -46,19 +47,19 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
        }
 }
 
-static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
-               Evas_Event_Mouse_Move *ev)
-{
-       viewmgr_update_view(VIEW_CHANNELNUMBER,
-                       UPDATE_TYPE_TIMER, 0);
-}
-
 static input_handler key_handler = {
        .key_down = _key_down_cb,
-       .mouse_move = _mouse_move_cb,
 };
 
-static Eina_Bool _hide_timer(void *data)
+static void _stop_hide_timer(struct _priv *priv)
+{
+       if (priv->hide_timer) {
+               ecore_timer_del(priv->hide_timer);
+               priv->hide_timer = NULL;
+       }
+}
+
+static Eina_Bool _done_input(void *data)
 {
        struct _priv *priv;
        int r;
@@ -68,13 +69,12 @@ static Eina_Bool _hide_timer(void *data)
 
        priv = data;
 
-       priv->hide_timer = NULL;
-
        r = tv_channel_direct_tune(priv->major, priv->minor);
        if (r < 0)
                _ERR("invalid channel");
 
        viewmgr_hide_view(VIEW_CHANNELNUMBER);
+       viewmgr_show_view(VIEW_CHANNELINFO);
 
        return ECORE_CALLBACK_CANCEL;
 }
@@ -84,15 +84,7 @@ static void _start_hide_timer(struct _priv *priv)
        if (priv->hide_timer)
                ecore_timer_reset(priv->hide_timer);
        else
-               priv->hide_timer = ecore_timer_add(HIDE_DUR, _hide_timer, priv);
-}
-
-static void _stop_hide_timer(struct _priv *priv)
-{
-       if (priv->hide_timer) {
-               ecore_timer_del(priv->hide_timer);
-               priv->hide_timer = NULL;
-       }
+               priv->hide_timer = ecore_timer_add(HIDE_DUR, _done_input, priv);
 }
 
 static void _tune_channel(void *data)
@@ -132,9 +124,17 @@ static void _channel_mouse_down_cb(int id, void *data, Evas *e,
        _tune_channel(data);
 }
 
+static void _channel_focused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *it)
+{
+       viewmgr_update_view(VIEW_CHANNELNUMBER,
+                       UPDATE_TYPE_TIMER, 0);
+}
+
 static input_handler channel_handler = {
        .key_down = _channel_key_down_cb,
        .mouse_down = _channel_mouse_down_cb,
+       .focused = _channel_focused_cb,
 };
 
 static void _release_channel_handler(Evas_Object *obj)
@@ -166,6 +166,13 @@ static void _update_channel_list(struct _priv *priv)
        _release_channel_handler(priv->list);
        elm_box_clear(priv->list);
 
+       if (!channel_list) {
+               evas_object_hide(priv->list);
+               return;
+       }
+
+       evas_object_show(priv->list);
+
        first = NULL;
        ly = NULL;
        EINA_LIST_FOREACH(channel_list, l, channel_info) {
@@ -190,11 +197,15 @@ static void _update_channel_list(struct _priv *priv)
                if (!first) {
                        first = ly;
                        elm_object_focus_set(ly, EINA_TRUE);
+                       elm_object_signal_emit(ly, SIGNAL_FIRST, "");
                }
        }
 
-       if (first && ly)
+       if (first && ly) {
                elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP);
+               elm_object_focus_next_object_set(ly, first, ELM_FOCUS_DOWN);
+               elm_object_signal_emit(ly, SIGNAL_LAST, "");
+       }
 
        if (channel_list)
                tv_channel_del_list(channel_list);
@@ -202,16 +213,13 @@ static void _update_channel_list(struct _priv *priv)
 
 static void _update_number_info(struct _priv *priv)
 {
-       char buf[BUF_MAX];
-
-       if (priv->major < 0) {
+       if (!priv->number) {
                _ERR("Wrong channel number");
                return;
        }
 
-       snprintf(buf, sizeof(buf), "%d", priv->major);
-
-       elm_object_part_text_set(priv->base, PART_CHANNELNUMBER_NUMBER, buf);
+       elm_object_part_text_set(priv->base,
+                       PART_CHANNELNUMBER_NUMBER, priv->number);
 
        _update_channel_list(priv);
 }
@@ -240,8 +248,8 @@ static int _get_number(const char *keyname)
 
 static void _number_reset(struct _priv *priv)
 {
+       memset(priv->number, '\0', sizeof(char) * NUMBER_MAX + 1);
        priv->major = -1;
-       priv->minor = -1;
 
        _release_channel_handler(priv->list);
        elm_box_clear(priv->list);
@@ -249,33 +257,18 @@ static void _number_reset(struct _priv *priv)
 
 static void _number_tuning(struct _priv *priv, const char *keyname)
 {
-       int num;
-
-       if (!priv || !keyname) {
-               _ERR("failed to get priv and keyname");
+       if (!keyname) {
+               _ERR("failed to get keyname");
                return;
        }
 
-       num = _get_number(keyname);
-       if (num < 0 || (num == 0 && priv->major <= 0))
-               goto error;
-
-       if (priv->major < 0) {
-               priv->major = num;
-       } else {
-               priv->major *= 10;
-               priv->major += num;
-       }
-
-       if (priv->major > MAJOR_MAX)
-               goto error;
+       strncat(priv->number, keyname, 1);
+       priv->major = atoi(priv->number);
 
        _update_number_info(priv);
 
-       return;
-
-error:
-       _number_reset(priv);
+       if (strlen(priv->number) == NUMBER_MAX)
+               _done_input(priv);
 }
 
 static Evas_Object *_create(Evas_Object *win, void *data)
@@ -311,19 +304,13 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                goto error;
        }
 
-       elm_object_focus_allow_set(scroll, EINA_FALSE);
-
        priv->list = util_add_box(scroll, false);
        if (!priv->list) {
                _ERR("failed to create box");
                goto error;
        }
-
        elm_box_align_set(priv->list, 0.5, 0.0);
 
-       elm_object_focus_allow_set(priv->list, EINA_TRUE);
-       elm_object_focus_set(priv->list, EINA_TRUE);
-
        viewmgr_set_view_data(VIEW_CHANNELNUMBER, priv);
 
        inputmgr_add_callback(priv->base, 0, &key_handler, priv);
@@ -419,10 +406,10 @@ static void _update(void *view_data, int type, void *data)
                        return;
                }
 
+               viewmgr_show_view(VIEW_CHANNELNUMBER);
+
                if (_get_number(ev->keyname) != -1)
                        _number_tuning(priv, ev->keyname);
-
-               _start_hide_timer(priv);
        } else if (type == UPDATE_TYPE_INPUT_KEY_UP) {
                Evas_Event_Key_Up *ev = data;