summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2015-10-01 17:20:32 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2015-10-01 17:20:32 -0700
commitaa3f1d4672b4542702d213010b47b995885c2fac (patch)
tree7263d217e90797082c752de3efe23842b8fbdfda
parent5c13e4f787c5a447d2f69663c658f24bb4bbb915 (diff)
parente425d0585f2e56bdc9fa78c50227fd9c945bd970 (diff)
downloadair_mediahub-aa3f1d4672b4542702d213010b47b995885c2fac.tar.gz
air_mediahub-aa3f1d4672b4542702d213010b47b995885c2fac.tar.bz2
air_mediahub-aa3f1d4672b4542702d213010b47b995885c2fac.zip
Merge "action_menu: scrolls the whole area of action menu" into tizen
-rw-r--r--include/util/util.h1
-rw-r--r--include/view/action_menu.h16
-rw-r--r--res/edc/view/action_menu.edc192
-rw-r--r--res/edc/widgets/button.edc66
-rw-r--r--src/util/util.c47
-rw-r--r--src/view/action_menu.c208
6 files changed, 341 insertions, 189 deletions
diff --git a/include/util/util.h b/include/util/util.h
index 1ade043..2857f20 100644
--- a/include/util/util.h
+++ b/include/util/util.h
@@ -21,6 +21,7 @@
#include <app_media.h>
bool util_check_movie_type(const char *str);
+bool util_launch_request(const char *appid, const char *key, const char *value);
Evas_Object *util_add_button(Evas_Object *base, const char *style,
const char *text);
Evas_Object *util_add_box(Evas_Object *base, Eina_Bool horizontal);
diff --git a/include/view/action_menu.h b/include/view/action_menu.h
index f4730d8..5e29159 100644
--- a/include/view/action_menu.h
+++ b/include/view/action_menu.h
@@ -22,10 +22,13 @@
/* group */
#define GRP_ACTION_MENU_VIEW "group.action_menu_view"
+#define GRP_ACTION_MENU_CONTENT "group.action_menu_content"
#define GRP_ACTION_NO_CONTENT "group.action_no_content"
/* part */
+#define PART_ACTION_MENU "part.action_menu"
#define PART_ACTION_TV_BTN "part.action_tv_btn"
+#define PART_ACTION_MORE_BTN "part.action_more_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"
@@ -34,12 +37,9 @@
#define PART_NO_CONTENT_BG "part.no_content_bg"
#define PART_NO_CONTENT_TEXT "part.no_content_text"
-/* signal */
-#define SIG_SHOW_NO_CONTENT "show,no_content"
-#define SIG_HIDE_NO_CONTENT "hide,no_content"
-
/* style */
#define STYLE_BTN_LIVETV "action_btn_livetv"
+#define STYLE_BTN_MORE "action_btn_more"
#define STYLE_BTN_FAVORITE "action_btn_favorite"
#define STYLE_BTN_DELETE "action_btn_delete"
@@ -61,11 +61,19 @@
#define IMAGE_ACTION_DELETE_FOC "/btn_menu_del_foc.png"
#define IMAGE_ACTION_DELETE_DIS "/btn_menu_del_dis.png"
+/* defines */
#define GRID_ITEM_X_MOVIE 440
#define GRID_ITEM_Y_MOVIE (328 + 32)
#define GRID_ITEM_X_GALLERY (210 + 20)
#define GRID_ITEM_Y_GALLERY (210 + 20)
#define GRID_ITEM_X_MUSIC 440
#define GRID_ITEM_Y_MUSIC (134 + 20)
+#define GRID_ITEM_N_MOVIE 1
+#define GRID_ITEM_N_GALLERY 2
+#define GRID_ITEM_N_MUSIC 1
+
+#define CATEGORY_MOVIE "Movie"
+#define CATEGORY_GALLERY "Gallery"
+#define CATEGORY_MUSIC "Music"
#endif /* __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ */
diff --git a/res/edc/view/action_menu.edc b/res/edc/view/action_menu.edc
index 7ece860..ec2bc9d 100644
--- a/res/edc/view/action_menu.edc
+++ b/res/edc/view/action_menu.edc
@@ -42,8 +42,6 @@ group {
state: "show" 0.0;
inherit: "default" 0.0;
align: 1.0 0.5;
- color: COLOR_ITEM_BG;
- fixed: 1 0;
}
}
part {
@@ -64,37 +62,63 @@ group {
}
}
part {
- name: "tv_btn_area";
- type: SPACER;
+ name: PART_ACTION_MENU;
+ type: SWALLOW;
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;
+ rel2.to: "menu_area";
}
}
+ }
+ programs {
+ program {
+ name: SIG_SHOW_VIEW;
+ signal: SIG_SHOW_VIEW;
+ source: SIG_SOURCE_SRC;
+ action: STATE_SET "show" 0.0;
+ target: "menu_area";
+ transition: TRANSITION_SHOW_MENU;
+ }
+ program {
+ name: SIG_HIDE_VIEW;
+ signal: SIG_HIDE_VIEW;
+ source: SIG_SOURCE_SRC;
+ action: STATE_SET "default" 0.0;
+ target: "menu_area";
+ transition: TRANSITION_HIDE_MENU;
+ after: SIG_HIDE_DONE;
+ }
+ program {
+ name: SIG_HIDE_DONE;
+ action: SIGNAL_EMIT SIG_HIDE_DONE SIG_SOURCE_EDC;
+ }
+ program {
+ name: SIG_HIDE_SET;
+ signal: SIG_HIDE_SET;
+ source: SIG_SOURCE_SRC;
+ action: STATE_SET "default" 0.0;
+ target: "menu_area";
+ }
+ }
+}
+
+group {
+ name: GRP_ACTION_MENU_CONTENT;
+ parts {
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;
+ relative: 1.0 0.0;
}
- min: 372 64;
- fixed: 1 1;
+ min: 0 118;
+ align: 0.5 0.0;
+ fixed: 0 1;
}
}
part {
@@ -104,10 +128,12 @@ group {
description {
state: "default" 0.0;
rel1 {
- to: "tv_btn_area";
+ to: PART_ACTION_TV_BTN;
relative: 0.0 1.0;
}
- rel2.to: "tv_btn_area";
+ rel2 {
+ to: PART_ACTION_TV_BTN;
+ }
min: 0 1;
align: 0.5 0.0;
color: COLOR_ITEM_DIVIDER;
@@ -121,10 +147,12 @@ group {
description {
state: "default" 0.0;
rel1 {
- to: "tv_btn_area";
+ to: PART_ACTION_TV_BTN;
relative: 0.0 1.0;
}
- rel2.to: "tv_btn_area";
+ rel2 {
+ to: PART_ACTION_TV_BTN;
+ }
min: 0 126;
align: 0.5 0.0;
fixed: 0 1;
@@ -227,19 +255,6 @@ group {
}
}
part {
- name: "padding_favorite_area_right_bottom";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1.relative: 1.0 1.0;
- rel2.relative: 1.0 1.0;
- min: 10 0;
- align: 1.0 1.0;
- fixed: 1 1;
- }
- }
- part {
name: PART_ACTION_FAVORITE_AREA;
type: SWALLOW;
scale: 1;
@@ -249,24 +264,6 @@ group {
to: "padding_favorite_area_left_top";
relative: 0.0 1.0;
}
- rel2 {
- to: "padding_favorite_area_right_bottom";
- relative: 0.0 0.0;
- }
- fixed: 1 1;
- }
- }
- part {
- name: "padding_bg_no_content_right_bottom";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1.relative: 1.0 1.0;
- rel2.relative: 1.0 1.0;
- min: 30 32;
- align: 1.0 1.0;
- fixed: 1 1;
}
}
part {
@@ -275,66 +272,47 @@ group {
scale: 1;
description {
state: "default" 0.0;
+ min: 440 616;
rel1 {
to: "padding_favorite_area_left_top";
relative: 0.0 1.0;
}
- rel2 {
- to: "padding_bg_no_content_right_bottom";
- relative: 0.0 0.0;
- }
- fixed: 1 1;
}
}
}
- programs {
- program {
- name: SIG_SHOW_VIEW;
- signal: SIG_SHOW_VIEW;
- source: SIG_SOURCE_SRC;
- action: STATE_SET "show" 0.0;
- target: "menu_area";
- transition: TRANSITION_SHOW_MENU;
- }
- program {
- name: SIG_HIDE_VIEW;
- signal: SIG_HIDE_VIEW;
- source: SIG_SOURCE_SRC;
- action: STATE_SET "default" 0.0;
- target: "menu_area";
- transition: TRANSITION_HIDE_MENU;
- after: SIG_HIDE_DONE;
- }
- program {
- name: SIG_HIDE_DONE;
- action: SIGNAL_EMIT SIG_HIDE_DONE SIG_SOURCE_EDC;
- }
- program {
- name: SIG_HIDE_SET;
- signal: SIG_HIDE_SET;
- source: SIG_SOURCE_SRC;
- action: STATE_SET "default" 0.0;
- target: "menu_area";
- }
- }
}
group {
name: GRP_ACTION_NO_CONTENT;
parts {
part {
+ name: "padding";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 30 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ fixed: 1 0;
+ }
+ }
+ part {
name: PART_NO_CONTENT_BG;
type: RECT;
scale: 1;
description {
state: "default" 0.0;
+ rel2 {
+ to: "padding";
+ relative: 0.0 1.0;
+ }
color: COLOR_NO_CONTENT_BG;
- visible: 0;
- }
- description {
- state: "show" 0.0;
- inherit: "default" 0.0;
- visible: 1;
}
}
part {
@@ -349,31 +327,7 @@ group {
align: 0.5 0.5;
}
color: COLOR_TEXT_INDEX;
- visible: 0;
}
- description {
- state: "show" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- }
- programs {
- program {
- name: SIG_SHOW_NO_CONTENT;
- signal: SIG_SHOW_NO_CONTENT;
- source: SIG_SOURCE_SRC;
- action: STATE_SET "show" 0.0;
- target: PART_NO_CONTENT_BG;
- target: PART_NO_CONTENT_TEXT;
- }
- program {
- name: SIG_HIDE_NO_CONTENT;
- signal: SIG_HIDE_NO_CONTENT;
- source: SIG_SOURCE_SRC;
- action: STATE_SET "default" 0.0;
- target: PART_NO_CONTENT_BG;
- target: PART_NO_CONTENT_TEXT;
}
}
}
diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc
index 359a06d..a68f5cd 100644
--- a/res/edc/widgets/button.edc
+++ b/res/edc/widgets/button.edc
@@ -3383,12 +3383,33 @@ group {
data.item: "focus_highlight" "on";
parts {
part {
+ name: "padding";
+ type: SPACER;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 500 120;
+ }
+ }
+ part {
name: "bg";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
- color: 0 0 0 0;
+ min: 327 64;
+ rel1 {
+ to: "padding";
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: "padding";
+ relative: 0.5 0.5;
+ }
+ color: COLOR_ITEM_BG;
+ align: 0.5 0.5;
+ fixed: 1 1;
}
description {
state: "focused" 0.0;
@@ -3525,6 +3546,49 @@ group {
}
group {
+ name: "elm/button/base/action_btn_more";
+ inherit: "elm/button/base/action_btn_livetv";
+ data.item: "focus_highlight" "on";
+ parts {
+ part {
+ name: "padding";
+ type: SPACER;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 500 116;
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 184 60;
+ rel1 {
+ to: "padding";
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: "padding";
+ relative: 0.5 0.5;
+ }
+ color: COLOR_ITEM_BG;
+ align: 0.5 0.5;
+ fixed: 1 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_ITEM_FOCUS;
+ }
+ }
+ }
+}
+
+group {
name: "elm/button/base/action_btn_favorite";
data.item: "focus_highlight" "on";
images {
diff --git a/src/util/util.c b/src/util/util.c
index 3e9c86d..c698a3d 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <Elementary.h>
+#include <app_control.h>
#include <app_debug.h>
#include <app_contents.h>
@@ -33,6 +34,52 @@ bool util_check_movie_type(const char *str)
return strcmp(str, VIDEO_COPYRIGHT);
}
+bool util_launch_request(const char *appid, const char *key, const char *value)
+{
+ app_control_h app_ctrl;
+ int r;
+
+ r = app_control_create(&app_ctrl);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to create app control handle");
+ return false;
+ }
+
+ r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to set app control operation");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ if (key && value) {
+ r = app_control_add_extra_data(app_ctrl, key, value);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to add extra data");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+ }
+
+ r = app_control_set_app_id(app_ctrl, appid);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to set app control app id");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ r = app_control_send_launch_request(app_ctrl, NULL, NULL);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to send app control launch request");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ app_control_destroy(app_ctrl);
+
+ return true;
+}
+
Evas_Object *util_add_button(Evas_Object *base, const char *style,
const char *text)
{
diff --git a/src/view/action_menu.c b/src/view/action_menu.c
index c4f21cd..0eb90b6 100644
--- a/src/view/action_menu.c
+++ b/src/view/action_menu.c
@@ -15,7 +15,6 @@
*/
#include <Elementary.h>
-#include <app_control.h>
#include <app_debug.h>
#include <app_contents.h>
#include <app_define.h>
@@ -28,6 +27,7 @@
#define TEXT_LIVETV "Live TV"
#define TEXT_FAVORITE "Favorite"
+#define TEXT_MORE "More"
#define NUM_MENU_BTN 4
#define MAX_BTN_COL 4
@@ -35,9 +35,12 @@
#define TABLE_PADDING_X 0
#define TABLE_PADDING_Y 0
+#define GRID_PADDING 20
+
enum _object_type {
ACTION_DISABLED = -1,
ACTION_LIVETV_BTN = 0,
+ ACTION_MORE_BTN,
ACTION_FAVORITE_BTN,
ACTION_DELETE_BTN,
ACTION_FAVORITE_GRID
@@ -53,12 +56,16 @@ enum _content_type {
struct _priv {
Evas_Object *win;
Evas_Object *base;
+ Evas_Object *scr;
+ Evas_Object *box;
+ Evas_Object *content;
+ Evas_Object *nocontent;
Evas_Object *tv_btn;
+ Evas_Object *more_btn;
Evas_Object *menu_btn[NUM_MENU_BTN];
Evas_Object *table;
- Evas_Object *ly;
Evas_Object *grid;
Elm_Object_Item *selected_it;
@@ -78,10 +85,12 @@ struct _menu_info {
struct _content_info {
int grid_x;
int grid_y;
+ int grid_n;
const char *style;
int app_contents_type;
+ const char *category;
const char *no_content;
};
@@ -116,22 +125,28 @@ struct _content_info content_info[] = {
{
.grid_x = GRID_ITEM_X_MOVIE,
.grid_y = GRID_ITEM_Y_MOVIE,
+ .grid_n = GRID_ITEM_N_MOVIE,
.style = STYLE_GRID_MOVIE_ITEM_FAVORITE,
.app_contents_type = CONTENTS_MOVIE,
+ .category = CATEGORY_MOVIE,
.no_content = "No favorite Movies"
},
{
.grid_x = GRID_ITEM_X_GALLERY,
.grid_y = GRID_ITEM_Y_GALLERY,
+ .grid_n = GRID_ITEM_N_GALLERY,
.style = STYLE_GRID_GALLERY_ITEM_FAVORITE,
.app_contents_type = CONTENTS_GALLERY,
+ .category = CATEGORY_GALLERY,
.no_content = "No favorite Contents"
},
{
.grid_x = GRID_ITEM_X_MUSIC,
.grid_y = GRID_ITEM_Y_MUSIC,
+ .grid_n = GRID_ITEM_N_MUSIC,
.style = STYLE_GRID_SONG_ITEM_FAVORITE,
.app_contents_type = CONTENTS_MUSIC,
+ .category = CATEGORY_MUSIC,
.no_content = "No favorite Songs"
}
};
@@ -154,38 +169,24 @@ static void _hide_view(struct _priv *priv, bool anim)
static bool _livetv_clicked(struct _priv *priv)
{
- app_control_h app_ctrl;
- int r;
-
- r = app_control_create(&app_ctrl);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("failed to create app control handle");
+ if (!util_launch_request(APP_ID_LIVETV, NULL, NULL)) {
+ _ERR("launch failed: %s\n", APP_ID_LIVETV);
return false;
}
- r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("failed to set app control operation");
- app_control_destroy(app_ctrl);
- return false;
- }
+ _hide_view(priv, false);
- r = app_control_set_app_id(app_ctrl, APP_ID_LIVETV);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("failed to set app control app id");
- app_control_destroy(app_ctrl);
- return false;
- }
+ return true;
+}
- r = app_control_send_launch_request(app_ctrl, NULL, NULL);
- if (r != APP_CONTROL_ERROR_NONE) {
- _ERR("failed to send app control launch request");
- app_control_destroy(app_ctrl);
+static bool _more_clicked(struct _priv *priv)
+{
+ if (!util_launch_request(APP_ID_FAVORITE, PARAM_CATEGORY,
+ content_info[priv->content_type].category)) {
+ _ERR("launch failed: %s\n", APP_ID_FAVORITE);
return false;
}
- app_control_destroy(app_ctrl);
-
_hide_view(priv, false);
return true;
@@ -280,6 +281,7 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
switch (id) {
case ACTION_LIVETV_BTN:
+ case ACTION_MORE_BTN:
case ACTION_FAVORITE_BTN:
case ACTION_DELETE_BTN:
if (!elm_object_focus_get(obj))
@@ -313,6 +315,9 @@ static void _clicked_cb(int id, void *data, Evas_Object *obj)
case ACTION_LIVETV_BTN:
_livetv_clicked(priv);
break;
+ case ACTION_MORE_BTN:
+ _more_clicked(priv);
+ break;
case ACTION_FAVORITE_BTN:
_favorite_clicked(priv, obj);
break;
@@ -594,18 +599,13 @@ static bool _draw_livetv_btn(struct _priv *priv)
{
Evas_Object *btn;
- btn = elm_button_add(priv->base);
- if (!btn) {
- _ERR("failed to create button object");
+ btn = util_add_button(priv->content, STYLE_BTN_LIVETV, TEXT_LIVETV);
+ if (!btn)
return false;
- }
-
- elm_object_style_set(btn, STYLE_BTN_LIVETV);
- elm_object_text_set(btn, TEXT_LIVETV);
inputmgr_add_callback(btn, ACTION_LIVETV_BTN, &_handler, priv);
- elm_object_part_content_set(priv->base, PART_ACTION_TV_BTN, btn);
+ elm_object_part_content_set(priv->content, PART_ACTION_TV_BTN, btn);
evas_object_show(btn);
@@ -617,17 +617,38 @@ static bool _draw_livetv_btn(struct _priv *priv)
return true;
}
+static bool _draw_more_btn(struct _priv *priv)
+{
+ Evas_Object *btn;
+
+ btn = util_add_button(priv->box, STYLE_BTN_MORE, TEXT_MORE);
+ if (!btn)
+ return false;
+
+ inputmgr_add_callback(btn, ACTION_MORE_BTN, &_handler, priv);
+
+ evas_object_show(btn);
+ elm_box_pack_end(priv->box, btn);
+
+ elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
+
+ priv->more_btn = btn;
+
+ return true;
+}
+
static bool _draw_menu_area(struct _priv *priv)
{
Evas_Object *table;
- table = util_add_table(priv->base, TABLE_PADDING_X, TABLE_PADDING_Y);
+ table = util_add_table(priv->content, TABLE_PADDING_X, TABLE_PADDING_Y);
if (!table) {
_ERR("failed to add table");
return false;
}
- elm_object_part_content_set(priv->base, PART_ACTION_MENU_AREA, table);
+ elm_object_part_content_set(priv->content, PART_ACTION_MENU_AREA, table);
priv->table = table;
@@ -638,10 +659,10 @@ static bool _draw_favorite_area(struct _priv *priv)
{
Evas_Object *ly, *grid;
- elm_object_part_text_set(priv->base, PART_ACTION_FAVORITE_TITLE,
+ elm_object_part_text_set(priv->content, PART_ACTION_FAVORITE_TITLE,
TEXT_FAVORITE);
- ly = elm_layout_add(priv->base);
+ ly = elm_layout_add(priv->content);
if (!ly) {
_ERR("failed to create layout object");
return false;
@@ -649,9 +670,7 @@ static bool _draw_favorite_area(struct _priv *priv)
elm_layout_file_set(ly, EDJEFILE, GRP_ACTION_NO_CONTENT);
- elm_object_part_content_set(priv->base, PART_ACTION_NO_CONTENT_BG, ly);
-
- grid = util_add_gengrid(priv->base, 0, 0, EINA_FALSE);
+ grid = util_add_gengrid(priv->content, 0, 0, EINA_FALSE);
if (!grid) {
_ERR("failed to create gengrid object");
evas_object_del(ly);
@@ -660,13 +679,12 @@ static bool _draw_favorite_area(struct _priv *priv)
inputmgr_add_callback(grid, ACTION_FAVORITE_GRID, &_handler, priv);
+ elm_object_focus_region_show_mode_set(grid, ELM_FOCUS_REGION_SHOW_ITEM);
+
elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_LEFT);
elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT);
- elm_object_part_content_set(priv->base,
- PART_ACTION_FAVORITE_AREA, grid);
-
- priv->ly = ly;
+ priv->nocontent = ly;
priv->grid = grid;
return true;
@@ -708,15 +726,13 @@ static void _update_menu_area(struct _priv *priv)
}
for (i = 0; i < NUM_MENU_BTN; i++) {
- btn = elm_button_add(priv->base);
+ btn = util_add_button(priv->content, menu_info[i].style,
+ menu_info[i].title);
if (!btn) {
_ERR("failed to create button object");
return;
}
- elm_object_style_set(btn, menu_info[i].style);
- elm_object_text_set(btn, menu_info[i].title);
-
_set_menu_state(btn, i, mi->media_id);
evas_object_show(btn);
@@ -745,20 +761,18 @@ static void _update_menu_area(struct _priv *priv)
static void _update_no_content_area(struct _priv *priv)
{
- if (!priv->favorite_list) {
- elm_object_signal_emit(priv->ly, SIG_SHOW_NO_CONTENT,
- SIG_SOURCE_SRC);
- elm_object_part_text_set(priv->ly, PART_NO_CONTENT_TEXT,
- content_info[priv->content_type].
- no_content);
-
- elm_object_focus_allow_set(priv->grid, EINA_FALSE);
- } else {
- elm_object_signal_emit(priv->ly, SIG_HIDE_NO_CONTENT,
- SIG_SOURCE_SRC);
+ int i;
- elm_object_focus_allow_set(priv->grid, EINA_TRUE);
+ for (i = 0; i < NUM_MENU_BTN; i++) {
+ elm_object_focus_next_object_set(priv->menu_btn[i],
+ priv->more_btn, ELM_FOCUS_DOWN);
}
+
+ elm_object_part_text_set(priv->nocontent, PART_NO_CONTENT_TEXT,
+ content_info[priv->content_type].no_content);
+
+ elm_object_part_content_set(priv->content, PART_ACTION_NO_CONTENT_BG,
+ priv->nocontent);
}
static void _update_favorite_area(struct _priv *priv)
@@ -769,8 +783,11 @@ static void _update_favorite_area(struct _priv *priv)
Eina_List *l;
app_media *am;
int type;
+ int count;
elm_gengrid_clear(priv->grid);
+ elm_object_part_content_unset(priv->content, PART_ACTION_NO_CONTENT_BG);
+ elm_object_part_content_unset(priv->content, PART_ACTION_FAVORITE_AREA);
type = priv->content_type;
@@ -780,6 +797,11 @@ static void _update_favorite_area(struct _priv *priv)
priv->favorite_list = _get_favorite_list(
content_info[type].app_contents_type);
+ if (!priv->favorite_list) {
+ _update_no_content_area(priv);
+ return;
+ }
+
elm_gengrid_item_size_set(priv->grid,
elm_config_scale_get() * content_info[type].grid_x,
elm_config_scale_get() * content_info[type].grid_y);
@@ -788,17 +810,43 @@ static void _update_favorite_area(struct _priv *priv)
EINA_LIST_FOREACH(priv->favorite_list, l, am) {
it = elm_gengrid_item_append(priv->grid, ic, am, NULL, NULL);
-
elm_object_item_data_set(it, am);
}
elm_gengrid_item_class_free(ic);
- _update_no_content_area(priv);
+ count = eina_list_count(priv->favorite_list) / content_info[type].grid_n;
+ if (eina_list_count(priv->favorite_list) % content_info[type].grid_n)
+ count++;
+
+ evas_object_size_hint_min_set(priv->grid, 0, elm_config_scale_get() *
+ content_info[type].grid_y * count);
+ elm_scroller_step_size_set(priv->scr, 0,
+ content_info[type].grid_y + GRID_PADDING);
+
+ elm_object_part_content_set(priv->content,
+ PART_ACTION_FAVORITE_AREA, priv->grid);
}
static bool _draw_items(struct _priv *priv)
{
+ Evas_Object *base;
+
+ base = elm_layout_add(priv->box);
+ if (!base) {
+ _ERR("failed to create base object");
+ return false;
+ }
+
+ elm_layout_file_set(base, EDJEFILE, GRP_ACTION_MENU_CONTENT);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ evas_object_show(base);
+ elm_box_pack_end(priv->box, base);
+
+ priv->content = base;
+
if (!_draw_livetv_btn(priv)) {
_ERR("failed to draw livetv button");
return false;
@@ -814,6 +862,11 @@ static bool _draw_items(struct _priv *priv)
return false;
}
+ if (!_draw_more_btn(priv)) {
+ _ERR("failed to draw livetv button");
+ return false;
+ }
+
return true;
}
@@ -844,7 +897,7 @@ static bool _update_items(struct _priv *priv, struct view_update_data *vdata)
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct _priv *priv;
- Evas_Object *base;
+ Evas_Object *base, *scr, *box;
if (!win) {
_ERR("failed to get win object");
@@ -865,13 +918,35 @@ static Evas_Object *_create(Evas_Object *win, void *data)
}
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);
+ scr = util_add_scroller(base);
+ if (!scr) {
+ _ERR("failed to add scroller");
+ evas_object_del(base);
+ free(priv);
+ return NULL;
+ }
+
+ box = util_add_box(scr, EINA_FALSE);
+ if (!box) {
+ _ERR("failed to add box");
+ evas_object_del(base);
+ free(priv);
+ return NULL;
+ }
+
+ evas_object_show(box);
+ elm_object_content_set(scr, box);
+
+ elm_object_part_content_set(base, PART_ACTION_MENU, scr);
+
priv->win = win;
priv->base = base;
+ priv->scr = scr;
+ priv->box = box;
viewmgr_set_view_data(VIEW_ACTION_MENU, priv);
@@ -898,6 +973,8 @@ static void _show(void *view_data)
priv = view_data;
+ elm_scroller_region_show(priv->scr, 0, 0, 0, 0);
+
evas_object_show(priv->base);
viewmgr_update_view(VIEW_BASE, UPDATE_TOAST_HIDE, NULL);
@@ -973,6 +1050,7 @@ static void _destroy(void *view_data)
priv = view_data;
inputmgr_remove_callback(priv->tv_btn, &_handler);
+ inputmgr_remove_callback(priv->more_btn, &_handler);
inputmgr_remove_callback(priv->grid, &_handler);
for (i = 0; i < NUM_MENU_BTN; i++)