Fix wallpaper crash problem when orientation status is changed to landscape.
authorTaeHo Choi <thanks.choi@samsung.com>
Thu, 28 Mar 2013 02:49:18 +0000 (11:49 +0900)
committerTaeHo Choi <thanks.choi@samsung.com>
Thu, 28 Mar 2013 02:49:18 +0000 (11:49 +0900)
Change-Id: Iff29de9a6b59ca0c737c9a1dba519e14b94747f4
Signed-off-by: TaeHo Choi <thanks.choi@samsung.com>
src/StWallpaperAlbumListDetailForm.cpp
src/StWallpaperAlbumListForm.cpp
src/StWallpaperImageSelectForm.cpp

index fb5b230..3511a44 100644 (file)
@@ -247,9 +247,6 @@ WallpaperAlbumListDetailForm::CreateIconListView(void)
 void
 WallpaperAlbumListDetailForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
 {
-       RemoveAllControls();
-       CreateHeader(L"Wallpaper Album List");
-       CreateFooter();
-       CreateIconListView();
+       __pIconListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
        Invalidate(true);
 }
\ No newline at end of file
index 3accef6..8dc390c 100644 (file)
@@ -225,9 +225,6 @@ WallpaperAlbumListForm::CreateIconListView(void)
 void
 WallpaperAlbumListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
 {
-       RemoveAllControls();
-       CreateHeader(L"Wallpaper Album List");
-       CreateFooter();
-       CreateIconListView();
+       __pIconListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
        Invalidate(true);
 }
\ No newline at end of file
index d2335b1..37dc055 100644 (file)
@@ -268,8 +268,32 @@ WallpaperImageSelectForm::CreateImage(void)
 void
 WallpaperImageSelectForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
 {
-       RemoveAllControls();
-       CreateFooter();
-       CreateImage();
+       Label* pLabel = static_cast<Label*>(GetControl(NO_CONTENTS, true));
+       Rectangle rect = GetClientAreaBounds();
+       ContentManager pContentManager;
+       pContentManager.Construct();
+       ImageContentInfo* pImageContentInfo = static_cast<ImageContentInfo*>(pContentManager.GetContentInfoN(*__pContentId));
+       Bitmap* pBitmap = ResourceManager::GetApplicationBitmapN(pImageContentInfo->GetContentPath());
+       Rectangle clientRect = GetClientAreaBounds();
+
+       float bitmapWidthRate = rect.width / (float)pBitmap->GetWidth();
+       float bitmapHeightRate = rect.height / (float)pBitmap->GetHeight();
+
+       int bitmapWidth = 0;
+       int bitmapHeight = 0;
+
+       if (bitmapWidthRate > bitmapHeightRate)
+       {
+               bitmapHeight = pBitmap->GetHeight() * bitmapHeightRate;
+               bitmapWidth = pBitmap->GetWidth() * bitmapHeightRate;
+       }
+       else
+       {
+               bitmapHeight = pBitmap->GetHeight() * bitmapWidthRate;
+               bitmapWidth = pBitmap->GetWidth() * bitmapWidthRate;
+       }
+       int xPos = (clientRect.width / LINE_COUNT_2) - (bitmapWidth / DEVIDE_TWO);
+       int yPos = (clientRect.height / LINE_COUNT_2) - (bitmapHeight / DEVIDE_TWO);
+       pLabel->SetBounds(Rectangle(xPos, yPos, bitmapWidth, bitmapHeight));
        Invalidate(true);
 }
\ No newline at end of file