Merge "add manifest file to avoid smack error" into tizen accepted/tizen/tv/20150909.140316 submit/tizen_tv/20150909.021039 submit/tizen_tv/20150909.042240
authorMinkyu Kang <mk7.kang@samsung.com>
Wed, 9 Sep 2015 02:23:21 +0000 (19:23 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 9 Sep 2015 02:23:21 +0000 (19:23 -0700)
26 files changed:
CMakeLists.txt
include/datamgr.h
include/define.h
include/grid.h
include/utils.h
include/view.h
packaging/org.tizen.favorite.spec
res/favorite.edc
res/images/ic_thumbnail_lock_01.png [new file with mode: 0644]
res/widgets/gengrid_apps.edc
res/widgets/gengrid_tv.edc
src/common/utils.c
src/data/app.c
src/data/channel.c
src/data/media.c
src/data/web.c
src/grid/grid_apps.c
src/grid/grid_gallery.c
src/grid/grid_movie.c
src/grid/grid_music.c
src/grid/grid_tv.c
src/grid/grid_webs.c
src/main.c
src/view/view_action_menu.c
src/view/view_base.c
src/view/view_pin.c [new file with mode: 0644]

index 1bef08a..4300f1b 100644 (file)
@@ -27,6 +27,7 @@ pkg_check_modules(PKGS REQUIRED
                glib-2.0
                capi-web-bookmark
                tv-service
+               ui-gadget-1
                )
 
 IF(NOT DEFINED PACKAGE_NAME)
@@ -66,6 +67,7 @@ SET(SRCS
        src/common/utils.c
        src/view/view_base.c
        src/view/view_action_menu.c
+       src/view/view_pin.c
        src/grid/grid_tv.c
        src/grid/grid_movie.c
        src/grid/grid_gallery.c
index ead6b10..d9dc358 100644 (file)
@@ -22,6 +22,8 @@ enum data_type {
        DATA_ARTIST,
        DATA_ALBUM_NAME,
        DATA_DURATION,
+       DATA_SUBTITLE,
+       DATA_DESCRIPTION,
 };
 
 enum action_type {
@@ -35,8 +37,9 @@ struct datamgr {
        void (*free_favorites)(Eina_List *list);
        int (*get_count)(enum item_type type);
        char *(*get_data)(void *data, enum data_type type);
-       bool (*action)(Elm_Object_Item *it, enum action_type type);
+       bool (*action)(Elm_Object_Item *it, enum action_type type, void *data);
        bool (*data_updated)(void *data1, void *data2);
+       bool (*data_locked)(Elm_Object_Item *it, bool *locked);
 };
 
 struct datamgr *get_channel_datamgr(void);
index b0a87c9..f0c3675 100644 (file)
 #define __AIR_FAVORITE_DEFINE_H__
 
 /* View ID */
-#define VIEW_ID_BASE "VIEW_ID_BASE"
-#define VIEW_ID_ACTION_MENU "VIEW_ID_ACTION_MENU"
+#define VIEW_BASE "VIEW_BASE"
+#define VIEW_ACTION_MENU "VIEW_ACTION_MENU"
+#define VIEW_PIN "VIEW_PIN"
+
+/* Grid ID */
+#define GRID_TV "TV"
+#define GRID_MOVIE "Movie"
+#define GRID_GALLERY "Gallery"
+#define GRID_MUSIC "Music"
+#define GRID_APP "Apps"
+#define GRID_WEB "Web"
 
 /* Group */
 #define GRP_VIEW_BASE "grp.view.base"
 #define GRP_VIEW_ACTION_MENU "grp.view.action.menu"
+#define GRP_TV_BANNER "grp.tv.banner"
 
 /* Part for edc file */
 #define PART_TOP_TITLE "part.top.title"
 #define PART_TEXT_BG "part.text.bg"
 #define PART_THUMB_ICON "part.thumb.icon"
 #define PART_THUMB_TEXT "part.thumb.text"
+#define PART_THUMB_TEXT_BR "part.thumb.text.browser"
 #define PART_THUMB_SUBTEXT1 "part.thumb.subtext1"
 #define PART_THUMB_SUBTEXT2 "part.thumb.subtext2"
 #define PART_THUMB_PLAY_ICON "part.thumb.play.icon"
 #define PART_THUMB_DEFAULT_TV_ICON "part.thumb.default.tv.icon"
 #define PART_LIVETV_BTN "part.livetv.button"
 #define PART_ACTION_MENU "part.action.menu"
+#define PART_BANNER "part.banner"
+#define PART_TITLE "part.title"
+#define PART_SUBTITLE "part.subtitle"
+#define PART_DESCRIPT "part.description"
 
 /* Style */
 #define STYLE_MENU_BTN "style.menu.button"
 #define STYLE_LIVETV_BTN "style.livetv.button"
 #define STYLE_ACTION_MENU_FAV_BTN "style.action.menu.favorite.button"
 #define STYLE_ACTION_MENU_LOCK_BTN "style.action.menu.lock.button"
+#define STYLE_TOAST "style.toast"
 
 /* Signal */
 #define SIG_FOCUSED "focused"
 #define SIG_INVISIBLE "invisible"
 #define SIG_DISABLE "elm,state,disabled"
 #define SIG_TOGGLE "toggle"
+#define SIG_TIMEOUT "timeout"
 
 /* Source */
 #define SRC_EDC "edc"
 #define SRC_MENU_BTN "menubtn"
 #define SRC_ACTION_BTN "source.action.btn"
+#define SRC_LOCK_ICON "source.lock.icon"
 
 /* Transition */
 #define TRANSITION_FOCUS DECELERATE 0.20
 #define STR_CNT_WEBS "bookmark"
 #define STR_BROWSER "Web Browser"
 #define STR_LIVETV "Live TV"
+#define STR_REMOVE_FAVORITE "Removed from your favorite."
+#define STR_SUCCESS "success"
+#define STR_FAIL "fail"
+#define STR_LOCKED "Content is locked."
+#define STR_UNLOCKED "Content is unlocked."
 
 /* Font */
 #define FONT_TIZENSANS_REGULAR "TizenSans"
 #define COLOR_TEXT_BG 113 128 147 255
 #define COLOR_ITEM_FOCUS 0 119 246 255
 #define COLOR_ITEM_FOCUS_0 0 119 246 0
+#define COLOR_BR_R 255
+#define COLOR_BR_G 255
+#define COLOR_BR_B 255
+#define COLOR_BR_A 255
 
 /* Size */
 #define SIZE_BOX_PAD_H (40 + 40)
 #define SIZE_APP_ICON_MAX 100
 #define SIZE_ACTION_TABLE_BORDER 0
 #define SIZE_COL_MAX 4
+#define SIZE_TOAST_TIMEOUT 5.0
 
 /* Count */
 #define COUNT_MENU 6
 #define COUNT_ACTION 2
+#define COUNT_BANNER 1
 
 /* Image */
 #define PLAY_ICON_PNG "ic_thumbnail_play.png"
 #define ACTION_LOCK_FOC_PNG "btn_menu_lock_foc.png"
 #define ACTION_LOCK_SEL_PNG "btn_menu_lock_sel.png"
 #define ACTION_LOCK_DIS_PNG "btn_menu_lock_dis.png"
+#define LOCK_ICON_PNG "ic_thumbnail_lock_01.png"
 
 /* Path */
 #define PATH_PLAY_ICON_PNG IMGDIR"/ic_thumbnail_play.png"
index 924d89c..e4c1ebd 100644 (file)
@@ -30,8 +30,11 @@ struct grid_data {
 
        Eina_List *(*create_item_list)(void);
        void (*destroy_item_list)(Eina_List *list);
-       bool (*item_action)(Elm_Object_Item *it, enum action_type type);
+       bool (*item_action)(Elm_Object_Item *it,
+                       enum action_type type, void *data);
        bool (*item_updated)(void *pre_data, void *new_data);
+       bool (*item_locked)(Elm_Object_Item *it, bool *locked);
+       bool (*load_item_banner)(Evas_Object *banner, void *data);
 };
 
 struct grid_data *get_tv_grid_data(void);
index 975a8e3..ebe092b 100644 (file)
@@ -18,7 +18,8 @@
 #define __AIR_FAVORITE_UTILS_H__
 
 Evas_Object *utils_add_window(const char *name);
-Evas_Object *utils_add_layout(Evas_Object *parent, const char *group);
+Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
+               Eina_Bool resize);
 Evas_Object *utils_add_gengrid(Evas_Object *parent,
                int item_size_x, int item_size_y);
 Evas_Object *utils_add_box(Evas_Object *parent, const char *part,
index a32afa3..ca7252c 100644 (file)
 
 view_class *view_base_get_vclass(void);
 view_class *view_action_menu_get_vclass(void);
+view_class *view_pin_get_vclass(void);
 
 enum update_type {
        UPDATE_DATA = 0,
        UPDATE_GRID,
+       UPDATE_SHOW_TOAST,
+       UPDATE_LOCK,
+       UPDATE_UNLOCK,
+       UPDATE_MENU,
 };
 
 #endif /* __AIR_APPS_VIEW_H__ */
index 452e5fe..f0c02a9 100644 (file)
@@ -17,6 +17,7 @@ BuildRequires: pkgconfig(capi-content-media-content)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(capi-web-bookmark)
 BuildRequires: pkgconfig(tv-service)
+BuildRequires: pkgconfig(ui-gadget-1)
 
 %define _appdir /usr/apps/%{name}
 %define _bindir %{_appdir}/bin
index 5942d58..13873fb 100644 (file)
@@ -481,6 +481,184 @@ collections {
                                        fixed, 1 1;
                                }
                        }
+
+                       part {
+                               name, "padding.info.banner";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 40 40;
+                                       rel2.relative, 0.0 0.0;
+                                       align, 0.0 0.0;
+                                       fixed, 1 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_BANNER;
+                               type, SWALLOW;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 536 174;
+                                       rel1 {
+                                               to, "padding.info.banner";
+                                               relative, 1.0 1.0;
+                                       }
+                                       rel2.to, "padding.info.banner";
+                                       align, 0.0 0.0;
+                                       fixed, 1 1;
+                               }
+                       }
+               }
+       }
+
+       group {
+               name, GRP_TV_BANNER;
+               parts {
+                       part {
+                               name, "bg";
+                               type, RECT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 255 255 255 255;
+                               }
+                       }
+
+                       part {
+                               name, "padding.title.left.top";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 28 26;
+                                       rel2.relative, 0.0 0.0;
+                                       align, 0.0 0.0;
+                                       fixed, 1 1;
+                               }
+                       }
+
+                       part {
+                               name, "padding.title.right.top";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 28 26;
+                                       rel1.relative, 1.0 0.0;
+                                       rel2.relative, 1.0 0.0;
+                                       align, 1.0 0.0;
+                                       fixed, 1 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_TITLE;
+                               type, TEXT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 51 51 51 255;
+                                       min, 0 32;
+                                       rel1 {
+                                               to, "padding.title.left.top";
+                                               relative, 1.0 1.0;
+                                       }
+                                       rel2 {
+                                               to, "padding.title.right.top";
+                                               relative, 0.0 1.0;
+                                       }
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+                                       text {
+                                               font, FONT_TIZENSANS_LIGHT;
+                                               size, 28;
+                                               align, 0.0 0.5;
+                                       }
+                               }
+                       }
+
+                       part {
+                               name, "padding.text";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 0 6;
+                                       rel1 {
+                                               to, "part.title";
+                                               relative, 0.0 1.0;
+                                       }
+                                       rel2.to, "part.title";
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_SUBTITLE;
+                               type, TEXT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 51 51 51 255;
+                                       min, 0 32;
+                                       rel1 {
+                                               to, "padding.text";
+                                               relative, 0.0 1.0;
+                                       }
+                                       rel2.to, "padding.text";
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+                                       text {
+                                               font, FONT_TIZENSANS_LIGHT;
+                                               size, 28;
+                                               align, 0.0 0.5;
+                                       }
+                               }
+                       }
+
+                       part {
+                               name, "padding.description";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 0 24;
+                                       rel1 {
+                                               to, "part.subtitle";
+                                               relative, 0.0 1.0;
+                                       }
+                                       rel2.to, "part.subtitle";
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_DESCRIPT;
+                               type, TEXT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 112 112 112 255;
+                                       min, 0 28;
+                                       rel1 {
+                                               to, "padding.description";
+                                               relative, 0.0 1.0;
+                                       }
+                                       rel2.to, "padding.description";
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+                                       text {
+                                               font, FONT_TIZENSANS_LIGHT;
+                                               size, 28;
+                                               align, 0.0 0.5;
+                                       }
+                               }
+                       }
                }
        }
 }
