D-pad navigation for Quic access view 08/48608/1 accepted/tizen/tv/20150923.231359 submit/tizen_tv/20150923.224634
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Wed, 23 Sep 2015 14:44:14 +0000 (16:44 +0200)
committerMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Wed, 23 Sep 2015 14:46:23 +0000 (16:46 +0200)
[Issue]    https://bugs.tizen.org/jira/browse/TT-183
[Problem]  There was no support for D-pad navigation in Quick Access.
[Cause]    Some elements seemed not to be allowed to be focused.
[Solution] Added buttons which enables to focus tiles in Quick Access.
[Verify]   Launch browser > Open few web pages > open Quick Access
           view, try to navigate using D-pad.

Change-Id: Ie0e5b661a8502d551539e9d89e59162d554eb044
Signed-off-by: Maciej Skrzypkowski <m.skrzypkows@samsung.com>
services/MainUI/MainUI.cpp
services/MainUI/MainUI.h
services/MainUI/edc/MainUI.edc
services/SimpleUI/SimpleUI.cpp
services/WebPageUI/WebPageUI.cpp
services/WebPageUI/WebPageUI.h

index 11df7f9..d2248fd 100644 (file)
@@ -101,6 +101,9 @@ void MainUI::showMostVisited(std::shared_ptr< services::HistoryItemVector > vec)
 {
     addHistoryItems(vec);
     showHistory();
+    // update focus chain
+    elm_object_focus_custom_chain_append(m_parent, m_mostVisitedButton, NULL);
+    elm_object_focus_custom_chain_append(m_parent, m_bookmarksButton, NULL);
 }
 
 void MainUI::showBookmarks(std::vector< std::shared_ptr< tizen_browser::services::BookmarkItem > > vec)
@@ -208,7 +211,6 @@ Evas_Object* MainUI::createTopButtons (Evas_Object *parent)
     evas_object_smart_callback_add(mostVisitedButton, "clicked", _mostVisited_clicked, this);
     evas_object_show(mostVisitedButton);
     elm_layout_content_set(layoutTop, "mostvisited_click", mostVisitedButton);
-
     m_mostVisitedButton = mostVisitedButton;
 
     Evas_Object *bookmarksButton = elm_button_add(layoutTop);
@@ -216,7 +218,6 @@ Evas_Object* MainUI::createTopButtons (Evas_Object *parent)
     evas_object_smart_callback_add(bookmarksButton, "clicked", _bookmark_clicked, this);
     evas_object_show(bookmarksButton);
     elm_layout_content_set(layoutTop, "bookmark_click", bookmarksButton);
-
     m_bookmarksButton = bookmarksButton;
 
     return layoutTop;
@@ -274,11 +275,11 @@ void MainUI::addHistoryItem(std::shared_ptr<services::HistoryItem> hi)
     itemData->item = hi;
     itemData->mainUI = std::shared_ptr<MainUI>(this);
 
-    Evas_Object* tile = elm_layout_add(m_mostVisitedView);
+    Evas_Object* tile = elm_button_add(m_mostVisitedView);
     if (tileNumber == BIG_TILE_INDEX)
-        elm_layout_file_set(tile, edjFilePath.c_str(), "big_tile");
+        elm_object_style_set(tile, "big_tile");
     else
-        elm_layout_file_set(tile, edjFilePath.c_str(), "small_tile");
+        elm_object_style_set(tile, "small_tile");
     evas_object_size_hint_weight_set(tile, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set (tile, EVAS_HINT_FILL, EVAS_HINT_FILL);
     evas_object_show(tile);
@@ -289,7 +290,8 @@ void MainUI::addHistoryItem(std::shared_ptr<services::HistoryItem> hi)
     elm_layout_text_set(tile, "page_url", hi->getUrl().c_str());
     Evas_Object * thumb = tizen_browser::tools::EflTools::getEvasImage(hi->getThumbnail(), m_parent);
     elm_object_part_content_set(tile, "elm.thumbnail", thumb);
-    edje_object_signal_callback_add(elm_layout_edje_get(tile), "mouse,clicked,1", "over", _thumbClicked, itemData);
+    evas_object_smart_callback_add(tile, "clicked", _thumbClicked, itemData);
+    elm_object_focus_custom_chain_append(m_parent, tile, NULL);
 
     m_historyItems.push_back(hi);
 }
@@ -374,7 +376,7 @@ void MainUI::_thumbBookmarkClicked(void * data, Evas_Object * , void *)
     itemData->mainUI->openURLInNewTab(itemData->item, itemData->mainUI->isDesktopMode());
 }
 
-void MainUI::_thumbClicked(void* data, Evas_Object *, const char *, const char *)
+void MainUI::_thumbClicked(void* data, Evas_Object*, void*)
 {
     BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
     HistoryItemData * itemData = reinterpret_cast<HistoryItemData *>(data);
@@ -386,7 +388,7 @@ void MainUI::clearHistoryGenlist()
     BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
 
     for (auto it = m_tiles.begin(); it != m_tiles.end(); ++it) {
-        edje_object_signal_callback_del(elm_layout_edje_get(*it), "mouse,clicked,1", "over", _thumbClicked);
+        evas_object_smart_callback_del(*it, "clicked", _thumbClicked);
         evas_object_del(*it);
     }
 
index 0b5b52b..30e9aa6 100644 (file)
@@ -80,7 +80,7 @@ private:
     static char* _grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part);
     static Evas_Object * _grid_bookmark_content_get(void *data, Evas_Object *obj, const char *part);
     static void _thumbBookmarkClicked(void * data, Evas_Object * obj, void * event_info);
