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 MpCommonUtil.cpp
19 * @brief This is the implementation file for CommonUtil class.
22 #include <unique_ptr.h>
23 #include "MpCommonUtil.h"
25 using namespace Tizen::App;
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28 using namespace Tizen::Base::Utility;
29 using namespace Tizen::Content;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Io;
32 using namespace Tizen::Ui;
33 using namespace Tizen::Ui::Controls;
34 using namespace Tizen::Ui::Scenes;
36 static const int H_CREATE_TABLE_VIEW_ITEM = 70;
37 static const int Y_CREATE_TABLE_VIEW_ITEM = 29;
38 static const int W_CREATE_TABLE_VIEW_ITEM_COUNT_LABEL_ITEM = 170;
39 static const int DEPTH = 3;
41 const wchar_t* SECTION_MUSIC_SETTING = L"MUSIC_SETTING";
42 const wchar_t* INITIAL_TAB = L"INITIAL_TAB"; // 0 - 7
43 const wchar_t* SONGS_TAB = L"SONGS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
44 const wchar_t* ALBUMS_TAB = L"ALBUMS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
45 const wchar_t* ARTISTS_TAB = L"ARTISTS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
46 const wchar_t* GENRES_TAB = L"GENRES_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
47 const wchar_t* COMPOSERS_TAB = L"COMPOSERS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
48 const wchar_t* YEARS_TAB = L"YEARS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
49 const wchar_t* FOLDERS_TAB = L"FOLDERS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
50 const wchar_t* PLAYERLISTS_TAB = L"PLAYERLISTS_TAB"; // 0 - 1 (UNCHECKED, CHECKED)
51 const wchar_t* AUTO_OFF_LEVEL = L"AUTO_OFF_LEVEL"; // 0 - 5 (OFF, 15 MIN, 30 MIN, 1 HOUR, 1 HOUR 30 MIN, 2 HOURS)
52 const wchar_t* MOST_PLAYED = L"MOST_PLAYED"; // 0 - 1 (UNCHECKED, CHECKED)
53 const wchar_t* RECENTLY_PLAYED = L"RECENTLY_PLAYED"; // 0 - 1 (UNCHECKED, CHECKED)
54 const wchar_t* RECENTLY_ADD = L"RECENTLY_ADD"; // 0 - 1 (UNCHECKED, CHECKED)
55 const wchar_t* REPEAT_MODE = L"REPEAT_MODE"; // 0 - 2 (OFF, ONE, ALL)
56 const wchar_t* SHUFFLE_MODE = L"SHUFFLE_MODE"; // 0 - 1 (OFF, ON)
57 const wchar_t* VOLUME_LEVEL = L"VOLUME_LEVEL"; // 0 - 15
59 static const wchar_t* IDS_ORIGINAL_QUOTATION = L"'";
60 static const wchar_t* IDS_REPLACE_QUOTATION = L"\\'";
61 static const wchar_t* STRING_QUERY_PREFIX = L" ='";
62 static const wchar_t* STRING_QUERY_SUFFIX = L"'";
64 static bool __addToPlaylistState = false;
65 static Tizen::Base::String __AddToPlaylistName = null;
67 static const int Y_GAP_CONTENT_PIKER_ITEM = 16;
68 static const int W_SONG_TITLE_CONTENT_PIKER_ITEM = 440;
69 static const int H_SONG_TITLE_CONTENT_PIKER_ITEM = 88;
70 static const int W_SONG_TIME_CONTENT_PIKER_ITEM = 155;
72 Tizen::Graphics::Bitmap*
73 CommonUtil::GetContentAlbumArtN(Tizen::Base::String& path)
76 Tizen::Graphics::Bitmap* pBitmap = null;
78 AppLogDebug("path(%ls)", path.GetPointer());
79 Tizen::Content::AudioMetadata* pAudioMeta = Tizen::Content::ContentManagerUtil::GetAudioMetaN(path);
80 if (pAudioMeta == null)
86 pBitmap = pAudioMeta->GetAlbumArtN();
93 Tizen::Content::AudioContentInfo*
94 CommonUtil::GetAudioContentInfoN(const Tizen::Base::String& filePath)
97 ContentId contentId = GetContentId(filePath);
99 if (IsFailed(GetLastResult()))
101 AppLogDebug("filePath(%ls) failed", filePath.GetPointer());
102 SetLastResult(E_FAILURE);
106 ContentInfo* pContentInfo = GetContentInfoN(contentId);
107 if (pContentInfo == null || pContentInfo->GetContentType() != CONTENT_TYPE_AUDIO)
109 AppLogDebug("GetContentInfoN(%ls) failed", contentId.ToString().GetPointer());
111 SetLastResult(E_FAILURE);
116 return static_cast<AudioContentInfo*>(pContentInfo);
119 Tizen::Base::Collection::IList*
120 CommonUtil::ContentSearchResultListN(const Tizen::Base::String& contentFileName,
121 const Tizen::Base::String& ColumnName,
122 const Tizen::Base::String& sortColumn,
123 Tizen::Base::SortOrder sortOrder)
125 AppLogDebug("ENTER");
126 String WhereExpr = null;
127 WhereExpr = CommonUtil::SpecialReplaceChange(contentFileName);
128 WhereExpr = CommonUtil::MakeQuery(ColumnName, WhereExpr);
130 Tizen::Base::Collection::IList* pSearchList = CommonUtil::SearchContentList(WhereExpr, sortColumn);
131 if (pSearchList == null)
133 SetLastResult(E_FAILURE);
134 AppLogDebug("CommonUtil::SearchContentList failed");
142 CommonUtil::FilePathToContentFileName(const Tizen::Base::String& filePath)
144 AppLogDebug("ENTER");
145 String tempWhereClause = filePath;
147 String contentFileName = null;
149 tempWhereClause.LastIndexOf(L"/", tempWhereClause.GetLength() - 1, indexOf);
150 tempWhereClause.SubString(indexOf + 1, contentFileName);
153 return contentFileName;
156 Tizen::Content::ContentId
157 CommonUtil::GetContentId(const Tizen::Base::String& filePath)
159 AppLogDebug("ENTER");
160 String contentFileName = FilePathToContentFileName(filePath);
161 IList* pContentSearchResultList = ContentSearchResultListN(contentFileName, STRING_SORT_FILE_NAME, STRING_SORT_TITLE);
162 if (pContentSearchResultList == null || pContentSearchResultList->GetCount() == 0)
164 SetLastResult(E_FAILURE);
165 delete pContentSearchResultList;
166 AppLogDebug("CommonUtil::ContentSearchResultListN(%ls) failed", filePath.GetPointer());
170 ContentSearchResult* pResult = static_cast<ContentSearchResult*>(pContentSearchResultList->GetAt(INIT_VALUE));
173 pContentSearchResultList->RemoveAll(true);
174 delete pContentSearchResultList;
175 SetLastResult(E_FAILURE);
177 AppLogDebug("pSearchList->GetAt(0) failed");
182 if (pResult->GetContentType() == CONTENT_TYPE_AUDIO)
184 ContentInfo* pContentInfo = pResult->GetContentInfo();
185 contentId = pContentInfo->GetContentId();
189 SetLastResult(E_FAILURE);
192 pContentSearchResultList->RemoveAll(true);
193 delete pContentSearchResultList;
199 Tizen::Content::ContentInfo*
200 CommonUtil::GetContentInfoN(const Tizen::Content::ContentId& contentId)
202 AppLogDebug("ENTER");
203 ContentManager contentManager;
204 result r = contentManager.Construct();
207 AppLogDebug("contentManager.Construct() failed(%s)", GetErrorMessage(r));
211 ContentInfo* pContentInfo = contentManager.GetContentInfoN(contentId);
217 CommonUtil::StringToContentId(const Tizen::Base::String& contentIdString, Tizen::Content::ContentId& outContentId)
219 AppLogDebug("ENTER");
220 ContentId pcontentId;
222 result r = pcontentId.Parse(contentIdString, uuId);
225 AppLogDebug("pcontentId.Parse(%s, outContentId) failed", contentIdString.GetPointer());
235 CommonUtil::GetFormatDate(long dateValue)
237 AppLogDebug("ENTER");
241 // fTime.Format(20, L"%02d:%02d:%02d", 0, 0, 0);
242 fTime.Format(20, L"%02d:%02d", 0, 0);
247 dateTime.AddSeconds(dateValue / 1000);
248 // fTime.Format(20, L"%02d:%02d:%02d", dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond());
249 fTime.Format(20, L"%02d:%02d",dateTime.GetMinute(), dateTime.GetSecond());
256 CommonUtil::SpecialReplaceChange(const Tizen::Base::String& text)
258 AppLogDebug("ENTER");
259 String retStr = text;
260 retStr.Replace(IDS_ORIGINAL_QUOTATION, IDS_REPLACE_QUOTATION);
265 Tizen::Base::Collection::IList*
266 CommonUtil::SearchContentList(const Tizen::Base::String& whereExpr,
267 const Tizen::Base::String& sortColumn,
268 Tizen::Base::SortOrder sortOrder)
270 AppLogDebug("ENTER");
271 AppLogDebug("%ls, %ls", whereExpr.GetPointer(), sortColumn.GetPointer());
275 ContentSearch search;
276 search.Construct(CONTENT_TYPE_AUDIO);
277 IList* pSearchList = search.SearchN(SEARCH_PAGE_NO, SEARCH_COUNT_PER_PAGE, totalPage, totalCount, whereExpr, sortColumn, sortOrder);
278 if (pSearchList == null)
280 AppLogDebug("pSearchList is null");
284 AppLogDebug("%d", pSearchList->GetCount());
289 Tizen::Base::Collection::IList*
290 CommonUtil::SearchContentList(const Tizen::Base::String& columnName)
292 AppLogDebug("ENTER");
296 ContentSearch search;
297 search.Construct(CONTENT_TYPE_AUDIO);
299 IList* pSearchList = search.GetValueListN(SEARCH_PAGE_NO, SEARCH_COUNT_PER_PAGE, totalPage, totalCount, columnName, SORT_ORDER_ASCENDING);
300 if (pSearchList == null)
302 AppLogDebug("pSearchList is null");
311 CommonUtil::MakeQuery(const Tizen::Base::String& ColumnName,
312 const Tizen::Base::String& SerachName)
314 AppLogDebug("ENTER");
315 String MakeQueryName = null;
316 result r = E_SUCCESS;
318 r = MakeQueryName.Append(ColumnName);
319 TryCatch(r == E_SUCCESS, , "String::MakeQuery() fail[%s]", GetErrorMessage(r));
321 r = MakeQueryName.Append(STRING_QUERY_PREFIX);
322 TryCatch(r == E_SUCCESS, , "String::MakeQuery() fail[%s]", GetErrorMessage(r));
324 r = MakeQueryName.Append(SerachName);
325 TryCatch(r == E_SUCCESS, , "String::MakeQuery() fail[%s]", GetErrorMessage(r));
327 r = MakeQueryName.Append(STRING_QUERY_SUFFIX);
328 TryCatch(r == E_SUCCESS, , "String::MakeQuery() fail[%s]", GetErrorMessage(r));
331 return MakeQueryName;
334 MakeQueryName.Clear();
335 return MakeQueryName;
339 CommonUtil::GetValue(const Tizen::Base::String& entryName)
341 AppLogDebug("ENTER");
342 result r = E_SUCCESS;
344 AppRegistry* pAppRegistry = null;
345 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
346 TryCatch(pAppRegistry != null, , "Failed to Find AppRegistry!");
347 r = pAppRegistry->Get(entryName, value);
348 if (r == E_KEY_NOT_FOUND)
350 AppLogDebug("registry initialize.");
351 r = pAppRegistry->Add(MOST_PLAYED, 1);
352 r = pAppRegistry->Add(RECENTLY_PLAYED, 1);
353 r = pAppRegistry->Add(RECENTLY_ADD, 1);
354 r = pAppRegistry->Add(AUTO_OFF_LEVEL, 0);
355 r = pAppRegistry->Add(REPEAT_MODE, 2);
356 r = pAppRegistry->Add(SHUFFLE_MODE, 0);
357 r = pAppRegistry->Add(VOLUME_LEVEL, 5);
358 r = pAppRegistry->Save();
360 pAppRegistry->Get(entryName, value);
366 //AppLogDebug("CATCH : %s", GetErrorMessage(r));
371 CommonUtil::SetValue(const Tizen::Base::String& entryName, const int value)
373 AppLogDebug("ENTER");
374 result r = E_SUCCESS;
375 AppRegistry* pAppRegistry = null;
376 pAppRegistry = UiApp::App::GetInstance()->GetAppRegistry();
377 TryCatch(pAppRegistry != null, , "Failed to Find AppRegistry!");
378 r = pAppRegistry->Set(entryName, value);
379 if (r == E_KEY_NOT_FOUND)
381 AppLogDebug("registry initialize.");
382 r = pAppRegistry->Add(MOST_PLAYED, 1);
383 r = pAppRegistry->Add(RECENTLY_PLAYED, 1);
384 r = pAppRegistry->Add(RECENTLY_ADD, 1);
385 r = pAppRegistry->Add(AUTO_OFF_LEVEL, 0);
386 r = pAppRegistry->Add(REPEAT_MODE, 2);
387 r = pAppRegistry->Add(SHUFFLE_MODE, 0);
388 r = pAppRegistry->Add(VOLUME_LEVEL, 5);
389 r = pAppRegistry->Set(entryName, value);
390 r = pAppRegistry->Save();
394 pAppRegistry->Save();
400 //AppLogDebug("CATCH : %s", GetErrorMessage(r));
405 CommonUtil::ShowNowPlayPanel(Tizen::Ui::Controls::TableView& tableView,
406 const bool playStatus,
407 Tizen::Graphics::Rectangle clientBounds)
409 AppLogDebug("ENTER");
410 if (playStatus == true)
412 tableView.SetBounds(Rectangle(0, H_NOW_PLAY_BAR, clientBounds.width, clientBounds.height - H_NOW_PLAY_BAR));
413 tableView.Invalidate(true);
417 tableView.SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height));
418 tableView.Invalidate(true);
424 CommonUtil::GetContentInfo(const ContentInformation& contentInfoStruct,
425 const Tizen::Base::String& SceneId)
427 AppLogDebug("ENTER");
428 String retString = null;
430 if (SceneId.Equals(IDSCN_ALBUM_LIST, true) || SceneId.Equals(IDSCN_SEARCH, true))
432 retString = contentInfoStruct.AlbumName;
434 else if (SceneId.Equals(IDSCN_ARTIST_ALBUM_LIST, true))
436 retString = contentInfoStruct.AlbumName;
438 else if (SceneId.Equals(IDSCN_GENRE_LIST, true))
440 retString = contentInfoStruct.GenreName;
442 else if (SceneId.Equals(IDSCN_COMPOSER_LIST, true))
444 retString = contentInfoStruct.ComposerName;
446 else if (SceneId.Equals(IDSCN_YEAR_LIST, true))
448 retString = Integer::ToString(contentInfoStruct.ReleaseYear);;
449 if (retString.Equals(L"0", true))
451 retString = STRING_UNKNOWN;
454 else if (SceneId.Equals(IDSCN_FOLDER_LIST, true))
456 retString = contentInfoStruct.ContentFilePath;
458 else if (SceneId.Equals(IDSCN_PLAYLIST_LIST, true))
460 retString = contentInfoStruct.TitleName;
467 CommonUtil::SetSongsString(const int temp)
469 AppLogDebug("ENTER");
470 String StrSongs = null;
471 String StrFormat = null;
473 StrSongs.Append(L"%d ");
474 StrSongs.Append(ResourceManager::GetString("IDS_MUSIC_HEADER_SONGS"));
475 StrFormat.Format(STRING_LENGTH, StrSongs.GetPointer(), temp);
481 CommonUtil::ShowCheckedCountLabel(Tizen::Ui::Controls::Label& checkCountLabel, int itemCount, Tizen::Ui::Controls::TableView& tableView, const Tizen::Ui::Controls::Form& form)
483 AppLogDebug("ENTER");
484 int width = form.GetClientAreaBounds().width;
485 int height = form.GetClientAreaBounds().height;
486 if (itemCount == INIT_VALUE)
488 checkCountLabel.SetShowState(false);
489 checkCountLabel.Invalidate(true);
490 tableView.SetBounds(Rectangle(INIT_VALUE, H_SELECT_ALL_BUTTON, width, height - H_SELECT_ALL_BUTTON));
495 String StrSelectStr = null;
496 String ResSelect = ResourceManager::GetString("IDS_COM_BODY_SELECTED");
497 ResSelect.Append(L"(%d)");
499 StrSelectStr.Format(STRING_LENGTH, ResSelect.GetPointer(), itemCount);
501 checkCountLabel.SetText(StrSelectStr);
502 checkCountLabel.SetShowState(true);
503 checkCountLabel.Invalidate(true);
505 // tableView.SetBounds(Rectangle(INIT_VALUE, H_SELECT_ALL_BUTTON, width, height - H_SELECT_ALL_BUTTON - checkCountLabel.GetBounds().height));
506 tableView.Invalidate(true);
511 CommonUtil::ShowSelectAllCheckButton(Tizen::Ui::Controls::CheckButton& checkButton)
513 AppLogDebug("ENTER");
514 if (checkButton.IsEnabled() == true)
516 checkButton.SetSelected(false);
517 checkButton.Invalidate(true);
523 CommonUtil::SetAllCheckState(bool state,
524 Tizen::Ui::Controls::TableView& tableView,
527 AppLogDebug("ENTER");
529 for (int iCount = INIT_VALUE; iCount < totalCount; iCount++)
531 tableView.SetItemChecked(iCount, state);
533 tableView.Invalidate(true);
538 CommonUtil::SetFastScrollIndex(Tizen::Ui::Controls::TableView& tableview)
540 AppLogDebug("ENTER");
541 String retCountry = null;
542 Tizen::System::SettingInfo::GetValue("http://tizen.org/setting/locale.country", retCountry);
544 String indexText = null;
545 if (retCountry.CompareTo("eng_GB") == 0)
547 indexText.Append(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
549 else if(retCountry.CompareTo("kor_KR") == 0)
551 // indexText.Append(L"ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ");
552 indexText.Append(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ#0");
555 indexText.Append(L"#");
556 indexText.Append(L"0");
558 tableview.SetFastScrollIndex(indexText, false);
565 CommonUtil::SetLayoutFitToContainer(const Tizen::Ui::Container& container, Tizen::Ui::Control& childControl)
567 AppLogDebug("ENTER");
568 RelativeLayout* pLayout = dynamic_cast<RelativeLayout*>(container.GetPortraitLayoutN());
571 pLayout->SetHorizontalFitPolicy(childControl, FIT_POLICY_PARENT);
572 pLayout->SetVerticalFitPolicy(childControl, FIT_POLICY_PARENT);
576 pLayout = dynamic_cast<RelativeLayout*>(container.GetLandscapeLayoutN());
579 pLayout->SetHorizontalFitPolicy(childControl, FIT_POLICY_PARENT);
580 pLayout->SetVerticalFitPolicy(childControl, FIT_POLICY_PARENT);
588 CommonUtil::SetFooterItemEnabled(Tizen::Ui::Controls::Footer& pFooter, bool enable)
590 AppLogDebug("ENTER");
591 for (int iCount = 0; iCount < pFooter.GetItemCount(); iCount++)
593 pFooter.SetItemEnabled(iCount, enable);
595 pFooter.Invalidate(true);
600 CommonUtil::SetTabHeaderStyle(Tizen::Ui::Controls::Header& pHeader)
602 AppLogDebug("ENTER");
603 pHeader.RemoveAllButtons();
604 pHeader.RemoveAllItems();
606 pHeader.SetStyle(HEADER_STYLE_TAB);
607 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
609 for (int iCount = 0; iCount < HEAD_ITEM_COUNT; iCount++)
611 HeaderItem pTabHeaderItem;
612 pTabHeaderItem.Construct(IDA_HEADER_BUTTON_SONG + iCount);
613 pTabHeaderItem.SetText(ResourceManager::GetString(TabNameId[iCount]));
615 pHeader.AddItem(pTabHeaderItem);
621 CommonUtil::SetEditHeaderStyle(Tizen::Ui::Controls::Header& pHeader, const Tizen::Base::String& titleText)
623 AppLogDebug("ENTER");
624 pHeader.RemoveAllButtons();
625 pHeader.RemoveAllItems();
627 pHeader.SetStyle(HEADER_STYLE_TITLE);
628 pHeader.SetTitleText(titleText);
630 ButtonItem buttonItem;
631 buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_HEADER_BUTTON_SELECTE_ALL);
633 Bitmap* normal = ResourceManager::GetBitmapN(L"00_icon_select_all_web.png");
634 buttonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, normal);
636 Bitmap* pressed = ResourceManager::GetBitmapN(L"00_icon_select_all_press_web.png");
637 buttonItem.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pressed);
639 Bitmap* disable = ResourceManager::GetBitmapN(L"00_icon_select_all_dim_web.png");
640 buttonItem.SetIcon(BUTTON_ITEM_STATUS_DISABLED, disable);
642 pHeader.SetButton(BUTTON_POSITION_RIGHT, buttonItem);
643 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
652 CommonUtil::SetButtonItemUnCheckedIcon(Tizen::Ui::Controls::Header& header)
654 AppLogDebug("ENTER");
655 header.RemoveAllButtons();
656 ButtonItem buttonItem;
657 buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_HEADER_BUTTON_CHECK_BOX_CHECKED_ICON);
659 Bitmap* pBgNormal = ResourceManager::GetBitmapN(L"00_check_bg.png");
660 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBgNormal);
662 Bitmap* pBgPressed = ResourceManager::GetBitmapN(L"00_check_bg_press.png");
663 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBgPressed);
665 Bitmap* pBgDisabled = ResourceManager::GetBitmapN(L"00_check_bg_press.png");
666 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_DISABLED, pBgDisabled);
668 header.SetButton(BUTTON_POSITION_RIGHT, buttonItem);
669 header.Invalidate(true);
678 CommonUtil::SetItemCheckedAll(bool isChecked, Tizen::Ui::Controls::TableView& tableView)
680 AppLogDebug("ENTER");
681 int totalCount = tableView.GetItemCount();
682 for (int iCount = INIT_VALUE; iCount < totalCount; iCount++)
684 tableView.SetItemChecked(iCount, isChecked);
686 tableView.Invalidate(true);
691 CommonUtil::SetButtonItemCheckedIcon(Tizen::Ui::Controls::Header& header)
693 AppLogDebug("ENTER");
694 header.RemoveAllButtons();
695 ButtonItem buttonItem;
696 buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_HEADER_BUTTON_CHECK_BOX_UNCHECKED_ICON);
698 Bitmap* pBgNormal = ResourceManager::GetBitmapN(L"00_check_bg.png");
699 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBgNormal);
701 Bitmap* pBgPressed = ResourceManager::GetBitmapN(L"00_check_bg_press.png");
702 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBgPressed);
704 Bitmap* pBgDisabled = ResourceManager::GetBitmapN(L"00_check_bg_press.png");
705 buttonItem.SetBackgroundBitmap(BUTTON_ITEM_STATUS_DISABLED, pBgDisabled);
707 Bitmap* pIconChecked = ResourceManager::GetBitmapN(L"00_check_checking.png");
708 buttonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pIconChecked);
709 buttonItem.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pIconChecked);
710 buttonItem.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pIconChecked);
712 header.SetButton(BUTTON_POSITION_RIGHT, buttonItem);
713 header.Invalidate(true);
722 Tizen::Ui::Controls::Popup*
723 CommonUtil::CreateContentDeletePopup(Tizen::Ui::IActionEventListener& listener, int deleteActionId, int cancelActionId)
725 AppLogDebug("ENTER");
726 Popup* pDeletePopup = new (std::nothrow) Popup();
727 if (IsFailed(pDeletePopup->Construct(IDL_CONTENTS_DELETE_POPUP)))
730 AppLogDebug("Construct(IDL_CONTENTS_DELETE_POPUP))) failed(%s)", GetErrorMessage(GetLastResult()));
734 Button* pDeleteButton = static_cast<Button*>(pDeletePopup->GetControl(IDC_DELETE_BUTTON));
735 pDeleteButton->SetText(ResourceManager::GetString(L"IDS_MUSIC_OPT_DELETE"));
736 pDeleteButton->SetActionId(deleteActionId);
737 pDeleteButton->AddActionEventListener(listener);
739 Button* CancelButton = static_cast<Button*>(pDeletePopup->GetControl(IDC_CANCEL_BUTTON));
740 CancelButton->SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT_CANCEL"));
741 CancelButton->SetActionId(cancelActionId);
742 CancelButton->AddActionEventListener(listener);
744 Label* pDeleteQustionLabel = static_cast<Label*>(pDeletePopup->GetControl(IDC_LABEL_DELETE_Q));
745 pDeleteQustionLabel->SetText(ResourceManager::GetString(L"IDS_MUSIC_POP_DELETE_Q"));
751 Tizen::Ui::Controls::TableViewContextItem*
752 CommonUtil::CreateTableViewContextItemN(Tizen::Ui::IActionEventListener& listener, int itemWidth, FlickMenuStyle menuStyle)
754 AppLogDebug("ENTER");
755 Panel* pItem = CommonUtil::CreateFlickMenuN(listener, menuStyle);
758 AppLogDebug("CommonUtil::CreateSweepMenuItemN failed");
762 TableViewContextItem* pTableViewContextItem = new (std::nothrow) TableViewContextItem();
763 if (IsFailed(pTableViewContextItem->Construct(Dimension(itemWidth, ITEM_HEIGHT))))
765 AppLogDebug("Construct(Dimension(GetWidth(), ITEM_HEIGHT) failed(%s)", GetErrorMessage(GetLastResult()));
767 delete pTableViewContextItem;
771 pTableViewContextItem->AddControl(*pItem);
772 pTableViewContextItem->SetIndividualSelectionEnabled(pItem, true);
775 return pTableViewContextItem;
778 Tizen::Ui::Controls::Panel*
779 CommonUtil::CreateFlickMenuN(Tizen::Ui::IActionEventListener& listener, FlickMenuStyle menuStyle)
781 AppLogDebug("ENTER");
782 Panel* pFlickMenuPanel = new (std::nothrow) Panel();
783 if (menuStyle ==FLICK_MENU_STYLE_TYPE_01)
785 if (IsFailed(pFlickMenuPanel->Construct(IDL_SWEEP_QUICK_MENU_ITEM_PANEL)))
787 AppLogDebug("Construct(IDL_SWEEP_QUICK_MENU_ITEM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
788 delete pFlickMenuPanel;
792 else if (menuStyle == FLICK_MENU_STYLE_TYPE_02)
794 if (IsFailed(pFlickMenuPanel->Construct(IDL_SWEEP_QUICK_ALBUM_PANEL)))
796 AppLogDebug("Construct(IDL_SWEEP_QUICK_ALBUM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
797 delete pFlickMenuPanel;
801 else if (menuStyle == FLICK_MENU_STYLE_TYPE_03)
803 if (IsFailed(pFlickMenuPanel->Construct(IDL_SWEEP_QUICK_PLAYALL_ITEM_PANEL)))
805 AppLogDebug("Construct(IDL_SWEEP_QUICK_ALBUM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
806 delete pFlickMenuPanel;
810 else if (menuStyle == FLICK_MENU_STYLE_TYPE_04)
812 if (IsFailed(pFlickMenuPanel->Construct(IDL_SWEEP_QUICK_ITEM2_PANEL)))
814 AppLogDebug("Construct(IDL_SWEEP_QUICK_ALBUM_PANEL) failed(%s)", GetErrorMessage(GetLastResult()));
815 delete pFlickMenuPanel;
822 delete pFlickMenuPanel;
826 if (menuStyle & FLICK_MENU_ITEM_SHARE)
828 Button* pShareButton = static_cast<Button*>(pFlickMenuPanel->GetControl(IDC_SHARE_BUTTON));
829 pShareButton->SetText(ResourceManager::GetString(L"IDS_MUSIC_BUTTON_SHARE"));
830 pShareButton->SetActionId(IDA_FLICK_MENU_ITEM_SHARE);
831 pShareButton->AddActionEventListener(listener);
834 if (menuStyle & FLICK_MENU_ITEM_SET_AS)
836 Button* pSetButton = static_cast<Button*>(pFlickMenuPanel->GetControl(IDC_SET_AS_BUTTON));
837 pSetButton->SetText(ResourceManager::GetString(L"IDS_COM_SK_SET_AS"));
838 pSetButton->SetActionId(IDA_FLICK_MENU_ITEM_SET_AS);
839 pSetButton->AddActionEventListener(listener);
842 if (menuStyle & FLICK_MENU_ITEM_ADDTO)
844 Button* pAddToPlaylistButton = static_cast<Button*>(pFlickMenuPanel->GetControl(IDC_ADD_TO_BUTTON));
845 pAddToPlaylistButton->SetText(ResourceManager::GetString(L"IDS_MUSIC_OPT_ADD_TO"));
846 pAddToPlaylistButton->SetActionId(IDA_FLICK_MENU_ITEM_ADDTO);
847 pAddToPlaylistButton->AddActionEventListener(listener);
850 if (menuStyle & FLICK_MENU_ITEM_DELETE)
852 Button* pDeleteButton = static_cast<Button*>(pFlickMenuPanel->GetControl(IDC_BUTTON_DELETE));
853 pDeleteButton->SetText(ResourceManager::GetString("IDS_MUSIC_SK3_DELETE"));
854 pDeleteButton->SetActionId(IDA_FLICK_MENU_ITEM_DELETE);
855 pDeleteButton->AddActionEventListener(listener);
858 if (menuStyle & FLICK_MENU_ITEM_PLAYALL)
860 Button* pDeleteButton = static_cast<Button*>(pFlickMenuPanel->GetControl(IDC_PLAY_ALL_BUTTON));
861 pDeleteButton->SetText(ResourceManager::GetString("IDS_MUSIC_OPT_MOREMENU_PLAY_ALL"));
862 pDeleteButton->SetActionId(IDA_FLICK_MENU_ITEM_PLAYALL);
863 pDeleteButton->AddActionEventListener(listener);
867 return pFlickMenuPanel;
871 CommonUtil::GetStringItemSelected(int itemCount)
873 AppLogDebug("ENTER");
874 String StrSelectStr = null;
876 if (itemCount > INIT_VALUE)
880 String ResSelect = ResourceManager::GetString("IDS_VR_POP_1_ITEM_SELECTED");
881 StrSelectStr.Format(STRING_LENGTH, ResSelect.GetPointer());
885 String ResSelect = ResourceManager::GetString("IDS_VR_POP_PD_ITEMS_SELECTED");
886 StrSelectStr.Format(STRING_LENGTH, ResSelect.GetPointer(), itemCount);
891 // StrSelectStr.Format(STRING_LENGTH, L"Select <Noun>s");//NEED STRING
898 CommonUtil::SetShowStateVariableHeightSizeControl(Tizen::Ui::Control& control, int controlHeight, bool isShow)
900 AppLogDebug("ENTER");
901 CommonUtil::SetShowStateControl(control, isShow);
902 CommonUtil::SetVariableHeightSizeControl(control, controlHeight);
903 control.Invalidate(true);
909 CommonUtil::SetVariableHeightSizeControl(Tizen::Ui::Control& control, int controlHeight)
911 AppLogDebug("ENTER");
912 if (control.GetHeight() != controlHeight)
914 control.SetSize(control.GetWidth(), controlHeight);
919 Tizen::Ui::Controls::ContextMenu*
920 CommonUtil::CreateContextMenuN(const Tizen::Ui::Control& source, Tizen::Ui::IActionEventListener& listener)
922 AppLogDebug("ENTER");
923 SceneManager* pSceneManager = SceneManager::GetInstance();
924 AppAssert(pSceneManager);
926 Scene* pScene = pSceneManager->GetCurrentScene();
928 Form *pForm = pScene->GetForm();
931 int screenHeight = pForm->GetHeight();
932 Point convertPosition = source.ConvertToScreenPosition(Point(source.GetWidth() / 2, 0));
933 Point itemPoint(convertPosition.x, convertPosition.y + source.GetHeight());
935 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
936 if (itemPoint.y > screenHeight / 2)
938 itemPoint.y = itemPoint.y - source.GetHeight();
939 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
942 ContextMenu* pContextMenu = new (std::nothrow) ContextMenu();
943 pContextMenu->Construct(Point(INIT_VALUE, INIT_VALUE), CONTEXT_MENU_STYLE_LIST, direction);
944 pContextMenu->SetName(L"IDC_CONTEXT_MENU");
945 pContextMenu->AddActionEventListener(listener);
946 pContextMenu->SetAnchorPosition(itemPoint);
947 pContextMenu->SetMaxVisibleItemsCount(5);
948 pContextMenu->SetShowState(true);
955 CommonUtil::AddContextMenuItem(Tizen::Ui::Controls::ContextMenu& contextMenu, unsigned int contextMenuItemStyle)
957 AppLogDebug("ENTER");
958 if (CONTEXT_MENU_ITEM_STYLE_CALL & contextMenuItemStyle)
960 // IDA_CONTEXT_MENU_ITEM_CALL
961 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_CALL_RINGTONE"), IDA_CONTEXT_MENU_ITEM_CALL);
964 if (CONTEXT_MENU_ITEM_STYLE_SEARCH & contextMenuItemStyle)
966 // IDA_CONTEXT_MENU_ITEM_SEARCH
967 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"), IDA_CONTEXT_MENU_ITEM_SEARCH);
970 if (CONTEXT_MENU_ITEM_STYLE_BLUETOOTH & contextMenuItemStyle)
972 // IDA_CONTEXT_MENU_ITEM_BLUETOOTH
973 contextMenu.AddItem(L"Bluetooth", IDA_CONTEXT_MENU_ITEM_BLUETOOTH);//NEED STRING
976 if (CONTEXT_MENU_ITEM_STYLE_MESSAGE & contextMenuItemStyle)
978 // IDA_CONTEXT_MENU_ITEM_MESSAGE
979 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_CONTEXT_MENU_ITEM_MESSAGE);
982 if (CONTEXT_MENU_ITEM_STYLE_ALARM & contextMenuItemStyle)
984 // IDA_CONTEXT_MENU_ITEM_ALARM
985 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_SETAS_ALARM_TONE"), IDA_CONTEXT_MENU_ITEM_ALARM);
988 if (CONTEXT_MENU_ITEM_STYLE_EMAIL & contextMenuItemStyle)
990 // IDA_CONTEXT_MENU_ITEM_EMAIL
991 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXT_MENU_ITEM_EMAIL);
994 if (CONTEXT_MENU_ITEM_STYLE_SETTINGS & contextMenuItemStyle)
996 // IDA_CONTEXT_MENU_ITEM_SETTINGS
997 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_CONTEXT_MENU_ITEM_SETTINGS);
1000 if (CONTEXT_MENU_ITEM_STYLE_FOLDER_VIEW & contextMenuItemStyle)
1002 // IDA_CONTEXT_MENU_ITEM_FOLDER_VIEW
1003 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MSGF_SK3_FOLDER_VIEW"), IDA_CONTEXT_MENU_ITEM_FOLDER_VIEW);
1006 if (CONTEXT_MENU_ITEM_STYLE_CREATE_PLAYLIST & contextMenuItemStyle)
1008 // IDA_CONTEXT_MENU_ITEM_CREATE_PLAYLIST
1009 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_CREATE_PLAYLIST"), IDA_CONTEXT_MENU_ITEM_CREATE_PLAYLIST);
1012 if (CONTEXT_MENU_ITEM_STYLE_SHARE_VIA & contextMenuItemStyle)
1014 // IDA_CONTEXT_MENU_ITEM_SHARE_VIA
1015 contextMenu.AddItem(ResourceManager::GetString(L"IDS_IV_BODY_SHARE_VIA"), IDA_CONTEXT_MENU_ITEM_SHARE_VIA);
1018 if (CONTEXT_MENU_ITEM_STYLE_EDIT & contextMenuItemStyle)
1020 // IDA_CONTEXT_MENU_ITEM_EDIT
1021 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"), IDA_CONTEXT_MENU_ITEM_EDIT);
1024 if (CONTEXT_MENU_ITEM_STYLE_CALLER & contextMenuItemStyle)
1026 // IDA_CONTEXT_MENU_ITEM_CALLER
1027 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_SETAS_CALLER_RINGTONE"), IDA_CONTEXT_MENU_ITEM_CALLER);
1030 if (CONTEXT_MENU_ITEM_STYLE_GO_TO_LIBARY & contextMenuItemStyle)
1032 // IDA_CONTEXT_MENU_ITEM_GO_TO_LIBARY
1033 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_GO_TO_LIBRARY"), IDA_CONTEXT_MENU_ITEM_GO_TO_LIBARY);
1036 if (CONTEXT_MENU_ITEM_STYLE_ADD & contextMenuItemStyle)
1038 // IDA_CONTEXT_MENU_ITEM_STYLE_ADD
1039 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_OPT_ADD"), IDA_CONTEXT_MENU_ITEM_STYLE_ADD);
1042 if (CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST & contextMenuItemStyle)
1044 // IDA_CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST
1045 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_BODY_ADD_TO_PLAYLIST"), IDA_CONTEXT_MENU_ITEM_STYLE_ADD_TO_PLAYLIST);
1048 if (CONTEXT_MENU_ITEM_STYLE_SET_AS & contextMenuItemStyle)
1050 // IDA_CONTEXT_MENU_ITEM_STYLE_SET_AS
1051 contextMenu.AddItem(ResourceManager::GetString(L"IDS_MUSIC_SK3_SET_AS"), IDA_CONTEXT_MENU_ITEM_STYLE_SET_AS);
1054 if (CONTEXT_MENU_ITEM_STYLE_DETAILS & contextMenuItemStyle)
1056 // IDA_CONTEXT_MENU_ITEM_STYLE_DETAILS
1057 contextMenu.AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"), IDA_CONTEXT_MENU_ITEM_STYLE_DETAILS);
1060 if (CONTEXT_MENU_ITEM_STYLE_SOUND_PATH & contextMenuItemStyle)
1062 // IDA_CONTEXT_MENU_ITEM_STYLE_SOUND_PATH
1063 contextMenu.AddItem(L"Sound Path", IDA_CONTEXT_MENU_ITEM_STYLE_SOUND_PATH);//NEED STRING
1065 AppLogDebug("EXIT");
1069 CommonUtil::IsVaildContextMenuItemActionId(int actionId)
1071 AppLogDebug("ENTER");
1072 if (actionId >= IDA_CONTEXT_MENU_ITEM_BASE && actionId < IDA_CONTEXT_MENU_ITEM_MAX)
1076 AppLogDebug("EXIT");
1081 CommonUtil::IsVaildCommonPopupActionId(int actionId)
1083 AppLogDebug("ENTER");
1084 if (actionId >= IDA_COMMON_POPUP_BASE && actionId < IDA_COMMON_POPUP_MAX)
1088 AppLogDebug("EXIT");
1093 CommonUtil::ShowContextMenu(Tizen::Ui::Controls::ContextMenu& contextMenu, bool isShow)
1095 AppLogDebug("ENTER");
1096 CommonUtil::SetShowStateControl(contextMenu, isShow);
1101 AppLogDebug("EXIT");
1105 CommonUtil::SetShowStateControl(Tizen::Ui::Control& control, bool isShow)
1107 AppLogDebug("ENTER");
1108 if (control.GetShowState() != isShow)
1110 control.SetShowState(isShow);
1111 control.Invalidate(true);
1115 AppLogDebug("EXIT");
1120 CommonUtil::SetSimpleTitleStyle(Tizen::Ui::Controls::Header& pHeader, const Tizen::Base::String& titleText)
1122 AppLogDebug("ENTER");
1123 pHeader.RemoveAllButtons();
1124 pHeader.RemoveAllItems();
1126 pHeader.SetStyle(HEADER_STYLE_TITLE);
1127 pHeader.SetTitleText(titleText);
1128 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
1129 pHeader.Invalidate(true);
1130 AppLogDebug("EXIT");
1134 CommonUtil::SetTitleWithSearchIconStyle(Tizen::Ui::Controls::Header& pHeader, const Tizen::Base::String& titleText,
1135 const Tizen::Base::String& descriptionText, int actionId)
1137 AppLogDebug("ENTER");
1138 pHeader.RemoveAllButtons();
1139 pHeader.RemoveAllItems();
1141 pHeader.SetStyle(HEADER_STYLE_TITLE);
1142 pHeader.SetTitleText(titleText);
1144 ButtonItem buttonItem;
1145 buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, actionId);
1147 // CommonUtil::SetButtonItemIcon(buttonItem, L"T02_icon_search.png", L"T02_icon_search.png", L"T02_icon_search.png");
1148 pHeader.SetButton(BUTTON_POSITION_RIGHT, buttonItem);
1149 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
1150 AppLogDebug("EXIT");
1154 CommonUtil::SetTitleDescriptionWithIconStyle(Tizen::Ui::Controls::Header& pHeader, const Tizen::Base::String& titleText,
1155 Tizen::Base::String& descriptionText, int actionId, Tizen::Graphics::Bitmap* icon)
1157 AppLogDebug("ENTER");
1158 pHeader.RemoveAllButtons();
1159 pHeader.RemoveAllItems();
1161 pHeader.SetStyle(HEADER_STYLE_TITLE);
1162 pHeader.SetTitleText(titleText);
1163 pHeader.SetDescriptionText(descriptionText);
1165 ButtonItem buttonItem;
1166 buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, actionId);
1168 // CommonUtil::SetIconButtonItem(buttonItem, icon, icon, null);
1169 // CommonUtil::SetButtonItemIcon(buttonItem, L"T02_icon_search.png", L"T02_icon_search.png", L"T02_icon_search.png");
1170 pHeader.SetButton(BUTTON_POSITION_RIGHT, buttonItem);
1172 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
1173 pHeader.SetDescriptionTextColor(COLOR_HEADER_DESCRIPTION_TEXT);
1174 AppLogDebug("EXIT");
1178 CommonUtil::SetTitleDescriptionStyle(Tizen::Ui::Controls::Header& pHeader, const Tizen::Base::String& titleText, const Tizen::Base::String& descriptionText)
1180 AppLogDebug("ENTER");
1181 pHeader.RemoveAllButtons();
1182 pHeader.RemoveAllItems();
1184 pHeader.SetStyle(HEADER_STYLE_TITLE);
1185 pHeader.SetTitleText(titleText);
1186 pHeader.SetDescriptionText(descriptionText);
1188 pHeader.SetTitleTextColor(COLOR_HEADER_TITLE_TEXT);
1189 pHeader.SetDescriptionTextColor(COLOR_HEADER_DESCRIPTION_TEXT);
1190 AppLogDebug("EXIT");
1193 Tizen::Ui::Controls::Footer*
1194 CommonUtil::CreateContentListFooter(const Tizen::Ui::Controls::Form& form)
1196 AppLogDebug("ENTER");
1197 Footer* pFooter = form.GetFooter();
1198 if (pFooter == null)
1200 AppLogDebug("EXIT");
1205 ButtonItem AddButtonItem;
1206 ButtonItem backButtonItem;
1207 FooterItem searchButtonItem;
1209 AddButtonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1210 AddButtonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pAddButtonImage);
1212 backButtonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_BACK);
1213 backButtonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBackButtonImage);
1215 searchButtonItem.Construct(IDA_FOOTER_BUTTON_SEARCH);
1216 searchButtonItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pSearchButtonImage);
1218 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_ICON);
1220 pFooter->SetButton(BUTTON_POSITION_LEFT, AddButtonItem);
1221 pFooter->SetButton(BUTTON_POSITION_RIGHT, backButtonItem);
1222 pFooter->AddItem(searchButtonItem);
1224 FooterItem AddButtonItem;
1225 FooterItem searchButtonItem;
1227 AddButtonItem.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1228 AddButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BODY_ADD_TO_PLAYLIST"));
1230 searchButtonItem.Construct(IDA_FOOTER_BUTTON_SEARCH);
1231 searchButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
1233 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1235 pFooter->AddItem(AddButtonItem);
1236 pFooter->AddItem(searchButtonItem);
1239 AppLogDebug("EXIT");
1243 Tizen::Ui::Controls::Footer*
1244 CommonUtil::CreatePlaylistEditFooter(const Tizen::Ui::Controls::Form& form)
1246 AppLogDebug("ENTER");
1247 Footer* pFooter = form.GetFooter();
1248 if (pFooter == null)
1250 AppLogDebug("EXIT");
1254 FooterItem deleteButtonItem;
1255 FooterItem cancelButtonItem;
1257 deleteButtonItem.Construct(IDA_FOOTER_BUTTON_DELETE);
1258 deleteButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_OPT_DELETE"));
1260 cancelButtonItem.Construct(IDA_FOOTER_BUTTON_CANCEL);
1261 cancelButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT_CANCEL"));
1263 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1265 pFooter->AddItem(deleteButtonItem);
1266 pFooter->AddItem(cancelButtonItem);
1268 AppLogDebug("EXIT");
1272 Tizen::Ui::Controls::Footer*
1273 CommonUtil::CreateDefaultPlaylistContentListFooter(const Tizen::Ui::Controls::Form& form)
1275 AppLogDebug("ENTER");
1276 Footer* pFooter = form.GetFooter();
1277 if (pFooter == null)
1279 AppLogDebug("EXIT");
1283 FooterItem editButtonItem;
1284 FooterItem createPlaylistButtonItem;
1285 FooterItem searchButtonItem;
1287 editButtonItem.Construct(IDA_FOOTER_BUTTON_EDIT);
1288 editButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
1289 createPlaylistButtonItem.Construct(IDA_FOOTER_BUTTON_CREATE_PLAYLIST);
1290 createPlaylistButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BODY_CREATE_PLAYLIST"));
1292 searchButtonItem.Construct(IDA_FOOTER_BUTTON_SEARCH);
1293 searchButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
1295 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1297 pFooter->AddItem(editButtonItem);
1298 pFooter->AddItem(createPlaylistButtonItem);
1299 pFooter->AddItem(searchButtonItem);
1301 AppLogDebug("EXIT");
1305 Tizen::Ui::Controls::Footer*
1306 CommonUtil::CreateUserPlaylistContentListFooter(const Tizen::Ui::Controls::Form& form)
1308 AppLogDebug("ENTER");
1309 Footer* pFooter = form.GetFooter();
1310 if (pFooter == null)
1312 AppLogDebug("EXIT");
1316 FooterItem editButtonItem;
1317 FooterItem AddButtonItem;
1318 // FooterItem searchButtonItem;
1320 editButtonItem.Construct(IDA_FOOTER_BUTTON_EDIT);
1321 editButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
1323 AddButtonItem.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1324 AddButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BODY_ADD_TO_PLAYLIST"));
1326 // searchButtonItem.Construct(IDA_FOOTER_BUTTON_SEARCH);
1327 // searchButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
1329 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1331 pFooter->AddItem(editButtonItem);
1332 pFooter->AddItem(AddButtonItem);
1333 // pFooter->AddItem(searchButtonItem);
1335 AppLogDebug("EXIT");
1339 Tizen::Ui::Controls::Footer*
1340 CommonUtil::CreateAddtoPlaylistPickerFooter(const Tizen::Ui::Controls::Form& form)
1342 AppLogDebug("ENTER");
1343 Footer* pFooter = form.GetFooter();
1344 if (pFooter == null)
1346 AppLogDebug("EXIT");
1351 ButtonItem AddButtonItem;
1352 ButtonItem CancelButtonItem;
1354 AddButtonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1355 AddButtonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pAddButtonImage);
1357 CancelButtonItem.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_CANCEL);
1358 CancelButtonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pCancelButtonImage);
1360 pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_ICON);
1362 pFooter->SetButton(BUTTON_POSITION_LEFT, AddButtonItem);
1363 pFooter->SetButton(BUTTON_POSITION_RIGHT, CancelButtonItem);
1365 FooterItem AddButtonItem;
1366 FooterItem CancelButtonItem;
1368 AddButtonItem.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1369 AddButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BODY_ADD_TO_PLAYLIST"));
1371 CancelButtonItem.Construct(IDA_FOOTER_BUTTON_CANCEL);
1372 CancelButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT_CANCEL"));
1374 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1376 pFooter->AddItem(AddButtonItem);
1377 pFooter->AddItem(CancelButtonItem);
1380 AppLogDebug("EXIT");
1384 Tizen::Ui::Controls::Footer*
1385 CommonUtil::CreateAddtoPlaylistFooter(const Tizen::Ui::Controls::Form& form)
1387 AppLogDebug("ENTER");
1388 Footer* pFooter = form.GetFooter();
1389 if (pFooter == null)
1391 AppLogDebug("EXIT");
1395 FooterItem AddButtonItem;
1397 AddButtonItem.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1398 AddButtonItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BODY_ADD_TO_PLAYLIST"));
1399 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1400 pFooter->AddItem(AddButtonItem);
1402 AppLogDebug("EXIT");
1406 Tizen::Ui::Controls::Footer*
1407 CommonUtil::CreateEditContentListFooter(const Tizen::Ui::Controls::Form& form)
1409 AppLogDebug("ENTER");
1410 Footer* pFooter = form.GetFooter();
1411 if (pFooter == null)
1413 AppLogDebug("EXIT");
1416 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1418 FooterItem editButtonItem;
1419 FooterItem searchButtonItem;
1421 editButtonItem.Construct(IDA_FOOTER_BUTTON_EDIT);
1422 editButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
1424 searchButtonItem.Construct(IDA_FOOTER_BUTTON_SEARCH);
1425 searchButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
1427 pFooter->AddItem(editButtonItem);
1428 pFooter->AddItem(searchButtonItem);
1430 AppLogDebug("EXIT");
1434 Tizen::Ui::Controls::Footer*
1435 CommonUtil::CreateEditFooter(const Tizen::Ui::Controls::Form& form)
1437 AppLogDebug("ENTER");
1438 Footer* pFooter = form.GetFooter();
1439 if (pFooter == null)
1441 AppLogDebug("EXIT");
1444 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1446 FooterItem editButtonItem;
1447 editButtonItem.Construct(IDA_FOOTER_BUTTON_EDIT);
1448 editButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
1449 pFooter->AddItem(editButtonItem);
1451 AppLogDebug("EXIT");
1455 Tizen::Ui::Controls::Footer*
1456 CommonUtil::CreateDeleteFooter(const Tizen::Ui::Controls::Form& form)
1458 AppLogDebug("ENTER");
1459 Footer* pFooter = form.GetFooter();
1460 if (pFooter == null)
1462 AppLogDebug("EXIT");
1465 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1467 FooterItem deleteFooterItem;
1468 deleteFooterItem.Construct(IDA_FOOTER_BUTTON_DELETE);
1469 deleteFooterItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_SK3_DELETE"));
1471 FooterItem shareFooterItem;
1472 shareFooterItem.Construct(IDA_FOOTER_BUTTON_SHARE);
1473 shareFooterItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BUTTON_SHARE"));
1475 FooterItem addToPlaylistFooterItem;
1476 addToPlaylistFooterItem.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1477 addToPlaylistFooterItem.SetText(ResourceManager::GetString(L"IDS_MUSIC_BUTTON2_ADD_TO_PLAYLIST"));
1479 FooterItem cancelFooterItem;
1480 cancelFooterItem.Construct(IDA_FOOTER_BUTTON_CANCEL);
1481 cancelFooterItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT_CANCEL"));
1483 pFooter->AddItem(deleteFooterItem);
1484 pFooter->AddItem(shareFooterItem);
1485 pFooter->AddItem(addToPlaylistFooterItem);
1486 pFooter->AddItem(cancelFooterItem);
1488 pFooter->SetItemEnabled(INDEX_FOOTER_DELETE, false);
1489 pFooter->SetItemEnabled(INDEX_FOOTER_SHARE, false);
1490 pFooter->SetItemEnabled(INDEX_FOOTER_ADDTOPLATLIST, false);
1492 AppLogDebug("EXIT");
1496 Tizen::Ui::Controls::Footer*
1497 CommonUtil::CreateCancelFooter(const Tizen::Ui::Controls::Form& form)
1499 AppLogDebug("ENTER");
1500 Footer* pFooter = form.GetFooter();
1501 if (pFooter == null)
1503 AppLogDebug("EXIT");
1507 pFooter->SetBackButton();
1508 AppLogDebug("EXIT");
1512 Tizen::Ui::Controls::Footer*
1513 CommonUtil::CreateBackButtonStyleFooter(const Tizen::Ui::Controls::Form& form, FooterButtonStyle style)
1515 AppLogDebug("ENTER");
1516 Footer* pFooter = form.GetFooter();
1517 if (pFooter == null)
1519 AppLogDebug("EXIT");
1522 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1526 case STYLE_MORE_ADD:
1528 Bitmap* bitmapMore = ResourceManager::GetBitmapN(L"00_icon_more_ef.png");
1529 Bitmap* bitmapMorePress = ResourceManager::GetBitmapN(L"00_icon_more.png");
1531 ButtonItem buttonItemMore;
1532 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
1533 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, bitmapMore);
1534 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, bitmapMorePress);
1535 pFooter->SetButton(BUTTON_POSITION_LEFT,buttonItemMore);
1538 delete bitmapMorePress;
1542 case STYLE_ADDTO_DELETE_ADD:
1544 FooterItem footerItemAddto;
1545 footerItemAddto.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1546 footerItemAddto.SetText(ResourceManager::GetString(L"IDS_MUSIC_OPT_ADD_TO"));
1548 FooterItem footerItemDelete;
1549 footerItemDelete.Construct(IDA_FOOTER_BUTTON_DELETE);
1550 footerItemDelete.SetText(ResourceManager::GetString(L"IDS_MUSIC_SK3_DELETE"));
1552 pFooter->AddItem(footerItemAddto);
1553 pFooter->AddItem(footerItemDelete);
1557 case STYLE_SHARE_ADD:
1559 FooterItem footerItemShare;
1560 footerItemShare.Construct(IDA_FOOTER_BUTTON_SHARE);
1561 footerItemShare.SetText(ResourceManager::GetString(L"IDS_MUSIC_BUTTON_SHARE"));
1563 pFooter->AddItem(footerItemShare);
1567 case STYLE_DELETE_ADD:
1569 FooterItem footerItemDelete;
1570 footerItemDelete.Construct(IDA_FOOTER_BUTTON_DELETE);
1571 footerItemDelete.SetText(ResourceManager::GetString(L"IDS_MUSIC_SK3_DELETE"));
1573 pFooter->AddItem(footerItemDelete);
1579 FooterItem footerItemAdd;
1580 footerItemAdd.Construct(IDA_FOOTER_BUTTON_ADD);
1581 footerItemAdd.SetText(ResourceManager::GetString(L"IDS_MUSIC_SK_ADD_LITE"));
1583 pFooter->AddItem(footerItemAdd);
1590 pFooter->SetBackButton();
1591 AppLogDebug("EXIT");
1596 CommonUtil::SetBackButtonStyleFooter(Tizen::Ui::Controls::Footer& footer, FooterButtonStyle style)
1598 AppLogDebug("ENTER");
1599 footer.RemoveAllButtons();
1600 footer.RemoveAllItems();
1601 footer.SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1604 case STYLE_MORE_ADD:
1606 Bitmap* bitmapMore = ResourceManager::GetBitmapN(L"00_icon_more_web.png");
1607 Bitmap* bitmapMorePress = ResourceManager::GetBitmapN(L"00_icon_more_press_web.png");
1608 ButtonItem buttonItemMore;
1609 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
1610 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, bitmapMore);
1611 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, bitmapMorePress);
1612 footer.SetButton(BUTTON_POSITION_LEFT,buttonItemMore);
1614 delete bitmapMorePress;
1618 case STYLE_ADDTO_DELETE_ADD:
1620 FooterItem footerItemAddto;
1621 footerItemAddto.Construct(IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST);
1622 footerItemAddto.SetText(ResourceManager::GetString(L"IDS_MUSIC_OPT_ADD_TO"));
1623 FooterItem footerItemDelete;
1624 footerItemDelete.Construct(IDA_FOOTER_BUTTON_DELETE);
1625 footerItemDelete.SetText(ResourceManager::GetString(L"IDS_MUSIC_SK3_DELETE"));
1626 footer.AddItem(footerItemAddto);
1627 footer.AddItem(footerItemDelete);
1631 case STYLE_SHARE_ADD:
1633 FooterItem footerItemShare;
1634 footerItemShare.Construct(IDA_FOOTER_BUTTON_SHARE);
1635 footerItemShare.SetText(ResourceManager::GetString(L"IDS_MUSIC_BUTTON_SHARE"));
1636 footer.AddItem(footerItemShare);
1640 case STYLE_MORE_EDIT_ADD:
1642 footer.SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
1644 Bitmap* bitmapMore = ResourceManager::GetBitmapN(L"00_icon_more_web.png");
1645 Bitmap* bitmapMorePress = ResourceManager::GetBitmapN(L"00_icon_more_press_web.png");
1647 ButtonItem buttonItemMore;
1648 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
1649 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, bitmapMore);
1650 buttonItemMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, bitmapMorePress);
1651 footer.SetButton(BUTTON_POSITION_LEFT,buttonItemMore);
1654 delete bitmapMorePress;
1656 FooterItem editButtonItem;
1657 editButtonItem.Construct(IDA_FOOTER_BUTTON_EDIT);
1658 editButtonItem.SetText(ResourceManager::GetString(L"IDS_COM_BODY_EDIT"));
1659 footer.AddItem(editButtonItem);
1666 footer.SetBackButton();
1667 AppLogDebug("EXIT");
1671 CommonUtil::GetContentInformationN(const Tizen::Content::AudioContentInfo& audioContentInfo)
1673 AppLogDebug("ENTER");
1674 ContentInformation* pContentInfoStruct = new (std::nothrow) ContentInformation();
1676 pContentInfoStruct->contentId = audioContentInfo.GetContentId();
1677 pContentInfoStruct->GenreName = audioContentInfo.GetGenre();
1678 pContentInfoStruct->ArtistName = audioContentInfo.GetArtist();
1679 pContentInfoStruct->ComposerName = audioContentInfo.GetComposer();
1680 pContentInfoStruct->AlbumName = audioContentInfo.GetAlbumName();
1681 pContentInfoStruct->TitleName = audioContentInfo.GetTitle();
1682 pContentInfoStruct->ContentFilePath = audioContentInfo.GetContentPath();
1684 pContentInfoStruct->ReleaseYear = audioContentInfo.GetReleaseYear();
1685 pContentInfoStruct->Duration = audioContentInfo.GetDuration();
1686 pContentInfoStruct->contentId = audioContentInfo.GetContentId();
1688 AppLogDebug("EXIT");
1689 return pContentInfoStruct;
1693 CommonUtil::CreateTableViewItem(Tizen::Ui::Container& parent,
1694 const Tizen::Graphics::Bitmap& thumbnail,
1695 const Tizen::Base::String& itemName,
1698 AppLogDebug("ENTER");
1700 int X_Gap = W_THUMBNAIL + (X_GAP_THUMBNAIL * 2);
1701 int W_Label = W_CLIENT_AREA - (X_Gap + W_CREATE_TABLE_VIEW_ITEM_COUNT_LABEL_ITEM);
1703 Label* pSongThumbnailLabel = new (std::nothrow) Label();
1704 pSongThumbnailLabel->Construct(Rectangle(X_GAP_THUMBNAIL, Y_GAP_THUMBNAIL, W_THUMBNAIL, H_THUMBNAIL), L"");
1705 pSongThumbnailLabel->SetBackgroundBitmap(thumbnail);
1706 pSongThumbnailLabel->SetName(L"pSongThumbnailLabel");
1708 parent.AddControl(*pSongThumbnailLabel);
1710 Label* pSongNameLabel = new (std::nothrow) Label();
1711 pSongNameLabel->Construct(Rectangle(X_Gap, Y_CREATE_TABLE_VIEW_ITEM, W_Label, H_CREATE_TABLE_VIEW_ITEM), L"");
1712 pSongNameLabel->SetTextConfig(FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
1713 pSongNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1714 pSongNameLabel->SetText(itemName);
1716 parent.AddControl(*pSongNameLabel);
1718 Label* pSongTimeLabel = new (std::nothrow) Label();
1719 pSongTimeLabel->Construct(Rectangle(pSongNameLabel->GetWidth() + X_Gap, pSongNameLabel->GetY(), W_CREATE_TABLE_VIEW_ITEM_COUNT_LABEL_ITEM, H_CREATE_TABLE_VIEW_ITEM), L"");
1720 pSongTimeLabel->SetTextConfig(FONT_SIZE - 2, LABEL_TEXT_STYLE_NORMAL);
1721 pSongTimeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1722 pSongTimeLabel->SetText(CommonUtil::SetSongsString(itemCount));
1724 parent.AddControl(*pSongTimeLabel);
1725 AppLogDebug("EXIT");
1729 CommonUtil::CreateEditListTableViewItem(Tizen::Ui::Container& parent,
1730 const Tizen::Graphics::Bitmap& thumbnail,
1731 const Tizen::Base::String& itemName,
1734 AppLogDebug("ENTER");
1735 result r = E_SUCCESS;
1737 int W_Label = W_CLIENT_AREA - (W_TABLE_VIEW_MARK + W_THUMBNAIL + W_CREATE_TABLE_VIEW_ITEM_COUNT_LABEL_ITEM);
1739 Label* pSongThumbnailLabel = new (std::nothrow) Label();
1740 pSongThumbnailLabel->Construct(Rectangle(0, Y_GAP_THUMBNAIL, W_THUMBNAIL, H_THUMBNAIL), L"");
1741 pSongThumbnailLabel->SetBackgroundBitmap(thumbnail);
1742 pSongThumbnailLabel->SetName(L"pSongThumbnailLabel");
1744 Label* pSongNameLabel = new (std::nothrow) Label();
1745 pSongNameLabel->Construct(Rectangle(pSongThumbnailLabel->GetWidth(), Y_CREATE_TABLE_VIEW_ITEM, W_Label, H_CREATE_TABLE_VIEW_ITEM), L"");
1746 pSongNameLabel->SetTextConfig(FONT_SIZE + 2, LABEL_TEXT_STYLE_NORMAL);
1747 pSongNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1748 pSongNameLabel->SetText(itemName);
1750 Label* pSongCountLabel = new (std::nothrow) Label();
1751 pSongCountLabel->Construct(Rectangle(pSongNameLabel->GetWidth() + W_THUMBNAIL, pSongNameLabel->GetY(), W_CREATE_TABLE_VIEW_ITEM_COUNT_LABEL_ITEM, H_CREATE_TABLE_VIEW_ITEM), L"");
1752 pSongCountLabel->SetTextConfig(FONT_SIZE - 2, LABEL_TEXT_STYLE_NORMAL);
1753 pSongCountLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1754 pSongCountLabel->SetText(CommonUtil::SetSongsString(itemCount));
1756 parent.AddControl(*pSongThumbnailLabel);
1757 parent.AddControl(*pSongNameLabel);
1758 parent.AddControl(*pSongCountLabel);
1759 AppLogDebug("EXIT");
1764 CommonUtil::CreateTableViewContextItem(Tizen::Ui::Controls::TableViewContextItem& parent, Tizen::Ui::IActionEventListener& listener)
1766 AppLogDebug("ENTER");
1767 Button* pAddToPlaylistButton = new (std::nothrow) Button();
1768 pAddToPlaylistButton->Construct(Rectangle(X_GAP_CONTEXT_ITME, Y_GAP_CONTEXT_ITEM, parent.GetWidth() - (X_GAP_CONTEXT_ITME * 2), parent.GetHeight() - (Y_GAP_CONTEXT_ITEM * 2)));
1769 pAddToPlaylistButton->SetText(ResourceManager::GetString("IDS_MUSIC_BODY_ADD_TO_PLAYLIST"));
1770 pAddToPlaylistButton->SetTextSize(FONT_SIZE);
1771 pAddToPlaylistButton->SetActionId(IDA_FLICK_BUTTON_ADD_TO_PALYLIST);
1772 pAddToPlaylistButton->AddActionEventListener(listener);
1774 parent.SetIndividualSelectionEnabled(pAddToPlaylistButton, true);
1775 parent.AddControl(*pAddToPlaylistButton);
1777 AppLogDebug("EXIT");
1781 Tizen::Ui::Controls::TableView*
1782 CommonUtil::CreateEditorTableView(int width, int height)
1784 AppLogDebug("ENTER");
1785 TableView* pTableView = new (std::nothrow) TableView();
1786 pTableView->Construct(Rectangle(INIT_VALUE, H_SELECT_ALL_BUTTON, width, height - H_SELECT_ALL_BUTTON),
1788 TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
1789 AppLogDebug("EXIT");
1793 Tizen::Ui::Controls::TableView*
1794 CommonUtil::CreateTableView(int width, int height)
1796 AppLogDebug("ENTER");
1797 TableView* pTableView = new (std::nothrow) TableView();
1798 pTableView->Construct(Rectangle(0, 0, width, height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL);
1800 String retCountry = null;
1801 String indexText = null;
1803 Tizen::System::SettingInfo::GetValue("http://tizen.org/setting/locale.country", retCountry);
1804 if (retCountry.CompareTo("eng_GB") == 0)
1806 indexText.Append(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
1808 else if(retCountry.CompareTo("kor_KR") == 0)
1810 // indexText.Append(L"ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ");
1811 indexText.Append(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
1814 indexText.Append(L"#");
1815 indexText.Append(L"0");
1817 pTableView->SetFastScrollIndex(indexText, false);
1818 AppLogDebug("EXIT");
1823 CommonUtil::CreateContentPikerTableViewItem(Tizen::Ui::Controls::TableViewItem& parent, const Tizen::Base::String& songName, const Tizen::Base::String& songTime)
1825 AppLogDebug("ENTER");
1826 Label* pSongNameLabel = new (std::nothrow) Label();
1827 pSongNameLabel->Construct(Rectangle(0, Y_GAP_CONTENT_PIKER_ITEM, W_SONG_TITLE_CONTENT_PIKER_ITEM, H_SONG_TITLE_CONTENT_PIKER_ITEM), songName);
1828 pSongNameLabel->SetTextConfig(FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
1829 pSongNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1831 Label* pSongTimeLabel = new (std::nothrow) Label();
1832 pSongTimeLabel->Construct(Rectangle(pSongNameLabel->GetWidth(), Y_GAP_CONTENT_PIKER_ITEM, W_SONG_TIME_CONTENT_PIKER_ITEM, pSongNameLabel->GetHeight()), songTime);
1833 pSongTimeLabel->SetTextConfig(FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
1834 pSongTimeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1836 parent.AddControl(*pSongNameLabel);
1837 parent.AddControl(*pSongTimeLabel);
1839 AppLogDebug("EXIT");
1843 Tizen::Ui::Controls::CheckButton*
1844 CommonUtil::CreateSelectAllCheckedButton(int width)
1846 AppLogDebug("ENTER");
1847 CheckButton* pCheckButton = new (std::nothrow) CheckButton();
1848 pCheckButton->Construct(Rectangle(INIT_VALUE, INIT_VALUE, width, H_SELECT_ALL_BUTTON),
1849 CHECK_BUTTON_STYLE_MARK,
1850 BACKGROUND_STYLE_DEFAULT,
1852 ResourceManager::GetString("IDS_COM_BODY_SELECT_ALL"),
1853 GROUP_STYLE_BOTTOM);
1854 pCheckButton->SetActionId(IDA_CHECK_BUTTON, IDA_UNCHECK_BUTTON, INIT_VALUE);
1855 pCheckButton->SetColor(CHECK_BUTTON_STATUS_NORMAL, COLOR_SELECT_ALL);
1856 AppLogDebug("EXIT");
1857 return pCheckButton;
1860 Tizen::Ui::Controls::Label*
1861 CommonUtil::CreateCheckedCountLabel(int width, int height)
1863 AppLogDebug("ENTER");
1864 Label* pLabel = new (std::nothrow) Label();
1865 pLabel->Construct(Rectangle(INIT_VALUE, height - H_CHECKED_COUNT_LABEL, width, H_CHECKED_COUNT_LABEL), L"");
1866 pLabel->SetBackgroundColor(COLOR_SMALL_POPUP);
1867 pLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1868 pLabel->SetText(FONT_SIZE);
1869 AppLogDebug("EXIT");
1874 CommonUtil::SetAddtoPlaylistState(bool state)
1876 AppLogDebug("ENTER");
1877 __addToPlaylistState = state;
1878 AppLogDebug("EXIT");
1882 CommonUtil::GetAddtoPlaylistState(void)
1884 AppLogDebug("ENTER");
1885 AppLogDebug("EXIT");
1886 return __addToPlaylistState;
1890 CommonUtil::SetAddtoPlaylistName(const Tizen::Base::String& addToPlayName)
1892 AppLogDebug("ENTER");
1893 __AddToPlaylistName = addToPlayName;
1894 AppLogDebug("EXIT");
1898 CommonUtil::GetAddtoPlaylistName(void)
1900 AppLogDebug("ENTER");
1901 AppLogDebug("EXIT");
1902 return __AddToPlaylistName;
1906 CommonUtil::SetButtonEnabled(const Tizen::Ui::Controls::Form& form, int checkedItemCount, int actionId)
1908 AppLogDebug("ENTER");
1909 Footer* pFooter = form.GetFooter();
1910 if (pFooter == null)
1915 if (actionId == IDA_CHECK_BUTTON
1916 || actionId == IDA_UNCHECK_BUTTON
1917 || actionId == IDA_FOOTER_BUTTON_ADD_TO_PLAYLIST
1918 || actionId == IDA_FOOTER_BUTTON_DELETE)
1920 bool buttonState = checkedItemCount == 0 ? false : true;
1921 for (int iCount = 0; iCount < pFooter->GetItemCount() - 1; iCount++)
1923 pFooter->SetItemEnabled(iCount, buttonState);
1924 pFooter->Invalidate(true);
1927 else if (actionId == IDA_FOOTER_BUTTON_CANCEL)
1929 for (int iCount = 0; iCount < pFooter->GetItemCount() - 1; iCount++)
1931 pFooter->SetItemEnabled(iCount, true);
1932 pFooter->Invalidate(true);
1935 AppLogDebug("EXIT");
1939 CommonUtil::SetButtonEnabled(const Tizen::Ui::Controls::Form& form, int checkedItemCount)
1941 AppLogDebug("ENTER");
1942 Footer* pFooter = form.GetFooter();
1943 if (pFooter == null)
1948 bool buttonState = checkedItemCount == 0 ? false : true;
1949 for (int iCount = 0; iCount < pFooter->GetItemCount() - 1; iCount++)
1951 pFooter->SetItemEnabled(iCount, buttonState);
1952 pFooter->Invalidate(true);
1954 AppLogDebug("EXIT");
1958 CommonUtil::GetColorizedBitmapN(const Tizen::Graphics::Bitmap& bitmap, const Tizen::Graphics::Color& color)
1960 AppLogDebug("ENTER");
1961 if (bitmap.GetPixelColorFormat() != BITMAP_PIXEL_FORMAT_ARGB8888)
1965 std::unique_ptr<Bitmap>pRet(new (std::nothrow) Bitmap());
1970 result r = pRet->Construct(bitmap, Rectangle(0, 0, bitmap.GetWidth(), bitmap.GetHeight()));
1978 typedef unsigned long Pixel;
1979 Pixel* pDst = static_cast<Pixel*>(bi.pPixels);
1980 int dstPadding = bi.pitch / sizeof(Pixel) - bi.width;
1981 Pixel replacing = color.GetRGB32() & 0x00FFFFFF;
1982 for (int y = 0; y < bi.height; y++)
1984 for (int x = 0; x < bi.width; x++)
1986 *pDst = (*pDst & 0xFF000000) | replacing;
1993 AppLogDebug("EXIT");
1994 return pRet.release();
1998 CommonUtil::SetNoContentImage(Tizen::Ui::Controls::Label& source, Tizen::Base::String& resourceName, Tizen::Base::String& text)
2000 AppLogDebug("ENTER");
2001 Bitmap* pNoContentImage = ResourceManager::GetBitmapN(resourceName);
2002 source.SetBackgroundBitmap(*pNoContentImage);
2003 delete pNoContentImage;
2004 source.SetText(text);
2005 source.Invalidate(false);
2006 AppLogDebug("EXIT");
2010 CommonUtil::SetHighDepthToEllipsisPath(const Tizen::Base::String& fullFilePath)
2012 AppLogDebug("ENTER");
2013 StringTokenizer stringTokenizer(fullFilePath, IDS_SEPARATOR_SLASH);
2014 int depthCount = stringTokenizer.GetTokenCount() - DEPTH;
2015 if (depthCount <= INIT_VALUE)
2017 AppLogDebug("EXIT");
2018 return fullFilePath;
2021 String folderPath(L".");
2023 while (stringTokenizer.HasMoreTokens())
2026 stringTokenizer.GetNextToken(token);
2027 if (iLoopCount >= depthCount)
2029 folderPath.Append(IDS_SEPARATOR_SLASH);
2030 folderPath.Append(token);
2035 AppLogDebug("EXIT");