diff --git a/res/images/ic_thumbnail_lock_01.png b/res/images/ic_thumbnail_lock_01.png
new file mode 100644 (file)
index 0000000..cbd4267
Binary files /dev/null and b/res/images/ic_thumbnail_lock_01.png differ
index de5ddc5..b4e2062 100644 (file)
@@ -17,8 +17,9 @@
 group {
        name, "elm/gengrid/item/style.apps/default";
        data.item, "focus_highlight" "on";
-       data.item, "texts" "part.thumb.text";
+       data.item, "texts" "part.thumb.text part.thumb.text.browser";
        data.item, "contents" "part.thumb.icon part.thumb.bg part.text.bg";
+       data.item, "states" "is_browser";
        parts {
                part {
                        name, "padding.bottom.right";
@@ -75,12 +76,9 @@ group {
                                state, "default" 0.0;
                                rel1.to, "part.bg";
                                rel2 {
-                                       to, "part.bg";
+                                       to, PART_TEXT_BG;
                                        relative, 1.0 0.0;
                                }
-                               min, 0 212;
-                               align, 0.5 0.0;
-                               fixed, 0 1;
                                map {
                                        perspective_on, 1;
                                        perspective, "map";
@@ -99,13 +97,13 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
+                               min, 0 82;
                                rel1 {
-                                       to, PART_THUMB_BG;
+                                       to, "part.bg";
                                        relative, 0.0 1.0;
                                }
-                               rel2.to, PART_THUMB_BG;
-                               min, 0 82;
-                               align, 0.5 0.0;
+                               rel2.to, "part.bg";
+                               align, 0.5 1.0;
                                fixed, 0 1;
                                map {
                                        perspective_on, 1;
@@ -149,6 +147,132 @@ group {
                }
 
                part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               min, 0 1;
+                               rel1.to, "part.bg";
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               min, 1 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               min, 1 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "part.bg";
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               min, 0 1;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.right";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.divide.line";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               min, 0 1;
+                               rel1.to, PART_TEXT_BG;
+                               rel2 {
+                                       to, PART_TEXT_BG;
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
                        name, "part.focus.up";
                        type, RECT;
                        scale, 1;
@@ -295,7 +419,7 @@ group {
                }
 
                part {
-                       name, "padding.thumb.text";
+                       name, "padding.thumb.text.left";
                        type, SPACER;
                        scale, 1;
                        description {
@@ -312,23 +436,73 @@ group {
                }
 
                part {
+                       name, "padding.thumb.text.right";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 18 0;
+                               rel1 {
+                                       to, "part.focus.down";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2.to, "part.focus.down";
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
                        name, PART_THUMB_TEXT;
                        type, TEXT;
                        scale, 1;
                        description {
                                state, "default" 0.0;
                                color, 255 255 255 255;
-                               min, 176 82;
                                rel1 {
-                                       to, "padding.thumb.text";
+                                       to, "padding.thumb.text.left";
                                        relative, 1.0 0.0;
                                }
                                rel2 {
-                                       to, "padding.thumb.text";
+                                       to, "padding.thumb.text.right";
+                                       relative, 0.0 1.0;
+                               }
+                               text {
+                                       font, FONT_TIZENSANS_LIGHT;
+                                       size, 28;
+                                       align, 0.0 0.5;
+                               }
+                               map {
+                                       perspective_on, 1;
+                                       perspective, "map";
+                               }
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               map.on, 1;
+                       }
+                       description {
+                               state, "focused_0" 0.0;
+                               inherit, "focused" 0.0;
+                       }
+               }
+
+               part {
+                       name, PART_THUMB_TEXT_BR;
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 92 92 92 255;
+                               rel1 {
+                                       to, "padding.thumb.text.left";
                                        relative, 1.0 0.0;
                                }
-                               align, 0.0 0.0;
-                               fixed, 1 1;
+                               rel2 {
+                                       to, "padding.thumb.text.right";
+                                       relative, 0.0 1.0;
+                               }
                                text {
                                        font, FONT_TIZENSANS_LIGHT;
                                        size, 28;
@@ -343,6 +517,7 @@ group {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
                                map.on, 1;
+                               color, 255 255 255 255;
                        }
                        description {
                                state, "focused_0" 0.0;
@@ -362,6 +537,7 @@ group {
                        target, "part.focus.down";
                        target, "part.focus.right";
                        target, PART_THUMB_TEXT;
+                       target, PART_THUMB_TEXT_BR;
                        after, "focus.in.anim";
                }
 
@@ -385,6 +561,7 @@ group {
                        source, "elm";
                        action, STATE_SET "default" 0.0;
                        target, PART_THUMB_TEXT;
+                       target, PART_THUMB_TEXT_BR;
                        after, "focus.out.anim";
                }
 
@@ -438,5 +615,16 @@ group {
                        name, "item_selected";
                        action, SIGNAL_EMIT SIG_ITEM_SELECTED SRC_EDC;
                }
+
+               program {
+                       signal, "elm,state,is_browser,active";
+                       source, "elm";
+                       action, STATE_SET "visible" 0.0;
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.down";
+                       target, "part.inside.line.right";
+                       target, "part.divide.line";
+               }
        }
 }
index b67e2c6..4c6c8de 100644 (file)
@@ -20,6 +20,10 @@ group {
        data.item, "focus_highlight" "on";
        data.item, "texts" "part.thumb.text";
        data.item, "contents" "part.thumb.icon part.thumb.default.tv.icon part.thumb.bg part.text.bg";
+       images {
+               image, LOCK_ICON_PNG COMP;
+       }
+
        parts {
                part {
                        name, "padding.bottom.right";
@@ -373,6 +377,53 @@ group {
                                inherit, "focused" 0.0;
                        }
                }
+
+               part {
+                       name, "padding.lock.icon";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 14 18;
+                               rel1 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 1.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "part.lock.icon";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 40 40;
+                               rel1 {
+                                       to, "padding.lock.icon";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "padding.lock.icon";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 1.0 0.0;
+                               fixed, 1 1;
+                               image.normal, LOCK_ICON_PNG;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
        }
 
        programs {
@@ -464,5 +515,21 @@ group {
                        name, "item_selected";
                        action, SIGNAL_EMIT SIG_ITEM_SELECTED SRC_EDC;
                }
+
+               program {
+                       name, SIG_VISIBLE;
+                       signal, SIG_VISIBLE;
+                       source, SRC_LOCK_ICON;
+                       action, STATE_SET "visible" 0.0;
+                       target, "part.lock.icon";
+               }
+
+               program {
+                       name, SIG_INVISIBLE;
+                       signal, SIG_INVISIBLE;
+                       source, SRC_LOCK_ICON;
+                       action, STATE_SET "default" 0.0;
+                       target, "part.lock.icon";
+               }
        }
 }
index ed0958c..39628ed 100644 (file)
@@ -19,6 +19,7 @@
 #include <app_debug.h>
 
 #include "define.h"
+#include "datamgr.h"
 
 Evas_Object *utils_add_window(const char *name)
 {
@@ -43,11 +44,12 @@ Evas_Object *utils_add_window(const char *name)
        return win;
 }
 
-Evas_Object *utils_add_layout(Evas_Object *parent, const char *group)
+Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
+               Eina_Bool resize)
 {
        Evas_Object *layout;
 
-       if (!parent || !group) {
+       if (!parent) {
                _ERR("Invalid argument.");
                return NULL;
        }
@@ -58,11 +60,14 @@ Evas_Object *utils_add_layout(Evas_Object *parent, const char *group)
                return NULL;
        }
 
-       elm_layout_file_set(layout, EDJEFILE, group);
+       if (group)
+               elm_layout_file_set(layout, EDJEFILE, group);
 
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
                        EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(parent, layout);
+
+       if (resize)
+               elm_win_resize_object_add(parent, layout);
 
        return layout;
 }
@@ -184,6 +189,14 @@ Evas_Object *utils_add_table(Evas_Object *parent, const char *part,
        return table;
 }
 
+static void _notify_timeout_cb(void *data, Evas_Object *obj, void *ei)
+{
+       if (!obj)
+               return;
+
+       evas_object_del(obj);
+}
+
 Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
                const char *noti_style, const char *label_style, int timeout)
 {
@@ -224,6 +237,8 @@ Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
        if (text)
                elm_object_text_set(lbl, text);
 
+       evas_object_smart_callback_add(notify, SIG_TIMEOUT,
+                       _notify_timeout_cb, NULL);
        evas_object_show(notify);
 
        return notify;
index d73a69c..6601d40 100644 (file)
@@ -154,7 +154,7 @@ static void _free_favorites(Eina_List *list)
        }
 }
 
-static bool _action(Elm_Object_Item *it, enum action_type type)
+static bool _action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct app_data *adata;
        int r;
index b18b6d0..50b25ad 100644 (file)
@@ -128,6 +128,14 @@ static char *_get_data(void *data, enum data_type type)
                /* It will fixed after tv-service's implementation */
                return NULL;
 
+       case DATA_SUBTITLE:
+               /* It will be implemented as GUI guide */
+               return NULL;
+
+       case DATA_DESCRIPTION:
+               /* It will be implemented as GUI guide */
+               return NULL;
+
        default:
                _ERR("Invalid data type.");
                return NULL;
@@ -174,7 +182,43 @@ static bool _unset_favorite(struct channel_data *cdata)
        return true;
 }
 
-static bool _action(Elm_Object_Item *it, enum action_type type)
+static bool _update_lock(struct channel_data *cdata, void *data)
+{
+       TvServiceChannel channel;
+       char *pincode;
+       int r;
+
+       if (!data)
+               return false;
+
+       pincode = data;
+
+       r = tv_service_channel_info_create();
+       if (r != TVS_ERROR_OK) {
+               _ERR("Tv Service channel info create failed.");
+               return false;
+       }
+
+       r = tv_service_get_channel(cdata->id, &channel);
+       if (r != TVS_ERROR_OK) {
+               tv_service_channel_info_destroy();
+               return false;
+       }
+
+       if (channel.locked)
+               r = tv_service_unlock_channel(cdata->id, pincode);
+       else
+               r = tv_service_lock_channel(cdata->id, pincode);
+
+       tv_service_channel_info_destroy();
+
+       if (r < 0)
+               return false;
+
+       return true;
+}
+
+static bool _action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct channel_data *cdata;
        char str[SIZE_STR];
@@ -208,7 +252,11 @@ static bool _action(Elm_Object_Item *it, enum action_type type)
                break;
 
        case ACTION_UPDATE_LOCK:
-               /* It will implemented later. */
+               if (!_update_lock(cdata, data)) {
+                       _ERR("Update lock status failed.");
+                       return false;
+               }
+
                break;
 
        default:
@@ -232,6 +280,40 @@ static bool _data_updated(void *data1, void *data2)
        return true;
 }
 
+static bool _data_locked(Elm_Object_Item *it, bool *locked)
+{
+       struct channel_data *cdata;
+       TvServiceChannel channel;
+       int r;
+
+       if (!it) {
+               _ERR("Invalid argument.");
+               return false;
+       }
+
+       cdata = elm_object_item_data_get(it);
+       if (!cdata)
+               return false;
+
+       r = tv_service_channel_info_create();
+       if (r != TVS_ERROR_OK) {
+               _ERR("Tv Service channel info create failed.");
+               return false;
+       }
+
+       r = tv_service_get_channel(cdata->id, &channel);
+       if (r != TVS_ERROR_OK) {
+               tv_service_channel_info_destroy();
+               return false;
+       }
+
+       *locked = channel.locked;
+
+       tv_service_channel_info_destroy();
+
+       return true;
+}
+
 static struct datamgr _dmgr = {
        .get_data = _get_data,
        .get_count = NULL,
@@ -239,6 +321,7 @@ static struct datamgr _dmgr = {
        .free_favorites = _free_favorites,
        .action = _action,
        .data_updated = _data_updated,
+       .data_locked = _data_locked,
 };
 
 struct datamgr *get_channel_datamgr(void)
index 0cb365f..a4335da 100644 (file)
@@ -224,7 +224,7 @@ static void _free_favorites(Eina_List *list)
        }
 }
 
-static bool _action(Elm_Object_Item *it, enum action_type type)
+static bool _action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        app_media *am;
        app_media_info *minfo;
index e58437e..da1733f 100644 (file)
@@ -125,7 +125,7 @@ static void _free_favorites(Eina_List *list)
        }
 }
 
-static bool _action(Elm_Object_Item *it, enum action_type type)
+static bool _action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        /* It will be implemented later. */
 
index a7be106..a69b923 100644 (file)
@@ -23,7 +23,6 @@
 #include "define.h"
 #include "grid.h"
 
-#define STR_APPS "Apps"
 #define STYLE_APPS "style.apps"
 #define ITEM_APPS_X (212 + 26)
 #define ITEM_APPS_Y (294 + 26)
@@ -46,7 +45,13 @@ static char *_text_get(void *data, Evas_Object *obj, const char *part)
        if (!name)
                return NULL;
 
-       return strdup(name);
+       if ((!strcmp(name, STR_BROWSER)
+                               && !strcmp(part, PART_THUMB_TEXT_BR))
+                       || (strcmp(name, STR_BROWSER)
+                               && !strcmp(part, PART_THUMB_TEXT)))
+               return strdup(name);
+
+       return NULL;
 }
 
 static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
@@ -98,6 +103,12 @@ static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
                        return NULL;
                }
 
+               if (!strcmp(name, STR_BROWSER)) {
+                       evas_object_color_set(rect, COLOR_BR_R, COLOR_BR_G,
+                                       COLOR_BR_B, COLOR_BR_A);
+                       return rect;
+               }
+
                app_contents_get_color(name, &bright, &dark);
                evas_object_color_set(rect, bright.r, bright.g,
                                bright.b, bright.a);
@@ -112,6 +123,12 @@ static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
                        return NULL;
                }
 
+               if (!strcmp(name, STR_BROWSER)) {
+                       evas_object_color_set(rect, COLOR_BR_R, COLOR_BR_G,
+                                       COLOR_BR_B, COLOR_BR_A);
+                       return rect;
+               }
+
                app_contents_get_color(name, &bright, &dark);
                evas_object_color_set(rect, dark.r, dark.g, dark.b, dark.a);
 
@@ -121,11 +138,35 @@ static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
        return NULL;
 }
 
+static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *part)
+{
+       struct datamgr *dmgr;
+       char *name;
+
+       if (!data) {
+               _ERR("Data is NULL.");
+               return EINA_FALSE;
+       }
+
+       dmgr = get_apps_datamgr();
+       if (!dmgr || !dmgr->get_data)
+               return EINA_FALSE;
+
+       name = dmgr->get_data(data, DATA_NAME);
+       if (!name)
+               return EINA_FALSE;
+
+       if (!strcmp(name, STR_BROWSER))
+               return EINA_TRUE;
+
+       return EINA_FALSE;
+}
+
 static struct grid_class _gclass = {
        .item_style = STYLE_APPS,
        .text_get = _text_get,
        .content_get = _content_get,
-       .state_get = NULL,
+       .state_get = _state_get,
        .del = NULL,
 };
 
