Fix focus error after context view is closed 44/37144/2
authorKim Tae Soo <taesoo46.kim@samsung.com>
Thu, 19 Mar 2015 23:50:25 +0000 (08:50 +0900)
committerKim Tae Soo <taesoo46.kim@samsung.com>
Thu, 19 Mar 2015 23:52:58 +0000 (08:52 +0900)
Change-Id: Ic2acf04abe824e2b8e57abe684d519eaf20319b1
Signed-off-by: Kim Tae Soo <taesoo46.kim@samsung.com>
include/album-layout.h
include/song-layout.h
src/views/album-layout.cpp
src/views/album-songs-layout.cpp
src/views/category-layout.cpp
src/views/category-songs-layout.cpp
src/views/folder-layout.cpp
src/views/song-layout.cpp

index 7901cf7..1b983cb 100644 (file)
@@ -28,9 +28,6 @@ private:
        struct SAlbumLayout *m;
 
 private:
-       static Eina_Bool sm_CbFocusIdler(void *dt);
-       void m_OnFocusIdler(void);
-
        static char *sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part);
        static Evas_Object *sm_CbGetGridItemContent(void *data, Evas_Object *obj, const char *part);
        static void sm_CbRemoveGridItem(void *data, Evas_Object *obj);
index 37a5f85..714e1d1 100644 (file)
@@ -26,9 +26,6 @@ private:
        struct SSongLayout *m;
 
 private:
-       static Eina_Bool sm_CbFocusIdler(void *dt);
-       void m_OnFocusIdler(void);
-
        static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
        static Evas_Object *sm_CbGetListItemContent(void *data, Evas_Object *obj, const char *part);
        static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
index 61eff05..8fe0145 100644 (file)
@@ -73,7 +73,6 @@ struct SAlbumLayout {
        char *album_id;
        CAlbumSongsLayout *layoutAlbumSongs;
        SCallback callback;
-       Ecore_Idler *focusIdler;
 
        SAlbumLayout() {
                memset(this, 0, sizeof(SAlbumLayout));
@@ -84,27 +83,6 @@ struct SAlbumLayout {
 };
 
 
-Eina_Bool CAlbumLayout::sm_CbFocusIdler(void *dt)
-{
-       CAlbumLayout *root = (CAlbumLayout *)dt;
-
-       if (root)
-               root->m_OnFocusIdler();
-
-       return ECORE_CALLBACK_CANCEL;
-}
-
-
-void CAlbumLayout::m_OnFocusIdler(void)
-{
-       m->focusIdler = NULL;
-
-       ASSERT(m->focusedItem);
-       elm_gengrid_item_show(m->focusedItem, ELM_GENGRID_ITEM_SCROLLTO_IN);
-       elm_object_item_focus_set(m->focusedItem, EINA_TRUE);
-}
-
-
 char *CAlbumLayout::sm_CbGetGridItemText(void *data, Evas_Object *obj, const char *part)
 {
        SAlbumItemInfo *itinfo = (SAlbumItemInfo *)data;
@@ -230,7 +208,6 @@ void CAlbumLayout::sm_CbCtxtClose(void *dt)
 void CAlbumLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(m->focusedItem, EINA_TRUE);
 }
 
@@ -586,7 +563,10 @@ void CAlbumLayout::Update(bool focusFlag)
 void CAlbumLayout::SetFocus(const char *btnStr)
 {
        ASSERT(m);
-       m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
+       ASSERT(m->focusedItem);
+
+       elm_gengrid_item_show(m->focusedItem, ELM_GENGRID_ITEM_SCROLLTO_IN);
+       elm_object_item_focus_set(m->focusedItem, EINA_TRUE);
 }
 
 
index 188b248..c0ea801 100644 (file)
@@ -201,7 +201,6 @@ void CAlbumSongsLayout::sm_CbCtxtClose(void *dt)
 void CAlbumSongsLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(m->focused_item, EINA_TRUE);
 }
 
index c7bb8b5..fe23564 100644 (file)
@@ -152,20 +152,14 @@ void CCategoryLayout::m_OnFocusIdler(void)
        else {
                Evas_Object *focus = NULL;
 
-               if (t.depth == E_DEPTH_CATEGORY) {
-                       elm_gengrid_item_show(t.focused_item, ELM_GENGRID_ITEM_SCROLLTO_IN);
-                       elm_object_item_focus_set(t.focused_item, EINA_TRUE);
-               }
-               else if (t.depth == E_DEPTH_ALBUM) {
-                       if (!strcmp(m->focusBtnStr, MUSIC_FIRST_BTN))
-                               focus = m->addBtns[ABTN_PLAY];
-                       else if (!strcmp(m->focusBtnStr, MUSIC_SECOND_BTN))
-                               focus = m->addBtns[ABTN_NEXT];
-                       else // MUSIC_THIRD_BTN
-                               focus = m->addBtns[ABTN_LAST];
-
-                       elm_object_focus_set(focus, EINA_TRUE);
-               }
+               if (!strcmp(m->focusBtnStr, MUSIC_FIRST_BTN))
+                       focus = m->addBtns[ABTN_PLAY];
+               else if (!strcmp(m->focusBtnStr, MUSIC_SECOND_BTN))
+                       focus = m->addBtns[ABTN_NEXT];
+               else // MUSIC_THIRD_BTN
+                       focus = m->addBtns[ABTN_LAST];
+
+               elm_object_focus_set(focus, EINA_TRUE);
        }
 }
 
