TizenRefApp-8599 [Gallery] Implement Video player according to 77/131677/1
authorIgor Nazarov <i.nazarov@samsung.com>
Tue, 30 May 2017 10:32:56 +0000 (13:32 +0300)
committerIgor Nazarov <i.nazarov@samsung.com>
Tue, 30 May 2017 10:32:56 +0000 (13:32 +0300)
requirements

Change-Id: I1934c527272355126ccce52dec6f30a7200c9f6f

edc/button.edc
inc/presenters/VideoPlayerPage.h
src/presenters/VideoPlayerPage.cpp

index 6c7145952672ce9f453dbb95f8cb7ef8911464f2..9b49e27cc630a53b18580ada2bcf7a1547e49c90 100644 (file)
@@ -267,6 +267,9 @@ group{ "elm/button/base/gallery_image_full";
                inherit: "default"; \
                color: GALLERY_COLOR_VIDEO_BTN_PRESSED; \
             } \
+            desc { "disabled"; \
+               inherit: "pressed"; \
+            } \
          } \
          rect { "event"; \
             norepeat; \
@@ -278,6 +281,18 @@ group{ "elm/button/base/gallery_image_full";
          } \
       } \
       programs { \
+         program { "on_disabled"; \
+            signal: "elm,state,disabled"; \
+            source: "elm";\
+            action: STATE_SET "disabled"; \
+            target: "gallery.icon"; \
+         } \
+         program { "on_enabled"; \
+            signal: "elm,state,enabled"; \
+            source: "elm"; \
+            action: STATE_SET "default"; \
+            target: "gallery.icon"; \
+         } \
          program { "on_press"; \
             signal: "elm,action,press"; \
             source: ""; \
index 23f3656e6f688080b7555efdd7ad4c691327c0a0..e7d1794fa9fe0d649b6960b7bc63d0683303dace 100644 (file)
@@ -58,8 +58,8 @@ namespace gallery {
                ucl::Result seekToStart();
 
                void createControls();
-               void createButton(ucl::ElmStyle style, ucl::EdjePart part,
-                               const ucl::WidgetEventHandler &handler);
+               ucl::StyledWidgetSRef createButton(ucl::ElmStyle style,
+                               ucl::EdjePart part, const ucl::WidgetEventHandler &handler);
 
                bool resetTimer(Ecore_Timer *&timer, double timeout, Ecore_Task_Cb func);
                void stopTimer(Ecore_Timer *&timer);
@@ -114,6 +114,7 @@ namespace gallery {
                SoundManagerSRef m_soundMgr;
                ucl::LayoutSRef m_content;
                ucl::WidgetSRef m_image;
+               ucl::StyledWidgetSRef m_volumeMuteBtn;
                TouchParserSRef m_touchParser;
                player_h m_player;
                int m_videoDuration;
index 37b1a8c941fae2bcc2bbd4180333e6abb0fb7c60..d0876737b81e9e2a75829777f36b5a907b75a019 100644 (file)
@@ -288,7 +288,8 @@ namespace gallery {
                                WEAK_DELEGATE(VideoPlayerPage::onVolumeBtnClick,
                                asWeak(*this)));
 
-               createButton(impl::STYLE_VOLUME_MUTE_BTN, impl::PART_VOLUME_MUTE_BTN,
+               m_volumeMuteBtn = createButton(impl::STYLE_VOLUME_MUTE_BTN,
+                               impl::PART_VOLUME_MUTE_BTN,
                                WEAK_DELEGATE(VideoPlayerPage::onVolumeBtnClick,
                                asWeak(*this)));
 
@@ -301,7 +302,7 @@ namespace gallery {
                                asWeak(*this)));
        }
 
-       void VideoPlayerPage::createButton(const ElmStyle style,
+       StyledWidgetSRef VideoPlayerPage::createButton(const ElmStyle style,
                        const EdjePart part, const WidgetEventHandler &handler)
        {
                const auto btn = makeShared<StyledWidget>(elm_button_add(*m_content));
@@ -311,6 +312,8 @@ namespace gallery {
                m_content->setContent(*btn, part);
 
                btn->addEventHandler(BTN_CLICKED, handler);
+
+               return btn;
        }
 
        bool VideoPlayerPage::resetTimer(Ecore_Timer *&timer,
@@ -365,9 +368,7 @@ namespace gallery {
                if (!m_isControlsVisible) {
                        m_isControlsVisible = true;
 
-                       if (m_soundMgr && m_soundMgr->isMediaDeviceReady()) {
-                               showVolumeBtn();
-                       }
+                       showVolumeBtn();
 
                        if (m_state == State::PLAYING) {
                                m_content->emit(impl::SHOW_PAUSE_BTN);
@@ -399,10 +400,16 @@ namespace gallery {
 
        void VideoPlayerPage::showVolumeBtn()
        {
-               if (m_soundMgr->getCurrentMediaVolume() > 0) {
-                       m_content->emit(impl::SHOW_VOLUME_ON_BTN);
-               } else {
+               if (!m_soundMgr || !m_soundMgr->isMediaDeviceReady()) {
                        m_content->emit(impl::SHOW_VOLUME_MUTE_BTN);
+                       disable(*m_volumeMuteBtn);
+               } else {
+                       if (m_soundMgr->getCurrentMediaVolume() > 0) {
+                               m_content->emit(impl::SHOW_VOLUME_ON_BTN);
+                       } else {
+                               m_content->emit(impl::SHOW_VOLUME_MUTE_BTN);
+                               enable(*m_volumeMuteBtn);
+                       }
                }
        }
 
@@ -543,20 +550,14 @@ namespace gallery {
        void VideoPlayerPage::onMediaDeviceStateChanged()
        {
                if (m_isControlsVisible) {
-                       if (m_soundMgr->isMediaDeviceReady()) {
-                               showVolumeBtn();
-                       } else {
-                               m_content->emit(impl::HIDE_VOLUME_BTN);
-                       }
+                       showVolumeBtn();
                }
        }
 
        void VideoPlayerPage::onMediaVolumeChanged()
        {
                if (m_isControlsVisible) {
-                       if (m_soundMgr->isMediaDeviceReady()) {
-                               showVolumeBtn();
-                       }
+                       showVolumeBtn();
                }
        }
 
@@ -564,7 +565,7 @@ namespace gallery {
        {
                m_isPlaybackCompleted = true;
                pausePlayback();
-               showControls();
+               requestExit();
        }
 
        void VideoPlayerPage::onPlaybackInterrupted(player_interrupted_code_e code)