bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list);
bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info);
+bool listmgr_update_focus_item(struct listmgr *lmgr, int index);
+
#endif /* __AIR_MEDIAHUB_LISTMGR_H__ */
static void _update(void *layout_data, int update_type, void *data)
{
struct _priv *priv;
+ int index;
if (!layout_data) {
_ERR("failed to get layout data");
priv = layout_data;
- _update_list_area(priv);
+ switch (update_type) {
+ case UPDATE_CONTENT:
+ _update_list_area(priv);
+ break;
+ case UPDATE_FOCUS:
+ if (!data) {
+ _ERR("invalid argument");
+ return;
+ }
+
+ index = *(int *)data;
+ listmgr_update_focus_item(priv->listmgr, index);
+
+ break;
+ default:
+ break;
+ }
}
static layout_class _lclass = {
static void _update(void *layout_data, int update_type, void *data)
{
struct _priv *priv;
+ int index;
if (!layout_data) {
_ERR("failed to get layout data");
priv = layout_data;
- _update_content_list(priv);
+ switch (update_type) {
+ case UPDATE_CONTENT:
+ _update_content_list(priv);
+ break;
+ case UPDATE_FOCUS:
+ if (!data) {
+ _ERR("invalid argument");
+ return;
+ }
+
+ index = *(int *)data;
+ listmgr_update_focus_item(priv->listmgr, index);
+
+ break;
+ default:
+ break;
+ }
}
static layout_class _lclass = {
return ly;
}
+bool listmgr_update_focus_item(struct listmgr *lmgr, int index)
+{
+ Eina_List *item, *l;
+ Evas_Object *ly, *grid;
+ Elm_Object_Item *it;
+ int count;
+
+ item = elm_box_children_get(lmgr->box);
+ if (lmgr->show_play_info)
+ item = eina_list_next(item);
+
+ grid = NULL;
+ EINA_LIST_FOREACH(item, l, ly) {
+ grid = elm_object_part_content_get(ly, PART_ITEM_CONTENT);
+ if (!grid) {
+ _ERR("failed to get grid object");
+ return false;
+ }
+
+ count = elm_gengrid_items_count(grid);
+
+ if (index < count)
+ break;
+
+ index -= count;
+ }
+
+ it = elm_gengrid_first_item_get(grid);
+ while (index--)
+ it = elm_gengrid_item_next_get(it);
+
+ if (!it) {
+ _ERR("failed to get current grid item");
+ return false;
+ }
+
+ elm_gengrid_item_bring_in(it, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
+ elm_object_focus_set(grid, EINA_TRUE);
+ elm_object_item_focus_set(it, EINA_TRUE);
+
+ return true;
+}
+
bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list)
{
Evas_Object *ly;
#include "define.h"
#include "layout.h"
+#include "view.h"
#define TITLE_TEXT "Media Hub"
layoutmgr_hide_layout(priv->lmgr,
g_menu_item[priv->current_layout].layout_id);
layoutmgr_show_layout(priv->lmgr, g_menu_item[i].layout_id);
- layoutmgr_update_layout(priv->lmgr, g_menu_item[i].layout_id, 0, NULL);
+ layoutmgr_update_layout(priv->lmgr, g_menu_item[i].layout_id,
+ UPDATE_CONTENT, NULL);
priv->focused_btn = obj;
priv->current_layout = i;
evas_object_hide(priv->base);
}
+static void _update(void *view_data, int update_type, void *data)
+{
+ struct _priv *priv;
+ struct view_update_data *vdata;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ if (!data) {
+ _ERR("invalid argument");
+ return;
+ }
+
+ priv = view_data;
+ vdata = data;
+
+ layoutmgr_update_layout(priv->lmgr,
+ g_menu_item[priv->current_layout].layout_id,
+ UPDATE_FOCUS, (void *)&vdata->index);
+}
+
static void _destroy(void *view_data)
{
struct _priv *priv;
.create = _create,
.show = _show,
.hide = _hide,
+ .update = _update,
.destroy = _destroy,
};