@@ -154,7 +195,7 @@ static void _destroy_item_list(Eina_List *list)
        dmgr->free_favorites(list);
 }
 
-static bool _item_action(Elm_Object_Item *it, enum action_type type)
+static bool _item_action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct datamgr *dmgr;
 
@@ -167,7 +208,7 @@ static bool _item_action(Elm_Object_Item *it, enum action_type type)
        if (!dmgr || !dmgr->action)
                return false;
 
-       if (!dmgr->action(it, type)) {
+       if (!dmgr->action(it, type, data)) {
                _ERR("The item action failed.");
                return false;
        }
@@ -187,7 +228,7 @@ static bool _item_updated(void *pre_data, void *new_data)
 }
 
 static struct grid_data _gdata = {
-       .id = STR_APPS,
+       .id = GRID_APP,
        .item_size_x = ITEM_APPS_X,
        .item_size_y = ITEM_APPS_Y,
        .gclass = &_gclass,
index be85c2c..d648caa 100644 (file)
@@ -23,7 +23,6 @@
 #include "define.h"
 #include "grid.h"
 
-#define STR_GALLERY "Gallery"
 #define STYLE_GALLERY "style.gallery"
 #define ITEM_GALLERY_X (200 + 6)
 #define ITEM_GALLERY_Y (200 + 6)
@@ -133,7 +132,7 @@ static void _destroy_item_list(Eina_List *list)
        dmgr->free_favorites(list);
 }
 
