2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
20 #include "AppCommon.h"
21 #include <InputHandler.h>
28 #include "folder_info.h"
29 #include "song_info.h"
30 #include "album_info.h"
32 #include "music-controller.h"
33 #include "LayoutMgr.h"
34 #include "common-ui.h"
36 #include "ExtBaseLayout.h"
38 #include "folder-layout.h"
39 #include "base-view.h"
42 #define TOTAL_ADD_BTNS 3
43 #define GENGRID_ITEM_SIZE_W (263+20)
44 #define GENGRID_ITEM_SIZE_H (359+20)
49 FOLDER_LAYOUT_GENGRID,
50 FOLDER_LAYOUT_PLAY_BUTTON,
51 FOLDER_LAYOUT_NEXT_BUTTON,
52 FOLDER_LAYOUT_LAST_BUTTON,
61 struct SFolderItemInfo {
64 Elm_Object_Item *item;
68 const char *g_sourceTexts[] = {
69 N_("All Source"), // SOURCE_TYPE_ALL
70 N_("TV"), // SOURCE_TYPE_TV
71 N_("USB") // SOURCE_TYPE_USB
81 IDLER_TYPE_LAYOUT_UPDATE,
82 IDLER_TYPE_FOCUS_MOVE_BY_USER_INPUT
93 struct SFolderLayout {
97 Evas_Object *addBtns[TOTAL_ADD_BTNS];
98 Elm_Object_Item *focused_item;
101 Eina_List *it_infolist;
102 Elm_Gengrid_Item_Class *item_class;
103 Elm_Gengrid_Item_Class *songitem_class;
104 Ecore_Idler *focusIdler;
105 CMusicController *mhandle;
108 CFolderInfo *c_finfo;
110 SContentInfo *ctxtinfo;
113 EFocusIderType idlerType;
114 const char *focusBtnStr;
117 memset(this, 0, sizeof(SFolderLayout));
125 char *CFolderLayout::sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part)
127 SFolderItemInfo *itinfo = (SFolderItemInfo *)data;
128 CFolderInfo *finfo = NULL;
130 char buf[MAX_LENGTH];
136 finfo = itinfo->finfo;
138 if (!strcmp(part, "elm.text")) {
143 else if (!strcmp(part, "elm.text1")) {
144 count = finfo->Count();
145 snprintf(buf, sizeof(buf), "%d Songs", count);
153 char *CFolderLayout::sm_CbGetGridSongItemText(void *data, Evas_Object *obj, const char *part)
155 SFolderItemInfo *itinfo = (SFolderItemInfo *)data;
156 CSongInfo *sinfo = NULL;
162 sinfo = itinfo->sinfo;
164 if (!strcmp(part, "elm.text"))
166 else if (!strcmp(part, "elm.text1"))
167 txt = sinfo->Artist();
176 Evas_Object *CFolderLayout::sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part)
178 Evas_Object *img = NULL;
179 char buf[MAX_LENGTH];
184 if (!strcmp(part, "elm.swallow.icon")) {
185 img = elm_image_add(obj);
189 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
191 elm_image_file_set(img, buf, "NULL");
192 elm_image_no_scale_set(img, EINA_TRUE);
200 Evas_Object *CFolderLayout::sm_CbGetGridSongItemContent(void *data, Evas_Object *obj, const char *part)
202 CSongInfo *sinfo = NULL;
203 SFolderItemInfo *itinfo = NULL;
205 Evas_Object *img = NULL;
206 char buf[MAX_LENGTH];
211 itinfo = (SFolderItemInfo *)data;
212 sinfo = itinfo->sinfo;
214 if (!strcmp(part, "elm.swallow.icon")) {
215 img = elm_image_add(obj);
219 path = sinfo->ThumbnailPath();
221 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
222 MUSIC_IMAGE_DEFAULT_THUMB_126);
223 elm_image_file_set(img, buf, NULL);
224 elm_image_no_scale_set(img, EINA_TRUE);
227 elm_image_file_set(img, path, NULL);
228 elm_image_aspect_fixed_set(img, EINA_FALSE);
236 void CFolderLayout::sm_CbRemoveGridItem(void *data, Evas_Object *obj)
242 Eina_Bool CFolderLayout::sm_CbFocusIdler(void *dt)
244 CFolderLayout *root = (CFolderLayout *)dt;
247 root->m_OnFocusIdler();
249 return ECORE_CALLBACK_CANCEL;
253 void CFolderLayout::m_OnFocusIdler(void)
255 m->focusIdler = NULL;
257 if (m->idlerType == IDLER_TYPE_LAYOUT_UPDATE) {
258 Elm_Object_Item *it = NULL;
260 if (m->depth == E_DEPTH_SONG) {
261 it = elm_gengrid_first_item_get(m->grid);
262 elm_object_item_focus_set(it, EINA_TRUE);
265 it = m_FindItemByInfo(m->it_infolist, m->c_finfo);
267 elm_gengrid_item_show(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
268 elm_object_item_focus_set(it, EINA_TRUE);
273 Evas_Object *focus = NULL;
275 if (!strcmp(m->focusBtnStr, MUSIC_FIRST_BTN))
276 focus = m->addBtns[BTN_PLAY];
277 else if (!strcmp(m->focusBtnStr, MUSIC_SECOND_BTN))
278 focus = m->addBtns[BTN_NEXT];
279 else // MUSIC_THIRD_BTN
280 focus = m->addBtns[BTN_LAST];
282 elm_object_focus_set(focus, EINA_TRUE);
287 void CFolderLayout::sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid)
289 CFolderLayout *root = (CFolderLayout *)dt;
291 root->m_OnCtxtUpdate(type, lid);
295 void CFolderLayout::m_OnCtxtUpdate(EActionType type, int lid)
297 Eina_List *list = NULL;
298 CSongInfo *sinfo = NULL;
301 if (!m->ctxtinfo || !m->ctxtinfo->context)
304 if (type == ACTION_TYPE_ADDNEXT)
305 mode = ADD_TYPE_NEXT;
309 if (m->depth == E_DEPTH_SONG) {
310 sinfo = (CSongInfo *)m->ctxtinfo->context;
311 list = eina_list_append(list, sinfo);
314 m->mhandle->MediaGetList(LIST_TYPE_FOLDER_SONG,
315 m->ctxtinfo->context, &list);
316 sinfo = (CSongInfo *)eina_list_data_get(list);
319 if (type == ACTION_TYPE_ADDTO) {
320 if (!m->mhandle->MediaAddsongsPlaylist(lid, list))
321 _ERR(" Adding songs to playlist failed ");
323 CCommonUI::CreateMsgBox(m->base, MUSIC_TEXT_ADDTO_MSG);
328 m->mhandle->UpdatePlaylist(list, mode);
329 eina_list_free(list);
331 if (type == ACTION_TYPE_PLAY) {
333 m->mhandle->SetCurrentSong(sinfo->Id());
336 CCommonUI::UpdatePlaybackView((EAddType)type, Layout(), m->focused_item);
339 void CFolderLayout::sm_CbCtxtClose(void *dt)
341 CFolderLayout *root = (CFolderLayout *)dt;
343 root->m_OnCtxtClose();
347 void CFolderLayout::m_OnCtxtClose(void)
350 m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
351 elm_object_item_focus_set(m->focused_item, EINA_TRUE);
355 void CFolderLayout::sm_CbItemSelect(void *data, Elm_Object_Item *it, const char *emission, const char *source)
357 CFolderLayout *root = (CFolderLayout *)data;
359 root->m_OnItemSelect(it, emission, source);
363 void CFolderLayout::m_OnItemSelect(Elm_Object_Item *it, const char *emission, const char *source)
365 SFolderItemInfo *itinfo = NULL;
371 itinfo = m_FindItemInfo(m->it_infolist, it);
373 _ERR(" no item info found ");
377 if (m->depth == E_DEPTH_SONG) {
379 m->c_sinfo = new CSongInfo;
382 if (!m->c_sinfo->FlagCreate()) {
383 m->c_sinfo->Create();
386 m->c_sinfo->Duplicate(itinfo->sinfo);
390 m->c_finfo = new CFolderInfo;
393 if (!m->c_finfo->FlagCreate()) {
394 m->c_finfo->Create();
397 m->c_finfo->Duplicate(itinfo->finfo);
400 if (m->depth == E_DEPTH_SONG) {
401 id = m->c_sinfo->Id();
402 elm_gengrid_item_selected_set(it, EINA_FALSE);
403 m_GotoPlayback(ADD_TYPE_FRESH, id);
406 m->depth = E_DEPTH_SONG;
407 m_UpdateFolderGrid(false);
408 m->idlerType = IDLER_TYPE_LAYOUT_UPDATE;
409 m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
414 SFolderItemInfo *CFolderLayout::m_FindItemInfo(Eina_List *list, Elm_Object_Item *item)
417 SFolderItemInfo *itinfo = NULL;
423 EINA_LIST_FOREACH(list, l, obj) {
424 itinfo = (SFolderItemInfo *)obj;
425 if (itinfo->item == item)
433 int CFolderLayout::m_ConvertToMin(int milsec)
436 min = milsec / 60000; /*milli seconds per minute*/
442 void CFolderLayout::m_RemoveFocusIdler(void)
447 ecore_idler_del(m->focusIdler);
448 m->focusIdler = NULL;
452 void CFolderLayout::m_GotoPlayback(int mode, char *id)
454 Eina_List *list = NULL;
456 SFolderItemInfo *itinfo = NULL;
460 if (!m->it_infolist || eina_list_count(m->it_infolist) == 0)
463 if (m->depth == E_DEPTH_SONG) {
464 EINA_LIST_FOREACH(m->it_infolist, l, obj) {
465 itinfo = (SFolderItemInfo *)obj;
466 list = eina_list_append(list, itinfo->sinfo);
470 r = m->mhandle->MediaGetList(LIST_TYPE_SONG, NULL, &list);
471 if (r == false || eina_list_count(list) == 0)
475 m->mhandle->UpdatePlaylist(list, mode);
476 eina_list_free(list);
478 if (mode == ADD_TYPE_FRESH) {
480 if (id) /* If want to play selected song */
481 m->mhandle->SetCurrentSong(id);
484 CCommonUI::UpdatePlaybackView((EAddType)mode, Layout(), NULL);
488 Elm_Object_Item *CFolderLayout::m_FindItemByInfo(Eina_List *list, CFolderInfo *finfo)
491 SFolderItemInfo *itinfo = NULL;
498 EINA_LIST_FOREACH(list, l, obj) {
499 itinfo = (SFolderItemInfo *)obj;
500 id = itinfo->finfo->Id();
501 if (!strcmp(id, finfo->Id()))
509 void CFolderLayout::m_SortFolderGrid(void)
513 const char *sortFuncId[] = {
521 sortType = CInfo::SortType();
523 m->flist = CSortMgr::Sort(m->flist, sortFuncId[sortType]);
527 void CFolderLayout::m_CreateFolderGrid(void)
529 Evas_Object *grid = NULL;
530 Elm_Gengrid_Item_Class *grid_item = NULL;
532 grid = elm_gengrid_add(Layout());
535 evas_object_size_hint_weight_set(grid,
536 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
537 elm_gengrid_align_set(grid, 0, 0);
538 elm_object_part_content_set(Layout(), MUSIC_PART_FOLDER_GRID, grid);
539 Connect(grid, FOLDER_LAYOUT_GENGRID,
540 TYPE_MOUSE_MOVE | TYPE_KEY_DOWN |
541 TYPE_REALIZED | TYPE_UNREALIZED | TYPE_ACTIVATED);
542 elm_gengrid_item_size_set(grid,
543 elm_config_scale_get() * GENGRID_ITEM_SIZE_W,
544 elm_config_scale_get() * GENGRID_ITEM_SIZE_H);
547 grid_item = elm_gengrid_item_class_new();
549 evas_object_del(grid);
550 _ERR(" elm_genlist_item_class_new failed ");
553 grid_item->item_style = MUSIC_STYLE_FOLDER_GRID;
554 grid_item->func.text_get = sm_CbGetGridItemText;
555 grid_item->func.content_get = sm_CbGetGridItemContent;
556 grid_item->func.state_get = NULL;
557 grid_item->func.del = sm_CbRemoveGridItem;
558 m->item_class = grid_item;
560 grid_item = elm_gengrid_item_class_new();
562 elm_gengrid_item_class_free(m->item_class);
563 m->item_class = NULL;
564 evas_object_del(grid);
565 _ERR(" elm_genlist_item_class_new failed ");
568 grid_item->item_style = MUSIC_STYLE_FOLDER_GRID;
569 grid_item->func.text_get = sm_CbGetGridSongItemText;
570 grid_item->func.content_get = sm_CbGetGridSongItemContent;
571 grid_item->func.state_get = NULL;
572 grid_item->func.del = sm_CbRemoveGridItem;
573 m->songitem_class = grid_item;
575 m_UpdateFolderGrid(false);
579 void CFolderLayout::m_EmptyFolderGrid(bool sort_flag)
582 elm_gengrid_clear(m->grid);
585 eina_list_free(m->flist);
589 eina_list_free(m->it_infolist);
590 m->it_infolist = NULL;
594 void CFolderLayout::m_UpdateFolderGrid(bool sort_flag)
598 CFolderInfo *finfo = NULL;
599 CSongInfo *sinfo = NULL;
602 struct SFolderItemInfo *itinfo = NULL;
603 Elm_Object_Item *item = NULL;
604 char buf[MAX_LENGTH];
607 if (!m->grid || !m->item_class)
610 /* Remove existing foldergrid and prepare afresh */
611 m_EmptyFolderGrid(sort_flag);
614 if (m->depth == E_DEPTH_SONG) {
615 r = m->mhandle->MediaGetList(LIST_TYPE_FOLDER_SONG, m->c_finfo, &(m->flist));
617 eina_list_count(m->flist) == 0) {
618 _ERR(" Fetching folder list failed ");
623 r = m->mhandle->MediaGetList(LIST_TYPE_FOLDER,
626 eina_list_count(m->flist) == 0) {
627 _ERR(" Fetching folder list failed ");
628 SetEmptyStatus(true);
638 if (m->depth == E_DEPTH_SONG) {
639 EINA_LIST_FOREACH(m->flist, l, obj) {
640 sinfo = (CSongInfo *)obj;
641 itinfo = (SFolderItemInfo *)calloc(1, sizeof(*itinfo));
644 itinfo->sinfo = sinfo;
645 item = elm_gengrid_item_append(m->grid,
646 m->songitem_class, itinfo,
649 m->it_infolist = eina_list_append(m->it_infolist,
651 elm_object_part_text_set(Layout(),
652 MUSIC_PART_FOLDER_NAME,
655 dur = sinfo->Duration();
660 EINA_LIST_FOREACH(m->flist, l, obj) {
661 finfo = (CFolderInfo *)obj;
662 itinfo = (SFolderItemInfo *)calloc(1, sizeof(*itinfo));
665 itinfo->finfo = finfo;
666 item = elm_gengrid_item_append(m->grid, m->item_class,
669 m->it_infolist = eina_list_append(m->it_infolist,
671 source_type = CInfo::SourceType();
672 elm_object_part_text_set(Layout(),
673 MUSIC_PART_FOLDER_NAME,
674 _(g_sourceTexts[source_type]));
675 ts = ts + finfo->Count();
676 td = td + finfo->Duration();
679 snprintf(buf, sizeof(buf), "%d", ts);
680 elm_object_part_text_set(Layout(), MUSIC_PART_FOLDER_SONGCOUNT, buf);
682 snprintf(buf, sizeof(buf), "%d %s", m_ConvertToMin(td),
684 elm_object_part_text_set(Layout(), MUSIC_PART_FOLDER_TIME, buf);
688 void CFolderLayout::m_CreateTopsection(void)
692 char buf[MAX_LENGTH];
694 SBtnInfo btninfo[TOTAL_ADD_BTNS];
696 btninfo[BTN_PLAY].name = MUSIC_STR_PLAY;
697 btninfo[BTN_PLAY].part = MUSIC_PART_FOLDER_PLAYBTN;
698 btninfo[BTN_PLAY].style = MUSIC_STYLE_ADD_PLAY_BTN;
699 btninfo[BTN_PLAY].icon = MUSIC_IMAGE_ADD_PLAY;
700 btninfo[BTN_PLAY].type = FOLDER_LAYOUT_PLAY_BUTTON;
702 btninfo[BTN_NEXT].name = MUSIC_STR_ADDNEXT;
703 btninfo[BTN_NEXT].part = MUSIC_PART_FOLDER_NEXTBTN;
704 btninfo[BTN_NEXT].style = MUSIC_STYLE_ADD_NEXT_BTN;
705 btninfo[BTN_NEXT].icon = MUSIC_IMAGE_ADD_NEXT;
706 btninfo[BTN_NEXT].type = FOLDER_LAYOUT_NEXT_BUTTON;
708 btninfo[BTN_LAST].name = MUSIC_STR_ADDLAST;
709 btninfo[BTN_LAST].part = MUSIC_PART_FOLDER_LASTBTN;
710 btninfo[BTN_LAST].style = MUSIC_STYLE_ADD_LAST_BTN;
711 btninfo[BTN_LAST].icon = MUSIC_IMAGE_ADD_LAST;
712 btninfo[BTN_LAST].type = FOLDER_LAYOUT_LAST_BUTTON;
714 for (i = 0; i < TOTAL_ADD_BTNS; i++) {
715 btn = elm_button_add(Layout());
719 evas_object_size_hint_weight_set(btn,
720 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
721 elm_object_text_set(btn, _(btninfo[i].name));
722 elm_object_style_set(btn, btninfo[i].style);
724 Connect(btn, btninfo[i].type, TYPE_MOUSE_MOVE | TYPE_CLICKED | TYPE_KEY_DOWN);
726 img = elm_image_add(btn);
728 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
730 elm_image_file_set(img, buf, NULL);
731 elm_object_part_content_set(btn,
732 MUSIC_PART_ELM_SWALLOWICON, img);
735 elm_object_part_content_set(Layout(), btninfo[i].part,
743 bool CFolderLayout::Create(CLayoutMgr *mgr)
749 Evas_Object *base = NULL;
750 Evas_Object *win = NULL;
751 Evas_Object *layout = NULL;
752 CMusicController *mhandle = NULL;
753 CViewMgr *vmgr = NULL;
755 _CHECK(m = new SFolderLayout)
756 _CHECK(vmgr = CViewMgr::GetInstance())
757 _CHECK(base = mgr->Base())
758 _CHECK(win = vmgr->Window())
759 _CHECK(mhandle = CMusicController::GetInstance())
760 _CHECK(layout = CCommonUI::AddBase(base, MUSIC_FOLDER_LAYOUT))
761 _CHECK(CExtBaseLayout::Create(layout))
767 m->mhandle = mhandle;
769 m->depth = E_DEPTH_FOLDER;
771 m_CreateTopsection();
772 m_CreateFolderGrid();
774 Connect(layout, FOLDER_LAYOUT, TYPE_KEY_DOWN);
777 memset(&parcel, 0, sizeof(SParcel));
778 parcel.updateType = E_LAYOUT_UPDATE;
779 m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
782 _CHECK_FAIL{ CExtBaseLayout::Destroy(); }
783 _CHECK_FAIL{ evas_object_del(layout); }
788 _CHECK_FAIL{ delete m; m = NULL; }
789 } _CREATE_END_AND_CATCH{ return false; }
795 void CFolderLayout::Destroy(void)
799 Disconnect(Layout());
801 m_RemoveFocusIdler();
802 m_EmptyFolderGrid(false);
803 CExtBaseLayout::Destroy();
804 evas_object_del(Layout());
807 if (m->c_sinfo && m->c_sinfo->FlagCreate())
808 m->c_sinfo->Destroy();
816 void CFolderLayout::t_OnShow(void)
819 m->depth = E_DEPTH_FOLDER;
820 m_UpdateFolderGrid(false);
823 memset(&parcel, 0, sizeof(SParcel));
824 parcel.updateType = E_LAYOUT_UPDATE;
825 parcel.layoutId = MUSIC_FOLDER_LAYOUT;
826 m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
828 evas_object_show(Layout());
832 void CFolderLayout::Update(bool focusFlag)
837 m_UpdateFolderGrid(true);
841 elm_object_focus_set(m->grid, EINA_TRUE);
845 void CFolderLayout::SetFocus(const char *btnStr)
849 m->focusBtnStr = btnStr;
850 m->idlerType = IDLER_TYPE_FOCUS_MOVE_BY_USER_INPUT;
851 m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
855 void CFolderLayout::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev)
858 case FOLDER_LAYOUT_GENGRID:
860 Elm_Object_Item *item;
862 item = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
863 ev->cur.canvas.y, NULL, NULL);
867 if (!elm_object_item_focus_get(item))
868 elm_object_item_focus_set(item, EINA_TRUE);
872 case FOLDER_LAYOUT_PLAY_BUTTON:
873 case FOLDER_LAYOUT_NEXT_BUTTON:
874 case FOLDER_LAYOUT_LAST_BUTTON:
876 if (!elm_object_focus_get(obj))
877 elm_object_focus_set(obj, EINA_TRUE);
887 void CFolderLayout::OnMouseClicked(int id, Evas_Object *obj)
890 case FOLDER_LAYOUT_PLAY_BUTTON:
891 m_GotoPlayback(ADD_TYPE_FRESH, NULL);
894 case FOLDER_LAYOUT_NEXT_BUTTON:
895 m_GotoPlayback(ADD_TYPE_NEXT, NULL);
898 case FOLDER_LAYOUT_LAST_BUTTON:
899 m_GotoPlayback(ADD_TYPE_END, NULL);
908 void CFolderLayout::OnRealized(int id, Evas_Object *obj, Elm_Object_Item *item)
911 case FOLDER_LAYOUT_GENGRID:
912 elm_object_item_signal_callback_add(item,
913 MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
914 sm_CbItemSelect, this);
923 void CFolderLayout::OnUnrealized(int id, Evas_Object *obj, Elm_Object_Item *item)
926 case FOLDER_LAYOUT_GENGRID:
927 elm_object_item_signal_callback_del((Elm_Object_Item *)item,
928 MUSIC_SIGNAL_BTN_CLICKED, MUSIC_BASE_VIEW,
938 void CFolderLayout::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
943 if (!strcmp(ev->keyname, KEY_BACK) ||
944 !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
945 if (m->depth == E_DEPTH_SONG) {
946 m->depth = E_DEPTH_FOLDER;
947 m_UpdateFolderGrid(false);
948 m_RemoveFocusIdler();
949 m->idlerType = IDLER_TYPE_LAYOUT_UPDATE;
950 m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
954 memset(&parcel, 0, sizeof(SParcel));
955 parcel.updateType = E_FOCUS_UPDATE;
956 m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
962 case FOLDER_LAYOUT_GENGRID:
964 Elm_Object_Item *it = NULL;
965 SContentInfo *ctxtinfo = NULL;
966 SFolderItemInfo *itinfo = NULL;
971 if (strcmp(ev->keyname, KEY_MENU) &&
972 strcmp(ev->keyname, KEY_MENU_REMOTE))
975 it = elm_object_focused_item_get(obj);
977 _ERR(" unable to get focused item ");
980 m->focused_item = it;
987 ctxtinfo = (SContentInfo *)calloc(1, sizeof(*ctxtinfo));
991 itinfo = m_FindItemInfo(m->it_infolist, it);
997 ctxtinfo->cbdata = this;
998 ctxtinfo->update = sm_CbCtxtUpdate;
999 ctxtinfo->close = sm_CbCtxtClose;
1000 if (m->depth == E_DEPTH_SONG) {
1001 ctxtinfo->type = CONTEXT_TYPE_SONG;
1002 ctxtinfo->context = itinfo->sinfo;
1005 ctxtinfo->type = CONTEXT_TYPE_FOLDER;
1006 ctxtinfo->context = itinfo->finfo;
1009 m->ctxtinfo = ctxtinfo;
1012 memset(&parcel, 0, sizeof(SParcel));
1013 parcel.ctxtInfo = ctxtinfo;
1014 if (!m->vmgr->PushView(MUSIC_CONTEXT_VIEW, &parcel))
1015 _ERR("viewmgr push view MUSIC_CONTEXT_VIEW failed");
1019 case FOLDER_LAYOUT_PLAY_BUTTON:
1020 case FOLDER_LAYOUT_NEXT_BUTTON:
1021 case FOLDER_LAYOUT_LAST_BUTTON:
1022 if (!strcmp(ev->keyname, KEY_UP)) {
1023 const char *btnText = NULL;
1025 if (id == FOLDER_LAYOUT_PLAY_BUTTON)
1026 btnText = MUSIC_FIRST_BTN;
1027 else if (id == FOLDER_LAYOUT_NEXT_BUTTON)
1028 btnText = MUSIC_SECOND_BTN;
1029 else //FOLDER_LAYOUT_LAST_BUTTON
1030 btnText = MUSIC_THIRD_BTN;
1033 memset(&parcel, 0, sizeof(SParcel));
1034 parcel.updateType = E_FOCUS_UPDATE;
1035 parcel.keyEvent = KEY_UP;
1036 parcel.focusedBtn = btnText;
1037 m->vmgr->UpdateView((const char *)MUSIC_BASE_VIEW, &parcel);
1047 void CFolderLayout::OnActivated(int id, Evas_Object *obj, Elm_Object_Item *item)
1050 case FOLDER_LAYOUT_GENGRID:
1051 m_OnItemSelect(item, NULL, NULL);