#include <cstdlib>
#include <FMedia.h>
#include <FSystem.h>
+
#include "GlAlbumInfo.h"
#include "GlAlbumListPresentationModel.h"
#include "GlGalleryApp.h"
static const int ICON_CAP = 3;
static const int FOLDER_CAP = 8;
-static const int ICON_SIZE = 102;
-static const int FOLDER_SIZE_WIDTH = 334;
-static const int FOLDER_SIZE_HEIGHT = 334;
+static const int ICON_SIZE = 107;
+static const int FOLDER_SIZE_WIDTH = 348;
+static const int FOLDER_SIZE_HEIGHT = 348;
+
+static const int CANVAS_HEIGHT = 71;
+static const int CANVAS_WIDTH = 326;
static const int FONT_SIZE_FOLDER_NAME = 32;
static const int FONT_SIZE_FOLDER_DATE = 25;
-static const int FONT_SIZE_FOLDER_COUNT = 42;
-static const int GAP_FONT = 5;
+static const int FONT_SIZE_FOLDER_COUNT = 45;
+static const int FONT_SIZE_FOLDER_COUNT_SMALL = 35;
+
+static const int CANVAS_IMAGE_FOLDER_HEIGHT = 48;
+static const int CANVAS_IMAGE_FOLDER_WIDTH = 48;
+static const int IMAGE_COUNT_WIDTH = 100;
+static const int IMAGE_COUNT_HEIGHT = 60;
+static const int CANVAS_MARGIN_LEFT = 10;
+static const int GAP = 10;
+static const int HEIGHT_OFFSET = 5;
+static const int Y_POS_CANVAS = 260;
+static const int FOLDER_NAME_WIDTH = 165;
+static const int FOLDER_NAME_HEIGHT = 38 ;
-static const int MAX_FONT_LENGTH = 15;
-static const unsigned int COLOR_BLACK = Color32<25, 25, 25>::Value;
-static const unsigned int COLOR_1 = Color32<71, 128, 11>::Value;
-static const unsigned int COLOR_2 = Color32<56, 78, 116>::Value;
-static const unsigned int COLOR_3 = Color32<49, 125, 174>::Value;
-static const unsigned int COLOR_4 = Color32<165, 53, 33>::Value;
+static const int ALPHA_BG = 110;
+
+static const Color COLOR_CANVAS_BG (Color::GetColor(COLOR_ID_BLACK));
static const String RESERVED_MEDIA_PATH = Environment::GetMediaPath();
static const String RESERVED_CAMERA_PATH = Environment::GetMediaPath() + L"Camera";
static const int FORMAT_BUFFER_SIZE = 256;
-static const int MAX_RANDOM_COLOR_NUMBER = 4;
-static const int COMPARE_COLOR_NUMBER_0 = 0;
-static const int COMPARE_COLOR_NUMBER_1 = 1;
-static const int COMPARE_COLOR_NUMBER_2 = 2;
-static const int COMPARE_COLOR_NUMBER_3 = 3;
-
static const int DOUBLE_NUMBER = 2;
static const int TRIPLE_NUMBER = 3;
IList* AlbumListPresentationModel::__pAlbumInfoList = null;
AlbumListPresentationModel::AlbumListPresentationModel(void)
- : __pFolderBackgroundBitmap(null)
- , __appControlMode(APP_CONTROL_MODE_MAIN)
- , __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE)
- , __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE)
+: __pFolderBackgroundBitmap(null)
+, __appControlMode(APP_CONTROL_MODE_MAIN)
+, __appControlMediaType(APPCONTROL_MEDIA_TYPE_IMAGE)
+, __appControlSelectionMode(APPCONTROL_SELECTION_MODE_SINGLE)
{
AppLogDebug("ENTER");
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
if (__pPresentationModelListener->GetCount() > 0)
{
IEnumerator* pEnum = __pPresentationModelListener->GetEnumeratorN();
+
while (pEnum->MoveNext() == E_SUCCESS)
{
IAlbumEventListener* pListener = null;
pListener = static_cast<IAlbumEventListener*>(pEnum->GetCurrent());
pListener->OnFileInfoChanged(CONTENT_TYPE_ALL);
}
+
delete pEnum;
pEnum = null;
}
return;
}
- Dimension dimSet(ICON_SIZE, ICON_SIZE);
canvas.DrawBitmap(rectNew, *__pFolderBackgroundBitmap);
Bitmap* pBitmap = pAlbumInfo->GetFolderThumnailBitmap();
+
if (pBitmap != null)
{
Rectangle rectFirst(ICON_CAP+FOLDER_CAP, ICON_CAP,
ICON_CAP * DOUBLE_NUMBER + ICON_SIZE * TRIPLE_NUMBER);
canvas.DrawBitmap(rectFirst, *pBitmap);
}
+
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
AlbumListPresentationModel::DrawFontImage(Canvas& canvas, AlbumInfo* pAlbumInfo, int index)
{
AppLogDebug("ENTER");
+
if (&canvas == null)
{
AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
return;
}
+ Point pointText;
String strCnt;
+ Bitmap* pBitmap = null;
+ Font ftFolderName, ftDate, ftCnt,ftCntSmall;
+ EnrichedText enText;
+ EnrichedText enTextCount;
+ TextElement textElement;
+ TextElement textElementCount;
+
int allContentCount = pAlbumInfo->GetContentIdCount();
strCnt.Format(FORMAT_BUFFER_SIZE, L"%d", allContentCount);
String strFolderName = pAlbumInfo->GetAlbumName();
- Color colorBack = COLOR_BLACK;
- if ( strFolderName == ResourceManager::GetString(L"IDS_MEDIABR_BODY_ALL_ALBUMS")
- || strFolderName == ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB")
- || strFolderName == ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS"))
+ Rectangle rectCanvas(ICON_CAP + FOLDER_CAP, Y_POS_CANVAS, CANVAS_WIDTH, CANVAS_HEIGHT);
+ Color bgColor(COLOR_CANVAS_BG);
+ bgColor.SetAlpha(ALPHA_BG);
+ canvas.FillRectangle(bgColor, rectCanvas);
+
+ if ( strFolderName == ResourceManager::GetString(L"IDS_COM_BODY_DOWNLOADS"))
{
- colorBack = COLOR_BLACK;
+ pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_DOWNLOAD);
+ }
+ else if ( strFolderName == ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB") )
+ {
+ pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_CAMERA);
}
else
{
- if (index % MAX_RANDOM_COLOR_NUMBER == COMPARE_COLOR_NUMBER_0)
- {
- colorBack = COLOR_1;
- }
- else if (index % MAX_RANDOM_COLOR_NUMBER == COMPARE_COLOR_NUMBER_1)
- {
- colorBack = COLOR_2;
- }
- else if (index % MAX_RANDOM_COLOR_NUMBER == COMPARE_COLOR_NUMBER_2)
- {
- colorBack = COLOR_3;
- }
- else if (index % MAX_RANDOM_COLOR_NUMBER == COMPARE_COLOR_NUMBER_3)
- {
- colorBack = COLOR_4;
- }
+ pBitmap = ResourceManager::GetBitmapN(IDB_ALBUM_ICON_FOLDER);
}
- Rectangle rectBack(ICON_CAP + FOLDER_CAP, ICON_CAP, ICON_SIZE * DOUBLE_NUMBER + ICON_CAP, ICON_SIZE);
- canvas.FillRectangle(colorBack, rectBack);
-
- Point pointText;
+ if ( pBitmap != null)
+ {
+ canvas.DrawBitmap(Rectangle(ICON_CAP + FOLDER_CAP, rectCanvas.y + HEIGHT_OFFSET, CANVAS_IMAGE_FOLDER_WIDTH,
+ CANVAS_IMAGE_FOLDER_HEIGHT), *pBitmap);
+ delete pBitmap;
+ }
- Font ftFolderName, ftDate, ftCnt;
ftFolderName.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_NAME);
ftDate.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_DATE);
ftCnt.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_COUNT);
+ ftCntSmall.Construct(FONT_STYLE_PLAIN, FONT_SIZE_FOLDER_COUNT_SMALL);
- EnrichedText enText;
- enText.Construct(Dimension(ICON_SIZE * DOUBLE_NUMBER - (ICON_CAP * DOUBLE_NUMBER),
- FONT_SIZE_FOLDER_NAME + ICON_CAP * DOUBLE_NUMBER));
+ enText.Construct(Dimension(FOLDER_NAME_WIDTH, FOLDER_NAME_HEIGHT));
enText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
- TextElement textElement;
textElement.Construct(strFolderName);
textElement.SetFont(ftFolderName);
textElement.SetTextColor(Color::GetColor(COLOR_ID_WHITE));
enText.SetTextAbbreviationEnabled(true);
enText.Add(textElement);
- pointText = Point(ICON_CAP + FOLDER_CAP, ICON_CAP + FONT_SIZE_FOLDER_NAME);
- canvas.SetFont(ftDate);
- canvas.SetForegroundColor(Color::GetColor(COLOR_ID_GREY));
+ enTextCount.Construct(Dimension(IMAGE_COUNT_WIDTH, IMAGE_COUNT_HEIGHT));
+ enTextCount.SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
+
+ textElementCount.Construct(strCnt);
+
+ if (strCnt.GetLength() > 3) // if the count in Album is greater than 3 digit number, use small font
+ {
+ textElementCount.SetFont(ftCntSmall);
+ }
+ else
+ {
+ textElementCount.SetFont(ftCnt);
+ }
+ textElementCount.SetTextColor(Color::GetColor(COLOR_ID_WHITE));
+ enTextCount.SetTextAbbreviationEnabled(true);
+ enTextCount.Add(textElementCount);
- pointText = Point((ICON_SIZE * DOUBLE_NUMBER + ICON_CAP) - ((FONT_SIZE_FOLDER_COUNT / DOUBLE_NUMBER) * strCnt.GetLength() + GAP_FONT),
- ICON_CAP + FONT_SIZE_FOLDER_NAME + FONT_SIZE_FOLDER_DATE);
+ pointText = Point(CANVAS_MARGIN_LEFT + CANVAS_IMAGE_FOLDER_WIDTH + GAP + FOLDER_NAME_WIDTH , rectCanvas.y + HEIGHT_OFFSET);
canvas.SetFont(ftCnt);
canvas.SetForegroundColor(Color::GetColor(COLOR_ID_WHITE));
- canvas.DrawText(pointText, strCnt, MAX_FONT_LENGTH);
+ canvas.DrawText(pointText, enTextCount);
- pointText = Point(ICON_CAP + FOLDER_CAP, ICON_CAP);
+ pointText = Point(CANVAS_MARGIN_LEFT + CANVAS_IMAGE_FOLDER_WIDTH + GAP , rectCanvas.y + GAP + HEIGHT_OFFSET);
canvas.SetForegroundColor(Color::GetColor(COLOR_ID_WHITE));
canvas.DrawText(pointText, enText);
AlbumListPresentationModel::CreateMergeBitmapN(int index)
{
AppLogDebug("ENTER index(%d)", index);
+
if (__pAlbumInfoList == null)
{
AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
result
AlbumListPresentationModel::StartAppControl( const String& providerId, const String& operationId,
- const IMap* pDataList, IAppControlResponseListener* pListener)
+ const IMap* pDataList, IAppControlResponseListener* pListener)
{
AppLogDebug("ENTER");
AppLogDebug("FindAppControlN(%ls, %ls)", providerId.GetPointer(), operationId.GetPointer());
return;
}
}
+
IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING);
String* pDirPath = null;
AlbumInfo* pAlbumInfo = null;
}
if ((*pDirPath == RESERVED_CAMERA_PATH)
- ||(*pDirPath == RESERVED_CAMERA_PATH_EXT))
+ ||(*pDirPath == RESERVED_CAMERA_PATH_EXT))
{
IList* pContentIdList = GetContentIdListInDirectoryN(*pDirPath, contentType);
contentId = pAlbumInfo->GetContentId(i);
__pThumbnailProvider->CancelThumbnailRequest(contentId, __pThumbnailEvent);
}
- */
+ */
}
}
AppLogDebug("EXIT");