-static bool _item_action(Elm_Object_Item *it, enum action_type type)
+static bool _item_action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct datamgr *dmgr;
 
@@ -146,7 +145,7 @@ static bool _item_action(Elm_Object_Item *it, enum action_type type)
        if (!dmgr || !dmgr->action)
                return false;
 
-       if (!dmgr->action(it, type)) {
+       if (!dmgr->action(it, type, data)) {
                _ERR("The item action failed.");
                return false;
        }
@@ -166,7 +165,7 @@ static bool _item_updated(void *pre_data, void *new_data)
 }
 
 static struct grid_data _gdata = {
-       .id = STR_GALLERY,
+       .id = GRID_GALLERY,
        .item_size_x = ITEM_GALLERY_X,
        .item_size_y = ITEM_GALLERY_Y,
        .gclass = &_gclass,
index 5ac0356..c90ffe6 100644 (file)
@@ -22,7 +22,6 @@
 #include "define.h"
 #include "grid.h"
 
-#define STR_MOVIE "Movie"
 #define STYLE_MOVIE "style.movie"
 #define ITEM_MOVIE_X (378 + 26)
 #define ITEM_MOVIE_Y (294 + 26)
@@ -157,7 +156,7 @@ static void _destroy_item_list(Eina_List *list)
        dmgr->free_favorites(list);
 }
 
