From: Jehun Lim Date: Mon, 10 Aug 2015 11:43:43 +0000 (+0900) Subject: add initial action menu view X-Git-Tag: accepted/tizen/tv/20150813.055045^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F45810%2F2;p=profile%2Ftv%2Fapps%2Fnative%2Fair_mediahub.git add initial action menu view Change-Id: I8ca095e9896a6791121609878e32de9155095981 Signed-off-by: Jehun Lim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a6b8a..8f4c9db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ src/main.c src/view/base.c src/view/viewer.c src/view/mplayer.c +src/view/action_menu.c src/layout/movie.c src/layout/gallery.c src/layout/music.c diff --git a/include/define.h b/include/define.h index f2fe159..5872281 100644 --- a/include/define.h +++ b/include/define.h @@ -21,6 +21,7 @@ #include "view/base.h" #include "view/viewer.h" #include "view/mplayer.h" +#include "view/action_menu.h" /* layouts */ #include "layout/movie.h" diff --git a/include/view.h b/include/view.h index ebb5a0e..653bd34 100644 --- a/include/view.h +++ b/include/view.h @@ -26,6 +26,9 @@ view_class *view_viewer_get_vclass(void); /* music player */ view_class *view_mplayer_get_vclass(void); +/* action menu */ +view_class *view_action_menu_get_vclass(void); + /* view data */ struct view_update_data { Eina_List *list; diff --git a/include/view/action_menu.h b/include/view/action_menu.h new file mode 100644 index 0000000..f74b934 --- /dev/null +++ b/include/view/action_menu.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#ifndef __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ +#define __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ + +/* view */ +#define VIEW_ACTION_MENU "VIEW_ACTION_MENU" + +/* group */ +#define GRP_ACTION_MENU_VIEW "group.action_menu_view" + +/* part */ +#define PART_ACTION_TV_BTN "part.action_tv_btn" +#define PART_ACTION_MENU_AREA "part.action_menu_area" +#define PART_ACTION_FAVORITE_TITLE "part.action_favorite_title" +#define PART_ACTION_FAVORITE_AREA "part.action_favorite_area" + +#endif /* __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ */ diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc index 448edc8..c73dcd1 100644 --- a/res/edc/mediahub.edc +++ b/res/edc/mediahub.edc @@ -20,6 +20,7 @@ collections { #include "view/base.edc" #include "view/viewer.edc" #include "view/mplayer.edc" + #include "view/action_menu.edc" #include "layout/movie.edc" #include "layout/gallery.edc" #include "layout/music.edc" diff --git a/res/edc/view/action_menu.edc b/res/edc/view/action_menu.edc new file mode 100644 index 0000000..2ba3028 --- /dev/null +++ b/res/edc/view/action_menu.edc @@ -0,0 +1,171 @@ +/* + * 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_ACTION_MENU_VIEW; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 0 0 0 150; + } + } + part { + name: "menu_area"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1.relative: 1.0 0.0; + min: 500 0; + align: 1.0 0.5; + color: COLOR_ITEM_BG; + fixed: 1 0; + } + } + part { + name: "divider"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "menu_area"; + rel2 { + to: "menu_area"; + relative: 0.0 1.0; + } + min: 1 0; + align: 1.0 0.5; + color: 0 0 0 25; + fixed: 1 0; + } + } + part { + name: "tv_btn_area"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "menu_area"; + rel2 { + to: "menu_area"; + relative: 1.0 0.0; + } + min: 0 118; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_ACTION_TV_BTN; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "tv_btn_area"; + relative: 0.5 0.5; + } + rel2 { + to: "tv_btn_area"; + relative: 0.5 0.5; + } + min: 372 64; + fixed: 1 1; + } + } + part { + name: PART_ACTION_MENU_AREA; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "tv_btn_area"; + relative: 0.0 1.0; + } + rel2.to: "tv_btn_area"; + min: 0 251; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: "padding_favorite_title"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_ACTION_MENU_AREA; + relative: 0.0 1.0; + } + rel2.to: PART_ACTION_MENU_AREA; + min: 0 40; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_ACTION_FAVORITE_TITLE; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_favorite_title"; + relative: 0.0 1.0; + } + rel2.to: "padding_favorite_title"; + min: 0 32; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: "padding_favorite_area"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_ACTION_FAVORITE_TITLE; + relative: 0.0 1.0; + } + rel2.to: PART_ACTION_FAVORITE_TITLE; + min: 0 30; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_ACTION_FAVORITE_AREA; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_favorite_area"; + relative: 0.0 1.0; + } + rel2.to: "bg"; + } + } + } +} diff --git a/src/main.c b/src/main.c index b3272f7..36f007d 100644 --- a/src/main.c +++ b/src/main.c @@ -90,6 +90,7 @@ static bool _create(void *data) viewmgr_add_view(view_base_get_vclass(), NULL); viewmgr_add_view(view_viewer_get_vclass(), NULL); viewmgr_add_view(view_mplayer_get_vclass(), NULL); + viewmgr_add_view(view_action_menu_get_vclass(), NULL); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); elm_win_focus_highlight_style_set(win, STYLE_INVISIBLE); @@ -113,6 +114,7 @@ static void _terminate(void *data) viewmgr_remove_view(VIEW_BASE); viewmgr_remove_view(VIEW_VIEWER); viewmgr_remove_view(VIEW_MPLAYER); + viewmgr_remove_view(VIEW_ACTION_MENU); viewmgr_destroy(); diff --git a/src/view/action_menu.c b/src/view/action_menu.c new file mode 100644 index 0000000..ef0cc30 --- /dev/null +++ b/src/view/action_menu.c @@ -0,0 +1,120 @@ +/* + * 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 +#include +#include + +#include "define.h" + +struct _priv { + Evas_Object *win; + Evas_Object *base; +}; + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + + if (!win) { + _ERR("failed to get win object"); + return NULL; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return NULL; + } + + base = elm_layout_add(win); + if (!base) { + _ERR("failed to create base object"); + free(priv); + return NULL; + } + + elm_layout_file_set(base, EDJEFILE, GRP_ACTION_MENU_VIEW); + + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + priv->win = win; + priv->base = base; + + viewmgr_set_view_data(VIEW_ACTION_MENU, priv); + + return base; +} + +static void _show(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + evas_object_show(priv->base); +} + +static void _hide(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + evas_object_hide(priv->base); +} + +static void _destroy(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + evas_object_del(priv->base); + + free(priv); +} + +static view_class _vclass = { + .view_id = VIEW_ACTION_MENU, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_action_menu_get_vclass(void) +{ + return &_vclass; +}