From e3e75dc514e8b7b3c096f57167407fe573d8a1be Mon Sep 17 00:00:00 2001 From: SungWan Kim Date: Tue, 23 Apr 2013 20:36:56 +0900 Subject: [PATCH] Resolve N_SE-35977 issue. Change-Id: I720e4b8fec53cc6b012a9b85e65d5186698e617a Signed-off-by: SungWan Kim --- inc/ClResourceManager.h | 2 ++ src/ClDayPanel.cpp | 6 ++++-- src/ClResourceManager.cpp | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/inc/ClResourceManager.h b/inc/ClResourceManager.h index 12ec199..87e62bf 100644 --- a/inc/ClResourceManager.h +++ b/inc/ClResourceManager.h @@ -33,6 +33,7 @@ public: static Tizen::Locales::DateTimeFormatter* CreateDateFormatterN(Tizen::Locales::DateTimeStyle dateStyle); static Tizen::Locales::DateTimeFormatter* CreateDateTimeFormatterN(Tizen::Locales::DateTimeStyle dateStyle); static Tizen::Locales::DateTimeFormatter* CreateTimeFormatterN(void); + static Tizen::Base::String GetAmPmString(bool am); static Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& bitmapPath, bool isAbsolute = false); static Tizen::Graphics::Bitmap* GetBlankBitmap(void); static Tizen::Base::String GetString(const Tizen::Base::String& stringId); @@ -57,6 +58,7 @@ private: private: Tizen::App::AppResource* __pAppResource; Tizen::Graphics::Bitmap* __pBlankBitmap; + Tizen::Locales::DateTimeFormatter* __pAmPmFormatter; Tizen::Locales::DateTimeFormatter* __pMonthFormatter; Tizen::Locales::DateTimeFormatter* __pWeekFormatter; Tizen::Locales::DateTimeFormatter* __pWeekShortFormatter; diff --git a/src/ClDayPanel.cpp b/src/ClDayPanel.cpp index 0b5538e..557b6e2 100644 --- a/src/ClDayPanel.cpp +++ b/src/ClDayPanel.cpp @@ -972,14 +972,16 @@ DayEventPanel::InitializeTimeLine(void) } __pLabelAm = new (std::nothrow) Label(); - __pLabelAm->Construct(Rectangle(X_TIME_LINE_AMPM, 0, W_TIME_LINE_AMPM, H_TIME_LINE_AMPM), L"AM"); + __pLabelAm->Construct(Rectangle(X_TIME_LINE_AMPM, 0, W_TIME_LINE_AMPM, H_TIME_LINE_AMPM), + ResourceManager::GetAmPmString(true)); __pLabelAm->SetTextConfig(FONT_SIZE_TIME_LINE_AMPM, LABEL_TEXT_STYLE_NORMAL); __pLabelAm->SetTextColor(Color(COLOR_TIME_LINE_AMPM)); __pPanelDayEvents->AddControl(__pLabelAm); __pLabelAm->SetShowState(__is24HourEnabled == false); __pLabelPm = new (std::nothrow) Label(); - __pLabelPm->Construct(Rectangle(X_TIME_LINE_AMPM, H_EVENT_LIST_ITEM * AMPM_TIME_COUNT + H_TIME_LINE_NUMBER / 2, W_TIME_LINE_AMPM, H_TIME_LINE_AMPM), L"PM"); + __pLabelPm->Construct(Rectangle(X_TIME_LINE_AMPM, H_EVENT_LIST_ITEM * AMPM_TIME_COUNT + H_TIME_LINE_NUMBER / 2, W_TIME_LINE_AMPM, H_TIME_LINE_AMPM), + ResourceManager::GetAmPmString(false)); __pLabelPm->SetTextConfig(FONT_SIZE_TIME_LINE_AMPM, LABEL_TEXT_STYLE_NORMAL); __pLabelPm->SetTextColor(Color(COLOR_TIME_LINE_AMPM)); __pPanelDayEvents->AddControl(__pLabelPm); diff --git a/src/ClResourceManager.cpp b/src/ClResourceManager.cpp index bd44c8b..7151670 100644 --- a/src/ClResourceManager.cpp +++ b/src/ClResourceManager.cpp @@ -105,16 +105,20 @@ ResourceManager* ResourceManager::__pInstance = null; ResourceManager::ResourceManager(void) : __pAppResource(null) , __pBlankBitmap(null) + , __pAmPmFormatter(null) , __pMonthFormatter(null) , __pWeekFormatter(null) + , __pWeekShortFormatter(null) { } ResourceManager::~ResourceManager(void) { delete __pBlankBitmap; + delete __pAmPmFormatter; delete __pMonthFormatter; delete __pWeekFormatter; + delete __pWeekShortFormatter; } DateTimeFormatter* @@ -228,6 +232,27 @@ ResourceManager::CreateTimeFormatterN(void) return pTimeFormatter; } +String +ResourceManager::GetAmPmString(bool am) +{ + TryReturn(GetInstance() != null, String(), "[E_FAILURE] Unable to get resource instance."); + + String str; + if (am == true) + { + DateTime date; + date.SetValue(1900, 1, 1, 1); + GetInstance()->__pAmPmFormatter->Format(date, str); + } + else + { + DateTime date; + date.SetValue(1900, 1, 1, 13); + GetInstance()->__pAmPmFormatter->Format(date, str); + } + return str; +} + Bitmap* ResourceManager::GetBitmapN(const String& bitmapPath, bool isAbsolute) { @@ -374,6 +399,8 @@ ResourceManager::Construct(void) __pAppResource = UiApp::GetInstance()->GetAppResource(); TryReturn(__pAppResource != null, E_FAILURE, "[E_FAILURE] Unable to get app resource."); + __pAmPmFormatter = DateTimeFormatter::CreateTimeFormatterN(DATE_TIME_STYLE_NONE); + __pAmPmFormatter->ApplyPattern(L"a"); __pMonthFormatter = DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_NONE); __pMonthFormatter->ApplyPattern(L"MMMM"); __pWeekFormatter = DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_NONE); -- 2.7.4