-static bool _item_action(Elm_Object_Item *it, enum action_type type)
+static bool _item_action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct datamgr *dmgr;
 
@@ -170,7 +169,7 @@ static bool _item_action(Elm_Object_Item *it, enum action_type type)
        if (!dmgr || !dmgr->action)
                return false;
 
-       if (!dmgr->action(it, type)) {
+       if (!dmgr->action(it, type, data)) {
                _ERR("The item action failed.");
                return false;
        }
@@ -190,7 +189,7 @@ static bool _item_updated(void *pre_data, void *new_data)
 }
 
 static struct grid_data _gdata = {
-       .id = STR_MOVIE,
+       .id = GRID_MOVIE,
        .item_size_x = ITEM_MOVIE_X,
        .item_size_y = ITEM_MOVIE_Y,
        .gclass = &_gclass,
index e6090c6..3a2aae4 100644 (file)
@@ -23,7 +23,6 @@
 #include "define.h"
 #include "grid.h"
 
-#define STR_MUSIC "Music"
 #define STYLE_MUSIC "style.music"
 #define ITEM_MUSIC_X (488 + 26)
 #define ITEM_MUSIC_Y (134 + 26)
@@ -131,7 +130,7 @@ static void _destroy_item_list(Eina_List *list)
        dmgr->free_favorites(list);
 }
 
-static bool _item_action(Elm_Object_Item *it, enum action_type type)
+static bool _item_action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct datamgr *dmgr;
 
@@ -144,7 +143,7 @@ static bool _item_action(Elm_Object_Item *it, enum action_type type)
        if (!dmgr || !dmgr->action)
                return false;
 
-       if (!dmgr->action(it, type)) {
+       if (!dmgr->action(it, type, data)) {
                _ERR("The item action failed.");
                return false;
        }
@@ -164,7 +163,7 @@ static bool _item_updated(void *pre_data, void *new_data)
 }
 
 static struct grid_data _gdata = {
-       .id = STR_MUSIC,
+       .id = GRID_MUSIC,
        .item_size_x = ITEM_MUSIC_X,
        .item_size_y = ITEM_MUSIC_Y,
        .gclass = &_gclass,
index 8ad32b4..a6bee0f 100644 (file)
@@ -23,7 +23,6 @@
 #include "grid.h"
 #include "datamgr.h"
 
-#define STR_TV "TV"
 #define STYLE_TV "style.tv"
 #define ITEM_TV_X (378 + 26)
 #define ITEM_TV_Y (294 + 26)
@@ -154,7 +153,7 @@ static void _destroy_item_list(Eina_List *list)
        dmgr->free_favorites(list);
 }
 
-static bool _item_action(Elm_Object_Item *it, enum action_type type)
+static bool _item_action(Elm_Object_Item *it, enum action_type type, void *data)
 {
        struct datamgr *dmgr;
 
@@ -167,7 +166,7 @@ static bool _item_action(Elm_Object_Item *it, enum action_type type)
        if (!dmgr || !dmgr->action)
                return false;
 
-       if (!dmgr->action(it, type)) {
+       if (!dmgr->action(it, type, data)) {
                _ERR("The item action failed.");
                return false;
        }
@@ -186,8 +185,60 @@ static bool _item_updated(void *pre_data, void *new_data)
        return dmgr->data_updated(pre_data, new_data);
 }
 
+static bool _item_locked(Elm_Object_Item *it, bool *locked)
+{
+       struct datamgr *dmgr;
+
+       if (!it) {
+               _ERR("Invalid argument.");
+               return false;
+       }
+
+       dmgr = get_channel_datamgr();
+       if (!dmgr || !dmgr->data_locked)
+               return false;
+
+       if (!dmgr->data_locked(it, locked)) {
+               _ERR("Get lock status failed.");
+               return false;
+       }
+
+       return true;
+}
+
+static bool _load_item_banner(Evas_Object *banner, void *data)
+{
+       struct datamgr *dmgr;
+       char *title, *subtitle, *description;
+
+       if (!banner || !data) {
+               _ERR("Invaild argument.");
+               return false;
+       }
+
+       dmgr = get_channel_datamgr();
+       if (!dmgr || !dmgr->get_data)
+               return false;
+
+       elm_layout_file_set(banner, EDJEFILE, GRP_TV_BANNER);
+
+       title = dmgr->get_data(data, DATA_NAME);
+       if (title)
+               elm_object_part_text_set(banner, PART_TITLE, title);
+
+       subtitle = dmgr->get_data(data, DATA_SUBTITLE);
+       if (subtitle)
+               elm_object_part_text_set(banner, PART_SUBTITLE, subtitle);
+
+       description = dmgr->get_data(data, DATA_DESCRIPTION);
+       if (description)
+               elm_object_part_text_set(banner, PART_DESCRIPT, description);
+
+       return true;
+}
+
 static struct grid_data _gdata = {
-       .id = STR_TV,
+       .id = GRID_TV,
        .item_size_x = ITEM_TV_X,
        .item_size_y = ITEM_TV_Y,
        .gclass = &_gclass,
@@ -195,6 +246,8 @@ static struct grid_data _gdata = {
        .destroy_item_list = _destroy_item_list,
        .item_action = _item_action,
        .item_updated = _item_updated,
+       .item_locked = _item_locked,
+       .load_item_banner = _load_item_banner,
 };
 
 struct grid_data *get_tv_grid_data(void)
index ee42d6b..1414742 100644 (file)
@@ -22,7 +22,6 @@
 #include "define.h"
 #include "grid.h"
 
-#define STR_WEBS "Web"
 #define STYLE_WEBS "style.webs"
 #define ITEM_WEBS_X (378 + 26)
 #define ITEM_WEBS_Y (294 + 26)
@@ -148,7 +147,7 @@ static void _destroy_item_list(Eina_List *list)
 }
 
 static struct grid_data _gdata = {
-       .id = STR_WEBS,
+       .id = GRID_WEB,
        .item_size_x = ITEM_WEBS_X,
        .item_size_y = ITEM_WEBS_Y,
        .gclass = &_gclass,
index 5fea085..89b2aa6 100644 (file)
@@ -17,6 +17,9 @@
 #include <app.h>
 #include <Elementary.h>
 #include <viewmgr.h>
+#include <inputmgr.h>
+#include <ui-gadget.h>
+#include <app_define.h>
 #include <app_debug.h>
 
 #include "define.h"
@@ -49,6 +52,12 @@ static bool _create(void *data)
                return false;
        }
 
+       if (ug_init_efl(win, UG_OPT_INDICATOR_ENABLE) < 0) {
+               _ERR("Fail to init ug");
+               evas_object_del(win);
+               return false;
+       }
+
        if (!viewmgr_create(win)) {
                _ERR("Create viewmgr failed.");
                evas_object_del(win);
@@ -69,6 +78,13 @@ static bool _create(void *data)
                return false;
        }
 
+       if (!viewmgr_add_view(view_pin_get_vclass(), NULL)) {
+               _ERR("Add view faild.");
+               viewmgr_destroy();
+               evas_object_del(win);
+               return false;
+       }
+
        ad->win = win;
 
        return true;
@@ -89,14 +105,17 @@ static void _terminate(void *data)
                ad->win = NULL;
        }
 
