diff options
author | Igor Nazarov <i.nazarov@samsung.com> | 2017-04-28 20:18:29 +0300 |
---|---|---|
committer | Igor Nazarov <i.nazarov@samsung.com> | 2017-04-28 20:32:53 +0300 |
commit | 98fbc3c9ecd86adb6bc8d1eb89111809c488866c (patch) | |
tree | 66b467d7ebd51b11e1cf8d4b504c35f4f695d745 | |
parent | a9055bae5bcac9dc351a6e9a11d1d124b7eaa3e0 (diff) | |
download | gallery-98fbc3c9ecd86adb6bc8d1eb89111809c488866c.tar.gz gallery-98fbc3c9ecd86adb6bc8d1eb89111809c488866c.tar.bz2 gallery-98fbc3c9ecd86adb6bc8d1eb89111809c488866c.zip |
TizenRefApp-8459 [Gallery] Implement launch select mode from ThumbnailPage
- Implemented launch of select mode from ThumbnailPage;
- Fixed bug in ImageGrid when start in select mode after long press.
Change-Id: Ib354d8c67a8f5ebaad690cf8cb01894cf0d8b872
-rw-r--r-- | inc/presenters/ThumbnailPage.h | 2 | ||||
-rw-r--r-- | src/presenters/PreviewPage.cpp | 8 | ||||
-rw-r--r-- | src/presenters/ThumbnailPage.cpp | 29 | ||||
-rw-r--r-- | src/view/ImageGrid.cpp | 4 |
4 files changed, 37 insertions, 6 deletions
diff --git a/inc/presenters/ThumbnailPage.h b/inc/presenters/ThumbnailPage.h index 925cc9e..cbf889e 100644 --- a/inc/presenters/ThumbnailPage.h +++ b/inc/presenters/ThumbnailPage.h @@ -48,6 +48,8 @@ namespace gallery { void reload(); + int getSafeItemIndex(int itemIndex) const; + void onAlbumChanged(); bool onEachMedia(MediaItemSRef &&media); diff --git a/src/presenters/PreviewPage.cpp b/src/presenters/PreviewPage.cpp index 5eb1e58..5a25a59 100644 --- a/src/presenters/PreviewPage.cpp +++ b/src/presenters/PreviewPage.cpp @@ -276,6 +276,8 @@ namespace gallery { Result PreviewPage::prepare() { + ILOG("m_selectModeStartup: %d", m_selectModeStartup); + m_content = PageContent::Builder(). setFlags(PageContent::FLAG_BOTTOM_BUTTON | PageContent::FLAG_SELECT_BUTTON | @@ -372,7 +374,9 @@ namespace gallery { void PreviewPage::onAlbumChanged() { - if (!isEmpty(m_album)) { + if (m_selectModeStartup) { + requestExit(); + } else if (!isEmpty(m_album)) { reload(); } } @@ -417,7 +421,7 @@ namespace gallery { void PreviewPage::onBackKey() { - if (m_isInSelectMode) { + if (m_isInSelectMode && !m_selectModeStartup) { switchToNormalMode(); return; } diff --git a/src/presenters/ThumbnailPage.cpp b/src/presenters/ThumbnailPage.cpp index 2b4c456..20af9fb 100644 --- a/src/presenters/ThumbnailPage.cpp +++ b/src/presenters/ThumbnailPage.cpp @@ -234,13 +234,26 @@ namespace gallery { void ThumbnailPage::onItemEvent(const int itemIndex, const int event, const int x, const int y) { - if (!isActive() || (event != ImageGrid::ITEM_EVENT_CLICK)) { + if (!isActive()) { + return; + } + + bool selectModeStartup = false; + + switch (event) { + case ImageGrid::ITEM_EVENT_CLICK: + break; + case ImageGrid::ITEM_EVENT_TAP_AND_HOLD: + selectModeStartup = true; + break; + default: return; } m_page = PreviewPage::Builder(). setNaviframe(asShared(getNaviframe())). setAlbum(m_album). + setSelectModeStartup(selectModeStartup). setStartItemIndex(itemIndex). build(DELEGATE(ThumbnailPage::onPageExitRequest, this)); } @@ -249,9 +262,21 @@ namespace gallery { { if (const PreviewPageSRef previewPage = dynamicRefCast<PreviewPage>(m_page)) { - m_imageGrid->scrollToItem(previewPage->getCurrentItemIndex()); + m_imageGrid->scrollToItem(getSafeItemIndex( + previewPage->getCurrentItemIndex())); } m_page.reset(); popTo(); } + + int ThumbnailPage::getSafeItemIndex(const int itemIndex) const + { + if (itemIndex < 0) { + return 0; + } + if (itemIndex >= static_cast<int>(m_mediaItems.size())) { + return (m_mediaItems.size() - 1); + } + return itemIndex; + } } diff --git a/src/view/ImageGrid.cpp b/src/view/ImageGrid.cpp index b60d5b9..f1c0df4 100644 --- a/src/view/ImageGrid.cpp +++ b/src/view/ImageGrid.cpp @@ -435,6 +435,8 @@ namespace gallery { ELOG("setTheme() failed!"); } else if (imageGrid.m_isInSelectMode) { m_layout.emit(impl::SIGNAL_FORCE_SELECT_MODE); + edje_object_message_signal_process( + elm_layout_edje_get(m_layout)); } } fill(m_layout); @@ -1025,8 +1027,6 @@ namespace gallery { if (m_slotSize == 0) { UCL_ASSERT(!isOdd, "Must be even!"); - edje_object_message_signal_process( - elm_layout_edje_get(slot->getLayout())); slot->getLayout().calculate(); setSlotSize(slot->getSize()); } |