TizenRefApp-6627 Focus in Search field after disabling search mode 78/87078/3
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Tue, 6 Sep 2016 08:17:54 +0000 (11:17 +0300)
committerAleksandr Sapozhnik <a.sapozhnik@samsung.com>
Wed, 7 Sep 2016 10:48:08 +0000 (03:48 -0700)
[Implementation] Remove focus from search when ListView is activated.
Implemented navigation notifications when window focus changes.

Change-Id: I21bb4f65e1b84ab2d210f84b443c61c6254b9a5b
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
contacts-app/src/OperationDefaultController.cpp
lib-apps-common/inc/Ui/Window.h
lib-apps-common/src/Ui/Window.cpp
lib-contacts/src/Contacts/List/ListView.cpp

index e052df2..6477474 100644 (file)
@@ -78,7 +78,6 @@ void OperationDefaultController::onRequest(Operation operation, app_control_h re
        } else if (appId && strcmp(appId, APP_CONTROL_PHONE_APPID) == 0) {
                if (getBadgeCount(APP_CONTROL_PHONE_APPID) > 0) {
                        selectedTab = TabLogs;
-                       static_cast<LogsView *>(m_Tabs[TabLogs])->resetMissedCalls();
                } else {
                        selectedTab = getLastTab();
                }
index 7e76d62..aeeb0e7 100644 (file)
@@ -68,9 +68,11 @@ namespace Ui
                virtual Evas_Object *onWindowCreate();
 
        private:
+               void onFocused(Evas_Object *obj, void *eventInfo);
+               void onUnfocused(Evas_Object *obj, void *eventInfo);
+               void onRotationChanged(Evas_Object *obj, void *eventInfo);
                void onBackPressed(Evas_Object *obj, void *eventInfo);
                void onMenuPressed(Evas_Object *obj, void *eventInfo);
-               void onRotationChanged(Evas_Object *obj, void *eventInfo);
 
                Evas_Object *m_Conform;
                Evas_Object *m_Layout;
index fbf9234..2a6a5af 100644 (file)
@@ -61,9 +61,11 @@ void Window::setRotationEnabled(bool isEnabled)
 
 void Window::attachView(View *view)
 {
-       elm_object_part_content_set(m_Layout, "elm.swallow.content", view->create(m_Layout));
-       view->onNavigation(true, elm_win_rotation_get(getEvasObject()));
        m_MainView = view;
+       elm_object_part_content_set(m_Layout, "elm.swallow.content", m_MainView->create(m_Layout));
+       if (elm_win_focus_get(getEvasObject())) {
+               m_MainView->onNavigation(true, elm_win_rotation_get(getEvasObject()));
+       }
 }
 
 Evas_Object *Window::onCreate(Evas_Object *parent)
@@ -86,8 +88,13 @@ Evas_Object *Window::onCreate(Evas_Object *parent)
        evas_object_show(bg);
        elm_object_part_content_set(m_Layout, "elm.swallow.bg", bg);
 
+       evas_object_smart_callback_add(window, "focused",
+                       makeCallback(&Window::onFocused), this);
+       evas_object_smart_callback_add(window, "unfocused",
+                       makeCallback(&Window::onUnfocused), this);
        evas_object_smart_callback_add(window, "rotation,changed",
                        makeCallback(&Window::onRotationChanged), this);
+
        eext_object_event_callback_add(m_Layout, EEXT_CALLBACK_BACK,
                        makeCallback(&Window::onBackPressed), this);
        eext_object_event_callback_add(m_Layout, EEXT_CALLBACK_MORE,
@@ -105,17 +112,17 @@ Evas_Object *Window::onWindowCreate()
        return window;
 }
 
-void Window::onBackPressed(Evas_Object *obj, void *eventInfo)
+void Window::onFocused(Evas_Object *obj, void *eventInfo)
 {
-       if (!m_MainView || m_MainView->onBackPressed()) {
-               elm_win_lower(getEvasObject());
+       if (m_MainView) {
+               m_MainView->onNavigation(true, elm_win_rotation_get(getEvasObject()));
        }
 }
 
-void Window::onMenuPressed(Evas_Object *obj, void *eventInfo)
+void Window::onUnfocused(Evas_Object *obj, void *eventInfo)
 {
        if (m_MainView) {
-               m_MainView->onMenuPressed();
+               m_MainView->onNavigation(false, elm_win_rotation_get(getEvasObject()));
        }
 }
 
@@ -123,3 +130,17 @@ void Window::onRotationChanged(Evas_Object *obj, void *eventInfo)
 {
        m_MainView->onRotation(elm_win_rotation_get(obj));
 }
+
+void Window::onBackPressed(Evas_Object *obj, void *eventInfo)
+{
+       if (!m_MainView || m_MainView->onBackPressed()) {
+               elm_win_lower(getEvasObject());
+       }
+}
+
+void Window::onMenuPressed(Evas_Object *obj, void *eventInfo)
+{
+       if (m_MainView) {
+               m_MainView->onMenuPressed();
+       }
+}
index bd02ddf..3c13156 100644 (file)
@@ -171,6 +171,9 @@ void ListView::onNavigation(bool isCurrent)
 {
        updateAddButton();
        m_PersonProvider->setUpdateMode(isCurrent);
+       if (isCurrent) {
+               elm_object_focus_set(m_SearchField->getEntry(), EINA_FALSE);
+       }
 }
 
 bool ListView::onBackPressed()