-       viewmgr_remove_view(VIEW_ID_BASE);
-       viewmgr_remove_view(VIEW_ID_ACTION_MENU);
+       viewmgr_remove_view(VIEW_BASE);
+       viewmgr_remove_view(VIEW_ACTION_MENU);
+       viewmgr_remove_view(VIEW_PIN);
        viewmgr_destroy();
 }
 
 static void _app_control(app_control_h control, void *data)
 {
        struct _appdata *ad;
+       char *category;
+       int r;
 
        if (!data) {
                _ERR("Get data failed.");
@@ -107,10 +126,37 @@ static void _app_control(app_control_h control, void *data)
        if (ad->win)
                elm_win_activate(ad->win);
 
-       if (!viewmgr_push_view(VIEW_ID_BASE))
+       r = app_control_get_extra_data(control, PARAM_CATEGORY, &category);
+       if (r != APP_CONTROL_ERROR_NONE)
+               category = NULL;
+
+       if (category)
+               viewmgr_update_view(VIEW_BASE, UPDATE_MENU, category);
+
+       if (!viewmgr_push_view(VIEW_BASE))
                _ERR("Push view failed.");
 }
 
+static void _pause(void *data)
+{
+       view_state state;
+
+       state = viewmgr_get_view_state(VIEW_ACTION_MENU);
+       if (state == VIEW_STATE_VISIBLE)
+               viewmgr_hide_view(VIEW_ACTION_MENU);
+
+       state = viewmgr_get_view_state(VIEW_PIN);
+       if (state == VIEW_STATE_VISIBLE)
+               viewmgr_hide_view(VIEW_PIN);
+
+       inputmgr_enable(EINA_FALSE);
+}
+
+static void _resume(void *data)
+{
+       inputmgr_enable(EINA_TRUE);
+}
+
 int main(int argc, char *argv[])
 {
        struct _appdata ad;
@@ -118,6 +164,8 @@ int main(int argc, char *argv[])
                .create = _create,
                .terminate = _terminate,
                .app_control = _app_control,
+               .pause = _pause,
+               .resume = _resume,
        };
 
        memset(&ad, 0x00, sizeof(ad));
index 52d8aed..6b719e0 100644 (file)
@@ -37,6 +37,7 @@ struct _priv {
        Evas_Object *base;
        Evas_Object *live_btn;
        Evas_Object *menu_btn[COUNT_ACTION];
+       Evas_Object *banner;
        struct grid_data *gdata;
 };
 
@@ -44,21 +45,18 @@ struct _action_info {
        int id;
        const char *title;
        const char *style;
-       Eina_Bool disable;
 };
 
 static struct _action_info action_info[] = {
        {
                .id = BTN_FAVORITE,
                .title = STR_FAVORITE,
-               .style = STYLE_ACTION_MENU_FAV_BTN,
-               .disable = EINA_FALSE
+               .style = STYLE_ACTION_MENU_FAV_BTN
        },
        {
                .id = BTN_LOCK,
                .title = STR_LOCK,
-               .style = STYLE_ACTION_MENU_LOCK_BTN,
-               .disable = EINA_TRUE
+               .style = STYLE_ACTION_MENU_LOCK_BTN
        }
 };
 
@@ -81,18 +79,29 @@ static void _livetv_selected(void)
                return;
        }
 
-       viewmgr_hide_view(VIEW_ID_ACTION_MENU);
+       viewmgr_hide_view(VIEW_ACTION_MENU);
 }
 
 static void _favorite_selected(struct grid_data *gdata)
 {
-       if (!gdata->item_action(gdata->focused_item, ACTION_UPDATE_FAVORITE)) {
+       if (!gdata->item_action(gdata->focused_item,
+                               ACTION_UPDATE_FAVORITE, NULL)) {
                _ERR("Unfavorite failed.");
                return;
        }
 
-       viewmgr_update_view(VIEW_ID_BASE, UPDATE_GRID, gdata);
-       viewmgr_hide_view(VIEW_ID_ACTION_MENU);
+       viewmgr_update_view(VIEW_BASE, UPDATE_GRID, gdata);
+       viewmgr_update_view(VIEW_BASE, UPDATE_SHOW_TOAST, STR_REMOVE_FAVORITE);
+       viewmgr_hide_view(VIEW_ACTION_MENU);
+}
+
+static void _lock_selected(struct grid_data *gdata)
+{
+       if (!gdata->item_action || !gdata->item_locked)
+               return;
+
+       viewmgr_update_view(VIEW_PIN, UPDATE_DATA, gdata);
+       viewmgr_show_view(VIEW_PIN);
 }
 
 static void _clicked_cb(int id, void *data, Evas_Object *obj)
@@ -116,7 +125,7 @@ static void _clicked_cb(int id, void *data, Evas_Object *obj)
                break;
 
        case BTN_LOCK:
-               /* It is not supported yet. */
+               _lock_selected(priv->gdata);
                break;
 
        default:
@@ -134,7 +143,7 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
 
        if (!strcmp(ev->keyname, KEY_BACK)
                        || !strcmp(ev->keyname, KEY_BACK_REMOTE))
-               viewmgr_hide_view(VIEW_ID_ACTION_MENU);
+               viewmgr_hide_view(VIEW_ACTION_MENU);
 }
 
 static input_handler _btn_input_handler = {
@@ -156,15 +165,60 @@ static bool _draw_livetv_area(struct _priv *priv)
 
        inputmgr_add_callback(btn, BTN_LIVETV, &_btn_input_handler, priv);
 
-       elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
-       elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
-       elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
-
        priv->live_btn = btn;
 
        return true;
 }
 
