add UP and DOWN key handling to show and hide menu bar in photoviewer view 25/37525/1 accepted/tizen/tv/20150401.123944 submit/tizen_tv/20150401.080439
authorJehun Lim <jehun.lim@samsung.com>
Mon, 30 Mar 2015 12:13:45 +0000 (21:13 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Mon, 30 Mar 2015 12:13:45 +0000 (21:13 +0900)
Change-Id: Iefd1d89d353c4a9e68aa1c700c819ff9692a6673
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
include/common/define.h
include/util/timeout_handler.h
src/util/timeout_handler.cpp
src/view/photo-viewer/photoviewer_view.cpp

index f7a0c45..f4bf39a 100644 (file)
@@ -34,6 +34,8 @@
 #define KEY_BACK_REMOTE "XF86Close"
 #define KEY_RIGHT "Right"
 #define KEY_LEFT "Left"
+#define KEY_UP "Up"
+#define KEY_DOWN "Down"
 #define KEY_MENU "Super_L"
 #define KEY_MENU_REMOTE "XF86Send"
 
index 5f99c78..ad2a711 100644 (file)
@@ -45,9 +45,10 @@ public:
        bool Create(double timeout, ITimeoutListener *listener);
        virtual void Destroy(void);
 
+       void Timeout(void);
        void Reset(void);
        void Pause(void);
-       void Resume(void);      
+       void Resume(void);
 
 };
 
index f0c4588..85619e9 100644 (file)
@@ -56,6 +56,7 @@ Eina_Bool CTimeoutHandler::sm_CbTimer(void *data)
 
 Eina_Bool CTimeoutHandler::m_OnTimer(void)
 {
+       ecore_timer_del(m->timer);
        m->timer = NULL;
        m->listener->OnTimeout();
 
@@ -149,6 +150,14 @@ error:
 }
 
 
+void CTimeoutHandler::Timeout(void)
+{
+       ASSERT(m);
+
+       m_OnTimer();
+}
+
+
 void CTimeoutHandler::Reset(void)
 {
        ASSERT(m);
index 1c0cc5b..6c2ee7f 100644 (file)
@@ -310,8 +310,7 @@ void CPhotoViewerView::m_OnSettingBtnClicked(Evas_Object *obj,
        m->pCtxPopup = pCtxPopup;
        pCtxPopup->Create(m->base, &cb);
 
-       m->tooltip_timer = NULL;
-       elm_object_tooltip_hide(m->focusedbtn);
+       m_OnTimerTooltip();
 }
 
 
@@ -342,8 +341,7 @@ void CPhotoViewerView::m_OnZoomBtnClicked(Evas_Object *obj,
        m->pCtxPopup = pCtxPopup;
        pCtxPopup->Create(m->base, &cb);
 
-       m->tooltip_timer = NULL;
-       elm_object_tooltip_hide(m->focusedbtn);
+       m_OnTimerTooltip();
 }
 
 
@@ -420,7 +418,9 @@ Eina_Bool CPhotoViewerView::sm_CbTimerTooltip(void *cookie)
 
 Eina_Bool CPhotoViewerView::m_OnTimerTooltip(void)
 {
+       ecore_timer_del(m->tooltip_timer);
        m->tooltip_timer = NULL;
+
        elm_object_tooltip_hide(m->focusedbtn);
 
        return ECORE_CALLBACK_CANCEL;
@@ -440,7 +440,9 @@ Eina_Bool CPhotoViewerView::sm_CbTimerPreviewBar(void *cookie)
 
 Eina_Bool CPhotoViewerView::m_OnTimerPreviewBar(void)
 {
+       ecore_timer_del(m->pvbar_timer);
        m->pvbar_timer = NULL;
+
        elm_object_signal_emit(m->base, SIG_PREVIEWBAR_HIDE, "");
 
        return ECORE_CALLBACK_CANCEL;
@@ -1128,6 +1130,9 @@ void CPhotoViewerView::t_OnPause(void)
                m->pCtxPopup = NULL;
        }
 
+       if (m->tooltip_timer)
+               ecore_timer_freeze(m->tooltip_timer);
+
        elm_object_tooltip_hide(m->focusedbtn);
 
        if (m->slideshow_timer)
@@ -1140,25 +1145,29 @@ void CPhotoViewerView::t_OnResume(void)
 {
        ASSERT(m);
 
-       if (m->slideshow_timer)
-               ecore_timer_thaw(m->slideshow_timer);
-
-       m->cTimeoutHandler.Resume();
-
-       elm_object_focus_set(m->focusedbtn, EINA_TRUE);
-
-       elm_object_tooltip_show(m->focusedbtn);
        if (m->tooltip_timer)
                ecore_timer_reset(m->tooltip_timer);
        else {
                m->tooltip_timer = ecore_timer_add(TIMEOUT_TOOLTIP,
                                        sm_CbTimerTooltip, this);
        }
+
+       elm_object_tooltip_show(m->focusedbtn);
+
+       if (m->slideshow_timer)
+               ecore_timer_thaw(m->slideshow_timer);
+
+       m->cTimeoutHandler.Resume();
+
+       elm_object_focus_set(m->focusedbtn, EINA_TRUE);
 }
 
 
 void CPhotoViewerView::OnTimeout(void)
 {
+       if (m->tooltip_timer)
+               m_OnTimerTooltip();
+
        if (m->pCtxPopup && m->pCtxPopup->FlagCreate()) {
                m->pCtxPopup->Destroy();
                delete m->pCtxPopup;
@@ -1195,6 +1204,11 @@ Eina_Bool CPhotoViewerView::OnEvent(int type, void *event_info)
                } else if (!strcmp(ev->keyname, KEY_RIGHT)) {
                        sm_CbNextBtnClicked(this, NULL, NULL, NULL);
                        return EINA_FALSE;
+               } else if (!strcmp(ev->keyname, KEY_UP)) {
+                       if (m->slideshow_state == STATE_PLAY)
+                               return EINA_FALSE;
+
+                       elm_object_signal_emit(m->base, SIG_MENU_SHOW, "");
                } else if (!strcmp(ev->keyname, KEY_ENTER) ||
                        !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
                        if (m->slideshow_state == STATE_PLAY)
@@ -1240,7 +1254,8 @@ void CPhotoViewerView::OnKeyDown(int id, Evas *e, Evas_Object *obj,
                        !strcmp(ev->keyname, KEY_MENU_REMOTE)) {
                        m->pViewMgr->PushView(VIEW_CTXT_MENU, m->vd);
                        t_OnPause();
-               }
+               } else if (!strcmp(ev->keyname, KEY_DOWN))
+                       m->cTimeoutHandler.Timeout();
 
                break;
        default: