2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file IvImageViewerForm.cpp
19 * @brief This is the implementation file for ImageViewerForm class.
23 #include "IvCommonUtil.h"
24 #include "IvImageInfo.h"
25 #include "IvImageViewerApp.h"
26 #include "IvImageViewerForm.h"
27 #include "IvImageViewerPresentationModel.h"
28 #include "IvResourceManager.h"
29 #include "IvSettingPresentationModel.h"
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Base::Runtime;
36 using namespace Tizen::Base::Utility;
37 using namespace Tizen::Content;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Io;
40 using namespace Tizen::Media;
41 using namespace Tizen::System;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
46 static const unsigned int COLOR_HEADER_CONTORL_PANEL = Color32<0, 0, 0, 100>::Value;
47 static const unsigned int COLOR_HEADER_BUTTON1 = Color32<0, 0, 0, 100>::Value;
48 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
49 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
50 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
52 static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
54 static const int W_PLAY_BUTTON = 160;
55 static const int H_PLAY_BUTTON = 160;
57 static const int GAP_W_POPUP_ITEM = 5;
58 static const int W_DELETE_POPUP = 600;
59 static const int H_DELETE_POPUP = 300;
60 static const int H_DELETE_LABEL = 180;
61 static const int Y_DELETE_BUTTON = 180;
62 static const int H_DELETE_BUTTON = 80;
64 static const Dimension DUMMY_IMAGE_DIMENSION (720, 1280);
65 static const Rectangle DUMMY_IMAGE_RECTANGLE (0, 0, 720, 1280);
67 static const int PAGE_NO_CONTENT_SEARCH = 1;
68 static const int COUNT_PER_PAGE_CONTENT_SEARCH = 10;
70 static const int FORMAT_BUFFER_SIZE = 256;
72 static const long long SINGLE_GIGA_BYTE = (1024 * 1024 * 1024);
73 static const long long SINGLE_MEGA_BYTE = (1024 * 1024);
74 static const long long SINGLE_KILO_BYTE = 1024;
76 static const int Y_RENAME_BUTTON = 100;
77 static const int H_RENAME_BUTTON = 64;
78 static const int W_RENAME_BUTTON = 64;
80 static const int GAP_W_END_OF_LABEL = 60;
81 static const int X_DETAIL_FILEINFO_LABEL = 20;
82 static const int H_DETAIL_FILEINFO_LABEL = 50;
83 static const int H_DETAIL_MAIN_TEXT = 48;
84 static const int H_DETAIL_SUB_TEXT = 42;
85 static const int GAP_H_DETAIL_TEXT = 26;
86 static const int H_DETAIL_FILEINFO_VALUE_LABEL = 56;
88 static const int X_MORE = 55;
90 static const int DETAIL_SUB_FONT_SIZE = 32;
91 static const int DETAIL_MAIN_FONT_SIZE = 36;
92 static const int DETAIL_COUNT_MAX = 9;
94 ImageViewerForm::ImageViewerForm(void)
95 : __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
98 , __pScrollPanel(null)
99 , __pDetail_Label(null)
100 , __pLabelMessage(null)
101 , __pPlayButton(null)
102 , __pRenameButton(null)
103 , __pDetailFooterItem(null)
106 , __pContextMenuMore(null)
107 , __pContextMenuCopy(null)
108 , __pContextMenuSetAs(null)
109 , __pContextMenuShare(null)
110 , __pDeletePopup(null)
113 , __startSlide(false)
115 , __pPresentationModel(null)
117 AppLogDebug("ENTER");
118 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
121 ImageViewerForm::~ImageViewerForm(void)
123 AppLogDebug("ENTER");
124 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
128 ImageViewerForm::Initialize()
130 AppLogDebug("ENTER");
131 __pPresentationModel = ImageViewerPresentationModel::GetInstance();
133 if (__pPresentationModel->GetFileCount() > 0)
135 if (__pPresentationModel->GetType() == APPCONTROL_DATA_SLIDE_SHOW)
141 __pSettingPresentationModel = SettingPresentationModel::GetInstance();
143 int startIndex = __pPresentationModel->GetStartIndex();
144 String filePath = __pPresentationModel->GetFilePathAt(startIndex);
146 if (filePath.StartsWith(WEB_URL_HTTP, 0) == true)
148 __initializeDisplayModeCurrent = APPCONTROL_MODE_WEB_LINK;
150 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_MESSAGE)
152 __initializeDisplayModeCurrent = APPCONTROL_MODE_MESSAGE;
154 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_EMAIL)
156 __initializeDisplayModeCurrent = APPCONTROL_MODE_EMAIL;
160 __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
163 result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
165 if (filePath == EMPTY_SPACE)
167 MessageBox messageBox;
168 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_IV_POP_INVALID_IMAGE_FILE"), MSGBOX_STYLE_NONE,
171 messageBox.ShowAndWait(modalResult);
173 UiApp* pApp = UiApp::GetInstance();
177 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
183 ImageViewerForm::OnInitializing(void)
185 AppLogDebug("ENTER");
186 SetFormBackEventListener(this);
187 __pPresentationModel->AddListener(this);
190 InitializeDisplay(__initializeDisplayModeCurrent);
191 InitializePanelDetail();
194 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
195 || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
196 || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
198 int index = __pPresentationModel->GetStartIndex();
199 __pGallery->UpdateGallery();
200 __pGallery->SetCurrentItemIndex(index);
203 String filePath = __pPresentationModel->GetFilePathAt(index);
204 __pPresentationModel->RequestImage(filePath);
206 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
213 __pTimer = new (std::nothrow) Timer();
214 __pTimer->Construct(*this);
217 result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
218 AddOrientationEventListener(*this);
219 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
225 ImageViewerForm::OnInitialized(void)
227 AppLogDebug("ENTER");
228 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
234 ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
236 AppLogDebug("ENTER");
237 if (__detail == false)
239 ShowPanelDetail(true);
243 ShowPanelDetail(false);
246 Rectangle clientRect = GetClientAreaBounds();
247 Rectangle rect = GetBounds();
249 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
250 __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
251 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
254 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
258 ImageViewerForm::InitializeDisplay(AppControlMode status)
260 AppLogDebug("ENTER");
262 String strItemIdxText;
264 __pHeader = GetHeader();
265 __pHeader->AddActionEventListener(*this);
267 __pFooter = GetFooter();
268 __pFooter->AddActionEventListener(*this);
269 __pFooter->RemoveAllItems();
271 GetHeaderString(0, strItemText, strItemIdxText);
272 Rectangle rect = GetClientAreaBounds();
273 __pHeader->SetTitleText(strItemText);
274 __pHeader->SetDescriptionText(strItemIdxText);
276 if (status == APPCONTROL_MODE_NORMAL)
278 __pPlayButton = new (std::nothrow) Button();
279 if (__pPlayButton != null)
281 Rectangle clientRect = GetClientAreaBounds();
283 __pPlayButton->Construct(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
284 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
285 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
286 AddControl(*__pPlayButton);
288 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
289 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
290 delete pNormalBackgroundBitmap;
292 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
293 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
294 delete pPressedBackgroundBitmap;
296 __pPlayButton->AddActionEventListener(*this);
297 __pPlayButton->SetShowState(false);
300 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
301 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
302 __pFooter->SetBackButton();
304 FooterItem footerItem1;
305 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
306 Bitmap* pFooterItemShareNomal =
307 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
308 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
310 FooterItem footerItem2;
311 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DELETE);
312 Bitmap* pFooterItemDeleteNomal =
313 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_DELETE_NORMAL);
314 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDeleteNomal);
316 __pFooter->AddItem(footerItem1);
317 __pFooter->AddItem(footerItem2);
319 delete pFooterItemShareNomal;
320 delete pFooterItemDeleteNomal;
322 ButtonItem buttonItemMore;
323 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
324 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
325 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
326 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
327 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
328 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
330 else if (status == APPCONTROL_MODE_WEB_LINK)
332 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
333 __pFooter->SetBackButton();
335 FooterItem footerItem1;
336 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
337 Bitmap* pFooterItemShareNomal =
338 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
339 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
341 FooterItem footerItem2;
342 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DOWNLOAD);
343 Bitmap* pFooterItemDownlordNomal = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DOWNLOAD);
344 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDownlordNomal);
346 __pFooter->AddItem(footerItem1);
347 __pFooter->AddItem(footerItem2);
349 delete pFooterItemShareNomal;
350 delete pFooterItemDownlordNomal;
352 ButtonItem buttonItemMore;
353 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
354 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
355 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
356 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
357 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
358 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
360 __pFooter->AddItem(footerItem1);
361 __pFooter->AddItem(footerItem2);
363 else if (status == APPCONTROL_MODE_CROP)
365 FooterItem footerItem1;
366 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SAVE);
367 Bitmap* pfooterItem1 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_SAVE);
368 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem1);
370 FooterItem footerItem2;
371 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_BACK);
372 Bitmap* pfooterItem2 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_X);
373 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem2);
375 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
376 __pFooter->AddItem(footerItem1);
377 __pFooter->AddItem(footerItem2);
382 else if (status == APPCONTROL_MODE_MESSAGE || status == APPCONTROL_MODE_EMAIL)
384 __pPlayButton = new (std::nothrow) Button();
385 if (__pPlayButton != null)
387 Rectangle clientRect = GetClientAreaBounds();
389 __pPlayButton->Construct(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
390 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
391 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
392 AddControl(*__pPlayButton);
394 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
395 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
396 delete pNormalBackgroundBitmap;
398 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
399 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
400 delete pPressedBackgroundBitmap;
402 __pPlayButton->AddActionEventListener(*this);
403 __pPlayButton->SetShowState(false);
406 __pFooter->SetBackButton();
409 String filePath = __pPresentationModel->GetFilePathAt(0);
410 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
411 if (contentType == CONTENT_TYPE_VIDEO)
413 __pPlayButton->SetShowState(true);
415 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
419 ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
421 AppLogDebug("ENTER");
422 int allCount = __pPresentationModel->GetFileCount();
423 String pStr = __pPresentationModel->GetFilePathAt(index);
424 fileName = __pPresentationModel->GetFileName(pStr);
425 page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
426 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
430 ImageViewerForm::DeleteImageFile()
432 AppLogDebug("ENTER");
433 int currentIndex = __pGallery->GetCurrentItemIndex();
435 String strItemText(EMPTY_SPACE);
436 String strItemIdxText(EMPTY_SPACE);
437 int countPath = __pPresentationModel->GetFileCount();
438 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
439 result r = E_SUCCESS;
440 if (filePath.GetLength() == 0)
442 UiApp* pApp = UiApp::GetInstance();
444 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
449 if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
450 || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
452 ContentId contentId = __pPresentationModel->GetFileContentId(filePath);
453 ContentManager contentManager;
454 contentManager.Construct();
455 r = contentManager.DeleteContent(contentId);
458 r = File::Remove(filePath);
461 MessageBox messageBox;
462 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_FAILED"),
463 MSGBOX_STYLE_NONE, 3000);
465 messageBox.ShowAndWait(modalResult);
466 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
474 r = File::Remove(filePath);
477 __pPresentationModel->DeleteFilePathAt(currentIndex);
480 UiApp* pApp = UiApp::GetInstance();
482 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
486 else if ((countPath - 1) == currentIndex)
488 __pGallery->SetCurrentItemIndex(--currentIndex);
491 __pGallery->UpdateGallery();
492 filePath = __pPresentationModel->GetFilePathAt(currentIndex);
493 __pPresentationModel->RequestImage(filePath);
495 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
496 __pHeader->SetTitleText(strItemText);
497 __pHeader->SetDescriptionText(strItemIdxText);
499 if (__visible == true)
501 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
503 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
505 __pPlayButton->SetShowState(false);
509 __pPlayButton->SetShowState(true);
513 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
519 ImageViewerForm::CallVideoPlayer(void)
521 AppLogDebug("ENTER");
522 int index = __pGallery->GetCurrentItemIndex();
523 String filePath = __pPresentationModel->GetFilePathAt(index);
525 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
526 pDataList->Construct();
527 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
528 new (std::nothrow) String(APPCONTROL_DATA_VIDEO));
529 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(filePath));
531 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER,
532 APPCONTROL_OPERATION_ID_PLAY, pDataList, this);
533 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
537 ImageViewerForm::CreateGallery(void)
539 AppLogDebug("ENTER");
540 Rectangle clientRect = GetClientAreaBounds();
541 Rectangle rect = GetBounds();
543 __pGallery = new (std::nothrow) Gallery();
544 __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
545 __pGallery->SetName(L"GalleryControl");
546 __pGallery->SetItemProvider(*this);
547 __pGallery->AddGalleryEventListener(*this);
548 AddControl(*__pGallery);
549 __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
551 SlideShowTransitionEffect effect = __pPresentationModel->GetTransitionEffectOfSlideShow();
555 case SLIDE_SHOW_TRANSITION_EFFECT_DISSOLVE:
556 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_DISSOLVE);
558 case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
559 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
561 case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
565 __pGallery->SetSlideShowViewDuration(__pPresentationModel->GetDurationOfSlideShow());
567 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
571 ImageViewerForm::InitializePanelDetail()
573 AppLogDebug("ENTER");
574 __pScrollPanel = new (std::nothrow) ScrollPanel();
576 String arrayId[DETAIL_COUNT_MAX] =
578 L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
579 L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
580 L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
583 if (__pScrollPanel == null)
585 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
587 return E_INVALID_STATE;
590 Rectangle clientRect = GetClientAreaBounds();
591 result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height));
594 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
596 return E_INVALID_STATE;
599 __pDetail_Label = new (std::nothrow) Label();
600 __pDetail_Label->Construct(RECT_DETAILS_CONTORL_LABEL, ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"));
601 __pScrollPanel->AddControl(*__pDetail_Label);
602 __pDetail_Label->SetTextVerticalAlignment(ALIGNMENT_TOP);
603 __pDetail_Label->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
604 __pDetail_Label->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
605 __pDetail_Label->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
607 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
609 __pDetail_FileInfo_Label[i] = new (std::nothrow) Label();
610 __pDetail_FileInfo_Label[i]->Construct(
611 Rectangle(X_DETAIL_FILEINFO_LABEL,
612 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT + H_DETAIL_SUB_TEXT) * i,
613 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_LABEL), ResourceManager::GetString(arrayId[i]));
614 __pScrollPanel->AddControl(*__pDetail_FileInfo_Label[i]);
616 __pDetail_FileInfo_Label[i]->SetTextVerticalAlignment(ALIGNMENT_TOP);
617 __pDetail_FileInfo_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
618 __pDetail_FileInfo_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_GREY));
619 __pDetail_FileInfo_Label[i]->SetTextConfig(DETAIL_SUB_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
621 __pDetail_FileInfo_Value_Label[i] = new (std::nothrow) Label();
623 if (i == DETAIL_COUNT_MAX - 1)
625 __pDetail_FileInfo_Value_Label[i]->Construct(
626 Rectangle(X_DETAIL_FILEINFO_LABEL,
627 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
628 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL * 3), L"");
632 __pDetail_FileInfo_Value_Label[i]->Construct(
633 Rectangle(X_DETAIL_FILEINFO_LABEL,
634 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
635 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL), L"");
638 __pScrollPanel->AddControl(*__pDetail_FileInfo_Value_Label[i]);
640 __pDetail_FileInfo_Value_Label[i]->SetTextVerticalAlignment(ALIGNMENT_TOP);
641 __pDetail_FileInfo_Value_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
642 __pDetail_FileInfo_Value_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
643 __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
646 __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
647 __pScrollPanel->SetShowState(false);
649 AddControl(*__pScrollPanel);
650 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
656 ImageViewerForm::InitializePopup(void)
658 AppLogDebug("ENTER");
659 if (__pDeletePopup == null)
661 __pDeletePopup = new (std::nothrow) Popup();
662 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
664 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
666 Label* pLabel = new (std::nothrow) Label();
667 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
668 ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
670 Button* pDeleteButton = new (std::nothrow) Button();
671 pDeleteButton->Construct(
672 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
673 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
674 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
675 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
676 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
677 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
678 pDeleteButton->AddActionEventListener(*this);
680 Button* pCancelButton = new (std::nothrow) Button();
681 pCancelButton->Construct(
682 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM,
683 Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
684 ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
685 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
686 pCancelButton->AddActionEventListener(*this);
688 __pDeletePopup->AddControl(*pLabel);
689 __pDeletePopup->AddControl(*pDeleteButton);
690 __pDeletePopup->AddControl(*pCancelButton);
694 __pDeletePopup->SetShowState(true);
695 __pDeletePopup->Show();
697 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
703 ImageViewerForm::InitializeContextMenuMore(void)
705 AppLogDebug("ENTER");
706 int currentIndex = __pGallery->GetCurrentItemIndex();
707 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
709 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
711 if (__pContextMenuMore != null)
713 delete __pContextMenuMore;
714 __pContextMenuMore = null;
717 __pContextMenuMore = new (std::nothrow) ContextMenu();
719 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
720 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
722 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
724 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SET_AS"),
725 ACTION_ID_CONTEXTMENU_SET_AS);
726 __pContextMenuMore->AddItem("Crop", ACTION_ID_FOOTER_BUTTON_CROP);
729 if (__pGallery->GetItemCount() > 1)
731 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SLIDE_SHOW"),
732 ACTION_ID_FOOTER_BUTTON_SLIDE);
734 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"),
735 ACTION_ID_FOOTER_BUTTON_DETAILS);
736 __pContextMenuMore->SetShowState(false);
737 __pContextMenuMore->AddActionEventListener(*this);
738 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
744 ImageViewerForm::InitializeContextMenuSetAs(void)
746 AppLogDebug("ENTER");
748 if (__pContextMenuSetAs != null)
750 delete __pContextMenuSetAs;
751 __pContextMenuSetAs = null;
754 __pContextMenuSetAs = new (std::nothrow) ContextMenu();
755 __pContextMenuSetAs->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
756 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
758 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_HOME_SCREEN_WALLPAPER_ABB"),
759 ACTION_ID_CONTEXTMENU_HOME);
760 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
761 ACTION_ID_CONTEXTMENU_LOCK);
762 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
763 ACTION_ID_CONTEXTMENU_CALLER);
764 __pContextMenuSetAs->AddActionEventListener(*this);
765 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
771 ImageViewerForm::InitializeContextMenuShare(void)
773 AppLogDebug("ENTER");
774 if (__pContextMenuShare != null)
776 delete __pContextMenuShare;
777 __pContextMenuShare = null;
779 __pContextMenuShare = new (std::nothrow) ContextMenu();
780 __pContextMenuShare->Construct(Point((GetClientAreaBounds().width - (X_MORE * 4)) / 4 + X_MORE * 2,
781 GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST,
782 CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
784 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
785 ACTION_ID_CONTEXTMENU_MESSAGE);
786 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXTMENU_EMAIL);
787 __pContextMenuShare->AddActionEventListener(*this);
788 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
794 ImageViewerForm::GetFileSize(String filePath)
796 AppLogDebug("ENTER");
800 result r = File::GetAttributes(filePath, attr);
803 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
807 size = attr.GetFileSize();
808 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
814 ImageViewerForm::SetDetailInfo(void)
816 AppLogDebug("ENTER");
818 Rectangle clientRect = GetClientAreaBounds();
819 __pScrollPanel->SetBounds(0, 0, clientRect.width, clientRect.height);
821 int currentIndex = __pGallery->GetCurrentItemIndex();
822 String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
824 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(strFilePath);
826 String strResult[DETAIL_COUNT_MAX] = {EMPTY_SPACE, };
828 strResult[0] = __pPresentationModel->GetFileName(strFilePath);
829 strResult[1] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
832 result r = File::GetAttributes(strFilePath, attr);
835 long long nSize = attr.GetFileSize();
836 DateTime dateTime = attr.GetDateTime();
837 strResult[2] = dateTime.ToString();
839 if (nSize > SINGLE_GIGA_BYTE)
841 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_GIGA_BYTE);
842 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_GB"));
844 else if (nSize > SINGLE_MEGA_BYTE)
846 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_MEGA_BYTE);
847 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_MB"));
849 else if (nSize > SINGLE_KILO_BYTE)
851 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_KILO_BYTE);
852 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_KB"));
856 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize);
857 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_B"));
862 strResult[2] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
863 strResult[3] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
866 strResult[4] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
867 strResult[5] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
868 strResult[6] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
869 strResult[7] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
870 strResult[8] = strFilePath;
871 String fileName = File::GetFileName(strFilePath);
872 strResult[8].Remove(strResult[8].GetLength() - fileName.GetLength(), fileName.GetLength());
874 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
876 strResult[0] = __downLordFileName;
878 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
880 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(strFilePath);
882 if (pImgMeta != null)
884 ImageContentInfo imageContentInfo;
885 r = imageContentInfo.Construct(&strFilePath);
888 strResult[1] = imageContentInfo.GetMediaFormat();
889 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pImgMeta->GetWidth(),
890 pImgMeta->GetHeight());
892 if (imageContentInfo.GetLocationTag() != EMPTY_SPACE)
894 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", imageContentInfo.GetLocationTag().GetPointer());
897 if (pImgMeta->GetLatitude() > 1.0 && pImgMeta->GetLongitude() > 1.0)
899 strResult[6].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLatitude());
900 strResult[7].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLongitude());
906 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
908 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(strFilePath);
909 if (pVideoMeta != null)
911 VideoContentInfo videoContentInfo;
912 r = videoContentInfo.Construct(&strFilePath);
915 strResult[1] = videoContentInfo.GetMediaFormat();
916 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pVideoMeta->GetWidth(),
917 pVideoMeta->GetHeight());
918 if (videoContentInfo.GetLocationTag() != EMPTY_SPACE)
920 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", videoContentInfo.GetLocationTag().GetPointer());
926 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
928 __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
929 __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
932 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
934 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
938 if (__pRenameButton == null)
940 __pRenameButton = new (std::nothrow) Button();
941 Rectangle rect = GetBounds();
942 __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
943 __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
945 Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
946 Bitmap* pIconBackground =
947 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
948 Bitmap* pIconPressed =
949 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
951 if (pIcon != null && pIconPressed != null && pIconBackground != null)
953 __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
954 __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
955 Point iconPosition(0, 0);
956 __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
957 __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
961 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
962 __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
966 delete pIconBackground;
968 __pScrollPanel->AddControl(*__pRenameButton);
969 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
970 __pRenameButton->AddActionEventListener(*this);
974 Rectangle rect = GetBounds();
975 __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
977 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
983 ImageViewerForm::ShowPanelDetail(bool showStatus)
985 AppLogDebug("ENTER");
989 __pScrollPanel->SetShowState(true);
994 __pScrollPanel->SetShowState(false);
997 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1003 ImageViewerForm::ChangeFooterItem(bool isChanged, Footer* pFooter, int position)
1005 AppLogDebug("ENTER");
1006 FooterItem footerItem;
1007 footerItem.Construct(ACTION_ID_FOOTER_BUTTON_DETAILS);
1008 Bitmap* pfooterItem = null;
1012 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS_CLOSE);
1013 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1017 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS);
1018 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1021 pFooter->SetItemAt(position, footerItem);
1022 pFooter->Invalidate(true);
1025 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1031 ImageViewerForm::DownloadFile(void)
1033 AppLogDebug("ENTER");
1034 String DestPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1035 if (File::IsFileExist(DestPath) == false)
1037 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1041 ContentId contentId;
1042 ContentManager contentManager;
1043 contentManager.Construct();
1045 ImageContentInfo imageContentInfo;
1046 imageContentInfo.Construct(null);
1048 imageContentInfo.SetKeyword(L"platform, tizen");
1049 String sourcePath = DestPath;
1050 String destPath = Environment::GetMediaPath();
1051 destPath.Append(FOLDER_PATH_DOWNLOADS);
1052 destPath.Append(__downLordFileName);
1054 contentId = contentManager.CreateContent(sourcePath, destPath, true, &imageContentInfo);
1055 ImageViewerForm::OnFormBackRequested(*this);
1056 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1060 ImageViewerForm::GetItemCount(void)
1062 AppLogDebug("ENTER");
1063 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1065 return __pPresentationModel->GetFileCount();
1069 ImageViewerForm::CreateItem(int index)
1071 AppLogDebug("ENTER : index(%d)", index);
1072 GalleryItem* pGallery = new (std::nothrow) GalleryItem();
1074 String filePath = __pPresentationModel->GetFilePathAt(index);
1075 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1076 Bitmap* pBitmap = pImageInfo->GetBitmapN();
1077 if (pBitmap == null)
1079 pBitmap = GetQuickThumbnailN(filePath);
1081 if (pBitmap == null)
1083 pBitmap = new (std::nothrow) Bitmap();
1084 pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1087 pGallery->Construct(*pBitmap, filePath);
1089 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1095 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
1097 AppLogDebug("ENTER index(%d)", index);
1098 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1099 pImageInfo->ClearBitmap();
1101 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1107 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
1109 AppLogDebug("ENTER index(%d)", index);
1111 String filePath = __pPresentationModel->GetFilePathAt(index);
1112 AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
1113 __pPresentationModel->RequestImage(filePath);
1116 String strItemIdxText;
1117 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1118 __pHeader->SetTitleText(strItemText);
1119 __pHeader->SetDescriptionText(strItemIdxText);
1121 if (__visible == true)
1123 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1124 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1126 __pPlayButton->SetShowState(true);
1130 __pPlayButton->SetShowState(false);
1135 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1139 ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
1141 AppLogDebug("ENTER");
1143 String filePath = __pPresentationModel->GetFilePathAt(index);
1144 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1146 if (__visible == true)
1148 if (contentType == CONTENT_TYPE_VIDEO)
1150 __pPlayButton->SetShowState(false);
1153 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1158 if (contentType == CONTENT_TYPE_VIDEO)
1160 __pPlayButton->SetShowState(true);
1163 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1166 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1167 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1170 Rectangle clientRect = GetClientAreaBounds();
1171 Rectangle rect = GetBounds();
1172 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1174 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1178 ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
1180 AppLogDebug("ENTER");
1181 PowerManager::KeepScreenOnState(true, false);
1182 if (__visible == true)
1184 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1186 int index = __pGallery->GetCurrentItemIndex();
1187 String filePath = __pPresentationModel->GetFilePathAt(index);
1188 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1190 if (contentType == CONTENT_TYPE_VIDEO)
1192 __pPlayButton->SetShowState(false);
1198 Rectangle clientRect = GetClientAreaBounds();
1199 Rectangle rect = GetBounds();
1200 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1202 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1206 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
1208 AppLogDebug("ENTER");
1209 PowerManager::KeepScreenOnState(false, true);
1210 int index = __pGallery->GetCurrentItemIndex();
1212 if (__visible == false)
1214 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1216 String filePath = __pPresentationModel->GetFilePathAt(index);
1217 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1218 if (contentType == CONTENT_TYPE_VIDEO)
1220 __pPlayButton->SetShowState(true);
1223 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1224 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1230 String strItemIdxText;
1231 GetHeaderString(index, strItemText, strItemIdxText);
1232 __pHeader->SetTitleText(strItemText);
1233 __pHeader->SetDescriptionText(strItemIdxText);
1235 Rectangle clientRect = GetClientAreaBounds();
1236 Rectangle rect = GetBounds();
1237 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1240 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1244 ImageViewerForm::OnUpdateContentList(void)
1249 ImageViewerForm::OnTerminating(void)
1251 AppLogDebug("ENTER");
1253 if (__pTimer != null)
1260 __pPresentationModel->ClearImageRequests();
1261 __pPresentationModel->RemoveListener(*this);
1263 if (__pContextMenuCopy != null)
1265 delete __pContextMenuCopy;
1266 __pContextMenuCopy = null;
1269 if (__pContextMenuSetAs != null)
1271 delete __pContextMenuSetAs;
1272 __pContextMenuSetAs = null;
1275 if (__pDeletePopup != null)
1277 delete __pDeletePopup;
1278 __pDeletePopup = null;
1281 if (__pContextMenuShare != null)
1283 delete __pContextMenuShare;
1284 __pContextMenuShare = null;
1287 if (__pContextMenuMore != null)
1289 delete __pContextMenuMore;
1290 __pContextMenuMore = null;
1293 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1299 ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
1301 AppLogDebug("ENTER actionId(%d)", actionId);
1302 SceneManager* pSceneManager = SceneManager::GetInstance();
1307 case ACTION_ID_FOOTER_MORE:
1309 InitializeContextMenuMore();
1311 __pContextMenuMore->SetShowState(true);
1312 __pContextMenuMore->Show();
1315 case ACTION_ID_CONTEXTMENU_SET_AS:
1316 InitializeContextMenuSetAs();
1318 __pContextMenuSetAs->SetShowState(true);
1319 __pContextMenuSetAs->Show();
1321 case ACTION_ID_FOOTER_BUTTON_SHARE:
1322 InitializeContextMenuShare();
1324 __pContextMenuShare->SetShowState(true);
1325 __pContextMenuShare->Show();
1327 case ACTION_ID_FOOTER_BUTTON_DELETE:
1328 __pDeletePopup->SetShowState(true);
1329 __pDeletePopup->Show();
1331 case ACTION_ID_FOOTER_BUTTON_SLIDE:
1333 int repeatValue = 0;
1335 if (__pPresentationModel->GetFileCount() > 1)
1337 __pGallery->UpdateGallery();
1338 if (__detail == false)
1340 ShowPanelDetail(false);
1343 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1344 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1346 if (repeatValue == 0)
1348 __pGallery->StartSlideShow(false);
1352 __pGallery->StartSlideShow(true);
1357 case ACTION_ID_FOOTER_BUTTON_CROP:
1360 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1361 filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex());
1362 pList->Add(new (std::nothrow) String(filePath));
1363 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList);
1366 case ACTION_ID_FOOTER_BUTTON_DETAILS:
1368 ShowPanelDetail(__detail);
1371 case ACTION_ID_FOOTER_BUTTON_BACK:
1372 ImageViewerForm::OnFormBackRequested(*this);
1374 case ACTION_ID_FOOTER_BUTTON_DOWNLOAD:
1377 case ACTION_ID_FOOTER_BUTTON_SAVE:
1379 case ACTION_ID_PANEL_HEADER_DETAILS_RENAME:
1381 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
1382 pSelectedIndex->Construct();
1383 pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1384 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex);
1387 case ACTION_ID_CONTEXTMENU_HOME:
1389 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1390 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1391 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
1392 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1393 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1396 case ACTION_ID_CONTEXTMENU_LOCK:
1398 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1399 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1400 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
1401 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1402 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1405 case ACTION_ID_CONTEXTMENU_CALLER:
1407 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1408 pDataList->Construct();
1409 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE),
1410 new (std::nothrow) String(APPCONTROL_DATA_SINGLE));
1411 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_RETURN_TYPE),
1412 new (std::nothrow) String(APPCONTROL_DATA_CONTACT_ID));
1414 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
1415 APPCONTROL_OPERATION_ID_PICK, pDataList, this);
1418 case ACTION_ID_CONTEXTMENU_EMAIL:
1420 OnRequestEmailAction();
1423 case ACTION_ID_CONTEXTMENU_MESSAGE:
1425 OnRequestMessagesAction();
1428 case ACTION_ID_CONTEXTMENU_COPY:
1430 int currentIndex = __pGallery->GetCurrentItemIndex();
1431 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1434 item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath);
1435 Clipboard* pClipboard = Clipboard::GetInstance();
1436 pClipboard->CopyItem(item);
1439 case ACTION_ID_DELETE_POPUP_DEL:
1441 __pDeletePopup->SetShowState(false);
1442 __pDeletePopup->Show();
1445 if (__detail == false)
1447 ShowPanelDetail(false);
1451 case ACTION_ID_DELETE_POPUP_CANCEL:
1453 __pDeletePopup->SetShowState(false);
1454 __pDeletePopup->Show();
1457 case ACTION_ID_CONTORL_BUTTON_PLAY:
1463 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1467 ImageViewerForm::OnFormBackRequested(Form& source)
1469 AppLogDebug("ENTER");
1470 if (__detail == false)
1472 ShowPanelDetail(false);
1476 UiApp* pApp = UiApp::GetInstance();
1479 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1483 ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
1484 const SceneId& currentSceneId, IList* pArgs)
1486 AppLogDebug("ENTER");
1488 Rectangle clientRect = GetClientAreaBounds();
1489 Rectangle rect = GetBounds();
1491 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1492 __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, clientRect.height));
1493 __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - 80, clientRect.height / 2 - 80, 160, 160));
1495 if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
1498 String strItemText(EMPTY_SPACE);
1499 String strItemIdxText(EMPTY_SPACE);
1500 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1501 __pHeader->SetTitleText(strItemText);
1502 __pHeader->SetDescriptionText(strItemIdxText);
1506 if (__pGallery->GetCurrentItemIndex() < 0)
1508 SetFooterItemState(false);
1512 SetFooterItemState(true);
1515 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1519 ImageViewerForm::OnSceneDeactivated(const SceneId& currentSceneId,
1520 const SceneId& nextSceneId)
1522 AppLogDebug("ENTER");
1523 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1527 ImageViewerForm::OnImageDecodedN(const int index)
1529 AppLogDebug("ENTER");
1530 __pGallery->RefreshGallery(index, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1532 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1536 ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
1537 const String& operationId, AppCtrlResult appControlResult,
1538 const IMap* pExtraData)
1540 AppLogDebug("ENTER");
1542 if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
1543 && operationId == APPCONTROL_OPERATION_ID_PICK
1544 && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1546 const String* pReturnType =
1547 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_RETURN_TYPE)));
1548 if (pReturnType != null && pReturnType->CompareTo(APPCONTROL_DATA_CONTACT_ID) == 0)
1550 const String* pContactId =
1551 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_VALUE)));
1552 SceneManager* pSceneManager = SceneManager::GetInstance();
1553 long long lresult = 0;
1554 if (pContactId != null && pContactId->GetLength() > 0)
1556 LongLong::Parse(*pContactId, lresult);
1558 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1559 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1560 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
1561 pList->Add(new (std::nothrow) LongLong(lresult));
1562 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1563 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1567 ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
1568 pImageViewerApp->SetFrameEnabled(true);
1569 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1573 ImageViewerForm::OnOverlayControlCreated(const Control& source)
1575 AppLogDebug("ENTER");
1576 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1580 ImageViewerForm::OnOverlayControlOpened(const Control& source)
1582 AppLogDebug("ENTER");
1583 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1587 ImageViewerForm::OnOverlayControlClosed(const Control& source)
1589 AppLogDebug("ENTER");
1590 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1594 ImageViewerForm::OnOtherControlSelected(const Control& source)
1596 AppLogDebug("ENTER");
1597 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1601 ImageViewerForm::InitShowGallery(void)
1603 AppLogDebug("ENTER");
1604 if (__pGallery != null && __pGallery->IsVisible() == false)
1606 Canvas* pCanvas = GetCanvasN();
1607 if (pCanvas == null || GetLastResult() != E_SUCCESS)
1609 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1615 __pGallery->SetShowState(true);
1618 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1622 ImageViewerForm::OnTimerExpired(Timer &timer)
1624 int repeatValue = 0;
1625 AppLogDebug("ENTER");
1626 if (__pPresentationModel->GetFileCount() > 1)
1628 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1629 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1631 if (repeatValue == 0)
1633 __pGallery->StartSlideShow(false);
1637 __pGallery->StartSlideShow(true);
1640 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1644 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
1646 AppLogDebug("ENTER");
1647 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1651 ImageViewerForm::OnContentUploadCompleted(RequestId requestId, result transferResult, const String& errorCode,
1652 const String& errorMessage)
1654 AppLogDebug("ENTER");
1655 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1659 ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId contentId,
1660 result transferResult, const String& errorCode, const String& errorMessage)
1662 AppLogDebug("ENTER");
1663 AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted");
1664 AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult));
1665 AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer());
1666 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1670 ImageViewerForm::OnContentDownloadToBufferCompleted(RequestId reqId, ByteBuffer* pBuffer, result r,
1671 const String& errorCode, const String& errorMessage)
1673 AppLogDebug("ENTER");
1674 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1678 ImageViewerForm::OnContentTransferCanceled(RequestId reqId, result res, const String& errorCode,
1679 const String& errorMessage)
1681 AppLogDebug("ENTER");
1682 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1686 ImageViewerForm::RequestDecodeUrl(void)
1688 AppLogDebug("ENTER");
1690 String filePath = __pPresentationModel->GetFilePathAt(0);
1692 if (filePath.StartsWith(WEB_URL_HTTP, 0) == false)
1694 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1699 __downLordFileName = __pPresentationModel->GetFileName(filePath);
1701 Image* pImage = new (std::nothrow) Image();
1702 pImage->Construct();
1705 uri.SetUri(filePath);
1707 pImage->DecodeUrl(uri, BITMAP_PIXEL_FORMAT_RGB565, 720, 1280, reqId, *this, 5000);
1710 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1714 ImageViewerForm::OnImageDecodeUrlReceived (RequestId reqId, Bitmap *pBitmap,
1715 result r, const String errorCode, const String errorMessage)
1717 AppLogDebug("ENTER");
1718 Image* pImage = new (std::nothrow) Image();
1719 pImage->Construct();
1721 String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1722 r = pImage->EncodeToFile(*pBitmap, IMG_FORMAT_JPG, destPath, true);
1726 __pPresentationModel->GetImageCacheAt(0)->SetFilePath(destPath);
1727 __pPresentationModel->GetImageCacheAt(0)->SetBitmap(pBitmap);
1729 __pGallery->RefreshGallery(0, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1731 __pPresentationModel->RequestImage(destPath);
1735 AppLogDebug("ImageViewerForm::OnImageDecodeUrlReceived [%s]", GetErrorMessage(r));
1739 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1743 ImageViewerForm::OnRequestEmailAction(void)
1745 AppLogDebug("ENTER");
1746 int currentIndex = __pGallery->GetCurrentItemIndex();
1748 if (__pPresentationModel->GetFileCount() <= 0)
1750 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1754 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1756 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1758 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1760 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1761 pDataList->Construct();
1762 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1763 new (std::nothrow) String(filePath));
1765 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
1766 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1768 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1772 ImageViewerForm::OnRequestMessagesAction(void)
1774 AppLogDebug("ENTER");
1775 int currentIndex = __pGallery->GetCurrentItemIndex();
1777 if (__pPresentationModel->GetFileCount() <= 0)
1779 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1783 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1785 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1787 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1789 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1790 pDataList->Construct();
1791 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),new (std::nothrow) String(APPCONTROL_DATA_MMS));
1792 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),new (std::nothrow) String(filePath));
1794 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES,
1795 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1797 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1801 ImageViewerForm::SetFooterItemState(bool isEnable)
1803 AppLogDebug("ENTER");
1804 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL)
1806 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1807 __pFooter->SetItemEnabled(0, isEnable);
1808 __pFooter->SetItemEnabled(1, isEnable);
1810 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
1812 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1813 __pFooter->SetItemEnabled(0, isEnable);
1814 __pFooter->SetItemEnabled(1, isEnable);
1816 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_CROP)
1818 __pFooter->SetItemEnabled(0, isEnable);
1820 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1824 ImageViewerForm::GetQuickThumbnailN(String& filePath)
1826 AppLogDebug("ENTER");
1827 Bitmap* pBitmap = null;
1829 if (filePath.GetLength() > 4)
1833 ContentSearch contentSearch;
1834 ContentSearchResult* pResultItem = null;
1835 IList* pContentInfoList = null;
1837 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1838 result r = contentSearch.Construct(contentType);
1839 AppLogDebug("r(%s)", GetErrorMessage(r));
1842 pBitmap = new (std::nothrow) Bitmap();
1843 r = pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1854 queryString = CONTENT_QUERY_PREFIX_FILENAME;
1855 queryString.Append(L"'");
1856 queryString.Append(__pPresentationModel->GetFileName(filePath));
1857 queryString.Append(L"'");
1859 pContentInfoList = contentSearch.SearchN(PAGE_NO_CONTENT_SEARCH, COUNT_PER_PAGE_CONTENT_SEARCH,
1860 totalPage, totalCount, queryString, EMPTY_SPACE, SORT_ORDER_NONE);
1862 if ((pContentInfoList != null) && GetLastResult() == E_SUCCESS && (pContentInfoList->GetCount() > 0))
1864 IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
1865 while (pEnum->MoveNext() == E_SUCCESS)
1867 pResultItem = static_cast<ContentSearchResult*>(pEnum->GetCurrent());
1868 if (pResultItem == null)
1873 if (pResultItem->GetContentInfo()->GetContentPath().CompareTo(filePath) == 0)
1875 pBitmap = pResultItem->GetContentInfo()->GetThumbnailN();
1881 if (pContentInfoList != null)
1883 delete pContentInfoList;
1886 if (pBitmap != null)
1888 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1890 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
1892 ImageBuffer* imageBuffer = new (std::nothrow) ImageBuffer();
1893 result r = imageBuffer->Construct(filePath);
1896 if ( imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_RIGHT_TOP ||
1897 imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_LEFT_BOTTOM )
1899 Dimension srcDim( imageBuffer->GetHeight(),imageBuffer->GetWidth());
1900 pBitmap->Scale(srcDim);
1904 Dimension srcDim(imageBuffer->GetWidth(), imageBuffer->GetHeight());
1905 pBitmap->Scale(srcDim);
1911 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1913 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(filePath);
1915 if (pVideoMeta != null && GetLastResult() == E_SUCCESS)
1917 Dimension srcDim(pVideoMeta->GetWidth(), pVideoMeta->GetHeight());
1918 pBitmap->Scale(srcDim);
1926 mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
1927 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
1928 pBitmap = new (std::nothrow) Bitmap();
1929 pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
1932 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));