Fixed navigating by D-pad in History and Settings 00/48600/3
authorAlbert Malewski <a.malewski@samsung.com>
Wed, 23 Sep 2015 11:06:16 +0000 (13:06 +0200)
committerAlbert Malewski <a.malewski@samsung.com>
Wed, 23 Sep 2015 11:51:52 +0000 (13:51 +0200)
[Issue]    https://bugs.tizen.org/jira/browse/TT-183
[Problem]  There was no support for D-pad navigation in More Menu.
[Cause]    Some elements seemed not to be allowed to be focused.
[Solution] Added focus on some elements in HistoryUI and SettingsUI
           using elm_object_focus_custom_chain_append. Set focus on
           'Close' button by default. Cleared focused elements from
           MoreMenuUI that were visible in HistoryUI, BookmarkManagerUI
           and SettingsUI.
[Verify]   Launch browser > Navigate to More menu > Choose an item
           You should be able to go into Bookmarks/History/Settings
           from More Menu just using keyboard/D-pad.

Change-Id: Ica000176f025659b2a4352a2b4e49fe13f552b92

services/HistoryUI/HistoryUI.cpp
services/HistoryUI/HistoryUI.h
services/MoreMenuUI/MoreMenuUI.cpp
services/MoreMenuUI/MoreMenuUI.h
services/SettingsUI/SettingsUI.cpp
services/SimpleUI/SimpleUI.cpp
services/SimpleUI/SimpleUI.h

index 8443e040fa274b840a44a2bce5be7121c0a7ae61..f8eaa131b709e52a0a34f7e1c5d72edeb66fede3 100644 (file)
@@ -75,6 +75,7 @@ void HistoryUI::showUI()
     addItems();
     evas_object_show(m_actionBar);
     evas_object_show(m_history_layout);
+    elm_object_focus_set(elm_object_part_content_get(m_actionBar, "close_click"), EINA_TRUE);
 }
 
 void HistoryUI::hideUI()
@@ -87,6 +88,7 @@ void HistoryUI::hideUI()
     m_gengrid = nullptr;
     evas_object_hide(m_actionBar);
     evas_object_hide(m_history_layout);
+    elm_object_focus_custom_chain_unset(m_history_layout);
 }
 
 // TODO: Remove this function when proper view handling will be introduced
@@ -179,11 +181,13 @@ Evas_Object* HistoryUI::createActionBar(Evas_Object* history_layout)
     elm_object_style_set(button, "history_button");
     evas_object_smart_callback_add(button, "clicked", HistoryUI::_clearHistory_clicked, this);
     elm_object_part_content_set(actionBar, "clearhistory_click", button);
+    elm_object_focus_custom_chain_append(history_layout, button, nullptr);
 
     button = elm_button_add(actionBar);
     elm_object_style_set(button, "history_button");
     evas_object_smart_callback_add(button, "clicked", HistoryUI::_close_clicked_cb, this);
     elm_object_part_content_set(actionBar, "close_click", button);
+    elm_object_focus_custom_chain_append(history_layout, button, nullptr);
 
     return actionBar;
 }
@@ -193,7 +197,7 @@ void HistoryUI::_close_clicked_cb(void * data, Evas_Object*, void*)
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     if (data) {
         HistoryUI *historyUI = static_cast<HistoryUI*>(data);
-        historyUI->closeHistoryUIClicked(std::string());
+        historyUI->closeHistoryUIClicked();
         historyUI->clearItems();
     }
 }
@@ -295,6 +299,7 @@ Evas_Object * HistoryUI::_history_grid_content_get(void *data, Evas_Object*, con
                 Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, _history_item_clicked_cb, (*it));
                 id->historyUI->m_map_history_views.insert(std::pair<std::string,Elm_Object_Item*>((*it)->item->getUrl(), historyView));
             }
+            elm_object_focus_custom_chain_append(id->historyUI->m_history_layout, id->historyUI->m_genListToday, nullptr);
 
             return id->historyUI->m_genListToday;
         }