+static void _set_focus_policy(struct _priv *priv)
+{
+       int i;
+
+       elm_object_focus_next_object_set(priv->live_btn, priv->live_btn,
+                       ELM_FOCUS_UP);
+       elm_object_focus_next_object_set(priv->live_btn, priv->live_btn,
+                       ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(priv->live_btn, priv->live_btn,
+                       ELM_FOCUS_RIGHT);
+       elm_object_focus_next_object_set(priv->live_btn, priv->menu_btn[0],
+                       ELM_FOCUS_DOWN);
+
+       elm_object_focus_next_object_set(priv->menu_btn[0], priv->menu_btn[0],
+                       ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(priv->menu_btn[COUNT_ACTION - 1],
+                priv->menu_btn[COUNT_ACTION - 1], ELM_FOCUS_RIGHT);
+
+       for (i = 0; i < COUNT_ACTION; i++)
+               elm_object_focus_next_object_set(priv->menu_btn[i],
+                               priv->menu_btn[i], ELM_FOCUS_DOWN);
+}
+
+static void _set_action_state(int idx, Evas_Object *btn, struct _priv *priv)
+{
+       struct grid_data *gdata;
+       bool locked;
+
+       if (!priv->gdata)
+               return;
+
+       gdata = priv->gdata;
+
+       if (action_info[idx].id == BTN_LOCK) {
+               /* Channel can only be locked */
+               if (!strcmp(gdata->id, GRID_TV) && gdata->item_locked) {
+                       gdata->item_locked(gdata->focused_item, &locked);
+
+                       if (locked)
+                               elm_object_signal_emit(btn, SIG_TOGGLE,
+                                               SRC_ACTION_BTN);
+
+                       return;
+               }
+
+               elm_object_disabled_set(btn, EINA_TRUE);
+       }
+}
+
 static bool _draw_action_area(struct _priv *priv)
 {
        Evas_Object *table, *btn;
@@ -189,8 +243,7 @@ static bool _draw_action_area(struct _priv *priv)
                inputmgr_add_callback(btn, action_info[i].id,
                                &_btn_input_handler, priv);
 
-               if (action_info[i].disable)
-                       elm_object_disabled_set(btn, EINA_TRUE);
+               _set_action_state(i, btn, priv);
 
                col = i % SIZE_COL_MAX;
                row = i / SIZE_COL_MAX;
@@ -200,15 +253,33 @@ static bool _draw_action_area(struct _priv *priv)
                priv->menu_btn[i] = btn;
        }
 
-       /* 'Favorite' can only be focused now. */
-       elm_object_focus_next_object_set(priv->menu_btn[0],
-                       priv->menu_btn[0], ELM_FOCUS_LEFT);
-       elm_object_focus_next_object_set(priv->menu_btn[0],
-                       priv->menu_btn[0], ELM_FOCUS_RIGHT);
-       elm_object_focus_next_object_set(priv->menu_btn[0],
-                       priv->menu_btn[0], ELM_FOCUS_DOWN);
-       elm_object_focus_next_object_set(priv->live_btn, priv->menu_btn[0],
-                       ELM_FOCUS_DOWN);
+       _set_focus_policy(priv);
+
+       return true;
+}
+
+static bool _draw_banner_area(struct _priv *priv)
+{
+       Evas_Object *banner;
+       void *data;
+
+       data = elm_object_item_data_get(priv->gdata->focused_item);
+       if (!data)
+               return false;
+
+       banner = utils_add_layout(priv->base, NULL, EINA_FALSE);
+       if (!banner) {
+               _ERR("Add layout failed.");
+               return false;
+       }
+
+       if (!priv->gdata->load_item_banner ||
+                       !priv->gdata->load_item_banner(banner, data))
+               return false;
+
+       elm_object_part_content_set(priv->base, PART_BANNER, banner);
+
+       priv->banner = banner;
 
        return true;
 }
@@ -229,7 +300,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       base = utils_add_layout(win, GRP_VIEW_ACTION_MENU);
+       base = utils_add_layout(win, GRP_VIEW_ACTION_MENU, EINA_TRUE);
        if (!base) {
                _ERR("Add layout failed.");
                free(priv);
@@ -239,7 +310,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        priv->win = win;
        priv->base = base;
 
-       if (!viewmgr_set_view_data(VIEW_ID_ACTION_MENU, priv)) {
+       if (!viewmgr_set_view_data(VIEW_ACTION_MENU, priv)) {
                _ERR("Set view data failed.");
                evas_object_del(base);
                free(priv);
@@ -247,7 +318,6 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        }
 
        _draw_livetv_area(priv);
-       _draw_action_area(priv);
 
        return base;
 }
@@ -278,6 +348,9 @@ static void _hide(void *data)
        }
        priv = data;
 
+       if (priv->banner)
+               evas_object_del(priv->banner);
+
        if (priv->base)
                evas_object_hide(priv->base);
 }
@@ -292,8 +365,14 @@ static void _update(void *view_data, int update_type, void *data)
        }
        priv = view_data;
 
-       if (update_type == UPDATE_DATA)
+       if (update_type == UPDATE_DATA) {
+               if (!data)
+                       return;
+
                priv->gdata = data;
+               _draw_action_area(priv);
+               _draw_banner_area(priv);
+       }
 }
 
 static void _destroy(void *data)
@@ -313,7 +392,7 @@ static void _destroy(void *data)
 }
 
 static view_class _vclass = {
-       .view_id = VIEW_ID_ACTION_MENU,
+       .view_id = VIEW_ACTION_MENU,
        .create = _create,
        .show = _show,
        .hide = _hide,
index d3b04de..79bb8b9 100644 (file)
@@ -43,6 +43,7 @@ struct _priv {
        Evas_Object *base;
        Evas_Object *box;
        Evas_Object *menu[COUNT_MENU];
+       Evas_Object *notify;
        int cur_menu_id;
 };
 
@@ -269,7 +270,7 @@ static void _grid_item_selected_cb(void *data, Elm_Object_Item *it,
        gdata = data;
 
        if (gdata->item_action)
-               gdata->item_action(it, ACTION_LAUNCH);
+               gdata->item_action(it, ACTION_LAUNCH, NULL);
 
        elm_gengrid_item_selected_set(it, EINA_FALSE);
 }
@@ -331,8 +332,8 @@ static void _grid_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
                if (!gdata)
                        return;
 
-               viewmgr_update_view(VIEW_ID_ACTION_MENU, UPDATE_DATA, gdata);
-               viewmgr_show_view(VIEW_ID_ACTION_MENU);
+               viewmgr_update_view(VIEW_ACTION_MENU, UPDATE_DATA, gdata);
+               viewmgr_show_view(VIEW_ACTION_MENU);
        }
 }
 
@@ -386,11 +387,6 @@ static bool _draw_top_area(struct _priv *priv)
                priv->menu[i] = btn;
        }
 
-       elm_object_focus_next_object_set(priv->menu[0],
-                       priv->menu[COUNT_MENU - 1], ELM_FOCUS_LEFT);
-       elm_object_focus_next_object_set(priv->menu[COUNT_MENU - 1],
-                       priv->menu[0], ELM_FOCUS_RIGHT);
-
        elm_object_focus_set(priv->menu[0], EINA_TRUE);
 
        return true;
@@ -445,7 +441,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                return NULL;
        }
 