-    static void _thumbClicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+    static void _thumbClicked(void * data, Evas_Object * obj, void * event_info);
     void setEmptyView(bool empty);
     void showNoHistoryLabel();
 
index 8dfe2be..55d5a22 100644 (file)
@@ -456,7 +456,7 @@ group { name: "mv_bookmarks";
     }
 }
 
-group { name: "big_tile";
+group { name: "elm/button/base/big_tile";
     data.item: "texts" "page_title page_url";
     data.item: "contents" "elm.thumbnail";
     min: 600 614;
@@ -670,10 +670,18 @@ group { name: "big_tile";
             target: "border_left";
             target: "border_right";
         }
+        program {
+            name: "mouse_click";
+            signal: "mouse,clicked,1";
+            source: "over";
+            script {
+                emit("elm,action,click", "");
+            }
+        }
     }
 }
 
-group { name: "small_tile";
+group { name: "elm/button/base/small_tile";
     data.item: "texts" "page_title page_url";
     data.item: "contents" "elm.thumbnail";
     images {
@@ -917,6 +925,14 @@ group { name: "small_tile";
             target: "border_left";
             target: "border_right";
         }
+        program {
+            name: "mouse_click";
+            signal: "mouse,clicked,1";
+            source: "over";
+            script {
+                emit("elm,action,click", "");
+            }
+        }
     }
 }
 
index 5528ab8..c475b47 100644 (file)
@@ -886,6 +886,16 @@ void SimpleUI::closeMoreMenu(const std::string& str)
     m_moreMenuUI->isBookmark.disconnect(boost::bind(&SimpleUI::checkBookmark, this));
     m_moreMenuUI->deleteBookmark.disconnect(boost::bind(&SimpleUI::deleteBookmark, this));
     m_moreMenuUI.reset();
+
+    // TODO: temporary showing proper view untin VieManger will be available
+    if (m_webPageUI->isHomePageActive()) {
+        m_webPageUI->switchViewToQuickAccess(m_mainUI->getContent());
+        m_webEngine->disconnectCurrentWebViewSignals();
+        m_mainUI->showMostVisited(getMostVisitedItems());
+    }
+    else {
+        switchViewToWebPage();
+    }
 }
 
 void SimpleUI::switchToMobileMode()
index 0982bf3..8adfcbe 100644 (file)
@@ -68,6 +68,7 @@ void WebPageUI::showUI()
 void WebPageUI::hideUI()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+    elm_object_focus_custom_chain_unset(m_mainLayout);
 }
 
 void WebPageUI::loadStarted()
@@ -108,6 +109,13 @@ void WebPageUI::setMainContent(Evas_Object* content)
     hideWebView();
     elm_object_part_content_set(m_mainLayout, "web_view", content);
     evas_object_show(content);
+
+    // set custom focus chain
+    elm_object_focus_custom_chain_unset(m_mainLayout);
+    elm_object_focus_custom_chain_append(m_mainLayout, m_rightButtonBar->getContent(), NULL);
+    if (!isHomePageActive())
+        elm_object_focus_custom_chain_append(m_mainLayout, m_leftButtonBar->getContent(), NULL);
+    elm_object_focus_custom_chain_append(m_mainLayout, m_URIEntry->getContent(), NULL);
 }
 
 void WebPageUI::switchViewToErrorPage()
@@ -126,6 +134,7 @@ void WebPageUI::switchViewToWebPage(Evas_Object* content, const std::string uri)
     setMainContent(content);
     evas_object_show(m_leftButtonBar->getContent());
     updateURIBar(uri);
+    elm_object_focus_custom_chain_append(m_mainLayout, content, NULL);
 }
 
 void WebPageUI::switchViewToQuickAccess(Evas_Object* content)
@@ -301,7 +310,16 @@ std::string WebPageUI::edjePath(const std::string& file)
     return std::string(EDJE_DIR) + file;
 }
 
-
+void WebPageUI::showTabUIConnect()
+{
+    hideUI();
+    showTabUI();
+}
+void WebPageUI::showMoreMenuConnect()
+{
+    hideUI();
+    showMoreMenu();
+}
 
 }   // namespace tizen_browser
 }   // namespace base_ui
\ No newline at end of file
index e2010c8..2a71239 100644 (file)
@@ -80,8 +80,8 @@ private:
     void forwardPageConnect() { forwardPage(); }
     void stopLoadingPageConnect() { stopLoadingPage(); }
     void reloadPageConnect() { reloadPage(); }
-    void showTabUIConnect() { showTabUI(); }
-    void showMoreMenuConnect() { showMoreMenu(); }
+    void showTabUIConnect();
+    void showMoreMenuConnect();
 
     Evas_Object* m_parent;
     Evas_Object* m_mainLayout;