@@ -325,7 +319,6 @@ void CCategoryLayout::sm_CbCtxtClose(void *dt)
 void CCategoryLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(t.focused_item, EINA_TRUE);
 }
 
@@ -1269,9 +1262,15 @@ void CCategoryLayout::SetFocus(const char *btnStr)
 {
        ASSERT(m);
 
-       m->idlerType = IDLER_TYPE_FOCUS_MOVE_BY_USER_INPUT;
-       m->focusBtnStr = btnStr;
-       m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
+       if (t.depth == E_DEPTH_CATEGORY) {
+               elm_gengrid_item_show(t.focused_item, ELM_GENGRID_ITEM_SCROLLTO_IN);
+               elm_object_item_focus_set(t.focused_item, EINA_TRUE);
+       }
+       else {
+               m->idlerType = IDLER_TYPE_FOCUS_MOVE_BY_USER_INPUT;
+               m->focusBtnStr = btnStr;
+               m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
+       }
 }
 
 
index 34d116b..27c1b22 100644 (file)
@@ -320,7 +320,6 @@ void CCategorySongsLayout::sm_CbCtxtClose(void *dt)
 void CCategorySongsLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(m->focused_item, EINA_TRUE);
 }
 
index 7a40134..ad6c08b 100644 (file)
@@ -347,7 +347,6 @@ void CFolderLayout::sm_CbCtxtClose(void *dt)
 void CFolderLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(m->focused_item, EINA_TRUE);
 }
 
index 7bd3f0b..3a322a0 100644 (file)
@@ -61,7 +61,6 @@ struct SSongLayout {
        CViewMgr* vmgr;
        SContentInfo *ctxtinfo;
        char *uri;
-       Ecore_Idler *focusIdler;
 
        SSongLayout() {
                memset(this, 0, sizeof(SSongLayout));
@@ -72,29 +71,6 @@ struct SSongLayout {
 };
 
 
-Eina_Bool CSongLayout::sm_CbFocusIdler(void *dt)
-{
-       CSongLayout *root = (CSongLayout *)dt;
-
-       if (root)
-               root->m_OnFocusIdler();
-
-       return ECORE_CALLBACK_CANCEL;
-}
-
-
-void CSongLayout::m_OnFocusIdler(void)
-{
-       m->focusIdler = NULL;
-
-       Elm_Object_Item *item = elm_genlist_first_item_get(m->songlist);
-       ASSERT(item);
-
-       elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_IN);
-       elm_object_item_focus_set(item, EINA_TRUE);
-}
-
-
 char *CSongLayout::sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part)
 {
        SSongItemInfo *itinfo = (SSongItemInfo *)data;
@@ -238,7 +214,6 @@ void CSongLayout::sm_CbCtxtClose(void *dt)
 void CSongLayout::m_OnCtxtClose(void)
 {
        m->vmgr->PopView();
-       m->vmgr->PushView(MUSIC_BASE_VIEW, NULL);
        elm_object_item_focus_set(m->focused_item, EINA_TRUE);
 }
 
@@ -613,7 +588,12 @@ void CSongLayout::Update(bool focusFlag)
 void CSongLayout::SetFocus(const char *btnStr)
 {
        ASSERT(m);
-       m->focusIdler = ecore_idler_add(sm_CbFocusIdler, this);
+
+       Elm_Object_Item *item = elm_genlist_first_item_get(m->songlist);
+       ASSERT(item);
+
+       elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_IN);
+       elm_object_item_focus_set(item, EINA_TRUE);
 }