From bf6b79589e27843bddf8bad1a255c13a42b08fd9 Mon Sep 17 00:00:00 2001 From: JongwooLee Date: Mon, 29 Apr 2013 13:24:34 +0900 Subject: [PATCH] Modified bug of RefreshGallery(REMOVE), Fixed N_SE-36063 issue Change-Id: Ibec7fb37c3e82dc6c2bd3f31058745522e63fed8 Signed-off-by: JongwooLee --- src/ui/controls/FUiCtrl_GalleryImageReader.cpp | 6 +++ src/ui/controls/FUiCtrl_GalleryPresenter.cpp | 55 +++++++++++++++++----- .../controls/FUiCtrl_GalleryViewEventHandler.cpp | 22 +++++++++ src/ui/inc/FUiCtrl_GalleryImageReader.h | 1 + src/ui/inc/FUiCtrl_GalleryViewEventHandler.h | 1 + 5 files changed, 74 insertions(+), 11 deletions(-) diff --git a/src/ui/controls/FUiCtrl_GalleryImageReader.cpp b/src/ui/controls/FUiCtrl_GalleryImageReader.cpp index a00aa28..e4cdc90 100644 --- a/src/ui/controls/FUiCtrl_GalleryImageReader.cpp +++ b/src/ui/controls/FUiCtrl_GalleryImageReader.cpp @@ -171,4 +171,10 @@ CATCH: delete pPartialGalleryBitmap; } +void +_GalleryImageReader::ResetLoadedPartialImageIndex(void) +{ + __currentLoadBitmapIndex = -1; +} + }}} // Tizen::Ui::Controls diff --git a/src/ui/controls/FUiCtrl_GalleryPresenter.cpp b/src/ui/controls/FUiCtrl_GalleryPresenter.cpp index 2b07ea3..2668000 100644 --- a/src/ui/controls/FUiCtrl_GalleryPresenter.cpp +++ b/src/ui/controls/FUiCtrl_GalleryPresenter.cpp @@ -562,6 +562,8 @@ _GalleryPresenter::OnBoundsChanged(void) r = __galleryRenderer.SetCanvasBounds(currentCanvasIndex, canvasBounds); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r)); + __pGalleryViewEventHandler->ResetTouch(); + r = __pGalleryViewEventHandler->AlignCanvas(false); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -646,8 +648,7 @@ _GalleryPresenter::RequestToLoadItem(int itemIndex) result _GalleryPresenter::RequestToUnloadItem(int itemIndex) { - result r = __pGalleryModel->RequestToUnloadItem(itemIndex); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + result r = E_SUCCESS; int canvasIndex = SearchCanvasIndex(itemIndex); if (canvasIndex != NOT_EXIST_CANVAS) @@ -655,9 +656,8 @@ _GalleryPresenter::RequestToUnloadItem(int itemIndex) __galleryRenderer.SetCanvasVisibility(canvasIndex, false); __pItemToCanvas[canvasIndex] = NOT_USED_CANVAS; } - SortItemToCanvasIndex(itemIndex, false); - if (GetItemCount() == 0) + if (GetItemCount() == 1) { r = SetCurrentItemIndex(NO_CURRENT_IMAGE); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -667,25 +667,58 @@ _GalleryPresenter::RequestToUnloadItem(int itemIndex) } else { - if (itemIndex < GetItemCount()) + if (itemIndex == __currentItemIndex) { - r = SetCanvasImage(itemIndex); + __pGalleryImageReader->ResetLoadedPartialImageIndex(); + r = __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - int canvasIndex = SearchCanvasIndex(itemIndex); - SysTryReturn(NID_UI_CTRL, canvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM, + __pGalleryViewEventHandler->SetZoomFlag(false); + + int canvasIndex = NOT_EXIST_CANVAS; + if (itemIndex == GetItemCount() - 1) + { + r = SetCanvasImage(itemIndex - 1); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + canvasIndex = SearchCanvasIndex(itemIndex - 1); + SysTryReturn(NID_UI_CTRL, canvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to search canvas"); + __currentItemIndex--; + } + else + { + r = SetCanvasImage(itemIndex + 1); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + canvasIndex = SearchCanvasIndex(itemIndex + 1); + SysTryReturn(NID_UI_CTRL, canvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM, + "[E_SYSTEM] Failed to search canvas"); + } r = __galleryRenderer.SetCanvasVisibility(canvasIndex, true); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = __galleryRenderer.SetCanvasBounds(canvasIndex, __galleryRenderer.GetViewRect()); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + if(ChangedItem() == false) + { + r = GetLastResult(); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + } } - else + else if (itemIndex < __currentItemIndex) { - r = SetCurrentItem(itemIndex - 1); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + __currentItemIndex--; } } + r = __pGalleryModel->RequestToUnloadItem(itemIndex); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + SortItemToCanvasIndex(itemIndex, false); + r = __galleryRenderer.RefreshView(); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/ui/controls/FUiCtrl_GalleryViewEventHandler.cpp b/src/ui/controls/FUiCtrl_GalleryViewEventHandler.cpp index 0acac4c..8568b80 100644 --- a/src/ui/controls/FUiCtrl_GalleryViewEventHandler.cpp +++ b/src/ui/controls/FUiCtrl_GalleryViewEventHandler.cpp @@ -227,6 +227,28 @@ CATCH: } bool +_GalleryViewEventHandler::ResetTouch() +{ + result r = E_SUCCESS; + + __pressed = false; + __moving = false; + __pinchInitialArea = 0; + __startPinchCenterPosition.SetPosition(0.0, 0.0); + __pinchMode = false; + __flickingDirection = FLICK_DIRECTION_NONE; + + r = SetVisibleCanvas(); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = RefreshView(); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r)); + + return true; +} + + +bool _GalleryViewEventHandler::OnTouchPinchZoom(_GalleryViewEventInfo& eventInfo) { if (__galleryPresenter.IsZoomingEnabled() == false) diff --git a/src/ui/inc/FUiCtrl_GalleryImageReader.h b/src/ui/inc/FUiCtrl_GalleryImageReader.h index e2d60e1..1238e4d 100644 --- a/src/ui/inc/FUiCtrl_GalleryImageReader.h +++ b/src/ui/inc/FUiCtrl_GalleryImageReader.h @@ -43,6 +43,7 @@ public: _GalleryBitmap* GetPartialImageFromFileN(int index, const Tizen::Graphics::FloatRectangle& partialBounds, const Tizen::Graphics::FloatDimension& imageSize) const; _GalleryBitmap* GetItemImage(int index) const; + void ResetLoadedPartialImageIndex(void); private: _GalleryImageReader(const _GalleryImageReader& rhs); diff --git a/src/ui/inc/FUiCtrl_GalleryViewEventHandler.h b/src/ui/inc/FUiCtrl_GalleryViewEventHandler.h index 6f41f6f..a02ab79 100644 --- a/src/ui/inc/FUiCtrl_GalleryViewEventHandler.h +++ b/src/ui/inc/FUiCtrl_GalleryViewEventHandler.h @@ -60,6 +60,7 @@ public: bool OnTouchPinchZoom(_GalleryViewEventInfo& eventInfo); bool OnTouchMoved(_GalleryViewEventInfo& eventInfo); bool OnTouchFlicked(_GalleryViewEventInfo& eventInfo); + bool ResetTouch(); //notiListener virtual void OnTransitionCancel(void); -- 2.7.4