Modification focus sequence: 53/37453/3
authorKim Tae Soo <taesoo46.kim@samsung.com>
Fri, 27 Mar 2015 01:02:01 +0000 (10:02 +0900)
committerYoungjin Kim <yj21c.kim@samsung.com>
Fri, 27 Mar 2015 01:51:19 +0000 (18:51 -0700)
When layout changed from "category song layout" to "category layout" chosen item should be focused.

Change-Id: Ibc33632850e3cd2dfe345483fbd5811eb15a7e10
Signed-off-by: Kim Tae Soo <taesoo46.kim@samsung.com>
include/category-songs-layout.h
src/views/category-layout.cpp
src/views/category-songs-layout.cpp

index 4dc1fda..863c4f5 100644 (file)
@@ -102,6 +102,9 @@ public:
        void SetParameter(EDepth depth, ESelectType selType, CCategoryInfo *catInfo, CAlbumInfo *albumInfo);
        Eina_List *CategorySongItemInfoList(void);
 
+       void SetCurrentCategory(CCategoryInfo *curCatInfo);
+       CCategoryInfo *CurrentCategory(void);
+
        virtual void SetFocus(const char *btnStr);
 
 public:
index 039e6de..b208815 100644 (file)
@@ -544,6 +544,8 @@ void CCategoryLayout::m_OnItemSelect(Elm_Object_Item *it, const char *emission,
                t.c_catinfo = NULL;
 
                t_HandleItemSelect(itinfo);
+
+               m->layoutCatSongs->SetCurrentCategory(t.c_catinfo);
        }
 
        t_UpdateLayoutWithFocus();
@@ -1243,6 +1245,9 @@ void CCategoryLayout::Update(bool focusFlag)
 {
        ASSERT(m);
 
+       CCategoryInfo *catInfo;
+       Elm_Object_Item *item;
+
        if (!focusFlag) {
                if (t.depth != E_DEPTH_CATEGORY)
                        return;
@@ -1250,6 +1255,17 @@ void CCategoryLayout::Update(bool focusFlag)
                return;
        }
 
+       catInfo = m->layoutCatSongs->CurrentCategory();
+       if (catInfo && catInfo->FlagCreate()) {
+               item = m_FindItemByInfo(m->it_infolist, catInfo);
+               if (item) {
+                       m->layoutCatSongs->SetCurrentCategory(NULL);
+                       elm_gengrid_item_show(item, ELM_GENGRID_ITEM_SCROLLTO_IN);
+                       elm_object_item_focus_set(item, EINA_TRUE);
+                       return;
+               }
+       }
+
        elm_object_focus_set(t.grid, EINA_TRUE);
 }
 
index 074684a..c2891d4 100644 (file)
@@ -104,6 +104,8 @@ struct SCategorySongsLayout {
        const char *focusBtnStr;
        EFocusIderType idlerType;
 
+       CCategoryInfo *curCatInfo;
+
        SCategorySongsLayout() {
                memset(this, 0, sizeof(SCategorySongsLayout));
        }
@@ -896,6 +898,7 @@ bool CCategorySongsLayout::Create(CLayoutMgr *mgr, CCategoryLayout *parent)
                Evas_Object *layout = NULL;
                CMusicController *mhandle = NULL;
                CViewMgr *vmgr = NULL;
+               CCategoryInfo *catInfo = NULL;
 
                _CHECK(m = new SCategorySongsLayout)
                _CHECK(vmgr = CViewMgr::GetInstance())
@@ -904,6 +907,7 @@ bool CCategorySongsLayout::Create(CLayoutMgr *mgr, CCategoryLayout *parent)
                _CHECK(mhandle = CMusicController::GetInstance())
                _CHECK(layout = CCommonUI::AddBase(base, MUSIC_CATEGORY_SONGS_LAYOUT))
                _CHECK(CExtBaseLayout::Create(layout))
+               _CHECK(catInfo = new CCategoryInfo)
 
                _WHEN_SUCCESS{
                        m->win = win;
@@ -912,10 +916,12 @@ bool CCategorySongsLayout::Create(CLayoutMgr *mgr, CCategoryLayout *parent)
                        m->mhandle = mhandle;
                        m->mgr = mgr;
                        m->parent = parent;
+                       m->curCatInfo = catInfo;
 
                        Connect(layout, CATEGORY_SONGS_LAYOUT, TYPE_KEY_DOWN);
                }
 
+               _CHECK_FAIL{ delete catInfo; }
                _CHECK_FAIL{ CExtBaseLayout::Destroy(); }
                _CHECK_FAIL{ evas_object_del(layout); }
                _CHECK_FAIL{}
@@ -934,6 +940,10 @@ void CCategorySongsLayout::Destroy(void)
 
        Disconnect(Layout());
 
+       if (m->curCatInfo->FlagCreate())
+               m->curCatInfo->Destroy();
+       delete m->curCatInfo;
+
        m_RemoveFocusIdler();
        m_EmptySongList();
        CExtBaseLayout::Destroy();
@@ -964,6 +974,35 @@ Eina_List *CCategorySongsLayout::CategorySongItemInfoList(void)
 }
 
 
+void CCategorySongsLayout::SetCurrentCategory(CCategoryInfo *curCatInfo)
+{
+       ASSERT(m);
+
+       if (m->curCatInfo->FlagCreate())
+               m->curCatInfo->Destroy();
+
+       m->curCatInfo->Create();
+
+       if (curCatInfo)
+               m->curCatInfo->Duplicate(curCatInfo);
+       else {
+               CCategoryInfo *emptyInfo = new CCategoryInfo;
+               emptyInfo->Create();
+               m->curCatInfo->Duplicate(emptyInfo);
+               emptyInfo->Destroy();
+               delete emptyInfo;
+       }
+}
+
+
+CCategoryInfo*CCategorySongsLayout::CurrentCategory(void)
+{
+       ASSERT(m);
+
+       return m->curCatInfo;
+}
+
+
 void CCategorySongsLayout::SetFocus(const char *btnStr)
 {
        ASSERT(m);