From: Denis Dolzhenko Date: Thu, 22 Sep 2016 10:01:44 +0000 (+0300) Subject: TizenRefApp-7241 First page of Slideshow is empty if mms has no text X-Git-Tag: submit/tizen/20160926.072415^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b48a285f722e1d324939c9029e29018fbdc8ac0;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7241 First page of Slideshow is empty if mms has no text Change-Id: I93b14ea9d3c18944018cbcf371733ec02ace27cc Signed-off-by: Denis Dolzhenko --- diff --git a/src/Viewer/Controller/inc/SmilPage.h b/src/Viewer/Controller/inc/SmilPage.h index fbf36fd1..44facf43 100644 --- a/src/Viewer/Controller/inc/SmilPage.h +++ b/src/Viewer/Controller/inc/SmilPage.h @@ -50,6 +50,7 @@ namespace Msg Evas_Object *getVideoSink() const; std::string getMediaPath() const; const std::list &getAttachments() const; + static bool isEmpty(const MsgPage &page); private: const MsgMedia *getMedia(const MsgPage &page, MsgMedia::Type type) const; diff --git a/src/Viewer/Controller/src/SmilPage.cpp b/src/Viewer/Controller/src/SmilPage.cpp index 09d5222f..c4f51d02 100644 --- a/src/Viewer/Controller/src/SmilPage.cpp +++ b/src/Viewer/Controller/src/SmilPage.cpp @@ -120,6 +120,19 @@ const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) con return nullptr; } +bool SmilPage::isEmpty(const MsgPage &page) +{ + const MsgMediaList &list = page.getMediaList(); + for(int i = 0; i < list.getLength(); ++i) + { + const MsgMedia &media = list[i]; + std::string filePath = media.getFilePath(); + if(media.getType() != MsgMedia::UnknownType && FileUtils::getFileSize(filePath) > 0) + return false; + } + return true; +} + void SmilPage::build(const MsgPage &page) { m_Duration = page.getPageDuration() / 1000.0 + 0.5; diff --git a/src/Viewer/Controller/src/SmilPlayer.cpp b/src/Viewer/Controller/src/SmilPlayer.cpp index 4ee26a57..a9ad502b 100644 --- a/src/Viewer/Controller/src/SmilPlayer.cpp +++ b/src/Viewer/Controller/src/SmilPlayer.cpp @@ -48,9 +48,13 @@ void SmilPlayer::create(const MessageMms &mms) const MsgPageList &pages = mms.getPageList(); for(int i = 0; i < pages.getLength(); ++i) { - SmilPage *smilPage = new SmilPage(getEo(), pages[i]); - m_Duration += smilPage->getDuration(); - m_PageList.push_back(smilPage); + const MsgPage &page = pages[i]; + if(!SmilPage::isEmpty(page)) + { + SmilPage *smilPage = new SmilPage(getEo(), page); + m_Duration += smilPage->getDuration(); + m_PageList.push_back(smilPage); + } } // Attachment: diff --git a/src/Viewer/Controller/src/Viewer.cpp b/src/Viewer/Controller/src/Viewer.cpp index 6a62449d..f3ee6255 100644 --- a/src/Viewer/Controller/src/Viewer.cpp +++ b/src/Viewer/Controller/src/Viewer.cpp @@ -101,10 +101,10 @@ void Viewer::create(MsgId id) } createLayout(); + createSmilPlayer(); createSubjectLayout(); createPlayerControl(); createRecipPanel(); - createSmilPlayer(); updateButtonState(); updatePlayPos(); @@ -131,12 +131,8 @@ void Viewer::createSubjectLayout() { if(!m_pSubjectLayout) { + int numberOfPages = m_pSmilPlayer ? m_pSmilPlayer->getPages().size() : 0; m_pSubjectLayout = new SubjectLayout(*m_pLayout); - - int numberOfPages = m_Msg->getPageList().getLength(); - if(!m_Msg->getAttachmentList().isEmpty()) - numberOfPages += 1; - m_pSubjectLayout->setNumberOfPages(numberOfPages); m_pSubjectLayout->show(); m_pLayout->setSubject(*m_pSubjectLayout);