index c849f5f61d08000588d2ffddeea45ff2c91329fc..0635653df6a99fc373fb99cfedcdb5800a4d3fd8 100644 (file)
@@ -50,7 +50,7 @@ public:
     Evas_Object* createActionBar(Evas_Object* history_layout);
     void show(Evas_Object *main_layout);
     void addItems();
-    boost::signals2::signal<void (const std::string&)> closeHistoryUIClicked;
+    boost::signals2::signal<void ()> closeHistoryUIClicked;
     boost::signals2::signal<void (const std::string&)> clearHistoryClicked;
     boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::HistoryItem>)> historyItemClicked;
     boost::signals2::signal<void (std::shared_ptr<tizen_browser::services::HistoryItem>)> historyDeleteClicked;
index 395a43d2b91c1a954a16e8c994b65b2d63fb611c..e472d21c4d4366417ab57c24ff5ebfc8509764ec 100644 (file)
@@ -103,6 +103,7 @@ void MoreMenuUI::showUI()
     m_gengrid=createGengrid(getContent());
     addItems();
     elm_object_part_content_set(getContent(), "elm.swallow.grid", m_gengrid);
+    setFocus(EINA_TRUE);
 }
 
 void MoreMenuUI::hideUI()
@@ -167,6 +168,8 @@ void MoreMenuUI::showCurrentTab()
     elm_object_style_set(button, "hidden_button");
     evas_object_smart_callback_add(button, "clicked", _close_clicked, this);
     elm_object_part_content_set(m_current_tab_bar, "close_click", button);
+    evas_object_show(button);
+    elm_object_focus_set(button, EINA_TRUE);
 
     button = elm_button_add(m_mm_layout);
     elm_object_style_set(button, "hidden_button");
@@ -499,12 +502,15 @@ void MoreMenuUI::_thumbSelected(void* data, Evas_Object*, void*)
     BROWSER_LOGD("type: %d", itemData->item);
         switch (itemData->item) {
         case HISTORY:
+            itemData->moreMenuUI->setFocus(EINA_FALSE);
             itemData->moreMenuUI->historyUIClicked(std::string());
             break;
         case SETTINGS:
+            itemData->moreMenuUI->setFocus(EINA_FALSE);
             itemData->moreMenuUI->settingsClicked(std::string());
             break;
         case BOOKMARK_MANAGER:
+            itemData->moreMenuUI->setFocus(EINA_FALSE);
             itemData->moreMenuUI->bookmarkManagerClicked(std::string());
             break;
 #ifdef READER_MODE_ENABLED
@@ -550,6 +556,7 @@ void MoreMenuUI::clearItems()
     hide();
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     elm_gengrid_clear(m_gengrid);
+    elm_object_tree_focus_allow_set(getContent(), EINA_FALSE);
     m_map_menu_views.clear();
     evas_object_del(m_current_tab_bar);
     elm_theme_extension_del(NULL, m_edjFilePath.c_str());
@@ -563,5 +570,13 @@ void MoreMenuUI::_exitClicked()
     elm_exit();
 }
 
+void MoreMenuUI::setFocus(Eina_Bool focusable)
+{
+    BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__);
+    elm_object_tree_focus_allow_set(getContent(), focusable);
+    if (focusable == EINA_TRUE)
+        elm_object_focus_set(elm_object_part_content_get(m_current_tab_bar, "close_click"), focusable);
+}
+
 }
 }
index 4b1dac157c36a9235d1f7f56892f867f35725123..8f1d803c97e96bfc2dd07737d1353cd942ed0f4a 100644 (file)
@@ -81,6 +81,7 @@ public:
     void setURL(const std::string& url);
     void changeBookmarkStatus(bool data);
     void createToastPopup(const char* text);
+    void setFocus(Eina_Bool focusable);
 
     boost::signals2::signal<void (int)> addToBookmarkClicked;
     //TODO: remove redundant argument from this signal.