-       base = utils_add_layout(win, GRP_VIEW_BASE);
+       base = utils_add_layout(win, GRP_VIEW_BASE, EINA_TRUE);
        if (!base) {
                _ERR("Add layout failed.");
                free(priv);
@@ -473,7 +469,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                }
        }
 
-       if (!viewmgr_set_view_data(VIEW_ID_BASE, priv)) {
+       if (!viewmgr_set_view_data(VIEW_BASE, priv)) {
                _ERR("Set view data failed.");
                gridmgr_destroy(gmgr);
                goto err;
@@ -521,13 +517,70 @@ static void _hide(void *data)
 
 static void _update(void *view_data, int update_type, void *data)
 {
+       struct _priv *priv;
+       struct grid_data *gdata;
+       char *menu_category;
+       int i;
+
        if (!view_data) {
                _ERR("Get data failed.");
                return;
        }
+       priv = view_data;
+
+       switch (update_type) {
+       case UPDATE_MENU:
+               if (!data)
+                       return;
+
+               menu_category = data;
+
+               for (i = 0; i < COUNT_MENU; i++) {
+                       gdata = _get_grid_data[i]();
+
+                       if (gdata && gdata->id
+                                       && !strcmp(gdata->id, menu_category)) {
+                               elm_object_focus_set(priv->menu[i], EINA_TRUE);
+                               break;
+                       }
+               }
+
+               break;
+
+       case UPDATE_GRID:
+               _update_current_grid(priv);
+               break;
 
-       if (update_type == UPDATE_GRID)
-               _update_current_grid(view_data);
+       case UPDATE_SHOW_TOAST:
+               priv->notify = utils_add_notify(priv->base, (char *)data,
+                               STYLE_TOAST, STYLE_TOAST, SIZE_TOAST_TIMEOUT);
+
+               break;
+
+       case UPDATE_LOCK:
+               if (!data)
+                       return;
+
+               gdata = data;
+
+               elm_object_item_signal_emit(gdata->focused_item, SIG_VISIBLE,
+                               SRC_LOCK_ICON);
+
+               break;
+
+       case UPDATE_UNLOCK:
+               if (!data)
+                       return;
+
+               gdata = data;
+
+               elm_object_item_signal_emit(gdata->focused_item, SIG_INVISIBLE,
+                               SRC_LOCK_ICON);
+
+               break;
+       default:
+               _ERR("Unhandled update type.");
+       }
 }
 
 static void _destroy(void *data)
@@ -558,7 +611,7 @@ static void _destroy(void *data)
 }
 
 static view_class _vclass = {
-       .view_id = VIEW_ID_BASE,
+       .view_id = VIEW_BASE,
        .create = _create,
        .show = _show,
        .hide = _hide,
diff --git a/src/view/view_pin.c b/src/view/view_pin.c
new file mode 100644 (file)
index 0000000..253db24
--- /dev/null
@@ -0,0 +1,226 @@
+/* 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 <Elementary.h>
+#include <viewmgr.h>
+#include <ui-gadget.h>
+#include <app_define.h>
+#include <app_debug.h>
+
+#include "grid.h"
+#include "view.h"
+#include "define.h"
+
+struct _priv {
+       Evas_Object *win;
+       ui_gadget_h ug;
+       struct grid_data *gdata;
+};
+
+static void _send_message(struct _priv *priv, const char *result)
+{
+       service_h service;
+       int r;
+
+       r = service_create(&service);
+       if (r != SERVICE_ERROR_NONE) {
+               _ERR("Fail to create service");
+               return;
+       }
+
+       r = service_add_extra_data(service, PARAM_PIN, result);
+       if (r != SERVICE_ERROR_NONE) {
+               _ERR("Fail to add data");
+               service_destroy(service);
+               return;
+       }
+
+       ug_send_message(priv->ug, service);
+       service_destroy(service);
+}
+
+static void _pincode_checked(struct _priv *priv, char *pincode)
+{
+       bool locked;
+
+       if (!priv->gdata->item_action(priv->gdata->focused_item,
+                               ACTION_UPDATE_LOCK, pincode)) {
+               _ERR("Update lock failed.");
+               _send_message(priv, STR_FAIL);
+               return;
+       }
+
+       if (!priv->gdata->item_locked(priv->gdata->focused_item, &locked)) {
+               _ERR("Get lock status failed.");
+               goto end;
+       }
+
+
+       if (locked) {
+               viewmgr_update_view(VIEW_BASE, UPDATE_LOCK, priv->gdata);
+               viewmgr_update_view(VIEW_BASE, UPDATE_SHOW_TOAST, STR_LOCKED);
+       } else {
+               viewmgr_update_view(VIEW_BASE, UPDATE_UNLOCK, priv->gdata);
+               viewmgr_update_view(VIEW_BASE, UPDATE_SHOW_TOAST, STR_UNLOCKED);
+       }
+
+end:
+       viewmgr_hide_view(VIEW_PIN);
+       viewmgr_hide_view(VIEW_ACTION_MENU);
+}
+
+static void _ug_result_cb(ui_gadget_h ug, service_h result, void *priv)
+{
+       char *pincode;
+       int r;
+
+       if (!priv) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       r = service_get_extra_data(result, PARAM_PIN, &pincode);
+       if (r != SERVICE_ERROR_NONE || !pincode) {
+               _ERR("Fail to get data");
+               return;
+       }
+
+       _pincode_checked(priv, pincode);
+
+       free(pincode);
+}
+
+static void _ug_destroy_cb(ui_gadget_h ug, void *priv)
+{
+       viewmgr_hide_view(VIEW_PIN);
+}
+
+static ui_gadget_h _load_pin_ug(struct _priv *priv)
+{
+       ui_gadget_h ug;
+       struct ug_cbs cbs = {0,};
+
+       cbs.result_cb = _ug_result_cb;
+       cbs.destroy_cb = _ug_destroy_cb;
+       cbs.priv = priv;
+
+       ug = ug_create(NULL, UG_ID_PIN, UG_MODE_FRAMEVIEW, NULL, &cbs);
+
+       return ug;
+}
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+
+       if (!win) {
+               _ERR("Get window object failed.");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("Calloc failed.");
+               return NULL;
+       }
+
+       priv->win = win;
+
+       if (!viewmgr_set_view_data(VIEW_PIN, priv)) {
+               _ERR("Set view data failed.");
+               free(priv);
+               return NULL;
+       }
+
+       return win;
+}
+
+static void _show(void *data)
+{
+       struct _priv *priv;
+       ui_gadget_h ug;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       ug = _load_pin_ug(priv);
+       if (!ug) {
+               _ERR("Create pin ug failed.");
+               return;
+       }
+
+       priv->ug = ug;
+}
+
+static void _hide(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       if (priv->ug)
+               ug_destroy(priv->ug);
+}
+
+static void _update(void *view_data, int update_type, void *data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = view_data;
+
+       if (update_type == UPDATE_DATA)
+               priv->gdata = data;
+}
+
+static void _destroy(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       if (priv->ug)
+               ug_destroy(priv->ug);
+
+       free(priv);
+}
+
+static view_class _vclass = {
+       .view_id = VIEW_PIN,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .update = _update,
+       .destroy = _destroy,
+};
+
+view_class *view_pin_get_vclass(void)
+{
+       return &_vclass;
+}