From 43c73cdb253ce849ab39cb133ad488fbfd213f70 Mon Sep 17 00:00:00 2001 From: chitta ranjan Date: Tue, 2 Apr 2013 15:49:14 +0900 Subject: [PATCH] New look ImageViewerForm Change-Id: I800c14875d159deeaedfae56dd53a6179ff76ec2 Signed-off-by: chitta ranjan --- inc/IvImageViewerForm.h | 4 +- res/screen-size-normal/IDL_FORM_IMAGE_VIEWER.xml | 24 +++--- src/IvImageViewerForm.cpp | 100 +++++++++++++---------- 3 files changed, 70 insertions(+), 58 deletions(-) diff --git a/inc/IvImageViewerForm.h b/inc/IvImageViewerForm.h index d5f1557..a5b0fe9 100644 --- a/inc/IvImageViewerForm.h +++ b/inc/IvImageViewerForm.h @@ -149,7 +149,7 @@ private: result ShowPanelDetail(bool showStatus); result ChangeFooterItem(bool isChanged, Tizen::Ui::Controls::Footer* pFooter, int position); long long GetFileSize(Tizen::Base::String filePath); - void GetHeaderString(int index, Tizen::Base::String& fileName, Tizen::Base::String& page); + void GetLabelText(int index, Tizen::Base::String& page); void DownloadFile(void); void RotateImage(Tizen::Base::String& filePath, RotateMode rotateMode); void CallVideoPlayer(void); @@ -163,7 +163,7 @@ private: private: AppControlMode __initializeDisplayModeCurrent; - Tizen::Ui::Controls::Header* __pHeader; + Tizen::Ui::Controls::Label* __pLabel; Tizen::Ui::Controls::Footer* __pFooter; Tizen::Ui::Controls::ScrollPanel* __pScrollPanel; Tizen::Ui::Controls::Label* __pDetail_Label; diff --git a/res/screen-size-normal/IDL_FORM_IMAGE_VIEWER.xml b/res/screen-size-normal/IDL_FORM_IMAGE_VIEWER.xml index f3d7fdb..48aba59 100644 --- a/res/screen-size-normal/IDL_FORM_IMAGE_VIEWER.xml +++ b/res/screen-size-normal/IDL_FORM_IMAGE_VIEWER.xml @@ -3,25 +3,25 @@ This XML file was automatically generated by UiBuilder - do not modify by hand. --> - - + 720
- - - + + +
-
- - -
- - - + + + +
diff --git a/src/IvImageViewerForm.cpp b/src/IvImageViewerForm.cpp index a18643a..6283d5f 100644 --- a/src/IvImageViewerForm.cpp +++ b/src/IvImageViewerForm.cpp @@ -48,6 +48,7 @@ static const unsigned int COLOR_HEADER_BUTTON1 = Color32<0, 0, 0, 100>::Value; static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value; static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value; static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value; +static const unsigned int COLOR_GALLERY_BG = Color32<31,31,31>::Value; static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48); @@ -93,7 +94,7 @@ static const int DETAIL_COUNT_MAX = 9; ImageViewerForm::ImageViewerForm(void) : __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL) -, __pHeader(null) +, __pLabel(null) , __pFooter(null) , __pScrollPanel(null) , __pDetail_Label(null) @@ -128,6 +129,10 @@ result ImageViewerForm::Initialize() { AppLogDebug("ENTER"); + + + result r = Form::Construct(IDL_FORM_IMAGE_VIEWER); + __pPresentationModel = ImageViewerPresentationModel::GetInstance(); if (__pPresentationModel->GetFileCount() > 0) @@ -162,8 +167,6 @@ ImageViewerForm::Initialize() __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL; } - result r = Form::Construct(IDL_FORM_IMAGE_VIEWER); - if (filePath == EMPTY_SPACE) { MessageBox messageBox; @@ -185,9 +188,28 @@ result ImageViewerForm::OnInitializing(void) { AppLogDebug("ENTER"); + result r = E_SUCCESS; SetFormBackEventListener(this); __pPresentationModel->AddListener(this); + __pLabel = dynamic_cast(GetControl(L"IDC_LABEL_INFO")); + + if(__pLabel == null) + { + return E_FAILURE; + } + __pLabel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL); + SetControlAlwaysOnTop(*__pLabel,true); + + int allCount = __pPresentationModel->GetFileCount(); + int index = 1 ; + String displayText; + displayText.Append(index); + displayText.Append("/"); + displayText.Append(allCount); + + __pLabel->SetText(displayText); + CreateGallery(); InitializeDisplay(__initializeDisplayModeCurrent); InitializePanelDetail(); @@ -216,7 +238,7 @@ ImageViewerForm::OnInitializing(void) __pTimer->Construct(*this); __pTimer->Start(1); } - result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true); + AddOrientationEventListener(*this); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -248,7 +270,7 @@ ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus o Rectangle clientRect = GetClientAreaBounds(); Rectangle rect = GetBounds(); - __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height)); + __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height)); __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2, clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON)); @@ -260,20 +282,16 @@ void ImageViewerForm::InitializeDisplay(AppControlMode status) { AppLogDebug("ENTER"); - String strItemText; - String strItemIdxText; - __pHeader = GetHeader(); - __pHeader->AddActionEventListener(*this); + String strItemIdxText; __pFooter = GetFooter(); __pFooter->AddActionEventListener(*this); __pFooter->RemoveAllItems(); - GetHeaderString(0, strItemText, strItemIdxText); + GetLabelText(0, strItemIdxText); Rectangle rect = GetClientAreaBounds(); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + if (status == APPCONTROL_MODE_NORMAL) { @@ -418,12 +436,11 @@ ImageViewerForm::InitializeDisplay(AppControlMode status) } void -ImageViewerForm::GetHeaderString(int index, String &fileName, String &page) +ImageViewerForm::GetLabelText(int index, String &page) { AppLogDebug("ENTER"); int allCount = __pPresentationModel->GetFileCount(); String pStr = __pPresentationModel->GetFilePathAt(index); - fileName = __pPresentationModel->GetFileName(pStr); page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -485,9 +502,7 @@ ImageViewerForm::DeleteImageFile() filePath = __pPresentationModel->GetFilePathAt(currentIndex); __pPresentationModel->RequestImage(filePath); - GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText); if (__visible == true) { @@ -531,10 +546,11 @@ ImageViewerForm::CreateGallery(void) Rectangle rect = GetBounds(); __pGallery = new (std::nothrow) Gallery(); - __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height)); + __pGallery->Construct(Rectangle(0, clientRect.y, rect.width, rect.height)); __pGallery->SetName(L"GalleryControl"); __pGallery->SetItemProvider(*this); __pGallery->AddGalleryEventListener(*this); + __pGallery->SetBackgroundColor(COLOR_GALLERY_BG); AddControl(*__pGallery); __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING")); @@ -578,7 +594,7 @@ ImageViewerForm::InitializePanelDetail() } Rectangle clientRect = GetClientAreaBounds(); - result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height)); + result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height - __pLabel->GetHeight())); if (r != E_SUCCESS) { AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); @@ -840,7 +856,7 @@ ImageViewerForm::SetDetailInfo(void) AppLogDebug("ENTER"); Rectangle clientRect = GetClientAreaBounds(); - __pScrollPanel->SetBounds(0, 0, clientRect.width, clientRect.height); + __pScrollPanel->SetBounds(0,__pLabel->GetHeight(), clientRect.width, clientRect.height - __pLabel->GetHeight()); int currentIndex = __pGallery->GetCurrentItemIndex(); String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex); @@ -1100,11 +1116,9 @@ ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index) AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer()); __pPresentationModel->RequestImage(filePath); - String strItemText; String strItemIdxText; - GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText); + __pLabel->SetText(strItemIdxText); if (__visible == true) { @@ -1138,7 +1152,8 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index) __pPlayButton->SetShowState(false); } - SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false); + SetActionBarsVisible( FORM_ACTION_BAR_FOOTER, false); + __pLabel->SetShowState(false); __visible = false; } else @@ -1148,7 +1163,8 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index) __pPlayButton->SetShowState(true); } - SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true); + SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true); + __pLabel->SetShowState(true); __visible = true; __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1); @@ -1157,7 +1173,7 @@ ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index) Rectangle clientRect = GetClientAreaBounds(); Rectangle rect = GetBounds(); - __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height)); + __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height)); Invalidate(true); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -1169,7 +1185,8 @@ ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery) PowerManager::KeepScreenOnState(true, false); if (__visible == true) { - SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false); + SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false); + __pLabel->SetShowState(false); int index = __pGallery->GetCurrentItemIndex(); String filePath = __pPresentationModel->GetFilePathAt(index); @@ -1199,8 +1216,8 @@ ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery) if (__visible == false) { - SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true); - + SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true); + __pLabel->SetShowState(true); String filePath = __pPresentationModel->GetFilePathAt(index); ContentType contentType = ContentManagerUtil::CheckContentType(filePath); if (contentType == CONTENT_TYPE_VIDEO) @@ -1214,11 +1231,10 @@ ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery) __visible = true; } - String strItemText; String strItemIdxText; - GetHeaderString(index, strItemText, strItemIdxText); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + GetLabelText(index, strItemIdxText); + __pLabel->SetText(strItemIdxText); + Rectangle clientRect = GetClientAreaBounds(); Rectangle rect = GetBounds(); @@ -1560,18 +1576,16 @@ ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId, Rectangle clientRect = GetClientAreaBounds(); Rectangle rect = GetBounds(); - __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height)); - __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, clientRect.height)); + __pGallery->SetBounds(Rectangle(0, clientRect.y, rect.width, rect.height)); + __pScrollPanel->SetBounds(Rectangle(0, __pLabel->GetHeight(), clientRect.width, clientRect.height - __pLabel->GetHeight())); __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - 80, clientRect.height / 2 - 80, 160, 160)); if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER) { SetDetailInfo(); - String strItemText(EMPTY_SPACE); String strItemIdxText(EMPTY_SPACE); - GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + GetLabelText(__pGallery->GetCurrentItemIndex(), strItemIdxText); + __pLabel->SetText(strItemIdxText); Invalidate(true); } @@ -2026,7 +2040,6 @@ void ImageViewerForm::OnFormFileEventOccuered(const int index, const unsigned lo __pGallery->SetCurrentItemIndex(currentIndex); } - String strItemText(EMPTY_SPACE); String strItemIdxText(EMPTY_SPACE); __pGallery->UpdateGallery(); @@ -2034,9 +2047,8 @@ void ImageViewerForm::OnFormFileEventOccuered(const int index, const unsigned lo String filePath = __pPresentationModel->GetFilePathAt(currentIndex); __pPresentationModel->RequestImage(filePath); - GetHeaderString(currentIndex, strItemText, strItemIdxText); - __pHeader->SetTitleText(strItemText); - __pHeader->SetDescriptionText(strItemIdxText); + GetLabelText(currentIndex,strItemIdxText); + __pLabel->SetText(strItemIdxText); if (__visible == true) { -- 2.7.4