index c51b6ff1913ea6941d34c1226233f9fd716383fd..7d887338faa78476f57d67d5c5bb391365c232ce 100644 (file)
@@ -77,6 +77,7 @@ void SettingsUI::showUI()
     evas_object_show(m_items_layout);
     evas_object_show(m_settings_layout);
     evas_object_show(m_actionBar);
+    elm_object_focus_set(elm_object_part_content_get(m_actionBar, "close_click"), EINA_TRUE);
 }
 
 void SettingsUI::hideUI()
index a2a0145db2fb3c42e75e5af79ef30af73c1a53cd..5528ab8e197e38aac032b873451474450f4e107f 100644 (file)
@@ -458,7 +458,7 @@ void SimpleUI::onOpenURLInNewTab(std::shared_ptr<tizen_browser::services::Histor
     std::string historyAddress = historyItem->getUrl();
     if(m_historyUI) {                // TODO: remove this section when naviframes will be available
         m_historyUI->clearItems();
-        closeHistoryUI(std::string());
+        closeHistoryUI();
     }
 
     if(m_moreMenuUI) {               // TODO: remove this section when naviframes will be available
@@ -792,20 +792,21 @@ void SimpleUI::showHistoryUI(const std::string& str)
             (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.historyui"));
         M_ASSERT(m_historyUI);
         m_historyUI->clearHistoryClicked.connect(boost::bind(&SimpleUI::onClearHistoryClicked, this,_1));
-        m_historyUI->closeHistoryUIClicked.connect(boost::bind(&SimpleUI::closeHistoryUI, this,_1));
+        m_historyUI->closeHistoryUIClicked.connect(boost::bind(&SimpleUI::closeHistoryUI, this));
         m_historyUI->historyItemClicked.connect(boost::bind(&SimpleUI::onOpenURLInNewTab, this, _1, true));     // desktop mode as default
         m_historyUI->addHistoryItems(getHistory());
         m_historyUI->show(m_window.get());
     }
 }
 
-void SimpleUI::closeHistoryUI(const std::string& str)
+void SimpleUI::closeHistoryUI()
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     m_historyUI->clearHistoryClicked.disconnect(boost::bind(&SimpleUI::onClearHistoryClicked, this,_1));
-    m_historyUI->closeHistoryUIClicked.disconnect(boost::bind(&SimpleUI::closeHistoryUI, this,_1));
+    m_historyUI->closeHistoryUIClicked.disconnect(boost::bind(&SimpleUI::closeHistoryUI, this));
     m_historyUI->historyItemClicked.disconnect(boost::bind(&SimpleUI::onOpenURLInNewTab, this, _1, true));     // desktop mode as default
     m_historyUI.reset();
+    m_moreMenuUI->setFocus(EINA_TRUE);
 }
 
 void SimpleUI::showSettingsUI(const std::string& str)
@@ -834,6 +835,7 @@ void SimpleUI::closeSettingsUI(const std::string& str)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
     m_settingsUI.reset();
+    m_moreMenuUI->setFocus(EINA_TRUE);
 }
 
 void SimpleUI::showMoreMenu()
@@ -940,6 +942,7 @@ void SimpleUI::closeBookmarkManagerMenu(const std::string& str)
     if(m_mainUI) {
         m_mainUI->showBookmarks(getBookmarks());
     }
+    m_moreMenuUI->setFocus(EINA_TRUE);
 }
 
 void SimpleUI::hideHistory()
index 897d66d1ede0498e73e7b1fb83ded684ca5b3294..a889e3f228b341545925d2d805031660ca8d539c 100644 (file)
@@ -209,7 +209,7 @@ private:
     void switchToMobileMode();
     void switchToDesktopMode();
     void showHistoryUI(const std::string& str);
-    void closeHistoryUI(const std::string&);
+    void closeHistoryUI();
     void showURIBar();
     void hideURIBar();
     void hideSettingsMenu();